环境准备
centos版本:centos 7
oracle版本:oracle 12c
1、查看防火墙状态:
[code]systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall开机启动
2、关闭selinux
[code]vi /etc/selinux/configSELINUX=disabled
3、安装依赖
离线安装
无网环境可下载以下安装包,进行安装:
[code]## binutilsrpm -i --force --nodeps binutils-2.20.51.0.2-5.48.el6.x86_64.rpm## compat-libcap1rpm -i --force --nodeps compat-libcap1-1.10-1.x86_64.rpm## compat-libstdc++-33rpm -i --force --nodeps compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm## compat-libstdc++-33.i686rpm -i --force --nodeps glibc-2.12-1.212.el6.i686.rpmrpm -i --force --nodeps glibc-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps glibc-common-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps glibc-devel-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps glibc-headers-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps libgcc-4.4.7-23.el6.i686.rpmrpm -i --force --nodeps nscd-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps nss-softokn-freebl-3.14.3-23.3.el6_8.i686.rpmrpm -i --force --nodeps nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64.rpmrpm -i --force --nodeps compat-libstdc++-33-3.2.3-69.el6.i686.rpm## gccrpm -i --force --nodeps cloog-ppl-0.15.7-1.2.el6.x86_64.rpmrpm -i --force --nodeps cpp-4.4.7-23.el6.x86_64.rpm# rpm -i --force --nodeps glibc-devel-2.12-1.212.el6.x86_64.rpm# rpm -i --force --nodeps libgcc-4.4.7-23.el6.i686.rpmrpm -i --force --nodeps libgomp-4.4.7-23.el6.x86_64.rpmrpm -i --force --nodeps gcc-4.4.7-23.el6.x86_64.rpm## gcc-c++rpm -i --force --nodeps libstdc++-4.4.7-23.el6.x86_64.rpmrpm -i --force --nodeps libstdc++-devel-4.4.7-23.el6.x86_64.rpmrpm -i --force --nodeps gcc-c++-4.4.7-23.el6.x86_64.rpm## glibcrpm -i --force --nodeps tzdata-2018e-3.el6.noarch.rpm# rpm -i --force --nodeps glibc-common-2.12-1.212.el6.x86_64.rpm# rpm -i --force --nodeps glibc-2.12-1.212.el6.x86_64.rpm## glibc.i686# rpm -i --force --nodeps glibc-common-2.12-1.212.el6.x86_64.rpm# rpm -i --force --nodeps glibc-2.12-1.212.el6.i686.rpm## glibc-devel# rpm -i --force --nodeps glibc-headers-2.12-1.212.el6.x86_64.rpm# rpm -i --force --nodeps glibc-devel-2.12-1.212.el6.x86_64.rpm## glibc-devel.i686# rpm -i --force --nodeps glibc-headers-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps glibc-devel-2.12-1.212.el6.i686.rpm## kshrpm -i --force --nodeps ksh-20120801-37.el6_9.x86_64.rpm## libgcc.i686# rpm -i --force --nodeps libgcc-4.4.7-23.el6.i686.rpm## libgccrpm -i --force --nodeps libgcc-4.4.7-23.el6.x86_64.rpm## libstdc++# rpm -i --force --nodeps glibc-2.12-1.212.el6.x86_64.rpm# rpm -i --force --nodeps libstdc++-4.4.7-23.el6.x86_64.rpm## libstdc++.i686# rpm -i --force --nodeps glibc-2.12-1.212.el6.x86_64.rpmrpm -i --force --nodeps libstdc++-4.4.7-23.el6.i686.rpm## libstdc++-devel# rpm -i --force --nodeps libstdc++-4.4.7-23.el6.x86_64.rpm# rpm -i --force --nodeps libstdc++-devel-4.4.7-23.el6.x86_64.rpm## libstdc++-devel.i686# rpm -i --force --nodeps libstdc++-4.4.7-23.el6.i686.rpmrpm -i --force --nodeps libstdc++-devel-4.4.7-23.el6.i686.rpm## libaiorpm -i --force --nodeps libaio-0.3.107-10.el6.x86_64.rpm## libaio.i686rpm -i --force --nodeps libaio-0.3.107-10.el6.i686.rpm## libaio-develrpm -i --force --nodeps libaio-devel-0.3.107-10.el6.x86_64.rpm## libaio-devel.i686rpm -i --force --nodeps libaio-devel-0.3.107-10.el6.i686.rpm## libXextrpm -i --force --nodeps libX11-1.6.4-3.el6.x86_64.rpmrpm -i --force --nodeps libX11-common-1.6.4-3.el6.noarch.rpmrpm -i --force --nodeps libXext-1.3.3-1.el6.x86_64.rpm## libXext.i686rpm -i --force --nodeps libXau-1.0.6-4.el6.i686.rpmrpm -i --force --nodeps libX11-1.6.4-3.el6.i686.rpmrpm -i --force --nodeps libxcb-1.12-4.el6.i686.rpmrpm -i --force --nodeps libXext-1.3.3-1.el6.i686.rpm## libX11# rpm -i --force --nodeps libX11-common-1.6.4-3.el6.noarch.rpm# rpm -i --force --nodeps libX11-1.6.4-3.el6.x86_64.rpm# libX11.i686# rpm -i --force --nodeps libX11-common-1.6.4-3.el6.noarch.rpm# rpm -i --force --nodeps libX11-1.6.4-3.el6.i686.rpm## libxcbrpm -i --force --nodeps libxcb-1.12-4.el6.x86_64.rpm## libxcb.i686# rpm -i --force --nodeps libxcb-1.12-4.el6.i686.rpm## libXirpm -i --force --nodeps libXi-1.7.8-1.el6.x86_64.rpm## libXi.i686# rpm -i --force --nodeps libX11-1.6.4-3.el6.i686.rpmrpm -i --force --nodeps libXi-1.7.8-1.el6.i686.rpm## makerpm -i --force --nodeps make-3.81-23.el6.x86_64.rpm## sysstatrpm -i --force --nodeps sysstat-9.0.4-33.el6_9.1.x86_64.rpm
有网络安装
[code]yum -y install binutils compat-libcap1 compat-libstdc++-33 \\compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 \\glibc-devel glibc-devel.i686 ksh libgcc libgcc.i686 \\libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 \\libaio libaio.i686 libaio-devel libaio-devel.i686 libXext \\libXext.i686 libX11 libX11.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat
4、创建运行oracle数据库的用户组和系统用户
[code]groupadd oinstallgroupadd dbauseradd -g oinstall -G dba -m oraclepasswd oracle>>oracle>>oracle //输入两次密码,设置生效
5、修改内核参数,vi /etc/sysctl.conf,添加:
[code]vi /etc/sysctl.conffs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 4098955264kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576sysctl -p //vi关闭后执行,使设置生效
6、修改用户限制
[code]vi /etc/security/limits.conforacle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240oracle hard stack 10240vi /etc/pam.d/loginsession required /lib64/security/pam_limits.sosession required pam_limits.so
7、修改环境变量
[code]vi /etc/profileif [ \"$USER\" = \"oracle\" ]; thenif [ \"$SHELL\" = \"/bin/ksh\" ]; thenulimit -p 16384ulimit -n 65536aelseulimit -u 16384 -n 65536fifisource /etc/profile
8、创建安装及数据目录
[code]mkdir -p /usr/local/oraInventorymkdir -p /usr/local/oracle/product/12.1.0/db_1chown -R oracle:oinstall /usr/local/oraclechown -R oracle:oinstall /usr/local/oraInventorychmod -R 775 /usr/local/oracle
9、切换用户,修改配置文件
[code]su - oraclevi ~/.bash_profileexport ORACLE_BASE=/usr/local/oracleexport ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1export ORACLE_SID=orclexport PATH=$ORACLE_HOME/bin:$PATHsource ~/.bash_profle
10、解压安装文件,并修改参数配置
[code]unzip linuxx64_12201_database.zipcp -R /usr/local/oracle/database/response /usr/local/oracle/cd /usr/local/oracle/response/vi db_install.rsporacle.install.option=INSTALL_DB_SWONLYUNIX_GROUP_NAME=oinstallINVENTORY_LOCATION=/usr/local/oraInventoryORACLE_HOME=/usr/local/oracle/product/12.1.0/db_1ORACLE_BASE=/usr/local/oracleoracle.install.db.InstallEdition=EEoracle.install.db.OSDBA_GROUP=dbaoracle.install.db.OSOPER_GROUP=oinstalloracle.install.db.OSBACKUPDBA_GROUP=oinstalloracle.install.db.OSDGDBA_GROUP=oinstalloracle.install.db.OSKMDBA_GROUP=oinstalloracle.install.db.OSRACDBA_GROUP=oinstalloracle.install.db.config.starterdb.password.SYS=oracleoracle.install.db.config.starterdb.password.SYSTEM=oracleDECLINE_SECURITY_UPDATES=trueoracle.install.db.config.starterdb.type=GENERAL_PURPOSEoracle.install.db.config.starterdb.globalDBName=orcloracle.install.db.config.starterdb.SID=orcl
11、安装数据库
[code]cd /usr/local/oracle/database./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile /usr/local/oracle/response/db_install.rsp
12、切换root用户执行以下脚本
[code]cd /usr/local/oraInventory./orainstRoot.shcd /usr/local/oracle/product/12.1.0/db_1./root.sh
13、启动监听
[code]su - oraclenetca /silent /responsefile /usr/local/oracle/response/netca.rspll $ORACLE_HOME/network/admin/*.oralsnrctl start
14、创建静默库
[code]vi /usr/local/oracle/response/dbca.rspgdbName=orclsid=orcltemplateName=/usr/local/oracle/product/12.1.0/db_1/assistants/dbca/templates/General_Purpose.dbccharacterSet=AL32UTF8sysPassword=oraclepdbAdminPassword=oraclesystemPassword=oraclecreateAsContainerDatabase=truetotalMemory=2054automaticMemoryManagement=falsedbca -silent -createDatabase -responseFile /usr/local/oracle/response/dbca.rsp -ignorePreReqs
15、查看进程端口
[code]ps -ef | grep oracle | grep -v grep |wc -llsnrctl status
16、oracle安装完成后检查
[code]sqlplus / as sysdba创建用户及密码:create user C##test identified by passwd;修改用户及密码:alter user C##test identified by password;修改用户权限:alter user C##test account unlock;grant create session to C##test;grant dba to C##test;GRANT CREATE USER,DROP USER,ALTER USER,CREATE ANY VIEW,DROP ANYVIEW,EXP_FULL_DATABASE,IMP_FULL_DATABASE, DBA,CONNECT,RESOURCE,CREATE SESSION TO C##test;connect C##test/password;
17、oracle12_C重启服务
[code]su - oraclesqlplus / as sysdbastartup;exit;lsnrctl start //如果无法成功启动监听,则强制注册服务:sqlplus / as sysdbaalter system register;exit;lsnrctl status //成功则服务已启动。