1、yum install vim -y
2、yum install unzip -y
3、yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
安装依赖包
4、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
检查有没有31个
5、添加安装用户和组
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 601 asmadmin
groupadd -g 602 asmdba
groupadd -g 603 asmoper
useradd -u 1101 -g oinstall -G dba oracle
id oracle
6、添加内核参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 48719476736
kernel.shmmni = 4096
kernel.sem = 250 32000 200 200
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
net.core.rmem_max = 4194304
7、/sbin/sysctl -p
8、修改用户的限制文件
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
9、修改vim /etc/pam.d/login文件
vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
10、关闭selinux
vim /etc/selinux/config
设置SELINUX=disabled
11、关闭防火墙
service iptables stop
systemctl stop firewalld
systemctl disable firewalld
12、创建目录和设置文件权限
mkdir -p /data/oracle/product/11.2.0
mkdir /data/oracle/oradata
mkdir /data/oracle/inventory
mkdir /data/oracle/fast_recovery_area
chown -R oracle:oinstall /data/oracle
chmod -R 775 /data/oracle
13、解压文件
mkdir -p /data/oracle/oracledir
cd /data/oracle/oracledir
unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip
14、su oracle。 vim .bash_profile
ORACLE_BASE=/data/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
使该文件生效
source .bash_profile
15、
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
16、编辑静默安装响应文件
cd /home/oracle
cp -R /data/oracle/oraclesetup/database/response/ .
cd response/
vim db_install.rsp
修改如下
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=CentOS
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/oracle/product/11.2.0
ORACLE_BASE=/data/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=zkz.orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.password.ALL=123456
DECLINE_SECURITY_UPDATES=true
17、安装
cd /data/oracle/oracledir/database/
./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
查看日志
18、配置监听
netca /silent /responseFile /home/oracle/response/netca.rsp
运行上面一句话后在 /data/oracle/product/11.2.0/netword/admin 下生成listener.ora文件
修改listener文件
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = orcl)
(ORACLE_HOME = /data/oracle/product/11.2.0)
(global_dbname = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.50)(PORT = 1521))
)
)
)
18、创建实例
vi /home/oracle/response/dbca.rsp
GDBNAME = "orcl.zkz"
SID = "orcl"
SYSPASSWORD = "123456"
SYSTEMPASSWORD = "123456"
CHARACTERSET = "ZHS16GBK"
NATIONALCHARACTERSET= "AL16UTF16"
dbca -silent -responseFile /home/oracle/response/dbca.rsp
19、启动监听
lsnrctl stop
lsnrctl start
sqlplus /nolog
conn /as sysdba
connect sys/sys as sysdba
shutdown normal
startup mount
alter database open;