在linux上静默安装oracle数据库

[root@thdldb01 ~]# cat /etc/oracle-release

Oracle Linux Server release 7.0

[root@thdldb01 ~]# cat /etc/hosts

127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4

192.168.1.7 thdldb01

[root@thdldb01 ~]#cd /etc/yum.repos.d 
 
[root@thdldb01 ~]# wget http://public-yum.oracle.com/public-yum-ol6.repo

[root@thdldb01 ~]#yum install oracle-rdbms-server-12cR1* -y

[root@thdldb01 ~]#yum install readline*devel* -y

[root@thdldb01 ~]# cd /opt && wget http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.42.tar.gz && tar zxvf rlwrap-0.42.tar.gz && cd rlwrap-0.42 && ./configure && make && make install

[root@thdldb01 rlwrap-0.42]# rlwrap -v

rlwrap 0.42

cat /etc/sysctl.conf

# oracle-rdbms-server-12cR1-preinstall setting for fs.file-max is 6815744

fs.file-max = 6815744

# oracle-rdbms-server-12cR1-preinstall setting for kernel.sem is '250 32000 100 128'

kernel.sem = 250 32000 100 128

# oracle-rdbms-server-12cR1-preinstall setting for kernel.shmmni is 4096

kernel.shmmni = 4096

# oracle-rdbms-server-12cR1-preinstall setting for kernel.shmall is 1073741824 on x86_64

kernel.shmall = 1073741824

# oracle-rdbms-server-12cR1-preinstall setting for kernel.shmmax is 4398046511104 on x86_64

kernel.shmmax = 4398046511104

# oracle-rdbms-server-12cR1-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19642132

kernel.panic_on_oops = 1

# oracle-rdbms-server-12cR1-preinstall setting for net.core.rmem_default is 262144

net.core.rmem_default = 262144

# oracle-rdbms-server-12cR1-preinstall setting for net.core.rmem_max is 4194304

net.core.rmem_max = 4194304

# oracle-rdbms-server-12cR1-preinstall setting for net.core.wmem_default is 262144

net.core.wmem_default = 262144

# oracle-rdbms-server-12cR1-preinstall setting for net.core.wmem_max is 1048576

net.core.wmem_max = 1048576

# oracle-rdbms-server-12cR1-preinstall setting for fs.aio-max-nr is 1048576

fs.aio-max-nr = 1048576

# oracle-rdbms-server-12cR1-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500

net.ipv4.ip_local_port_range = 9000 65500

[root@thdldb01 ~]#groupadd -g 54323 oper

[root@thdldb01 ~]#groupadd -g 54324 backupdba

[root@thdldb01 ~]#groupadd -g 54325 dgdba

[root@thdldb01 ~]#groupadd -g 54326 kmdba

[root@thdldb01 ~]#usermod -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle

[root@thdldb01 ~]#mkdir -p /u01/app/oracle

[root@thdldb01 ~]#chown -R oracle.oinstall /u01

[root@thdldb01 opt]# cat /etc/oraInst.loc

inventory_loc=/u01/app/oraInventory

inst_group=oinstall

[root@thdldb01 ~]#chown oracle:oinstall /etc/oraInst.loc

[root@thdldb01 ~]#chmod 664 /etc/oraInst.loc

[root@thdldb01 ~]# su - oracle

ORACLE_SID=thdldb; export ORACLE_SID

ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/12.1.0.2/dbhome_1; export ORACLE_HOME

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH

stty erase ^h

alias sqlplus="rlwrap sqlplus"

alias rman="rlwrap rman"

NLS_LANG=AMERICAN_AMERICA.UTF8; export NLS_LANG

#DISPLAY=192.168.0.4:0.0; export DISPLAY

[oracle@thdldb01 ~]$ ll

-rw-r--r-- 1 oracle oinstall 1673544724 Feb 26 03:55 linuxamd64_12102_database_1of2.zip

-rw-r--r-- 1 oracle oinstall 1014530602 Feb 26 03:54 linuxamd64_12102_database_2of2.zip

[oracle@thdldb01 ~]$ unzip linuxamd64_12102_database_1of2.zip

[oracle@thdldb01 ~]$ unzip linuxamd64_12102_database_2of2.zip

