centos下靜默安裝oracle11g
阿新 • • 發佈:2018-11-29
一、安裝依賴包
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
二、建立使用者名稱
groupadd oinstall groupadd dba useradd -m -d /home/oracle -g oinstall -G dba oracle passwd oracle
三、安裝jdk
yum install java-1.8.0-openjdk* -y
四、#設定swap 伺服器有忽略
dd if=/dev/zero of=/home/swap bs=1024 count=5120000 mkswap /home/swap swapon /home/swap
五、修改核心
# vim /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 1200000000 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576
六、修改使用者的限制檔案
# vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 修改/etc/pam.d/login檔案,新增: session required /lib64/security/pam_limits.so session required pam_limits.so 建立安裝目錄、修改檔案許可權 mkdir -p /data/app/oracle/product/11.2.0 mkdir /data/app/oracle/oradata mkdir /data/app/oracle/inventory mkdir /data/app/oracle/fast_recovery_area chown -R oracle:oinstall /data/app/oracle chmod -R 775 /data/app/oracle
七、設定環境oracle變數
vim /home/oracle/.bashrc ORACLE_BASE=/data/app/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0 ORACLE_SID=orcl PATH=$PATH:$ORACLE_HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH # source /home/oracle/.bashrc
八、root下編輯靜默安裝響應檔案
cp /data/database/response/db_install.rsp /data/database/response/db_install.rsp.bak #ORACLE_HOSTNAME = 主機名(hostname) vim /data/database/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=VM_0_5_centos UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/data/app/oracle/product/11.2.0 ORACLE_BASE=/data/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=dba DECLINE_SECURITY_UPDATES=true
九、啟動
su - oracle ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /data/database/response/db_install.rsp 出現如下則安裝正常: /data/app/oracle/inventory/orainstRoot.sh /data/app/oracle/product/11.2.0/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. 檢視安裝情況日誌 tailf /data/app/oracle/inventory/logs/installActions2018-11-29_10-45-46PM.log
十、執行sh檔案
#在root下執行L sh /data/app/oracle/inventory/orainstRoot.sh sh /data/app/oracle/product/11.2.0/root.sh
十一、用oracle使用者登入配置監聽
su - oracle #設定DISPLAY變數 export DISPLAY=localhost:0.0 netca -silent -responseFile /data/database/response/netca.rsp Oracle Net Listener Startup: Running Listener Control: /data/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 檢視監聽狀態:stop start lsnrctl status netstat -lntup|grep 1521 tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 28351/tnslsnr
十二、建立新庫,同時建立對應的例項
切換到root使用者,編輯 /data/database/response/dbca.rsp 修改以下引數: TOTALMEMORY 設定oracl管理記憶體 GDBNAME = "orcl" SID = "orcl" SYSPASSWORD = "oracle" SYSTEMPASSWORD = "oracle" SYSMANPASSWORD = "oracle" DBSNMPPASSWORD = "oracle" DATAFILEDESTINATION =/u01/app/oracle/oradata RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area CHARACTERSET = "ZHS16GBK" TOTALMEMORY = "1638" su - oracle dbca -silent -responseFile /data/database/response/dbca.rsp 看到如下安裝完成: 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 "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
十三、測試 sqlplus / as sysdba
sqlplus / as sysdba SQL> shutdown; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 413372416 bytes Fixed Size 2213896 bytes Variable Size 268437496 bytes Database Buffers 138412032 bytes Redo Buffers 4308992 bytes Database mounted. Database opened. SQL> oracle靜默安裝完成