centos版本:centos 6.8
oracle版本:oracle 12c
1、查看防火墙状态:
service iptable status
service iptables stop
2、关闭selinux
vi /etc/selinux/config
SELINUX=disabled
3、安装依赖
想要依赖包的可以留言联系我,也可自行下载相关依赖。
无网环境可下载以下安装包,进行安装:
## binutils
rpm -i --force --nodeps binutils-2.20.51.0.2-5.48.el6.x86_64.rpm
## compat-libcap1
rpm -i --force --nodeps compat-libcap1-1.10-1.x86_64.rpm
## compat-libstdc++-33
rpm -i --force --nodeps compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm
## compat-libstdc++-33.i686
rpm -i --force --nodeps glibc-2.12-1.212.el6.i686.rpm
rpm -i --force --nodeps glibc-2.12-1.212.el6.x86_64.rpm
rpm -i --force --nodeps glibc-common-2.12-1.212.el6.x86_64.rpm
rpm -i --force --nodeps glibc-devel-2.12-1.212.el6.x86_64.rpm
rpm -i --force --nodeps glibc-headers-2.12-1.212.el6.x86_64.rpm
rpm -i --force --nodeps libgcc-4.4.7-23.el6.i686.rpm
rpm -i --force --nodeps nscd-2.12-1.212.el6.x86_64.rpm
rpm -i --force --nodeps nss-softokn-freebl-3.14.3-23.3.el6_8.i686.rpm
rpm -i --force --nodeps nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64.rpm
rpm -i --force --nodeps compat-libstdc++-33-3.2.3-69.el6.i686.rpm
## gcc
rpm -i --force --nodeps cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -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.rpm
rpm -i --force --nodeps libgomp-4.4.7-23.el6.x86_64.rpm
rpm -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.rpm
rpm -i --force --nodeps libstdc++-devel-4.4.7-23.el6.x86_64.rpm
rpm -i --force --nodeps gcc-c++-4.4.7-23.el6.x86_64.rpm
## glibc
rpm -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.rpm
rpm -i --force --nodeps glibc-devel-2.12-1.212.el6.i686.rpm
## ksh
rpm -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
## libgcc
rpm -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.rpm
rpm -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.rpm
rpm -i --force --nodeps libstdc++-devel-4.4.7-23.el6.i686.rpm
## libaio
rpm -i --force --nodeps libaio-0.3.107-10.el6.x86_64.rpm
## libaio.i686
rpm -i --force --nodeps libaio-0.3.107-10.el6.i686.rpm
## libaio-devel
rpm -i --force --nodeps libaio-devel-0.3.107-10.el6.x86_64.rpm
## libaio-devel.i686
rpm -i --force --nodeps libaio-devel-0.3.107-10.el6.i686.rpm
## libXext
rpm -i --force --nodeps libX11-1.6.4-3.el6.x86_64.rpm
rpm -i --force --nodeps libX11-common-1.6.4-3.el6.noarch.rpm
rpm -i --force --nodeps libXext-1.3.3-1.el6.x86_64.rpm
## libXext.i686
rpm -i --force --nodeps libXau-1.0.6-4.el6.i686.rpm
rpm -i --force --nodeps libX11-1.6.4-3.el6.i686.rpm
rpm -i --force --nodeps libxcb-1.12-4.el6.i686.rpm
rpm -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
## libxcb
rpm -i --force --nodeps libxcb-1.12-4.el6.x86_64.rpm
## libxcb.i686
# rpm -i --force --nodeps libxcb-1.12-4.el6.i686.rpm
## libXi
rpm -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.rpm
rpm -i --force --nodeps libXi-1.7.8-1.el6.i686.rpm
## make
rpm -i --force --nodeps make-3.81-23.el6.x86_64.rpm
## sysstat
rpm -i --force --nodeps sysstat-9.0.4-33.el6_9.1.x86_64.rpm
有网环境:
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数据库的用户组和系统用户
groupadd oinstall
groupadd dba
useradd -g oinstall -g dba -m oracle
passwd oracle
>>123456
>>123456 //输入两次密码,设置生效
5、修改内核参数,vi /etc/sysctl.conf,添加:
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4098955264
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
6、修改用户限制
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 /lib64/security/pam_limits.so
session required pam_limits.so
7、修改环境变量
vi /etc/profile
if [ "$USER" = "oracle" ]; then
if [ "$SHELL" = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536a
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
8、创建安装及数据目录
mkdir -p /usr/local/oraInventory
mkdir -p /usr/local/oracle/product/12.1.0/db_1
chown -R oracle:oinstall /usr/local/oracle
chown -R oracle:oinstall /usr/local/oraInventory
chmod -R 775 /usr/local/oracle
9、切换用户,修改配置文件
su - oracle
vi ~/.bash_profle
export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
source ~/.bash_profle
10、解压安装文件,并修改参数配置
unzip linuxx64_12201_database.zip
cp -R /usr/local/oracle/database/response /usr/local/oracle/
cd /usr/local/oracle/response/
vi db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oraInventory
ORACLE_HOME=/usr/local/oracle/product/12.1.0/db_1
ORACLE_BASE=/usr/local/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oinstall
oracle.install.db.OSBACKUPDBA_GROUP=oinstall
oracle.install.db.OSDGDBA_GROUP=oinstall
oracle.install.db.OSKMDBA_GROUP=oinstall
oracle.install.db.OSRACDBA_GROUP=oinstall
oracle.install.db.config.starterdb.password.SYS=JLwg!2016
oracle.install.db.config.starterdb.password.SYSTEM=JLwg!2016
DECLINE_SECURITY_UPDATES=true
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
11、安装数据库
cd /usr/local/oracle/database
./runInstaller -silent -responseFile /usr/local/oracle/response/db_install.rsp
12、切换root用户执行以下脚本
./usr/local/oraInventory/orainstRoot.sh
./usr/local/oracle/product/11.2.0/db_1/root.sh
13、启动监听
su - oracle
netca /silent /responsefile /usr/local/oracle/response/netca.rsp
ll $ORACLE_HOME/network/admin/*.ora
lsnrctl start
14、创建静默库
vi /usr/local/oracle/dbca.rsp
gdbName=orcl
sid=orcl
templateName=/usr/local/oracle/product/11.2.0/db_1/assistants/dbca/templates/General_Purpose.dbc
characterSet=AL32UTF8
sysPassword=1qazQAZ1
pdbAdminPassword=1qazQAZ1
systemPassword=1qazQAZ1
createAsContainerDatabase=true
TOTALMEMORY=2054
automaticMemoryManagement=false
dbca -silent -createDatabase -responseFile /usr/local/oracle/dbca.rsp -ignorePreReqs
15、查看进程端口
ps -ef | grep oracle | grep -v grep |wc -l
lsnrctl status
16、oracle启动
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重启服务
su - oracle
sqlplus / as sysdba
startup;
exit;
lsnrctl start 如果无法成功启动监听,则强制注册服务:
sqlplus / as sysdba
alter system register;
exit;
lsnrctl status 成功则服务已启动。