Oracle 11204 for Centos7.x 全命令行静默安装

目录

1、准备工作

1.1、配置本地YUM源

1.2、安装依赖包

1.3、创建用户组 

1.4、创建软件安装目录和数据库目录

1.5、准备其它条件 

1.7、关闭防火墙与selinux

1.8、解压数据库文件 

2、安装数据库 

2.1、安装数据库软件

2.2、准备dbca.rsp文件

3.2、进行dbca建库

3、静默进行创建监听


1、准备工作

1.1、配置本地YUM源

mount -t auto /dev/cdrom  /mnt

rm -rf /etc/yum.repos.d/

mkdir -p /etc/yum.repos.d/


cat >> /etc/yum.repos.d/CentOS-Media.repo<<EOF
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-7.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c7-media [command]
#  
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c7-media [command]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOF


yum clean all
yum makecache

1.2、安装依赖包

 yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel libXext* unzip

1.3、创建用户组 

groupadd -g 1001 oinstall
groupadd -g 1002 dba
groupadd -g 1003 oper
groupadd -g 1004 asmdba
groupadd -g 1005 backupdba
groupadd -g 1006 dgdba
groupadd -g 1007 kmdba
groupadd -g 1008 racdba

useradd -u 1001 -m -g oinstall -G dba,oper,asmdba,backupdba,dgdba,kmdba,racdba oracle
id oracle
a=1
echo oracle:$a|chpasswd

1.4、创建软件安装目录和数据库目录

mkdir -p /u01/app/oracle
chown -R oracle:oinstall  /u01
chmod -R 775 /u01
mkdir -p /oracle/install/
chown -R oracle:oinstall  /oracle

1.5、准备其它条件 

hostnamectl set-hostname oracle11g
cat >> /etc/hosts <<EOF
17.21.68.132  oracle11g
EOF
cat >> /etc/sysctl.conf <<EOF
fs.file-max = 6815744  
kernel.sem = 250 32000 100 128  
kernel.shmmni = 4096  
kernel.shmall = 1073741824  
kernel.shmmax = 6597069766656
kernel.panic_on_oops = 1  
net.core.rmem_default = 262144  
net.core.rmem_max = 4194304  
net.core.wmem_default = 262144  
net.core.wmem_max = 1048576  
#net.ipv4.conf.eth3.rp_filter = 2       
#net.ipv4.conf.eth2.rp_filter = 2
#net.ipv4.conf.eth0.rp_filter = 1  
fs.aio-max-nr = 1048576  
net.ipv4.ip_local_port_range = 9000 65500 
EOF

cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF


cat >> /etc/profile <<EOF
if [ \$USER = "oracle" ]; then 
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
EOF

cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF
cat >>/home/oracle/.bash_profile<<EOF
unset USERNAME
export ORACLE_BASE=/u01/app/oracle 
export ORACLE_HOME=\$ORACLE_BASE/product/11.2/db
export ORACLE_SID=orcl
export PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin:\$ORA_CRS_HOME/bin:\$ORACLE_BASE/common/oracle/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export ORACLE_PATH=\$ORACLE_BASE/common/oracle/sql:\$ORACLE_HOME/rdbms/admin
export ORACLE_TERM=xterm
export TNS_ADMIN=\$ORACLE_HOME/network/admin
export ORA_NLS10=\$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=\$ORACLE_HOME/JRE
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/rdbms/jlib
export CLASSPATH=\${CLASSPATH}:\$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
umask=022
EOF
su - oracle
mkdir -p $ORACLE_HOME

1.7、关闭防火墙与selinux

systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/=enforcing/=disabled/g'  /etc/selinux/config
setenforce 0
getenforce

1.8、解压数据库文件 

mkdir -p /oracle/install/
chown -R oracle:oinstall /oracle/
cd /oracle/

unzip p13390677_112040_Linux-x86-64_1of7.zip 
unzip p13390677_112040_Linux-x86-64_2of7.zip 


chown -R oracle:oinstall database/

2、安装数据库 

2.1、安装数据库软件

runInstaller -silent  -force -noconfig -IgnoreSysPreReqs -ignorePrereq   -showProgress  oracle.install.option=INSTALL_DB_SWONLY  DECLINE_SECURITY_UPDATES=true  UNIX_GROUP_NAME=oinstall  INVENTORY_LOCATION=/u01/app/oraInventory  SELECTED_LANGUAGES=en  ORACLE_HOME=/u01/app/oracle/product/11.2/db  ORACLE_BASE=/u01/app/oracle  oracle.install.db.InstallEdition=EE  oracle.install.db.isCustomInstall=false  oracle.install.db.DBA_GROUP=oinstall  oracle.install.db.OPER_GROUP=dba   oracle.install.db.isRACOneInstall=false  oracle.install.db.config.starterdb.type=GENERAL_PURPOSE   SECURITY_UPDATES_VIA_MYORACLESUPPORT=false  oracle.installer.autoupdates.option=SKIP_UPDATES 




