您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)如何靜默安裝Oracle11g數(shù)據(jù)庫,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
1.1. 修改密碼及創(chuàng)建目錄和權(quán)限
1) 創(chuàng)建oracle用戶和組
[root@ENMOEDU ~]# groupadd oinstall
[root@ENMOEDU ~]# groupadd dba
[root@ENMOEDU ~]# useradd -g oinstall -G dba -s /bin/bash oracle
[root@ENMOEDU ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
2) 創(chuàng)建相關(guān)目錄并賦權(quán)
[root@ENMOEDU ~]# chown -R oracle:oinstall /data/u01
[root@ENMOEDU ~]# chmod -R 755 /data/u01
1.2. 設(shè)置oracle用戶環(huán)境變量
[root@ENMOEDU ~]# su - oracle
[oracle@ENMOEDU ~]$
[oracle@ENMOEDU ~]$ vi .bash_profile
注:在文件的最下方增加如下內(nèi)容 export ORACLE_BASE=/data/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1 export ORACLE_SID=ENMOEDU export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib |
修改完成,使其修改生效,如下:
[oracle@ENMOEDU ~]$ . .bash_profile
[oracle@ENMOEDU ~]$
或者
[oracle@ENMOEDU ~]$ source .bash_profile
[oracle@ENMOEDU ~]$
再或者注銷重新登錄
注:
ORACLE_BASE:oracle產(chǎn)品基目錄
ORACLE_HOME:數(shù)據(jù)庫產(chǎn)品目錄通常情況下HOME目錄是BASE的子目錄
ORACLE_SID:操作系統(tǒng)和oracle實(shí)例關(guān)聯(lián)的紐帶
PATH:將安裝后的oracle命令追加到執(zhí)行搜索路徑
LD_LIBRARY_PATH:動(dòng)態(tài)庫的位置
1.3. 上傳oracle安裝介質(zhì)并解壓安裝database軟件
1)已經(jīng)上傳成功,解壓之后會(huì)產(chǎn)生一個(gè)database目錄;
并且/meadia/database/response下有db_install.rsp、dbca.rsp和netca.rsp三個(gè)應(yīng)答文件,分別數(shù)據(jù)庫安裝文件、建立數(shù)據(jù)庫實(shí)例和監(jiān)聽配置安裝文件
[oracle@ENMOEDU software]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@ENMOEDU software]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@jianguan-EAST-fanxiqian-32 media]$ ll
database
p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
2)提前安裝必要的包:
用yum安裝:
[root@jianguan-EAST-fanxiqian-32 ~]yum install -y binutils*
yum install -y compat-libstdc*
yum install -y elfutils-libelf*
yum install -y gcc*
yum install -y glibc*
yum install -y ksh*
yum install -y libaio*
yum install -y libgcc*
yum install -y libstdc*
yum install -y make*
yum install -y sysstat*
yum install libXp* -y
yum install -y glibc-kernheaders
3)進(jìn)入到database/response/目錄,然后編輯用于安裝Oracle軟件的應(yīng)答文件db_install.rsp;
[oracle@jianguan-EAST-fanxiqian-32 database]$ cd /media/database/response/
[oracle@jianguan-EAST-fanxiqian-32 database]$ vi db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY //29行 安裝類型
ORACLE_HOSTNAME=jianguan-EAST-fanxiqian-32 //37行 主機(jī)名稱
UNIX_GROUP_NAME=oinstall //42行 安裝組
INVENTORY_LOCATION=/opt/oracle/inventory //47行INVENTORY目錄
SELECTED_LANGUAGES=zh_CN //78行 選擇語言
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1 //83行oracle_home地址
ORACLE_BASE=/data/u01/app/oracle //88行oracle_base地址
oracle.install.db.InstallEdition=EE //99行oracle版本
oracle.install.db.DBA_GROUP=dba //142行dba用戶組
oracle.install.db.OPER_GROUP=oinstall //147行oper用戶組
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //160行 數(shù)據(jù)庫類型
oracle.install.db.config.starterdb.globalDBName=eastfxq //165行g(shù)lobalDBName
oracle.install.db.config.starterdb.SID=eastfxq //170行SID
oracle.install.db.config.starterdb.memoryLimit=92160 //192行 自動(dòng)管理內(nèi)存的最小內(nèi)存(M)
oracle.install.db.config.starterdb.password.ALL=oracle //233行 設(shè)定所有數(shù)據(jù)庫用戶使用同一個(gè)密碼
DECLINE_SECURITY_UPDATES=true //385行 設(shè)置安全更新,一定要設(shè)置否則報(bào)錯(cuò);
3)執(zhí)行創(chuàng)建軟件的腳本:
1.執(zhí)行腳本之前需要編輯/etc/hosts
查看當(dāng)前的主機(jī)名,一定注意需要填寫當(dāng)前的主機(jī)名,也就是hostname顯示的名字!
[root@jianguan-EAST-fanxiqian-32 inventory]# hostname
jianguan-EAST-fanxiqian-32.38
[root@jianguan-EAST-fanxiqian-32 inventory]# vi /etc/hosts ##添加如下內(nèi)容,否則會(huì)后面會(huì)報(bào)錯(cuò),說不能識(shí)別hostname,
10.1.32.38 jianguan-EAST-fanxiqian-32.38
2.執(zhí)行安裝腳本!
[oracle@jianguan-EAST-fanxiqian-32 database]$ ./runInstaller -silent -responseFile /media/database/response/db_install.rsp -ignorePrereq
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 86279 MB Passed
Checking swap space: must be greater than 150 MB. Actual 17999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-06-25_12-19-25PM. Please wait ...[oracle@jianguan-EAST-fanxiqian-32 database]$
[oracle@jianguan-EAST-fanxiqian-32 database]$
[oracle@jianguan-EAST-fanxiqian-32 database]$
[oracle@jianguan-EAST-fanxiqian-32 database]$ You can find the log of this install session at:
/home/oracle/inventory/logs/installActions2018-06-25_12-19-25PM.log
3).可以通過查看前邊提示的日志來跟進(jìn)創(chuàng)建的過程:
[oracle@jianguan-EAST-fanxiqian-32 database]$tail -f 100 /home/oracle/inventory/logs/installActions2018-06-25_12-19-25PM.log
4)最后按著提示打開新的終端,以root身份登錄,執(zhí)行腳本:
#/home/oracle/inventory/orainstRoot.sh
#/data/u01/app/oracle/product/11.2.0/dbhome_1/db_1/root.sh
至此Oracle軟件創(chuàng)建成功。。。。。。。
1.4. 安裝監(jiān)聽軟件
1)編輯necat.rsp文件;
netca.rsp,主要改動(dòng)以下參數(shù)配置:
INSTALL_TYPE=""custom"" #安裝的類型
LISTENER_NUMBER=1 #監(jiān)聽器數(shù)量
LISTENER_NAMES={"LISTENER"} #監(jiān)聽器的名稱列表
LISTENER_PROTOCOLS={"TCP;1521"} #監(jiān)聽器使用的通訊協(xié)議列表
LISTENER_START=""LISTENER"" #監(jiān)聽器啟動(dòng)的名稱
2)執(zhí)行netca來創(chuàng)建監(jiān)聽軟件:
[oracle@jianguan-EAST-fanxiqian-32 response]$netca /silent /responseFile /media/database/response/netca.rsp
3)嘗試啟動(dòng)監(jiān)聽(有這個(gè)命令即可):
[oracle@jianguan-EAST-fanxiqian-32 response]$lsnrctl start
至此監(jiān)聽創(chuàng)建成功。。。。
1.5. 創(chuàng)建Oracle數(shù)據(jù)庫
1)編輯創(chuàng)建數(shù)據(jù)庫的應(yīng)答文件dbca.rsp,主要需要修改的參數(shù)如下(其余默認(rèn)即可)
RESPONSEFILE_VERSION ="11.2.0" //不能更改
OPERATION_TYPE ="createDatabase"
GDBNAME ="eastfxq" //數(shù)據(jù)庫的名字
SID ="eastfxq" //對(duì)應(yīng)的實(shí)例名字
TEMPLATENAME ="General_Purpose.dbc" //建庫用的模板文件 有兩個(gè)一個(gè)為新的名字
SYSPASSWORD ="oracle" //SYS管理員密碼
SYSTEMPASSWORD ="oracle" //SYSTEM管理員密碼
SYSMANPASSWORD= "oracle"
DBSNMPPASSWORD= "oracle"
DATAFILEDESTINATION =/data/u01/app/oracle/oradata
//數(shù)據(jù)文件存放目錄,默認(rèn)為$ORACLE_BASE/oradata;
RECOVERYAREADESTINATION=/data/u01/app/oracle/flash_recovery_area
//快速恢復(fù)區(qū)的目錄,默認(rèn)為$ORACLE_BASE/flash_recovery_area;
CHARACTERSET ="ZHS16GBK"
//字符集,重要!!!建庫后一般不能更改,所以建庫前要確定清楚;
TOTALMEMORY ="92160" //92160MB,物理內(nèi)存*80%左右
2)執(zhí)行dbca,開始創(chuàng)建數(shù)據(jù)庫;
[oracle@jianguan-EAST-fanxiqian-32 response]$ dbca -silent -responseFile /media/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
至此Oracle數(shù)據(jù)庫創(chuàng)建成功。。。。。
1.6. 調(diào)整Oracle的參數(shù)以及配置:
1.關(guān)于Oracle數(shù)據(jù)庫游標(biāo)相關(guān)的參數(shù)
1)OPEN_CURSORS 每個(gè)會(huì)話最大的游標(biāo)數(shù)(活動(dòng)的SQL語句),推薦設(shè)置成500
SQL> alter system set open_cursors=200 scope=spfile;
2)session_cached_cursors 每個(gè)會(huì)話緩存的游標(biāo)個(gè)數(shù),推薦設(shè)置成 200
SQL> alter system set session_cached_cursors=200 scope=spfile;
2.關(guān)于存儲(chǔ)的相關(guān)參數(shù):
1)DB_FILES 數(shù)據(jù)庫能創(chuàng)建的最大物理文件數(shù),根據(jù)數(shù)據(jù)量大小可以設(shè)置成1500或者更多。
SQL> alter system set db_files=1500 scope=spfile;
2)設(shè)置數(shù)據(jù)塊(存儲(chǔ)在物理文件或被緩存到SGA中)的大小,對(duì)于在線交易系統(tǒng)通常設(shè)置為8192,對(duì)于數(shù)據(jù)倉庫可設(shè)置為16K或32K。默認(rèn)是8192也就是8k;
3.關(guān)于Oracle的內(nèi)存相關(guān)設(shè)置:
前提需要先調(diào)整/dev/shm的大小,保證初始化參數(shù)MEMORY_TARGET或MEMORY_MAX_TARGET不能大于共享內(nèi)存(/dev/shm)
(1)查看大小
df -h /dev/shm
(2)修改大小 ,(注意格式,逗號(hào)后面不能有空格)
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=102400M 0 0
(3)重新掛載
umount /dev/shm
mount /dev/shm
(4)查看修改后的大小
df -h /dev/shm
不重起修改tmpfs大小 mount -o remount,size=100g /dev/shm
1)Oracle11g開啟自動(dòng)化內(nèi)存管理:可以設(shè)置memory_target和memory_max_target:
(1)memory_target:該參數(shù)設(shè)置整個(gè)oracle數(shù)據(jù)庫實(shí)例可以使用的內(nèi)存量,oralce數(shù)據(jù)庫實(shí)例在運(yùn)行過程中會(huì)根據(jù)需求自動(dòng)的調(diào)節(jié)SGA與PGA的大小??梢允褂孟鄳?yīng)的alter system命令動(dòng)態(tài)的修改memory_target的值。該參數(shù)是動(dòng)態(tài)初始化參數(shù)。
(2)memory_max_target:該參數(shù)設(shè)置oracle實(shí)例可以使用的最大內(nèi)存量。在調(diào)整memory_target的值時(shí)必須保持以下的約束關(guān)系memory_target<=memory_max_target.該參數(shù)是靜態(tài)初始化參數(shù),修改需要重啟才能生效。
Alter system set memory_target=90g;
Alter system set memory_max_target=100g scope=spfile; #(total_mem * 80%)
然后設(shè)置SGA_TARGET和PGA_AGGREGATE_TARGET的值,開啟自動(dòng)內(nèi)存管理之后,這倆值代表各自的最小值:
Alter system set SGA_TARGET=50G; ##(memory_target*80%*80%)
Alter system set PGA_AGGREGATE_TARGET=10G; ##(memory_target*80%*20%)
2)不開啟Oracle11g自動(dòng)化內(nèi)存管理,采用10g的自動(dòng)化共享內(nèi)存管理:
SGA_TARGET 當(dāng)數(shù)據(jù)庫使用自動(dòng)共享內(nèi)存管理方式時(shí),SGA各內(nèi)存區(qū)域總的內(nèi)存大小。
推薦設(shè)置值:
在線交易系統(tǒng): SGA_TARGET = (total_mem * 80%) * 80%
數(shù)據(jù)倉庫: SGA_TARGET = (total_mem * 80%) * 50%
PGA_AGGREGATE_TARGET 設(shè)置與服務(wù)進(jìn)程相關(guān)聯(lián)的 PGA 內(nèi)存大小。
推薦設(shè)置值:
在線交易系統(tǒng): PGA_AGGREGATE_TARGET = (total_mem * 80%) * 20%
數(shù)據(jù)倉庫: PGA_AGGREGATE_TARGET = (total_mem * 80%) * 50%
4.關(guān)于連接和會(huì)話:
PROCESSES 設(shè)置數(shù)據(jù)庫實(shí)例能夠啟動(dòng)的最大進(jìn)程數(shù),可設(shè)置為500~1000。
Alter system set PROCESSES =800 scope=spfile;
SESSIONS 數(shù)據(jù)庫的最大會(huì)話數(shù)。默認(rèn)值是(1.5 * PROCESSES) + 22。
Alter system set PROCESSES =1300 scope=spfile;
5. 添加日志組成員,提高redo的安全度!
SQL> alter database add logfile member '/oracle/logfile/redo1_02.log' to group 1;
Database altered.
SQL> alter database add logfile member '/oracle/logfile/redo2_02.log' to group 2;
Database altered.
SQL> alter database add logfile member '/oracle/logfile/redo3_02.log' to group 3;
Database altered.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/data/u01/app/oracle/oradata/eastfxq/redo03.log
/data/u01/app/oracle/oradata/eastfxq/redo02.log
/data/u01/app/oracle/oradata/eastfxq/redo01.log
/oracle/logfile/redo1_02.log
/oracle/logfile/redo2_02.log
/oracle/logfile/redo3_02.log
6 rows selected.
6.關(guān)于rman的相關(guān)修改,參考如下:
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ACCDB are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 31 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/caadb/backup/accdb/backup/rman/20180629/accdb_lev0_201806290230_%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_accdb.f'; # default
7.關(guān)于歸檔的目錄修改:以防默認(rèn)選擇的歸檔路徑為快速恢復(fù)區(qū)!
SQL> alter system set log_archive_dest_1='location=/data/u01/app/oracle/archivelog'
8.可以適當(dāng)修改快速恢復(fù)區(qū)的大小:
SQL> alter system set db_recovery_file_dest_size=6g;
1.7. 最后驗(yàn)證
1)查看實(shí)例名:
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
Eastfxq
2)查看數(shù)據(jù)庫名:
SQL> select name from v$database;
NAME
---------
EASTFXQ
或者
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
eastfxq
3)查看監(jiān)聽狀態(tài):
[oracle@jianguan-EAST-fanxiqian-32 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 25-JUN-2018 17:12:57
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.32.38)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 25-JUN-2018 14:32:17
Uptime 0 days 2 hr. 40 min. 39 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /data/u01/app/oracle/diag/tnslsnr/jianguan-EAST-fanxiqian-32/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.32.38)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "eastfxq" has 2 instance(s).
Instance "eastfxq", status UNKNOWN, has 3 handler(s) for this service...
Instance "eastfxq", status READY, has 1 handler(s) for this service...
Service "eastfxqXDB" has 1 instance(s).
Instance "eastfxq", status READY, has 1 handler(s) for this service...
The command completed successfully
4)檢查Oracle數(shù)據(jù)庫的字符集:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
5)查看數(shù)據(jù)文件的目錄:
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/data/u01/app/oracle/oradata/eastfxq/system01.dbf
/data/u01/app/oracle/oradata/eastfxq/sysaux01.dbf
/data/u01/app/oracle/oradata/eastfxq/undotbs01.dbf
/data/u01/app/oracle/oradata/eastfxq/users01.dbf
6)查看redo日志的路徑:
SQL> select GROUP#,MEMBER from v$logfile;
GROUP# MEMBER
--------------------------------------------------------------------------------------------
3 /data/u01/app/oracle/oradata/eastfxq/redo03.log
2 /data/u01/app/oracle/oradata/eastfxq/redo02.log
1 /data/u01/app/oracle/oradata/eastfxq/redo01.log
1 /oracle/logfile/redo1_02.log
2 /oracle/logfile/redo2_02.log
3 /oracle/logfile/redo3_02.log
6 rows selected.
至此Oracle數(shù)據(jù)庫環(huán)境準(zhǔn)備就緒。。。。。。
關(guān)于“如何靜默安裝Oracle11g數(shù)據(jù)庫”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。