您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關如何靜默安裝Oracle11g數據庫,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
1.1. 修改密碼及創建目錄和權限
1) 創建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) 創建相關目錄并賦權
[root@ENMOEDU ~]# chown -R oracle:oinstall /data/u01
[root@ENMOEDU ~]# chmod -R 755 /data/u01
1.2. 設置oracle用戶環境變量
[root@ENMOEDU ~]# su - oracle
[oracle@ENMOEDU ~]$
[oracle@ENMOEDU ~]$ vi .bash_profile
注:在文件的最下方增加如下內容 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產品基目錄
ORACLE_HOME:數據庫產品目錄通常情況下HOME目錄是BASE的子目錄
ORACLE_SID:操作系統和oracle實例關聯的紐帶
PATH:將安裝后的oracle命令追加到執行搜索路徑
LD_LIBRARY_PATH:動態庫的位置
1.3. 上傳oracle安裝介質并解壓安裝database軟件
1)已經上傳成功,解壓之后會產生一個database目錄;
并且/meadia/database/response下有db_install.rsp、dbca.rsp和netca.rsp三個應答文件,分別數據庫安裝文件、建立數據庫實例和監聽配置安裝文件
[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)進入到database/response/目錄,然后編輯用于安裝Oracle軟件的應答文件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行 主機名稱
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行 數據庫類型
oracle.install.db.config.starterdb.globalDBName=eastfxq //165行globalDBName
oracle.install.db.config.starterdb.SID=eastfxq //170行SID
oracle.install.db.config.starterdb.memoryLimit=92160 //192行 自動管理內存的最小內存(M)
oracle.install.db.config.starterdb.password.ALL=oracle //233行 設定所有數據庫用戶使用同一個密碼
DECLINE_SECURITY_UPDATES=true //385行 設置安全更新,一定要設置否則報錯;
3)執行創建軟件的腳本:
1.執行腳本之前需要編輯/etc/hosts
查看當前的主機名,一定注意需要填寫當前的主機名,也就是hostname顯示的名字!
[root@jianguan-EAST-fanxiqian-32 inventory]# hostname
jianguan-EAST-fanxiqian-32.38
[root@jianguan-EAST-fanxiqian-32 inventory]# vi /etc/hosts ##添加如下內容,否則會后面會報錯,說不能識別hostname,
10.1.32.38 jianguan-EAST-fanxiqian-32.38
2.執行安裝腳本!
[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).可以通過查看前邊提示的日志來跟進創建的過程:
[oracle@jianguan-EAST-fanxiqian-32 database]$tail -f 100 /home/oracle/inventory/logs/installActions2018-06-25_12-19-25PM.log
4)最后按著提示打開新的終端,以root身份登錄,執行腳本:
#/home/oracle/inventory/orainstRoot.sh
#/data/u01/app/oracle/product/11.2.0/dbhome_1/db_1/root.sh
至此Oracle軟件創建成功。。。。。。。
1.4. 安裝監聽軟件
1)編輯necat.rsp文件;
netca.rsp,主要改動以下參數配置:
INSTALL_TYPE=""custom"" #安裝的類型
LISTENER_NUMBER=1 #監聽器數量
LISTENER_NAMES={"LISTENER"} #監聽器的名稱列表
LISTENER_PROTOCOLS={"TCP;1521"} #監聽器使用的通訊協議列表
LISTENER_START=""LISTENER"" #監聽器啟動的名稱
2)執行netca來創建監聽軟件:
[oracle@jianguan-EAST-fanxiqian-32 response]$netca /silent /responseFile /media/database/response/netca.rsp
3)嘗試啟動監聽(有這個命令即可):
[oracle@jianguan-EAST-fanxiqian-32 response]$lsnrctl start
至此監聽創建成功。。。。
1.5. 創建Oracle數據庫
1)編輯創建數據庫的應答文件dbca.rsp,主要需要修改的參數如下(其余默認即可)
RESPONSEFILE_VERSION ="11.2.0" //不能更改
OPERATION_TYPE ="createDatabase"
GDBNAME ="eastfxq" //數據庫的名字
SID ="eastfxq" //對應的實例名字
TEMPLATENAME ="General_Purpose.dbc" //建庫用的模板文件 有兩個一個為新的名字
SYSPASSWORD ="oracle" //SYS管理員密碼
SYSTEMPASSWORD ="oracle" //SYSTEM管理員密碼
SYSMANPASSWORD= "oracle"
DBSNMPPASSWORD= "oracle"
DATAFILEDESTINATION =/data/u01/app/oracle/oradata
//數據文件存放目錄,默認為$ORACLE_BASE/oradata;
RECOVERYAREADESTINATION=/data/u01/app/oracle/flash_recovery_area
//快速恢復區的目錄,默認為$ORACLE_BASE/flash_recovery_area;
CHARACTERSET ="ZHS16GBK"
//字符集,重要!!!建庫后一般不能更改,所以建庫前要確定清楚;
TOTALMEMORY ="92160" //92160MB,物理內存*80%左右
2)執行dbca,開始創建數據庫;
[oracle@jianguan-EAST-fanxiqian-32 response]$ dbca -silent -responseFile /media/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
至此Oracle數據庫創建成功。。。。。
1.6. 調整Oracle的參數以及配置:
1.關于Oracle數據庫游標相關的參數
1)OPEN_CURSORS 每個會話最大的游標數(活動的SQL語句),推薦設置成500
SQL> alter system set open_cursors=200 scope=spfile;
2)session_cached_cursors 每個會話緩存的游標個數,推薦設置成 200
SQL> alter system set session_cached_cursors=200 scope=spfile;
2.關于存儲的相關參數:
1)DB_FILES 數據庫能創建的最大物理文件數,根據數據量大小可以設置成1500或者更多。
SQL> alter system set db_files=1500 scope=spfile;
2)設置數據塊(存儲在物理文件或被緩存到SGA中)的大小,對于在線交易系統通常設置為8192,對于數據倉庫可設置為16K或32K。默認是8192也就是8k;
3.關于Oracle的內存相關設置:
前提需要先調整/dev/shm的大小,保證初始化參數MEMORY_TARGET或MEMORY_MAX_TARGET不能大于共享內存(/dev/shm)
(1)查看大小
df -h /dev/shm
(2)修改大小 ,(注意格式,逗號后面不能有空格)
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開啟自動化內存管理:可以設置memory_target和memory_max_target:
(1)memory_target:該參數設置整個oracle數據庫實例可以使用的內存量,oralce數據庫實例在運行過程中會根據需求自動的調節SGA與PGA的大小。可以使用相應的alter system命令動態的修改memory_target的值。該參數是動態初始化參數。
(2)memory_max_target:該參數設置oracle實例可以使用的最大內存量。在調整memory_target的值時必須保持以下的約束關系memory_target<=memory_max_target.該參數是靜態初始化參數,修改需要重啟才能生效。
Alter system set memory_target=90g;
Alter system set memory_max_target=100g scope=spfile; #(total_mem * 80%)
然后設置SGA_TARGET和PGA_AGGREGATE_TARGET的值,開啟自動內存管理之后,這倆值代表各自的最小值:
Alter system set SGA_TARGET=50G; ##(memory_target*80%*80%)
Alter system set PGA_AGGREGATE_TARGET=10G; ##(memory_target*80%*20%)
2)不開啟Oracle11g自動化內存管理,采用10g的自動化共享內存管理:
SGA_TARGET 當數據庫使用自動共享內存管理方式時,SGA各內存區域總的內存大小。
推薦設置值:
在線交易系統: SGA_TARGET = (total_mem * 80%) * 80%
數據倉庫: SGA_TARGET = (total_mem * 80%) * 50%
PGA_AGGREGATE_TARGET 設置與服務進程相關聯的 PGA 內存大小。
推薦設置值:
在線交易系統: PGA_AGGREGATE_TARGET = (total_mem * 80%) * 20%
數據倉庫: PGA_AGGREGATE_TARGET = (total_mem * 80%) * 50%
4.關于連接和會話:
PROCESSES 設置數據庫實例能夠啟動的最大進程數,可設置為500~1000。
Alter system set PROCESSES =800 scope=spfile;
SESSIONS 數據庫的最大會話數。默認值是(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.關于rman的相關修改,參考如下:
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.關于歸檔的目錄修改:以防默認選擇的歸檔路徑為快速恢復區!
SQL> alter system set log_archive_dest_1='location=/data/u01/app/oracle/archivelog'
8.可以適當修改快速恢復區的大小:
SQL> alter system set db_recovery_file_dest_size=6g;
1.7. 最后驗證
1)查看實例名:
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
Eastfxq
2)查看數據庫名:
SQL> select name from v$database;
NAME
---------
EASTFXQ
或者
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
eastfxq
3)查看監聽狀態:
[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數據庫的字符集:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
5)查看數據文件的目錄:
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數據庫環境準備就緒。。。。。。
關于“如何靜默安裝Oracle11g數據庫”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。