[oracle@oracle11g database]$ ./runInstaller -silent  -force -noconfig -IgnoreSysPreReqs -ignorePrereq   -showProgress  oracle.install.option=INSTALL_DB_SWONLY  DECLINE_SECURITY_UPDATES=true  UNIX_GROUP_NAME=oinstall  INVENTORY_LOCATION=/u01/app/oraInventory  SELECTED_LANGUAGES=en  ORACLE_HOME=/u01/app/oracle/product/11.2/db  ORACLE_BASE=/u01/app/oracle  oracle.install.db.InstallEdition=EE  oracle.install.db.isCustomInstall=false  oracle.install.db.DBA_GROUP=oinstall  oracle.install.db.OPER_GROUP=dba   oracle.install.db.isRACOneInstall=false  oracle.install.db.config.starterdb.type=GENERAL_PURPOSE   SECURITY_UPDATES_VIA_MYORACLESUPPORT=false  oracle.installer.autoupdates.option=SKIP_UPDATES 
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB.   Actual 31746 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 3967 MB    Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-04-04_11-10-43AM. Please wait ...[oracle@oracle11g database]$ You can find the log of this install session at:
 /u01/app/oraInventory/logs/installActions2020-04-04_11-10-43AM.log

Prepare in progress.
..................................................   9% Done.

Prepare successful.

Copy files in progress.
..................................................   14% Done.
..................................................   20% Done.
..................................................   26% Done.
..................................................   31% Done.
..................................................   36% Done.
..................................................   41% Done.
..................................................   46% Done.
..................................................   51% Done.
..................................................   56% Done.
..................................................   63% Done.
..................................................   68% Done.
..................................................   73% Done.
..................................................   78% Done.
..................................................   83% Done.
..............................
Copy files successful.

Link binaries in progress.
..........
Link binaries successful.

Setup files in progress.
..................................................   88% Done.
..................................................   94% Done.

Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2020-04-04_11-10-43AM.log' for more details.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
        1. /u01/app/oraInventory/orainstRoot.sh
        2. /u01/app/oracle/product/11.2/db/root.sh


..................................................   100% Done.

Execute Root Scripts successful.
Successfully Setup Software.



[root@oracle11g oraInventory]# ./orainstRoot.sh 
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.


[root@oracle11g db]# sh root.sh 
Check /u01/app/oracle/product/11.2/db/install/root_oracle11g_2020-04-04_11-16-42.log for the output of root script

2.2、准备dbca.rsp文件

mkdir /oradata
chown oracle:oinstall

cat >/oracle/database/response/dbca_install.rsp<<EOF
 [GENERAL]
 RESPONSEFILE_VERSION = "11.2.0"  
 OPERATION_TYPE = "createDatabase"
 [CREATEDATABASE]
 GDBNAME = "orcl"
 SID = "orcl"
 TEMPLATENAME = "General_Purpose.dbc"
 STORAGETYPE=FS
 DATAFILEDESTINATION =/oradata
 CHARACTERSET = "AL32UTF8"
 NATIONALCHARACTERSET= "AL16UTF16"
 TOTALMEMORY = "1024"
 SYSPASSWORD = "oracle"
 SYSTEMPASSWORD = "oracle" 
EOF

cat /oracle/database/response/dbca_install.rsp

3.2、进行dbca建库

dbca -silent -responseFile /oracle/database/response/dbca_install.rsp


[oracle@oracle11g database]$ dbca -silent -responseFile /oracle/database/response/dbca_install.rsp
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl0.log" for further details.
[oracle@oracle11g database]$ dbca -silent -responseFile /oracle/database/response/dbca_install.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.

3、静默进行创建监听

netca -silent -responsefile /u01/app/oracle/product/11.2/db/assistants/netca/netca.rsp



/u01/app/oracle/product/11.2/db
[oracle@oracle11g db]$ netca -silent -responsefile /u01/app/oracle/product/11.2/db/assistants/netca/netca.rsp

Parsing command line arguments:
    Parameter "silent" = true
    Parameter "responsefile" = /u01/app/oracle/product/11.2/db/assistants/netca/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/db/bin/lsnrctl start LISTENER
    Listener Control complete.
    Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
[oracle@oracle11g db]$ 
[oracle@oracle11g db]$ lsnrctl stat

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-APR-2020 11:25:40

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                04-APR-2020 11:25:17
Uptime                    0 days 0 hr. 0 min. 22 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2/db/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle11g/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle11g)(PORT=1521)))
The listener supports no services
The command completed successfully
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值