CentOS靜默安裝Oracle 11g R2
一,
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
Oracle 11g 聯機文檔:
http://www.oracle.com/pls/db112/homepage
二,系統要求
記憶體:1G(官方最低要求1G)
硬碟:40G(企業版安裝所需4.29G和1.7G資料檔案)
檢查的命令
記憶體
# grep MemTotal /proc/meminfo
交換空間
# grep SwapTotal /proc/meminfo
磁碟空間
# df -ah
三,安裝前系統準備
1、添加主機名稱與IP對應記錄(root使用者下)
#vim /etc/hosts
192.168.1.254 Admin-PC
2、關閉Selinux(root使用者下)
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
# setenforce 0
3、建立使用者和組(root使用者:建立Oracle安裝組oinstall,資料庫管理員組dba,及oracle使用者)
# groupadd -g 200 oinstall
# groupadd -g 201 dba
# useradd -u 440 -g oinstall -G dba oracle (主組oinstall,其它組:dba)
# passwd oracle
4、修改核心參數(root使用者:修改 /etc/sysctl.conf 檔案,加上如下參數)
# vim /etc/sysctl.conf
net.ipv4.ip_local_port_range= 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576
#modprobe bridge
#lsmod|grep bridge
# sysctl -p
5、修改系統資源限制(root使用者:修改 /etc/security/limits.conf 檔案,加上下面的參數)
# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
6、修改使用者驗證選項(root使用者下:修改/etc/pam.d/login檔案加上如下參數)
# vim /etc/pam.d/login
session required pam_limits.so
7、建立安裝目錄及設定許可權(root使用者下)
# mkdir -p /app/oracle/
# chmod 755 /app/oracle/
# chown oracle.oinstall -R /app/oracle/
8、設定環境變數(root使用者下:修改/etc/profile檔案加上如下參數)
# vim /etc/profile
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export ORACLE_SID=ORCL
export ROACLE_PID=ORCL
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
完成後執行:
#source /etc/profile #環境變數修改生效
#env | grep ORA #查看環境變數是否完成
ORACLE_SID=ORCL
ORACLE_BASE=/app/oracle
ORACLE_HOME=/app/oracle/product/11.2.0/db_1
四、安裝Oracle
1.安裝依賴包(root使用者下)
#yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
2.字元介面下安裝oracle(root使用者下)
在/opt目錄下 解壓oracle軟體
# unzip -o linux.x64_11gR2_database_1of2.zip
# unzip -o linux.x64_11gR2_database_2of2.zip
#chown -R oracle:oinstall /opt/database/
解壓後得到database目錄,其中包含response目錄,該目錄中有三個rsp檔案,用來作為靜默安裝時的應答檔案的模板。
三個檔案作用分別是:
db_install.rsp:安裝應答
dbca.rsp:建立資料庫應答
netca.rsp:建立監聽、本地服務名等網路設定的應答
3.編輯安裝應答指令碼(root使用者下)
#vim /opt/database/response/db_install.rsp
4.靜默安裝Oracle(oracle使用者下)
$chmod -R 755 /opt/database
$./runInstaller -silent -force -responseFile /opt/database/response/db_install.rsp
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 165908 MB Passed
Checking swap space: must be greater than 150 MB. Actual 16383 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-01-29_03-35-32PM. Please wait ...[oracle@oracledb database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
[WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2015-01-29_03-35-32PM/installActions2015-01-29_03-35-32PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/opt/app/oracle/oraInventory/logs/installActions2015-01-29_03-35-32PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/app/oracle/oraInventory/orainstRoot.sh
/app/oracle/product/11.2.0/db_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使用者執行root.sh
$ su root
#/app/oracle/product/11.2.0/db_1/root.sh
5.靜默配置網路(oracle使用者下)
$ $ORACLE_HOME/bin/netca /silent /responseFile /opt/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /opt/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Listener "LISTENER" already exists.
Oracle Net Services configuration successful. The exit code is 0
6.修改指令碼dbca.rsp(root使用者下)
#vim /opt/database/response/dbca.rsp
7.靜默安裝資料庫(oracle使用者下)
$ $ORACLE_HOME/bin/dbca -silent -responseFile /opt/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
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
74% complete
85% complete
96% complete
100% complete
Look at the log file "/app/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.
安裝完成...
8.修改oracle配置(root使用者下)
#vim $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTNER=$ORACLE_HOME
#vim $ORACLE_HOME/bin/dbshut
ORACLE_HOME_LISTNER=$ORACLE_HOME
9.Linux啟動時自動啟動Oracle監聽和執行個體(root使用者下)
#vim /etc/oratab
ORCL:/app/oracle/product/11.2.0/db_1:Y
#vim /etc/rc.d/rc.local
su - oracle -c "lsnrctl start"
su - oracle -c dbstart
10.基本命令
登入資料庫: sqlplus / as sysdba
啟動監聽:lsnrctl start 或 $ORACLE_HOME/bin/lsnrctl start
查看監聽:lsnrctl status 或 $ORACLE_HOME/bin/lsnrctl status
停止監聽:lsnrctl stop
本文永久更新連結地址:http://www.bkjia.com/Linux/2016-07/133757tm