下载和解压的步骤略:
授权解压后的所有文件:
cd database/ chmod -R 775 *
禁用防火墙和SELINUX:
service iptables stop #临时停止 chkconfig iptables off #永久关闭防火墙 service network status #检查防火墙状态 vi /etc/selinux/config 修改SELINUX=disabled
安装依赖包(重要):
yum install gcc make binutils gcc-c++ compat-libstdc++-33elfutils-libelf-devel elfutils-libelf-devel-static ksh libaio libaio-develnumactl-devel sysstat unixODBC unixODBC-devel pcre-devel –y
添加oracle用户和组:
groupadd oinstall groupadd dba useradd -g oinstall -G dba oracle passwd oracle
配置系统内核参数:
vi /etc/sysctl.conf fs.aio-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
使配置生效:
sysctl -p
修改用户限制:
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
修改 /etc/pam.d/login 文件:
vi /etc/pam.d/login #追加内容 session required /lib64/security/pam_limits.so session required pam_limits.so
配置环境变量:
vi /etc/profile ## 在末尾追加 export ORACLE_BASE=/data/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0 export ORACLE_SID=orcl export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
创建安装目录:
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
复制response下的文件到用户目录:
编辑db_install_rsp文件:
oracle.install.option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=192.168.1.110 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/oracle/inventory SELECTED_LANGUAGES=en 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=orcl11g oracle.install.db.config.starterdb.SID=orcl oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryLimit=1024 oracle.install.db.config.starterdb.password.ALL=password_123 oracle.install.db.config.starterdb.password.SYS=password_123 oracle.install.db.config.starterdb.password.SYSTEM=password_123 oracle.install.db.config.starterdb.password.SYSMAN=password_123 oracle.install.db.config.starterdb.password.DBSNMP=password_123 oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/data/oracle/oradata oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/data/oracle/fast_recovery_area SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true
执行静默安装同时创建数据库:
./runInstaller -silent -ignorePrereq -responseFile ~/db_install.rsp
这里出了一点问题,记得切换到oracle用户执行(别忘了把安装文件一起拷贝过去):
cp *.rsp /home/oracle cd oracle_pkg/ cp -vrf database/ /home/oracle su oracle cd ~/database/
./runInstaller -silent -ignorePrereq -responseFile ~/db_install.rsp
开始安装:
新开一个终端,查看当前安装进度日志:
tail -f /data/oracle/inventory/logs/installActions2017-04-30_09-36-42AM.log
安装完成后显示:
The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root scripts to run /data/oracle/inventory/orainstRoot.sh /data/oracle/product/11.2.0/db_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts 4. Return to this window and hit "Enter" key to continue Successfully Setup Software.
按照提示,新开一个终端,使用root用户执行:
/data/oracle/inventory/orainstRoot.sh /data/oracle/product/11.2.0/db_1/root.sh
数据库软件安装完成,并且安装了一个实例名为orcl的数据库。
静默配置监听:
[oracle@centos ~]$ netca /silent /responsFile ~/netca.rsp
启动监听
[oracle@centos ~]$ lsnrctl start
使用sqlplus测试:
[oracle@centos ~]$ sqlplus / as sysdba