- 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用户的密码