ping www.baidu.com

Centos7安装oracle12c_libstdc++

一下步

将主机命名为c120
hostnamectl set-hostname c120

Centos7安装oracle12c_数据库_02

vi /etc/hosts
#添加如下内容
192.168.3.1 c120 #IP +主机名
oracle12c安装前的环境配置
#在最后添加如下内容
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
sysctl -p

Centos7安装oracle12c_数据库_03

#在最后添加如下内容
vi /etc/security/limits.conf

oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
安装依赖包,耐心等它跑完就行
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y

Centos7安装oracle12c_bc_04

#创建安装oracle12c需要的用户组和用户,oinstall组用于安装数据库,dba组用于管理数据库,-g表示这个用户的主组,-G标识这个用户的其它组
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper

useradd -u 54321 -g oinstall -G dba,oper oracle

passwd oracle

Centos7安装oracle12c_oracle_05

#设置SELINUX
vi /etc/selinux/config

#该更内容 SELINUX=permissive

setenforce Permissive
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
#创建Oracle安装目录
mkdir -p /usr/local/products/oracle12c
chown -R oracle:oinstall /usr/local
chmod -R 775 /usr/local/

Centos7安装oracle12c_oracle_06

#切换到oracle用户
su - oracle
#在最后添加如下内容
vi .bash_profile
export TMP=/tmp
export TMPDIR=$TMP

export ORACLE_HOSTNAME=solang
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/usr/local/products
export ORACLE_HOME=$ORACLE_BASE/oracle12c
export ORACLE_SID=cdb1

export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
#立即生效
source .bash_profile
echo $ORACLE_HOME

yum - y install unzip

Centos7安装oracle12c_oracle_07

下载地址https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

将oracle12c压缩包上传到  /home/oracle 目录下

yum -y install unzip
unzip linuxx64_12201_database.zip

Centos7安装oracle12c_libstdc++_08

Centos7安装oracle12c_oracle_09

cd database/response/

vi db_install.rsp #编辑的时候可能没有权限解决办法如 su 切换到root 对文件授权chmod -R 775 /home/oracle/database/response/db_install.rsp #chmod -R 775 绝对路径/文件

#编辑db_install.rsp,对应修改
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oraInventory
ORACLE_HOME=/usr/local/products/oracle12c
ORACLE_BASE=/usr/local/products
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba

Centos7安装oracle12c_oracle_10

Centos7安装oracle12c_数据库_11

# su - oracle 在oracle用户下操作
cd ~/database

#静默安装oracle12c
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforesponseFile /home/oracle/database/response/db_install.rsp
或者
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \ -showProgress -silent -responseFile /home/oracle/database/response/db_install.rsp

Centos7安装oracle12c_oracle_12

Centos7安装oracle12c_oracle_13

#切换到root用户
su
/usr/local/oraInventory/orainstRoot.sh
/usr/local/products/oracle12c/root.sh

Centos7安装oracle12c_数据库_14

Centos7安装oracle12c_bc_15

#oracle数据库软件安装成功
su - oracle
sqlplus / as sysdba

Centos7安装oracle12c_数据库_16

#数据库创建,使用数据库配置助手DBCA静默模式下创建数据库,看不懂则看下图
dbca -silent -createDatabase \
-templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \
-gdbname cdb1 -sid cdb1 -responseFile /home/oracle/database/response/dbca.rsp \
-characterSet AL32UTF8 \
-sysPassword OraPasswd1 \
-systemPassword OraPasswd1 \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName pdb1 \
-pdbAdminPassword OraPasswd1 \
-automaticMemoryManagement false \
-ignorePreReqs

Centos7安装oracle12c_libstdc++_17

sqlplus / as sysdba
select status from v$instance; #如图数据库创建成功

Centos7安装oracle12c_bc_18

#配置监听,使用默认的netca.rsp文件
netca -silent -responseFile /home/oracle/database/response/netca.rsp

Centos7安装oracle12c_libstdc++_19

修改为本机的主机名和oracle对应端口1521
su 切换到root授权listener.ora
chmod -R 775 /usr/local/products/oracle12c/network/admin/listener.ora
su - oracle
vi /usr/local/products/oracle12c/network/admin/listener.ora
lsnrctl status

#启动和关闭监听
lsnrctl start
lsnrctl stop

Centos7安装oracle12c_bc_20

Centos7安装oracle12c_oracle_21

Centos7安装oracle12c_bc_22

#将N修改为Y
vi /etc/oratab
vi /etc/init.d/dbora
#修改如下

#! /bin/sh
# description: Oracle auto start-stop script.
#
# Set ORACLE_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME.

ORACLE_HOME=/usr/local/products/oracle12c
ORA_OWNER=oracle

case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
# Remove "&" if you don't want startup as a background process.
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" &
touch /var/lock/subsys/dbora
;;

'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME" &
rm -f /var/lock/subsys/dbora
;;
esac
export ORA_OWNER=oracle
echo $ORA_OWNER #ORA_OWNER设置为oracle用户

Centos7安装oracle12c_oracle_23

#修改dbora组和文件权限
chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbor
#创建符号链接
ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora

#Oracle数据库开机自动启动,在oracle用户中单独启动和关闭数据库

$ORACLE_HOME/bin/dbstart $ORACLE_HOME
$ORACLE_HOME/bin/dbshut $ORACLE_HOME

Centos7安装oracle12c_数据库_24

Centos7安装oracle12c_libstdc++_25