CentOS7静默安装oracle11gR2

CentOS7静默安装oracle11gR2

1.安装unzip 工具、vim编辑器

[root@localhost ~]# yum -y install unzip vim
 
2.在/etc/hosts文件中添加本机IP跟主机名
[root@localhost ~]# echo "oracle.131" >> /etc/hostname
[root@localhost ~]# echo "10.162.144.67 PreOS-dell-22" >> /etc/hosts
 
3.关闭selinux ,编辑 /etc/selinux/config文件,设置SELINUX= enforcing 为SELINUX=disabled
[root@localhost ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
 
4.关闭防火墙
(1)查看防火墙状态:
[root@localhost ~]# systemctl status firewalld
(2)停止防火墙:
[root@localhost ~]# systemctl stop firewalld
(3)关闭自启动防火墙服务:
[root@localhost ~]# systemctl disable firewalld
 
5.安装Oracle 11g依赖包
[root@localhost ~]# yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh
[root@localhost ~]# yum -y install libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
 
6.添加oinstall 、dba 组,新建oracle用户并加入oinstall、dba组中
[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
 
7.设置oracle用户登录密码
[root@localhost ~]# passwd oracle
Changing password for user oracle.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully
 
8.查看Oracle用户信息
[root@localhost ~]# id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
 
9.修改内核参数,编辑 /etc/sysctl.conf,添加以下设置:
[root@localhost ~]# vim  /etc/sysctl.con
io-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
kernel.shmmni = 4096
kernel.sem = 250 32000 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
 
10.让内核参数生效
[root@localhost ~]#  sysctl –p
 
11.修改/etc/pam.d/login文件,添加以下设置
[root@localhost ~]# echo "session  required   /lib64/security/pam_limits.so" >> /etc/pam.d/login
[root@localhost ~]# echo "session  required   pam_limits.so" >> /etc/pam.d/login
 
12.修改/etc/profile文件,添加以下设置
[root@localhost ~]# vim /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
 
13.创建安装目录、修改文件权限
[root@localhost ~]# mkdir -p /u01/app/oracle/product/11.2.0
[root@localhost ~]# mkdir /u01/app/oracle/oradata
[root@localhost ~]# mkdir /u01/app/oracle/inventory
[root@localhost ~]# mkdir /u01/app/oracle/fast_recovery_area
[root@localhost ~]# chown -R oracle:oinstall /u01/app/oracle
[root@localhost ~]# chmod -R 775 /u01/app/oracle
 
14.上传oracle软件包到 /tmp目录下
解压oracle软件包
[root@localhost tmp]# unzip p13390677_112040_Linux-x86-64_1of7.zip && unzip p13390677_112040_Linux-x86-64_2of7.zip
 
15.切换到oracle用户,设置oracle用户环境变量
[root@localhost database]#  su - oracle
[[oracle@oracle ~]$ vim .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
[oracle@oracle ~]$ source .bash_profile
 
16.编辑静默安装响应文件
(1)切换到root 用户进入oracle安装包解压后的目录 /tmp/database/response/下备份db_install.rsp文件。
[oracle@oracle ~]$ su   
Password:
[root@oracle ~]# cd /tmp/database/response/
[root@oracle response]# ll
total 80
-rwxr-xr-x 1 root root 44533 Aug 27  2013 dbca.rsp
-rw-r--r-- 1 root root 25116 Aug 27  2013 db_install.rsp
-rwxr-xr-x 1 root root  5871 Aug 27  2013 netca.rsp
[root@oracle response]# cp db_install.rsp db_install.rsp.bak
[root@oracle response]# ll
total 108
-rwxr-xr-x 1 root root 44533 Aug 27  2013 dbca.rsp
-rw-r--r-- 1 root root 25116 Aug 27  2013 db_install.rsp
-rw-r--r-- 1 root root 25116 Mar 21 10:31 db_install.rsp.bak
-rwxr-xr-x 1 root root  5871 Aug 27  2013 netca.rsp
(2)编辑 /tmp/database/response/db_install.rsp文件,修改以下参数:
[root@oracle response]# vim db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle.131
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
 
17.根据响应文件安装oracle 11g
[root@oracle database]# su - oracle
Last login: Wed Mar 21 10:15:07 CST 2018 on pts/0
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted
[oracle@oracle ~]$ cd /tmp/database/
[oracle@oracle database]$ ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/database/response/db_install.rsp
Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 120 MB.   Actual 41520 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-21_10-40-40AM. Please wait ...[oracle@oracle 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.
You can find the log of this install session at:
/u01/app/oracle/inventory/logs/installActions2018-03-21_10-40-40AM.log
开始Oracle在后台静默安装。安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了。
出现以上界面,说明安装程序已在后台运行,此时再打开另外一个终端选项卡,输入提示的会话日志目录:
[root@oracle ~]# tail -f /u01/app/oracle/inventory/logs/installActions2018-03-21_10-40-40AM.log
INFO: Installation in progress
INFO: Extracting files to '/u01/app/oracle/product/11.2.0'.
INFO: Extracting files to '/u01/app/oracle/product/11.2.0'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_exp_1.xml'.
INFO: Performing fastcopy operations based on the information in the file 'racfiles.jar'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_dirs.lst'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_filemap.jar'.
INFO: Performing fastcopy operations based on the information in the file 'oracle.server_EE_1.xml'.
INFO: Performing fastcopy operations based on the information in the file 'setperms1.sh'.
INFO: Number of threads for fast copy :1
看到日志文件会持续输出安装信息没有输入异常信息,则表明安装过程正常。
待看到下内容部分,则表明安装已经完成
[oracle@oracle database]$ ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /tmp/database/response/db_install.rsp
Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 120 MB.   Actual 41520 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 2047 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-03-21_10-40-40AM. Please wait ...[oracle@oracle 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.
You can find the log of this install session at:
/u01/app/oracle/inventory/logs/installActions2018-03-21_10-40-40AM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oracle/inventory/logs/silentInstall2018-03-21_10-40-40AM.log' for more details.
 
As a root user, execute the following script(s):
    1. /u01/app/oracle/inventory/orainstRoot.sh
    2. /u01/app/oracle/product/11.2.0/root.sh
 
 
Successfully Setup Software.
[oracle@oracle database]$
 
18.按照提示切换root用户运行脚本
[oracle@oracle database]$ su
Password:
[root@oracle database]# sh /u01/app/oracle/inventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/inventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
 
Changing groupname of /u01/app/oracle/inventory to oinstall.
The execution of the script is complete.
[root@oracle database]# sh /u01/app/oracle/product/11.2.0/root.sh
Check /u01/app/oracle/product/11.2.0/install/root_oracle.131_2018-03-21_10-49-38.log for the output of root script
[root@oracle database]#
 
19.用oracle用户登录配置监听
[root@oracle database]# su - oracle
Last login: Wed Mar 21 10:42:32 CST 2018 from 192.168.106.1 on pts/1
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted
[oracle@oracle ~]$ netca -silent -responseFile /tmp/database/response/netca.rsp
 
Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /tmp/database/response/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/11.2.0/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@oracle ~]$
注意:如出现“···DISPLAY····”则需要配置DISPLAY变量,配完之后重新netca。
成功运行后,会在/u01/app/oracle/product/11.2.0/network/admin/ 中生成listener.ora和sqlnet.ora两个文件。
查看监听端口:
[oracle@oracle ~]$ cd /u01/app/oracle/product/11.2.0/network/admin/
[oracle@oracle admin]$ ll
total 12
-rw-r--r-- 1 oracle oinstall 366 Mar 21 10:51 listener.ora
drwxr-xr-x 2 oracle oinstall  64 Mar 21 10:41 samples
-rw-r--r-- 1 oracle oinstall 381 Dec 17  2012 shrept.lst
-rw-r--r-- 1 oracle oinstall 214 Mar 21 10:51 sqlnet.ora
[oracle@oracle admin]$ netstat -tnulp | grep 1521
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::1521                 :::*                    LISTEN      7177/tnslsnr
 
20.建立新库,同时建立对应的实例
切换到root用户,编辑 /tmp/database/response/dbca.rsp,修改以下参数:
[oracle@oracle admin]$ su -
Password:
Last login: Wed Mar 21 10:48:54 CST 2018 on pts/0
[root@oracle ~]# vim /tmp/database/response/dbca.rsp
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION = /u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"
 
21.进行静默配置
[root@oracle ~]# su - oracle
Last login: Wed Mar 21 10:51:18 CST 2018 on pts/0
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted
[oracle@oracle ~]$ dbca -silent -responseFile /tmp/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
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
[oracle@oracle ~]$
 
22.完成建库后进行实例检查
[oracle@oracle ~]$ ps -ef | grep ora_ | grep -v grep
oracle     7576      1  0 11:10 ?        00:00:00 ora_pmon_orcl
oracle     7578      1  0 11:10 ?        00:00:00 ora_psp0_orcl
oracle     7580      1  3 11:10 ?        00:00:03 ora_vktm_orcl
oracle     7584      1  0 11:10 ?        00:00:00 ora_gen0_orcl
oracle     7586      1  0 11:10 ?        00:00:00 ora_diag_orcl
oracle     7588      1  0 11:10 ?        00:00:00 ora_dbrm_orcl
oracle     7590      1  0 11:10 ?        00:00:00 ora_dia0_orcl
oracle     7592      1  0 11:10 ?        00:00:00 ora_mman_orcl
oracle     7594      1  0 11:10 ?        00:00:00 ora_dbw0_orcl
oracle     7596      1  0 11:10 ?        00:00:00 ora_lgwr_orcl
oracle     7598      1  0 11:10 ?        00:00:00 ora_ckpt_orcl
oracle     7600      1  0 11:10 ?        00:00:00 ora_smon_orcl
oracle     7602      1  0 11:10 ?        00:00:00 ora_reco_orcl
oracle     7604      1  0 11:10 ?        00:00:00 ora_mmon_orcl
oracle     7606      1  0 11:10 ?        00:00:00 ora_mmnl_orcl
oracle     7608      1  0 11:10 ?        00:00:00 ora_d000_orcl
oracle     7610      1  0 11:10 ?        00:00:00 ora_s000_orcl
oracle     7618      1  0 11:10 ?        00:00:00 ora_qmnc_orcl
oracle     7634      1  0 11:10 ?        00:00:00 ora_cjq0_orcl
oracle     7636      1  0 11:11 ?        00:00:00 ora_q000_orcl
oracle     7638      1  0 11:11 ?        00:00:00 ora_q001_orcl
 
23.查看监听状态
[oracle@oracle ~]$ lsnrctl status
 
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 21-MAR-2018 11:12:56
 
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
 
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                21-MAR-2018 10:51:34
Uptime                    0 days 0 hr. 21 min. 21 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle.131)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle ~]$
 
24.登录查看实例状态
[oracle@oracle ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 21 11:14:16 2018
 
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
 
 
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
 
Total System Global Area 1068937216 bytes
Fixed Size            2260088 bytes
Variable Size          331350920 bytes
Database Buffers      729808896 bytes
Redo Buffers            5517312 bytes
Database mounted.
Database opened.
 
SQL>
SQL> select * from v$database;
 
      DBID NAME      CREATED   RESETLOGS_CHANGE# RESETLOGS
---------- --------- --------- ----------------- ---------
至此,oracle 11g静默安装完成结束。
posted @ 2018-12-19 13:56  Kaichao  阅读(705)  评论(0)    收藏  举报