CentOS 7.2靜默安裝Oracle11g

aaron8219發表於2018-08-22
 
Preface
 
    Today I`m gonna export some test data to another server.The source server is Windows Server 2012 R2 and the tartget server is CentOS 7.2.Eventually,I found out that when using the OUI of Oracle 11g,the mouse cannot click anything in the interface even to click “exit”.I`m afraid it`s not properly supported on CentOS 7 series.Therefore I decided to install Oracle with silent mode first.
 
Precedure
 
1. Add user and groups.
1 groupadd oinstall
2 groupadd dba
3 useradd -g oinstall -G dba -m oracle
4 passwd oracle
5 id oracle

 

2. Create directories and grant privileges on them.

1 mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
2 mkdir -p /u01/app/oracle/{oradata,inventory,fast_recovery_area}
3 chown -R oracle:oinstall /u01
4 chmod -R 775 /u01

 

3. Modify the OS release(It`s a little trick).

1 cat /proc/version
2 cat /etc/redhat-release
3 CentOS Linux release 7.2.1511 (Core)
4 vim /etc/redhat-release
5 cat /etc/redhat-release
6 redhat-7

 

4. Install the required package.

1 yum install gcc* gcc-* gcc-c++-* glibc-devel-* glibc-headers-* compat-libstdc* libstdc* elfutils-libelf-devel* libaio-devel* sysstat* unixODBC-* pdksh-*

 

5. Disable the firewall.

1 systemctl status firewalld.service
2 systemctl stop firewalld.service
3 systemctl disable firewalld.service

 

6. Disable the selinux.

1 vi /etc/selinux/config 
2 cat /etc/selinux/config
3 SELINUX=disabled
4 or
5 sestatus -v
6 SELinux status:                 disabled

 

7. Modify the core parameters.

 1 vim /etc/sysctl.conf
 2 net.ipv4.icmp_echo_ignore_broadcasts = 1
 3 net.ipv4.conf.all.rp_filter = 1
 4 fs.file-max = 6815744 //Max opened files.
 5 fs.aio-max-nr = 1048576
 6 kernel.shmall = 2097152 //All pages of shared memory 8G:2097152*4k/1024/1024
 7 kernel.shmmax = 2147483648
 8 kernel.shmmni = 4096
 9 kernel.sem = 250 32000 100 128
10 net.ipv4.ip_local_port_range = 9000 65500 //Range of ports of IPv4.
11 net.core.rmem_default = 262144
12 net.core.rmem_max= 4194304
13 net.core.wmem_default= 262144
14 net.core.wmem_max= 1048576
15 //Make it take effect.
16 sysctl -p

 

8. Modify the limits to oracle user.

1 vim /etc/security/limits.conf
2 cat /etc/security/limits.conf
3 oracle soft nproc 2047
4 oracle hard nproc 16384
5 oracle soft nofile 1024
6 oracle hard nofile 65536

 

9. Modify the pam limit.

1 vim /etc/pam.d/login
2 cat /etc/pam.d/login
3 session required /lib64/security/pam_limits.so
4 session required pam_limits.so 

 

10. Modify variables of evironment.

1 export ORACLE_BASE=/u01/app/oracle
2 export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
3 export ORACLE_SID=ORCL 
4 export ORACLE_TERM=xterm
5 export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
6 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
7 export LANG=en_US
8 export NLS_LANG=AMERICAN_AMERICA.AL32UTF8

 

11. Install Oracle software by silent mode.

 1 egrep -v "(^#|^$)" /u01/database/response/db_install.rsp
 2 vim /u01/database/response/db_install.rsp
 3 cat /u01/database/response/db_install.rsp
 4 oracle.install.option=INSTALL_DB_SWONLY
 5 ORACLE_HOSTNAME=ORAHOST
 6 UNIX_GROUP_NAME=oinstall
 7 INVENTORY_LOCATION=/u01/app/oracle/inventory
 8 SELECTED_LANGUAGES=en,zh_CN
 9 ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
10 ORACLE_BASE=/u01/app/oracle
11 oracle.install.db.InstallEdition=EE
12 oracle.install.db.EEOptionsSelection=true
13 oracle.install.db.DBA_GROUP=dba
14 oracle.install.db.OPER_GROUP=dba
15 oracle.install.db.config.starterdb.password.ALL=Passw0rd
16 DECLINE_SECURITY_UPDATES=true 
17 //Execute the installation command.
18 ./runInstaller -silent -responseFile /u01/database/response/db_install.rsp -ignorePrereq

 

12. Install Oracle network by silent mode.

 1 egrep -v "(^#|^$)" /u01/database/response/netca.rsp
 2 [GENERAL]
 3 RESPONSEFILE_VERSION="11.2"
 4 CREATE_TYPE="CUSTOM"
 5 [oracle.net.ca]
 6 INSTALLED_COMPONENTS={"server","net8","javavm"}
 7 INSTALL_TYPE=""typical""
 8 LISTENER_NUMBER=1
 9 LISTENER_NAMES={"LISTENER"}
10 LISTENER_PROTOCOLS={"TCP;1521"}
11 LISTENER_START=""LISTENER""
12 NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
13 NSN_NUMBER=1
14 NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
15 NSN_SERVICE={"PLSExtProc"}
16 //Execute the configuration command.
17 netca -silent -responsefile "/u01/database/response/netca.rsp"

 

13. Install Oracle database by silent mode.

 1 egrep -v "(^#|^$)" /u01/database/response/dbca.rsp
 2 vim /u01/database/response/dbca.rsp
 3 cat /u01/database/response/dbca.rsp
 4 GDBNAME = "ORCL"
 5 SID = "ORCL"
 6 DB_UNIQUE_NAME = `ORCL`
 7 SYSPASSWORD = "Passw0rd"
 8 SYSTEMPASSWORD = "Passw0rd"
 9 DATAFILEDESTINATION =/u01/app/oracle/oradata
10 RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
11 CHARACTERSET = "AL32UTF8"
12 TOTALMEMORY = "512"
13 //Execute the creation command.
14 dbca -silent -responseFile /u01/database/response/dbca.rsp 
15 or
16 dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbName ORCL -sid ORCL -DB_Unique_Name ORCL -responseFile NO_VALUE -sysPassword Passw0rd -systemPassword Passw0rd -DataFileDestination /u01/app/oracle/oradata RecoveryAreaDestination /u01/app/oracle/oradata/fast_recovery_area -characterset AL32UTF8 -sampleSchema false -totalmemory 512

 

 

相關文章