在X86_64的centOS6.4下静默安装Oracle11g的操作历程:
1、首先安装oracle需要的安装包
[root@mytest ~]# yuminstall -y binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-develgcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++libstdc++-devel make numactl sysstat libXp unixODBC unixODBC-devel
2、下载安装pdksh(安装前需要确认没有安装过ksh,否则需要先卸载ksh避免冲突)
[root@mytest ~]#wget ftp://fr2.rpmfind.net/linux/centos/5.9/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
[root@mytest ~]# rpm-ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm
3、添加安装oracle需要的用户及其群组,并修改用户的密码
[root@mytest ~]#groupadd oracleDba
[root@mytest ~]#groupadd oinstall
[root@mytest ~]#useradd oracle -g oinstall -G oracleDba
[root@mytest ~]#passwd oracle
4、为安装oracle修改系统参数,并是系统参数及时生效
[root@mytest ~]# vi/etc/sysctl.conf
kernel.shmmax =2147483648
kernel.shmmni = 4096
kernel.sem = 25032000 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
[root@mytest ~]#sysctl -p
如果出现以下错误:
error:"net.bridge.bridge-nf-call-ip6tables" is an unknown key
error:"net.bridge.bridge-nf-call-iptables" is an unknown key
error:"net.bridge.bridge-nf-call-arptables" is an unknown key
解决方法如下:
[root@mytest ~]#modprobe bridge
[root@mytest ~]#lsmod | grep bridge
bridge 79078 0
stp 2218 2 bridge,garp
llc 5546 3 bridge,garp,stp
[root@mytest ~]#sysctl -p
5、修改于oracle安装用户相关的系统文件增加系统性能
[root@mytest ~]# vi/etc/security/limits.conf
oracle soft nproc2047
oracle hard nproc16384
oracle soft nofile1024
oracle hard nofile65536
oracle soft stack10240
[root@mytest ~]# vi/etc/pam.d/login
session required pam_limits.sosession
session required /lib64/security/pam_limits.so
[root@mytest ~]# vi/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
6、确认Selinux特性关闭
[root@mytest ~]# cat/etc/selinux/config
SELINUX=disabled
7、尽力oracle的安装目录并授权给oracle用户
[root@mytest ~]#mkdir -p /usr/local/oracle
[root@mytest ~]#chown -R oracle:oracleDba /usr/local/oracle/
[root@mytest ~]#chmod -R 755 /usr/local/oracle/
8、上传和解压缩oracle安装文件
[root@mytest ~]#unzip /var/ftp/upload/linux.x64_11gR2_database_1of2.zip -d /usr/local/oracle/&& unzip /var/ftp/upload/linux.x64_11gR2_database_2of2.zip -d/usr/local/oracle/
Archive: /var/ftp/upload/linux.x64_11gR2_database_1of2.zip
9、使用oracle用户登录,并修改资源文件使其生效
[oracle@mytest ~]$vi /home/oracle/.bash_profile
ORACLE_BASE=/usr/local/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_SID=orcl
ORACLE_OWNER=oracle
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin:/usr/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_BASEORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
export CLASSPATH
umask 022
[oracle@mytest ~]$source /home/oracle/.bash_profile
10、复制并创建一个新的数据库软件安装的应答文件
[oracle@mytestresponse]$ cp db_install.rsp db_install_swonly.rsp
[oracle@mytestresponse]$ vi db_install_swonly.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=mytest
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/usr/local/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/usr/local/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=oracleDba
oracle.install.db.OPER_GROUP=oinstall
DECLINE_SECURITY_UPDATES=true
11、开始安装Oracle
[oracle@mytestdatabase]$ ./runInstaller -silent -responseFile/usr/local/oracle/database/response/db_install_swonly.rsp
The followingconfiguration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/usr/local/oracle/oraInventory/orainstRoot.sh
/usr/local/oracle/product/11.2.0/dbhome_1/root.sh
To execute theconfiguration 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 SetupSoftware.
^C
12、回到 root用户运行以下脚本
[root@mytest ~]#/usr/local/oracle/oraInventory/orainstRoot.sh
Changing permissionsof /usr/local/oracle/oraInventory.
Adding read,writepermissions for group.
Removingread,write,execute permissions for world.
Changing groupnameof /usr/local/oracle/oraInventory to oinstall.
The execution of thescript is complete.
[root@mytest ~]#/usr/local/oracle/product/11.2.0/dbhome_1/root.sh
Check/usr/local/oracle/product/11.2.0/dbhome_1/install/root_mytest.localdomain_2013-09-01_12-34-16.logfor the output of root script
13、建立相关的数据文件路径和恢复文件路劲,复制并创建一个新的建库响应文件
[oracle@mytestdatabase]$ mkdir /usr/local/oracle/oradata
[oracle@mytestdatabase]$ mkdir /usr/local/oracle/recoverydata
[oracle@mytestresponse]$ cp dbca.rsp dbca_orcl.rsp
[oracle@mytestresponse]$ vi dbca_orcl.rsp
RESPONSEFILE_VERSION= "11.2.0" //不能更改
OPERATION_TYPE ="createDatabase"
GDBNAME ="orcl11g.us.oracle.com" //数据库的名字
SID ="orcl11g" //对应的实例名字
TEMPLATENAME ="General_Purpose.dbc" //建库用的模板文件
SYSPASSWORD ="xxxx" //SYS管理员密码
SYSTEMPASSWORD ="xxxx" //SYSTEM管理员密码
DATAFILEDESTINATION= xxxx //数据文件存放目录
RECOVERYAREADESTINATION=xxxx//恢复数据存放目录
CHARACTERSET ="ZHS16GBK" //字符集,重要!!!建库后一般不能更改,所以建库前要确定清楚。
TOTALMEMORY ="5120" //oracle内存5120MB
14、使用建库文件进行数据库的建立
[oracle@mytestdatabase]$ dbca -silent -responseFile/usr/local/oracle/database/response/dbca_orcl.rsp
Copying databasefiles
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating andstarting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
57% complete
60% complete
62% complete
Completing DatabaseCreation
66% complete
70% complete
73% complete
74% complete
85% complete
96% complete
100% complete
15、开启Oracle的监听
[oracle@mytestdatabase]$ netca /silent /responsefile/usr/local/oracle/database/response/netca.rsp
Parsing command linearguments:
Parameter "silent" = true
Parameter "responsefile" =/usr/local/oracle/database/response/netca.rsp
Done parsing commandline arguments.
Oracle Net ServicesConfiguration:
Profileconfiguration complete.
Oracle Net ListenerStartup:
Running Listener Control:
/usr/local/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listenerconfiguration complete.
Oracle Net Servicesconfiguration successful. The exit code is 0
16、检查一下Oracle的进程是否打开
[oracle@mytestdatabase]$ netstat -tunlp
(Not all processescould be identified, non-owned process info
will not be shown, you would have to be rootto see it all.)
Active Internetconnections (only servers)
Proto Recv-Q Send-QLocal Address ForeignAddress State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN -
tcp 0 0 142.100.64.101:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:46782 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN -
tcp 0 0 :::111 :::* LISTEN -
tcp 0 0 :::80 :::* LISTEN -
tcp 0 0 :::1521 :::* LISTEN 10097/tnslsnr
tcp 0 0 :::47441 :::* LISTEN -
tcp 0 0 ::1:53 :::* LISTEN -
tcp 0 0 :::22 :::* LISTEN -
tcp 0 0 ::1:631 :::* LISTEN -
tcp 0 0 ::1:25 :::* LISTEN -
tcp 0 0 :::443 :::* LISTEN -
tcp 0 0 :::23306 :::* LISTEN 9981/ora_d000_orcl1
udp 0 0 0.0.0.0:111 0.0.0.0:* -
udp 0 0 0.0.0.0:631 0.0.0.0:* -
udp 0 0 192.168.239.157:123 0.0.0.0:* -
udp 0 0 142.100.64.101:123 0.0.0.0:* -
udp 0 0 127.0.0.1:123 0.0.0.0:* -
udp 0 0 0.0.0.0:123 0.0.0.0:* -
udp 0 0 0.0.0.0:161 0.0.0.0:* -
udp 0 0 142.100.64.101:53 0.0.0.0:* -
udp 0 0 127.0.0.1:53 0.0.0.0:* -
udp 0 0 0.0.0.0:57412 0.0.0.0:* -
udp 0 0 0.0.0.0:708 0.0.0.0:* -
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 0.0.0.0:727 0.0.0.0:* -
udp 0 0 :::111 :::* -
udp 0 0 fe80::20c:29ff:fec2:2bb2:123 :::* -
udp 0 0 fe80::20c:29ff:fec2:2b9e:123 :::* -
udp 0 0 ::1:123 :::* -
udp 0 0 :::123 :::* -
udp 0 0 :::51342 :::* -
udp 0 0 ::1:53 :::* -
udp 0 0 :::17084 :::* 9977/ora_mmon_orcl1
udp 0 0 :::708 :::* -
udp 0 0 ::1:37961 :::* 9983/ora_s000_orcl1
udp 0 0 ::1:31567 :::* 9949/ora_pmon_orcl1
udp 0 0 ::1:11369 :::* 9981/ora_d000_orcl1
17、使用sqlplus登陆Oracle
[oracle@mytestdatabase]$ sqlplus / as sysdba
SQL*Plus: Release11.2.0.1.0 Production on Sun Sep 1 13:03:02 2013
Copyright (c) 1982,2009, Oracle. All rights reserved.
Connected to an idleinstance.
SQL> startup