在CentOS7下安装Oracle 12C

1、虚拟机配置(网络、关闭防火墙等)
2、安装oracle依赖包:
yum -y install binutils compat-libstdc++ compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel make sysstat unixODBC-devel binutils-* compat-libstdc++* elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc++* make* sysstat* unixODBC* wget unzip
3、创建必需组和用户:
groupadd  oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper -m oracle
4、设置oracle用户密码:
passwd oracle输入密码并确定
5、创建必需目录:
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oraInventory
mkdir /home/oracle/app/fast_recovery_area
mkdir /home/oracle/app/oracle/product
6、将/home/oracle所有权赋给oracle用户:
chown -R oracle:oinstall  /home/oracle
7、创建/etc/oraInst.loc文件,写入以下内容:
inventory_loc=/home/oracle/app/oraInventory
inst_group=oinstall
8、修改文件限制:
vim /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
9、修改pam设置:
vim /etc/pam.d/login,追加内容:
 #session required /lib/security/pam_limits.so(绝对路径配置)
 session required pam_limits.so
 10、修改安全设置:
 vim /etc/security/limits.conf,追加:
 oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
11、切换到oracle用户(su - oracle)(为了使以上配置生效,建议重启一次)
12、到官网下载oracle 12c安装包并上传到虚拟机:
虚拟机目录:/home/oracle/app/oracle/
oracle下载地址:https://www.oracle.com/database/technologies/oracle-database-software-downloads.html
 13、分别解压oracle的安装压缩包
 unzip linuxamd64_12102_database_1of2.zip
 unzip linuxamd64_12102_database_2of2.zip
 14、vim /home/oracle/app/oracle/database/response/db_install.rsp,修改:
 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.1.0
 oracle.install.option=INSTALL_DB_SWONLY
 UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/home/oracle/app/oracle/product/12.1.0/dbhome_1
ORACLE_BASE=/home/oracle/app
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.BACKUPDBA_GROUP=dba
oracle.install.db.DGDBA_GROUP=dba
oracle.install.db.KMDBA_GROUP=dba
15、执行安装:
/home/oracle/app/oracle/database/runInstaller -ignoreSysPrereqs -waitforcompletion -silent -responseFile /home/oracle/app/oracle/database/response/db_install.rsp SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true
16、安装成功后配置监听:
vim ~/.bashrc,追加:
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/12.1.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
17、静默安装监听器:
netca -silent -responsefile /home/oracle/app/oracle/database/response/netca.rsp
18、确认监听状态:
lsnrctl status
19、创建数据库:
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName orcl.example.com -sid orcl -createAsContainerDatabase true -numberOfPdbs 1 -pdbName pdb -pdbadminUsername pdba  -pdbadminPassword oracle -SysPassword 123456 -SystemPassword 123456 -emConfiguration NONE -recoveryAreaDestination $ORACLE_BASE/recovery_area -characterSet "AL32UTF8" -nationalCharacterSet "UTF8"  -redoLogFileSize 100
20、登录:
sqlplus / as sysdba

你可能感兴趣的:(oracle,CentOS)