静默安装oracle11g
安装rpm
[root@oracle ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33 gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 unzip
[root@oracle ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
创建用户
[root@oracle ~]# /usr/sbin/groupadd oinstall
[root@oracle ~]# /usr/sbin/groupadd dba
[root@oracle ~]# /usr/sbin/useradd -g oinstall -G dba oracle
[root@oracle ~]# echo "Oracle_1" |passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
修改内核参数
[root@oracle ~]# vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
[root@oracle ~]# sysctl -p
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
设置oracle用户shell限制
[root@oracle ~]# vim /etc/security/limits.conf
# oracle-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024
oracle soft nofile 1024
#
# # oracle-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536
oracle hard nofile 65536
#
# # oracle-rdbms-server-11gR2-preinstall setting for nproc soft limit is 16384
# # refer orabug15971421 for more info.
oracle soft nproc 16384
#
# # oracle-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384
oracle hard nproc 16384
#
# # oracle-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KB
oracle soft stack 10240
#
# # oracle-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KB
oracle hard stack 32768
修改vim /etc/pam.d/login文件
[root@oracle ~]# vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
关闭selinux
vim /etc/selinux/config
# 设置SELINUX=disabled
关闭防火墙
service iptables stop
systemctl stop firewalld
systemctl disable firewalld #可以不执行
修改主机名及hosts文件
[root@localhost ~]# vim /etc/hostname
oracle
[root@oracle ~]# vim /etc/hosts
10.10.10.101 oracle
##不要有非常规字符,如"-" "~"等,可以有“_”“#”“$”“.”
配置/etc/profile
[root@oracle ~]# 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
umask 022
fi
[root@oracle ~]# source /etc/profile
创建安装目录
[root@oracle ~]# mkdir -p /oracle/11g
[root@oracle ~]# mkdir -p /oracle/11g/oraInventory
[root@oracle ~]# chown -R oracle:oinstall /oracle/11g
[root@oracle ~]# chmod -R 775 /oracle/11g
配置oracle用户环境变量 /home/oracle/.bash_profile
[root@oracle ~]# vim /home/oracle/.bash_profile
ORACLE_BASE=/oracle/11g; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=orcl; export ORACLE_SID
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;export LD_LIBRARY_PATH
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_TERM=xterm; export ORACLE_TERM.
NLS_LANG="AMERICAN_AMERICA.AL32UTF8";export NLS_LANG
umask 022
[root@oracle ~]# source /home/oracle/.bash_profile
解压安装包文件,解压出来的文件需要oracle能访问
[root@oracle ~]# mkdir /home/oracle_install
[root@oracle oracle_install]# cd /home/oracle_install/
[root@oracle oracle_install]# unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
[root@oracle oracle_install]# chown oracle:oinstall -R /home/oracle_install
开始安装,安装数据库软件
修改应答文件
[root@oracle oracle_install]# cd /home/oracle_install/
[root@oracle oracle_install]# cp -a /home/oracle_install/database/response/ .
[root@oracle oracle_install]# cd response/
[root@oracle response]# vim db_install.rsp
#修改以下内容,其他保持默认即可
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/11g/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/oracle/11g/product/11.2.0/dbhome_1 //不需要提前创建
ORACLE_BASE=/oracle/11g
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false //自定义安装,否,使用默认组件
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=oracle.orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.password.ALL=Oracle_1
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手动写了false)
DECLINE_SECURITY_UPDATES=true //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
我的应答文件样例
[root@oracle response]# cat db_install.rsp |grep -v '#' |grep -v ^$
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/oracle/11g/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/oracle/11g/product/11.2.0/dbhome_1
ORACLE_BASE=/oracle/11g
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=oracle.orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=Oracle_1
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
开始安装,需要用oracle用户进行安装
[root@oracle ~]# su - oracle
[oracle@oracle ~]$ cd /home/oracle_install/database/
[oracle@oracle database]$ ./runInstaller -silent -responseFile /home/oracle_install/response/db_install.rsp
根据提示查看安装日志,安装完成后还需要手动执行两个脚本,在安装完的信息里面有详细路径
创建监听器
[oracle@oracle ~]$ netca /silent /responsefile /home/oracle_install/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle_install/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/oracle/11g/product/11.2.0/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_HOME下创建监听文件listenr.ora,可以根据实际情况修改
创建数据库
修改应答文件,修改GENERAL和CREATEDATABASE里面的内容
[oracle@oracle ~]$ vim /home/oracle_install/response/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "oracle.orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "Oracle_1"
SYSTEMPASSWORD = "Oracle_1"
CHARACTERSET = "AL32UTF8"
开始建库
[oracle@oracle ~]$ dbca -silent -responseFile /home/oracle_install/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 "/oracle/11g/cfgtoollogs/dbca/oracle/oracle.log" for further details.
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 289211569@qq.com