centos7 install oracle 11gR2
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.创建oracle用户和组
groupadd oinstall
groupadd dba
groupadd asmadmin
groupadd asmdba
useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
passwd oracle
3.修改内核参数
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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
oracle hard stack 10240
vi /etc/pam.d/login
session required pam_limits.so
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
source /etc/profile
5.创建安装目录
mkdir -p /data/app/oracle
chown -R oracle:oinstall oracle
chmod -R 775 /data/app/oracle
6.配置环境变量
su - oracle
vi ~/.bash_profile
export ORACLE_BASE=/data/app/oracle
export ORACLE_SID=orcl
source ~/.bash_profile
7.准备安装文件
su - root
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
8.复制响应文件模板
mkdir -p /home/oracle/etc
cp /home/oracle/database/response/* /home/oracle/etc/
9.静默安装Oracle软件
su - oracle
vi /home/oracle/etc/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=localhost
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/app/oracle/product/11.2.0/db_1
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
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=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.memoryLimit=512
oracle.install.db.config.starterdb.password.ALL=oracle
DECLINE_SECURITY_UPDATES=true
10.安装
database/runInstaller -silent -force -responseFile /home/oracle/etc/db_install.rsp -ignorePrereq
su - root
/data/app/oracle/product/11.2.0/db_1/root.sh
11.配置数据库环境变量
su - oracle
vi ~/.bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export TNS_ADMIN=$ORACLE_HOME/network/admin
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/JRE/lib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export LIBPATH=${CLASSPATH}:$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
export ORACLE_OWNER=oracle
export SPFILE_PATH=$ORACLE_HOME/dbs
export ORA_NLS10=$ORACLE_HOME/nls/data
source ~/.bash_profile
12.配置网络
$ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/etc/netca.rsp
13.安装数据库
vi /home/oracle/etc/dbca.rsp
GDBNAME = "orcl.localhost"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
CHARACTERSET = "AL32UTF8"
NATIONALCHARACTERSET="UTF8"
开始安装:
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/etc/dbca.rsp
14.建库后实例检查
ps -ef | grep ora_ | grep -v grep | wc -l
ps -ef | grep ora_ | grep -v grep
15.建库后监听检查
lsnrctl status
16.修改监听配置
先停止监听服务
lsnrctl stop
修改配置
vi /data/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
添加以下:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(SID_NAME=orcl)
(ORACLE_HOME=/data/app/oracle/product/11.2.0/db_1)
(PRESPAWN_MAX=20)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
)
)
)
重启监听服务:
lsnrctl start (oracle用户下)
17.安装完成,测试是否安装成功
连接数据库(oracle用户下)
sqlplus / as sysdba
启动oracle:
sql>startup