欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Oracle 11g静默安装

程序员文章站 2023-09-28 22:07:21
1、检查安装包 安装依赖包 yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ks ......
  • 1、检查安装包

安装依赖包

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

  • 2、创建用户组和用户

groupadd oinstall
groupadd dba
useradd -g oinstall -g dba oracle
passwd oracle

  • 3、修改内核参数

vi /etc/sysctl.conf

kernel.shmall = 2097152
kernel.shmmax = 4294967295

fs.aio-max-nr = 1048576
fs.file-max = 6815744
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

使用/sbin/sysctl -p 使内核参数实时生效

  • 4、修改用户资源限制

vi /etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

  • 5、修改配置文件

vi /etc/pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so

  • 6、关闭selinux

vi /etc/selinux/config
把 selinux=disabled 设置为disabled即可
sed -i “s/selinux=enforcing/selinux=disabled/”

  • 7、创建安装目录

mkdir -p /u01/app/oracle
chown -r oracle:oinstall /u01/app
chmod -r 755 /u01/app/

  • 8、修改/etc/profile配置文件

vi /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

  • 9、修改主机名

vi /etc/sysconfig/network
hostname=oracledb
vi /etc/hosts
192.168.0.106 oracledb

  • 10、修该oracle用户变量

vi /home/oracle/.bash_profile
export oracle_base=/u01/app
export oracle_home=$oracle_base/oracle/product/11.2.0/dbhome_1
export path=$oracle_home/bin:$path
export oracle_sid=orcl
#export classpath=$oracle_home/jre:$oracle_home/jlib:$oracle_home/rdbms/jlib
export nls_lang=american_america.al32utf8

  • 11、解压安装包

unzip linux.x64_11gr2_database_1of2.zip -d /u01/app/
unzip linux.x64_11gr2_database_2of2.zip -d /u01/app/

  • 12、 静默安装

cd /u01/app/database/response
cp db_install.rsp db_install.rsp.bak
vi db_install.rsp

oracle.install.responsefileversion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=install_db_swonly
oracle_hostname=oracledb
unix_group_name=oinstall
inventory_location=/u01/app/oracle/orainventory
selected_languages=en,zh_cn
oracle_home=/u01/app/oracle/product/11.2.0/dbhome_1
oracle_base=/u01/app
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.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=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=512
oracle.install.db.config.starterdb.installexampleschemas=false
oracle.install.db.config.starterdb.enablesecuritysettings=true
oracle.install.db.config.starterdb.password.all=orcl
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=file_system_storage
oracle.install.db.config.starterdb.filesystemstorage.datalocation=/home/oracle/oradata
oracle.install.db.config.starterdb.filesystemstorage.recoverylocation=/u01/app/oracle/recovery
oracle.install.db.config.asm.diskgroup=
oracle.install.db.config.asm.asmsnmppassword=
myoraclesupport_username=
myoraclesupport_password=
security_updates_via_myoraclesupport=
decline_security_updates=true
proxy_host=
proxy_port=
proxy_user=
proxy_pwd=

注:


oracle.install.option=install_db_swonly          //安装类型,只装数据库软件
oracle_hostname=oracledb                 //主机名称(命令hostname查询)
unix_group_name=oinstall                 // 安装组
inventory_location=/u01/app/oracle/orainventory //inventory目录(不填就是默认值,本例此处需修改,因个人创建安装目录而定)
selected_languages=en,zh_cn            // 选择语言
oracle_home=/u01/app/oracle/product/11.2.0/db_1     // oracle_home 路径根据目录情况注意修改 本例安装路径/u01/app/oracle
oracle_base=/u01/app/oracle     // oracle_base 
注意修改
oracle.install.db.installedition=ee         // oracle版本
oracle.install.db.iscustominstall=false         //自定义安装,否,使用默认组件
oracle.install.db.dba_group=dba         //dba用户组
oracle.install.db.oper_group=oinstall         //oper用户组
oracle.install.db.config.starterdb.type=general_purpose //数据库类型
oracle.install.db.config.starterdb.globaldbname=orcl //globaldbname
oracle.install.db.config.starterdb.sid=orcl         //sid(
此处注意与环境变量内配置sid一致)
oracle.install.db.config.starterdb.memorylimit=81920 //自动管理内存的内存(m)
oracle.install.db.config.starterdb.password.all=oracle //设定所有数据库用户使用同一个密码
security_updates_via_myoraclesupport=false       //(手动写了false)
decline_security_updates=true                 // **注意此参数 设定一定要为true


  • 13、开始安装

su - oracle
cd /u01/app/database
./runinstaller -silent -responsefile /u01/app/database/response/db_install.rsp
./runinstaller -silent -ignoresysprereqs -ignoreprereq -responsefile /u01/app/database/response/db_install.rsp

  • 14、用oracle用户登录配置监听

netca -silent -responsefile /u01/app/database/response/netca.rsp

netca -silent -responsefile /u01/app/database/response/netca.rsp
****display environment variable not set!
oracle net configuration assistant is a gui tool
which requires that display specify a location
where gui tools can display.
set and export display, then re-run.
[oracle@oracledb database]$ export display=localhost:0.0
[oracle@oracledb database]$ netca -silent -responsefile /u01/app/database/response/netca.rsp

  • 15、建立数据库

dbca -silent -responsefile /u01/app/database/response/dbca.rsp
备注:需要修改dbca文件中的实例名称,sys和system用户的密码