[oracle@thdldb01 ~]$ cd database/

[oracle@thdldb01 database]$ ls

install  response  rpm  runInstaller  sshsetup  stage  welcome.html

配置并安装oracle软件

修改配置模板(db_install.rsp),改动如下:

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=thdldb01

UNIX_GROUP_NAME=oinstall

INVENTORY_LOCATION=/home/oracle/database/stage/products.xml

ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1

ORACLE_BASE=/u01/app/oracle

oracle.install.db.InstallEdition=EE

oracle.install.db.DBA_GROUP=dba

oracle.install.db.OPER_GROUP=oper

oracle.install.db.BACKUPDBA_GROUP=backupdba

oracle.install.db.DGDBA_GROUP=dgdba

DECLINE_SECURITY_UPDATES=true

其他选项为默认。

[oracle@thdldb01 database]$ ./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/db_install.rsp

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.  Actual 7948 MB  Passed

Checking swap space: must be greater than 150 MB.  Actual 7999 MB  Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-02-26_04-13-23AM. Please wait ...[oracle@thdldb01 database]$ You can find the log of this install session at:

/u01/app/oraInventory/logs/installActions2015-02-26_04-13-23AM.log

The installation of Oracle Database 12c was successful.

Please check '/u01/app/oraInventory/logs/silentInstall2015-02-26_04-13-23AM.log' for more details.

As a root user, execute the following script(s):

1. /u01/app/oracle/product/12.1.0.2/dbhome_1/root.sh

Successfully Setup Software.

@配置和创建数据库thdldb

修改默认模板(dbca.rsp),改动的如下:

GDBNAME = "thdldb"

SID = "thdldb"

SYSPASSWORD = "Jieshi11gR2"

SYSTEMPASSWORD = "Jieshi11gR2"

DBSNMPPASSWORD = "Jieshi11gR2"

CHARACTERSET = "AL32UTF8"

NATIONALCHARACTERSET= "UTF8"

其他选项默认。

[oracle@thdldb01 ~]$ dbca -silent -responseFile /home/oracle/dbca.rsp

Cleaning up failed steps

5% complete

Copying database files

7% complete

9% complete

16% complete

23% complete

30% complete

41% complete

Creating and starting Oracle instance

43% complete

48% complete

53% complete

57% complete

58% complete

59% complete

62% complete

64% complete

Completing Database Creation

68% complete

71% complete

75% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/thdldb/thdldb0.log" for further details.

[oracle@thdldb01 ~]$ ps -ef |grep ora_

oracle  35108  1  0 05:05 ?  00:00:00 ora_pmon_thdldb

oracle  35110  1  0 05:05 ?  00:00:00 ora_psp0_thdldb

oracle  35112  1  1 05:05 ?  00:00:00 ora_vktm_thdldb

oracle  35116  1  0 05:05 ?  00:00:00 ora_gen0_thdldb

oracle  35118  1  0 05:05 ?  00:00:00 ora_mman_thdldb

oracle  35122  1  0 05:05 ?  00:00:00 ora_diag_thdldb

oracle  35124  1  0 05:05 ?  00:00:00 ora_dbrm_thdldb

oracle  35126  1  0 05:05 ?  00:00:00 ora_vkrm_thdldb

oracle  35128  1  0 05:05 ?  00:00:00 ora_dia0_thdldb

oracle  35130  1  0 05:05 ?  00:00:00 ora_dbw0_thdldb

oracle  35132  1  0 05:05 ?  00:00:00 ora_lgwr_thdldb

oracle  35134  1  0 05:05 ?  00:00:00 ora_ckpt_thdldb

oracle  35136  1  0 05:05 ?  00:00:00 ora_lg00_thdldb

oracle  35138  1  0 05:05 ?  00:00:00 ora_smon_thdldb

oracle  35140  1  0 05:05 ?  00:00:00 ora_lg01_thdldb

oracle  35142  1  0 05:05 ?  00:00:00 ora_reco_thdldb

oracle  35144  1  0 05:05 ?  00:00:00 ora_lreg_thdldb

oracle  35146  1  0 05:05 ?  00:00:00 ora_pxmn_thdldb

oracle  35148  1  1 05:05 ?  00:00:01 ora_mmon_thdldb

