linux靜默安裝oracle11g
阿新 • • 發佈:2022-11-30
目錄
linux靜默安裝oracle11g
1、環境準備
1.1下載安裝包
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_1of2.zip
http://download.oracle.com/otn/linux/oracle11g/R2/linux.x64_11gR2_database_2of2.zip
1.2、安裝rz依賴
yum install lrzsz -y
1.3、關閉selinux
vi /etc/selinux/config
設定SELINUX=disabled
1.4、關閉防火牆
systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld.service
1.5、安裝oracle依賴
yum install -y gcc make binutils gcc-c++ compat-libstdc++-33elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-develnumactl-devel sysstat unixODBC unixODBC-devel pcre-devel
1.6、建立使用者以及使用者組
groupadd -g 54321 oinstall useradd -u 54321 -g oinstall oracle passwd oracle
1.7、建立oracle安裝目錄
root使用者執行
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
mkdir -p /u01/oradata
chown -R oracle:oinstall /u01
chmod -R 775 /u01
2、更改系統環境
2.1、修改系統核心配置
vi /etc/sysctl.conf
追加:
#Oracle
#Oracle
# oracle-database-preinstall-19c setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-preinstall-19c setting for kernel.sem is '250 32000 100 128'
kernel.sem = 250 32000 100 128
# oracle-database-preinstall-19c setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-preinstall-19c setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-preinstall-19c setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-preinstall-19c setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-preinstall-19c setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-preinstall-19c setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-preinstall-19c setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-preinstall-19c setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
修改後重新整理配置:
sysctl -p
2.2、設定oracle使用者的環境變數
用oracle使用者編輯 ~/.bash_profile
檔案
vi ~/.bash_profile
需要更改指定例項名
export ORACLE_UNQNAME
export ORACLE_SID
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=dbserver24.localdomain
export ORACLE_UNQNAME=cpicdev #標識
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=cpicdev #例項名
export DATA_DIR=/u01/oradata
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LANG="en_US.UTF-8"
#export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_LANG="AMERICAN_AMERICA.AL32UTF8"
export NLS_DATA_FORMAT="yyyy-mm-dd hh24:mi:ss"
使環境變數生效(最好重啟機器,確保所有配置生效)
source ~/.bash_profile
3、安裝資料庫
3.1、解壓檔案
oracle使用者執行
cd /u01/package/
unzip /u01/package/linux.x64_11gR2_database_1of2.zip
unzip /u01/package/linux.x64_11gR2_database_2of2.zip
3.2、靜默安裝軟體
在oracle使用者執行(使用圖形安裝需要直接用oracle使用者登入,用su到oracle使用者出現問題)(一行的)
在/u01/package/database
下執行:
./runInstaller -waitforcompletion -silent -ignorePrereq
-responseFile /u01/package/database/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=${ORACLE_HOSTNAME}
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=${ORA_INVENTORY}
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=${ORACLE_HOME}
ORACLE_BASE=${ORACLE_BASE}
oracle.install.db.InstallEdition=SE
oracle.install.db.isCustomInstall=true
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=oinstall
DECLINE_SECURITY_UPDATES=true
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
./runInstaller -waitforcompletion -silent -ignorePrereq -responseFile /u01/package/database/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=${ORACLE_HOSTNAME} UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=${ORA_INVENTORY} SELECTED_LANGUAGES=en,zh_CN,zh_TW ORACLE_HOME=${ORACLE_HOME} ORACLE_BASE=${ORACLE_BASE} oracle.install.db.InstallEdition=SE oracle.install.db.isCustomInstall=true oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.DBA_GROUP=oinstall oracle.install.db.OPER_GROUP=oinstall DECLINE_SECURITY_UPDATES=true SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
成功如下:
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 670901 MB Passed
Checking swap space: must be greater than 150 MB. Actual 7934 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-11-29_05-44-21PM. Please wait ...You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2022-11-29_05-44-21PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
使用root使用者執行:生成/etc/oratab
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
3.2.1可能會出現的問題:
郵件問題,加上:
DECLINE_SECURITY_UPDATES=true
組內執行許可權問題:
User is not a member of the following chosen OS groups: [null, null]
oracle.install.db.DBA_GROUP=oinstall
oracle.install.db.OPER_GROUP=oinstall
有些強制引數問題:
Target environment do not meet some mandatory requirements.
-ignorePrereq
3.3、安裝例項
oracle使用者執行(一行的)
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ${ORACLE_SID} -sid ${ORACLE_SID} -responseFile NO_VALUE -characterSet AL32UTF8 -sysPassword Sinosoft_908 -systemPassword Sinosoft_908 -databaseType MULTIPURPOSE -totalMemory 2000 -storageType FS -datafileDestination "${DATA_DIR}" -redoLogFileSize 50 -emConfiguration NONE
安裝完成後提示:
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/insapi/insapi.log" for further details.
3.4、將動態引數寫入到靜態引數檔案中
引數將會寫在 $ORACLE_HOME/dbs
目錄下
sqlplus / as sysdba
SQL> create pfile from spfile;
3.5、啟動監聽
lsnrctl status
lsnrctl start
4、cat: /etc/oratab: No such file or directory
find -name root.sh
sh /u01/app/oracle/product/11.2.0/dbhome_1/root.sh