1.前期准备
- 关闭selinux
- 将ip加入hosts文件
2.安装依赖
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel
yum -y install elfutils-libelf-devel ksh libaio libaio-devel elfutils-libelf-devel-static
yum -y install numactl-devel sysstat unixODBC unixODBC-devel pcre-devel
pdksh yum不到,手动安装
wget -O /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm http://vault.centos.org/5.11/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
rpm -ivh /tmp/pdksh-5.2.14-37.el5_8.1.x86_64.rpm
#这个能解决什么问题来着,忘了,回头再补上,先装了再说
yum install -y xorg-x11-utils xorg-x11-apps
3.添加用户和组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "oracle" | passwd --stdin oracle
4.修改内核
cat >> /etc/sysctl.conf <<EOF
io-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
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
EOF
sysctl -p
5.修改用户的限制文件
/etc/security/limits.conf
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
6.修改/etc/pam.d/login文件
cat >> /etc/pam.d/login <<EOF
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF
7.修改/etc/profile文件
cat >> /etc/profile <<EOF
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
EOF
8.创建安装目录
ORACLE_PATH=/software
mkdir -p $ORACLE_PATH/oracle/product/11.2.0
mkdir $ORACLE_PATH/oracle/oradata
mkdir $ORACLE_PATH/oracle/etc
mkdir $ORACLE_PATH/oracle/inventory
mkdir $ORACLE_PATH/oracle/fast_recovery_area
chown -R oracle:oinstall $ORACLE_PATH/oracle
chmod -R 775 $ORACLE_PATH/oracle
9.unzip压缩包
unzip -d /software /software/linux.x64_11gR2_database_1of2.zip
unzip -d /software /software/linux.x64_11gR2_database_2of2.zip
cp -r /software/database/response /software/oracle/etc
10.配置oracle用户环境变量
su - oracle
cat >> ~/.bash_profile<<EOF
ORACLE_BASE=/software/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
EOF
11.编辑db_install.rsp
ORACLE_PATH=/software
sed -i "s/oracle.install.option=/oracle.install.option=INSTALL_DB_SWONLY/" /software/oracle/etc/response/db_install.rsp
sed -i "s/ORACLE_HOSTNAME=/ORACLE_HOSTNAME=oracle/" /software/oracle/etc/response/db_install.rsp
sed -i "s/UNIX_GROUP_NAME=/UNIX_GROUP_NAME=oinstall/" /software/oracle/etc/response/db_install.rsp
sed -i "s/INVENTORY\_LOCATION=/INVENTORY\_LOCATION=\/software\/oracle\/inventory/" /software/oracle/etc/response/db_install.rsp
sed -i "s/SELECTED\_LANGUAGES=/SELECTED\_LANGUAGES=en,zh_CN/" /software/oracle/etc/response/db_install.rsp
sed -i "s/ORACLE\_HOME=/ORACLE\_HOME=\/software\/oracle\/product\/11.2.0/" /software/oracle/etc/response/db_install.rsp
sed -i "s/ORACLE\_BASE=/ORACLE\_BASE=\/software\/oracle/" /software/oracle/etc/response/db_install.rsp
sed -i "s/oracle.install.db.InstallEdition=/oracle.install.db.InstallEdition=EE/" /software/oracle/etc/response/db_install.rsp
sed -i "s/oracle.install.db.DBA_GROUP=/oracle.install.db.DBA_GROUP=dba/" /software/oracle/etc/response/db_install.rsp
sed -i "s/oracle.install.db.OPER_GROUP=/oracle.install.db.OPER_GROUP=dba/" /software/oracle/etc/response/db_install.rsp
sed -i "s/DECLINE_SECURITY_UPDATES=/DECLINE_SECURITY_UPDATES=true/" /software/oracle/etc/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/software/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/software/oracle/product/11.2.0
ORACLE_BASE=/software/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
12.静默安装
/software/database/runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /software/oracle/etc/response/db_install.rsp
13.启动监听
export DISPLAY=localhost:0.0
netca -silent -responseFile /software/database/response/netca.rsp
14.配置dbca.rsp
su - root
vim /software/database/response/dbca.rsp
GDBNAME = "orcl" #78,700
SID = "orcl" #149
SYSPASSWORD = "oracle" #190
SYSTEMPASSWORD = "oracle" #200
SYSMANPASSWORD = "oracle" #231
DBSNMPPASSWORD = "oracle" #241
DATAFILEDESTINATION =/software/oracle/oradata #347
RECOVERYAREADESTINATION=/software/oracle/fast_recovery_area #367
CHARACTERSET = "ZHS16GBK" #415
TOTALMEMORY = "1638" #540
sed -i '78d' /software/database/response/dbca.rsp
sed -i '77a GDBNAME = "orcl"' /software/database/response/dbca.rsp
sed -i '149d' /software/database/response/dbca.rsp
sed -i '148a SID = "orcl"' /software/database/response/dbca.rsp
sed -i '190d' /software/database/response/dbca.rsp
sed -i '189a SYSPASSWORD = "oracle"' /software/database/response/dbca.rsp
sed -i '200d' /software/database/response/dbca.rsp
sed -i '199a SYSTEMPASSWORD = "oracle"' /software/database/response/dbca.rsp
sed -i '231d' /software/database/response/dbca.rsp
sed -i '230a SYSMANPASSWORD = "oracle"' /software/database/response/dbca.rsp
sed -i '241d' /software/database/response/dbca.rsp
sed -i '240a DBSNMPPASSWORD = "oracle"' /software/database/response/dbca.rsp
sed -i '347d' /software/database/response/dbca.rsp
sed -i '346a DATAFILEDESTINATION =\/software\/oracle\/oradata' /software/database/response/dbca.rsp
sed -i '367d' /software/database/response/dbca.rsp
sed -i '366a RECOVERYAREADESTINATION=\/software\/oracle\/fast_recovery_area' /software/database/response/dbca.rsp
sed -i '415d' /software/database/response/dbca.rsp
sed -i '414a CHARACTERSET = "ZHS16GBK"' /software/database/response/dbca.rsp
sed -i '540d' /software/database/response/dbca.rsp
sed -i '539a TOTALMEMORY = "1638"' /software/database/response/dbca.rsp
sed -i '700d' /software/database/response/dbca.rsp
sed -i '699a GDBNAME = "orcl"' /software/database/response/dbca.rsp
15.静默配置
su - oracle
dbca -silent -responseFile /software/database/response/dbca.rsp
16.启动
ps -ef | grep ora_ | grep -v grep
lsnrctl status
lsnrctl start
sqlplus / as sysdba
SQL> startup