oracle  35150  1  0 05:05 ?  00:00:00 ora_mmnl_thdldb

oracle  35152  1  0 05:05 ?   00:00:00 ora_d000_thdldb

oracle  35154  1  0 05:05 ?  00:00:00 ora_s000_thdldb

oracle  35166  1  0 05:05 ?  00:00:00 ora_tmon_thdldb

oracle  35168  1  0 05:05 ?  00:00:00 ora_tt00_thdldb

oracle  35170  1  0 05:05 ?  00:00:00 ora_smco_thdldb

oracle  35172  1  0 05:05 ?  00:00:00 ora_w000_thdldb

oracle  35174  1  0 05:05 ?  00:00:00 ora_w001_thdldb

oracle  35176  1  0 05:05 ?  00:00:00 ora_aqpc_thdldb

oracle  35178  1  0 05:05 ?  00:00:00 ora_cjq0_thdldb

oracle  35182  1  0 05:05 ?  00:00:00 ora_p000_thdldb

oracle  35184  1  0 05:05 ?  00:00:00 ora_p001_thdldb

oracle  35186  1  0 05:05 ?  00:00:00 ora_p002_thdldb

oracle  35188  1  0 05:05 ?  00:00:00 ora_p003_thdldb

oracle  35190  1  0 05:05 ?  00:00:00 ora_p004_thdldb

oracle  35192  1  0 05:05 ?  00:00:00 ora_p005_thdldb

oracle  35194  1  0 05:05 ?  00:00:00 ora_p006_thdldb

oracle  35196  1  0 05:05 ?  00:00:00 ora_p007_thdldb

oracle  35200  1  0 05:05 ?  00:00:00 ora_p008_thdldb

oracle  35202  1  0 05:05 ?  00:00:00 ora_p009_thdldb

oracle  35204  1  0 05:05 ?  00:00:00 ora_p00a_thdldb

oracle  35206  1  0 05:05 ?  00:00:00 ora_p00b_thdldb

oracle  35208  1  0 05:05 ?  00:00:00 ora_p00c_thdldb

oracle  35210  1  0 05:05 ?  00:00:00 ora_p00d_thdldb

oracle  35212  1  0 05:05 ?  00:00:00 ora_p00e_thdldb

oracle  35214  1  0 05:05 ?  00:00:00 ora_p00f_thdldb

oracle  35356  1  0 05:06 ?  00:00:00 ora_qm02_thdldb

oracle  35358  1  0 05:06 ?  00:00:00 ora_qm03_thdldb

oracle  35360  1  0 05:06 ?   00:00:00 ora_q002_thdldb

oracle  35362  1  0 05:06 ?  00:00:00 ora_q003_thdldb

oracle  35369  30417  0 05:07 pts/4  00:00:00 grep --color=auto ora_

创建和配置监听器(使用默认的模即可netca.rsp)

[oracle@thdldb01 ~]$ netca -silent -responseFile /home/oracle/netca.rsp

Parsing command line arguments:

Parameter "silent" = true

Parameter "responsefile" = /home/oracle/netca.rsp

Done parsing command line arguments.

Oracle Net Services Configuration:

Profile configuration complete.

Oracle Net Listener Startup:

Running Listener Control:

/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/lsnrctl start LISTENER

Listener Control complete.

Listener started successfully.

Listener configuration complete.

Oracle Net Services configuration successful. The exit code is 0

[oracle@thdldb01 ~]$ ps -ef |grep LIS

oracle  35409  1  0 05:09 ?  00:00:00 /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/tnslsnr LISTENER -inherit

oracle  35418  30417  0 05:09 pts/4  00:00:00 grep --color=auto LIS

[oracle@thdldb01 ~]$ netstat -an |grep 1521

tcp  0  0 192.168.1.7:61248  192.168.1.7:1521  ESTABLISHED

tcp6  0  0 :::1521  :::*  LISTEN

tcp6  0  0 192.168.1.7:1521  192.168.1.7:61195  TIME_WAIT

tcp6  0  0 192.168.1.7:1521  192.168.1.7:61248  ESTABLISHED

unix  2  [ ACC ]  STREAM  LISTENING  134954  /var/tmp/.oracle/sEXTPROC1521