您好,登錄后才能下訂單哦!
靜默安裝oracle 11gR2, 適用于 RHEL5/6 CENTOS5/6
一、保證系統有足夠的空間來安裝oracle
另外
tmp目錄必須大于120M
swap必須大于150M
二、需要安裝的軟件:
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
numactl-devel-0.9.8.i386
sysstat-7.0.2
x86_64
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-devel glibc-common glibc-headers kernel-headers ksh libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC* libaio-devel libaio-devel* unixODBC-devel unixODBC-devel*
binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat
i386
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel
glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-d
evel*.i686 make sysstat sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
三、創建用戶組
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/useradd -g oinstall -G dba,oper -d /home/oracle oracle
echo "oracle" |passwd --stdin oracle
四、修改內核參數
vim /etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 536870912
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
sysctp -p
五、修改oracle用戶的系統資源限制和權限
grep 'limits' /etc/pam.d/system-auth
session required pam_limits.so
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
六、配置oracle用戶環境變量
vim /home/oracle/.bash_profile
ORACLE_BASE=/DataBase/oracle
ORACLE_HOME=$ORACLE_BASE/db11g
ORACLE_SID=umpay
export ORACLE_OWNER=oracle
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin:$PATH
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID
. /home/oracle/.bash_profile
env |grep ORA
創建oraInst.loc
vi /etc/oraInst.loc
inventory_loc=/DataBase/oracle/oraInventory
inst_group=oinstall
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
六、解壓安裝包
mkdir -pv /DataBase/oracle/oraInventory
unzip linux.x64_11gR2_database_1of2.zip -d /DataBase/
unzip linux.x64_11gR2_database_2of2.zip -d /DataBase/
chown -R oracle.oinstall /DataBase/
七、修改oracle silent安裝時讀取的配置文件
切換到oracle用戶
su - oracle
新建一個文件或者copy模板,命名為 db_install.rsp 內容為下(根據實際環境修改):
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=dbserver
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/DataBase/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/DataBase/oracle/db11g
ORACLE_BASE=/DataBase/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.ne
twork:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.or
aolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=umpay
oracle.install.db.config.starterdb.SID=umpay
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=1024
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=pass
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
運行安裝:
./runInstaller -silent -responseFile /DataBase/db_install.rsp (讀取的文件路徑一定要是絕對路徑,否則安裝會報錯-ignorePrereq)
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 90617 MB Passed
Checking swap space: must be greater than 150 MB. Actual 15999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-04-22_03-26-43AM. Please wait ...[oracle@dbserver 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-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.
You can find the log of this install session at:
/DataBase/oracle/oraInventory/logs/installActions2014-04-22_03-26-43AM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/DataBase/oracle/oraInventory/orainstRoot.sh
/DataBase/oracle/db11g/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腳本并驗證安裝是否成功
[root@dbserver db11g]# /DataBase/oracle/db11g/root.sh
Check /DataBase/oracle/db11g/install/root_dbserver_2014-04-22_03-40-29.log for the output of root script
[root@dbserver db11g]# su - oracle
[oracle@dbserver ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 22 03:41:04 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL>
SQL>
SQL>
九、配置偵聽器,新建文件netca.rsp修改相關內容如下
[oracle@dbserver database]$ more ../netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="11.2"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""custom""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
運行安裝偵聽器:
[oracle@dbserver database]$ netca -silent -responseFile /DataBase/netca.rsp
****DISPLAY environment variable not set!
Oracle Net Configuration Assistant is a GUI tool
which requires that DISPLAY specify a location
where GUI tools can display.
Set and export DISPLAY, then re-run.報這種錯后聲明DISPLAY變量
[oracle@dbserver database]$ export DISPLAY=10.10.73.132:0.0
[oracle@dbserver database]$ netca -silent -responseFile /DataBase/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /DataBase/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/DataBase/oracle/db11g/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@dbserver database]$ netstat -nutlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::5989 :::* LISTEN -
tcp 0 0 :::1521 :::* LISTEN 8846/tnslsnr
tcp 0 0 :::22 :::* LISTEN -
[oracle@dbserver database]$
十、安裝數據庫,新建文件dbca.rsp修改相關內容如下
[oracle@dbserver database]$ more ../dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "dbserver"
SID = "umpay"
TEMPLATENAME = "General_Purpose.dbc"
[createTemplateFromDB]
SOURCEDB = "myhost:1521:orcl"
SYSDBAUSERNAME = "system"
TEMPLATENAME = "General_Purpose.dbc"
[createCloneTemplate]
SOURCEDB = "orcl"
TEMPLATENAME = "My Clone TEMPLATE"
[DELETEDATABASE]
SOURCEDB = "orcl"
[generateScripts]
TEMPLATENAME = "New Database"
GDBNAME = "orcl11.us.oracle.com"
[CONFIGUREDATABASE]
[ADDINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
NODELIST=
SYSDBAUSERNAME = "sys"
[DELETEINSTANCE]
DB_UNIQUE_NAME = "orcl11g.us.oracle.com"
INSTANCENAME = "orcl11g"
SYSDBAUSERNAME = "sys"
EMCONFIGURATION = "LOCAL"
SYSMANPASSWORD = "123456"
DBSNMPPASSWORD = "123456"
運行安裝數據庫:
[oracle@dbserver database]$ dbca -silent -createdatabase -responseFile /DataBase/dbca.rsp
Enter SYS user password:
Enter SYSTEM user password:
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 "/DataBase/oracle/cfgtoollogs/dbca/dbserver/dbserver.log" for further details.
[oracle@dbserver database]$ netstat -nutlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 :::5989 :::* LISTEN -
tcp 0 0 :::1521 :::* LISTEN 8846/tnslsnr
tcp 0 0 :::42291 :::* LISTEN 9467/ora_d000_umpay
tcp 0 0 :::22 :::* LISTEN -
udp 0 0 ::1:9123 :::* 9467/ora_d000_umpay
udp 0 0 :::29367 :::* 9463/ora_mmon_umpay
udp 0 0 ::1:53190 :::* 9435/ora_pmon_umpay
udp 0 0 ::1:21703 :::* 9469/ora_s000_umpay
十一、驗證安裝是否成功
[oracle@dbserver database]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 22 03:52:29 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> show user;
USER is "SYS"
SQL> show sga;
Total System Global Area 1653518336 bytes
Fixed Size 2213896 bytes
Variable Size 956303352 bytes
Database Buffers 687865856 bytes
Redo Buffers 7135232 bytes
SQL>
END
腳本實現自動安裝oracle
自動安裝腳本
腳本運行必須條件: 在腳本同目錄下必須有linux.x64_11gR2_database_1of2.zip,linux.x64_11gR2_database_2of2.zip 以及編輯好的的 dbca.rsp db_install.rsp netca.rsp 文件,否則腳本不會運行
#!/bin/sh
###############################
# auto install oracle #
# DATE: 2014-04-18 #
# Last Update: 2014-07-2 #
###############################
. /etc/sysconfig/network
. /etc/sysconfig/selinux
[ $UID -ne 0 ] && exit 2
[ $NETWORKING == no ] && exit 2
[ $SELINUX != "Disabled" ] && setenforce 0 >> /dev/null 2>&1;sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
[ `hostname` == $HOSTNAME ] || exit 2
/etc/init.d/iptables status|grep -q "stopped" || /sbin/iptables -F
for i in linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip dbca.rsp db_install.rsp netca.rsp
do
[ -f $i ] || exit 2
done
echo -n 'Input ORACLE_BASE: '
read ORACLE_BASE
echo -n 'Input ORACLE_HOME: '
read ORACLE_HOME
echo -n 'Input ORACLE_SID: '
read ORACLE_SID
uname -a|grep -q "x86_64" && export OS="x86_64" || export OS="i386"
if [ $OS == "x86_64" ];then
yum -y install gcc* gcc-* gcc-c++-* glibc-devel-* glibc-headers-* compat-libstdc* libstdc* elfutils-libelf-devel* libaio-devel* sysstat* unixODBC-* pdksh-*
else
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
fi
for j in iptables rhnsd isdn avahi-daemon avahi-dnsconfd bluetooth cpuspeed hidd ip6tables mcstrans pcscd gpm xinetd portmap yum-updatesd restorecond setroubleshoot yum-updatesd libvirtd xendomains xend iptables sendmail postfix
do
/etc/init.d/$j stop
/sbin/chkconfig --level 2345 $j off
done
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/groupadd oper
/usr/sbin/useradd -g oinstall -G dba,oper -d /home/oracle
echo "oracle" | passwd --stdin oracle
mv /etc/sysctl.conf /etc/sysctl.conf-`date +%Y-%m-%d`
cat << EOF >/etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
kernel.core_uses_pid = 1
kernel.sysrq = 0
net.ipv4.tcp_syncookies = 1
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.aio-max-nr = 1048576
fs.aio-max-nr = 1048576
fs.aio-max-nr = 1048576
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_default = 262144
EOF
/sbin/sysctl -p
cat << EOF >> /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat << EOF >> /etc/pam.d/login
session required pam_limits.so
EOF
cat << EOF >> /etc/profile
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
LOCAL_IP=`/sbin/ifconfig |grep "inet addr"|grep -v "127.0"|sed -e 's/.*addr://g' -e 's/Bcast.*//g'|head -1`
cat << EOF >> /home/oracle/.bash_profile
ORACLE_BASE=$ORACLE_BASE
ORACLE_HOME=$ORACLE_HOME
ORACLE_SID=$ORACLE_SID
DISPLAY=$LOCAL_IP:0.0
PATH=\$ORACLE_HOME/bin:\$PATH
export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID DISPLAY
EOF
cat << EOF >> /etc/oraInst.loc
inventory_loc=$ORACLE_BASE/oraInventory
inst_group=oinstall
EOF
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
[ -d $ORACLE_HOME ] && mv $ORACLE_HOME $ORACLE_HOME-`date +%Y-%m-%d`
mkdir -p $ORACLE_BASE/oraInventory
mkdir -p $ORACLE_HOME
unzip linux.x64_11gR2_database_1of2.zip -d $ORACLE_BASE/
unzip linux.x64_11gR2_database_2of2.zip -d $ORACLE_BASE/
cp dbca.rsp db_install.rsp netca.rsp $ORACLE_BASE/
chown -R oracle:oinstall $ORACLE_BASE
su - oracle -c "$ORACLE_BASE/database/runInstaller -silent -ignorePrereq -responseFile $ORACLE_BASE/db_install.rsp" && sh $ORACLE_HOME/root.sh
su - oracle -c "netca -silent -responseFile $ORACLE_BASE/netca.rsp"
su - oracle -c "dbca -silent -createdatabase -responseFile $ORACLE_BASE/dbca.rsp"
oracle修改字符編碼為utf8
shutdown immediate;
startup mount;
alter session set sql_trace=true;
alter system enable restricted session;
alter system set job_queue_processes=0;
alter system set aq_tm_processes=0;
alter database open;
alter database character set internal_use utf8;
alter session set sql_trace=false;
shutdown immediate;
startup;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。