Oracle database oracle 12c 单节点 安装部署

oracle12c单节点部署

环境情况

linux环境:

#cat /etc/redhat-release

CentOS Linux release 7.9.2009 (Core)
oracle版本:
12.2.0.1
下载地址:Oracle12c linux-server下载器
oracle安装目录:
/oracledata/app/oracle/product/12.2.0/dbhome_1
主机名与实例名:
orcl
服务器地址:
172.17.36.23

安装步骤
1、修改主机名
#hostname orcl
#vi /etc/sysconfig/network
1
2
etc/sysconfig/network增加:

NETWORKING=yes
HOSTNAME=orcl
1
2
#vi /etc/hosts
1
etc/hosts 增加:

#本机地址 主机名
172.17.36.23 orcl

2、配置yum源
#cd /etc/yum.repos.d/
#wget http://mirrors.aliyun.com/repo/Centos-7.repo
#mv Centos-7.repo CentOS-Base.repo
#yum clean all
#yum makecache
#yum update

3、安装依赖

yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33* elfutilslibelf-devel gcc gcc-c++ glibc* glibc glibc-devel glibc-devel* ksh libgcc* libgcc libstdc++ libstdc++ libstdc++-devel libstdc++-devel* libaio libaio* libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC* unixODBC-devel unixODBCdevel* libXp

4、创建Oracle用户与组

#groupadd --gid 54321 oinstall
#groupadd --gid 54322 dba
#groupadd --gid 54323 oper
#useradd --uid 1101 --gid oinstall --groups dba,oper oracle
#passwd oracle

5、修改内核参数(可参考其他环境)

#cp /etc/sysctl.conf /etc/sysctl.conf.bkup
#vi /etc/sysctl.conf

etc/sysctl.conf:

# Controls IP packet forwarding
net.ipv4.ip_forward = 0
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048586
kernel.panic_on_oops = 1
# fluentd
net.core.somaxconn=1024
net.core.netdev_max_backlog = 5000
net.ipv4.tcp_wmem = 4096 12582912 16777216
net.ipv4.tcp_rmem = 4096 12582912 16777216
net.ipv4.tcp_max_syn_backlog = 8096
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_tw_reuse = 1

或使用此版本/etc/sysctl.conf:

# syssoftware setting
vm.swappiness = 10
vm.dirty_background_ratio = 3
vm.dirty_ratio = 40
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
# oracle setting
kernel.shmmax = 549755813888
kernel.shmall = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
kernel.panic_on_oops = 1
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
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2

6、设置oracle用户shell限制

#cp /etc/security/limits.conf /etc/security/limits.conf.bkup
#vi etc/security/limits.conf

etc/security/limits.conf:

oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 10240
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728

#cp /etc/pam.d/login /etc/pam.d/login.bkup
#vi /etc/pam.d/login

/etc/pam.d/login增加:

session required pam_limits.so

7、配置oracle用户环境变量

#vi /home/oracle/.bash_profile

/home/oracle/.bash_profile增加:

#add for oracle database 12c ----Start----
export ORACLE_BASE=/oracledata/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export ORACLE_SID=orcl
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export TEMP=/tmp
export TMPDIR=/tmp
umask 022
#add for oracle database 12c ----End----
#alias sqlplus='rlwrap sqlplus'
#alias rman='rlwrap rman'

生效环境变量配置

# source /home/oracle/.bash_profile

8、创建对应文件夹并修改权限

# mkdir -p $ORACLE_BASE
# mkdir -p $ORACLE_HOME
# mkdir /oracle/app/oraInventory
# chown -R oracle:oinstall /oracle/app/oracle/
# chown -R oracle:oinstall /oracle/app/oraInventory
# chmod -R 775 /oracle/app/
# su - oracle

oracle用户操作
$ unzip xxx(安装包压缩文件)xxx.zip -d /oracledata/app/oracle/product/12.2.0/dbhome_1

9、安装软件

# cd $ORACLE_HOME
# ./runInstaller

根据提示执行脚本

#/oracledata/app/oraInventory/orainstRoot.sh
#/oracledata/app/oracle/product/12.2.0/dbhome_1/root.sh

10、配置监听

$ netca

11、安装数据库

$ dbca

网络配置$ORACLE_HOME/network/admin

服务端配置文件:

/oracledata/app/oracle/product/12.2.0/dbhome_1/network/admin/samples/listener.ora

vi /oracledata/app/oracle/product/12.2.0/dbhome_1/network/admin/samples/listener.ora

listener.ora:

SID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracledata/oracle/app/oracle/product/12.2.0/dbhome_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = orclpdb)
(ORACLE_HOME = /oracledata/oracle/app/oracle/product/12.2.0/dbhome_1)
(SID_NAME = orclpdb)
)
)

查看当前监听状态

$ lsnrctl status

开启监听

$ lsnrctl start

或许还可以强制注册:

alter system register;

客户端配置文件:

$ORACLE_HOME/network/admin/tnsnames.ora

172.17.36.23orcl =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.36.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = orcl)
    )
  )
172.17.36.23orclpdb =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.17.36.23)(PORT = 1521))
    )
    (CONNECT_DATA =
  (SERVICE_NAME = orclpdb)
    )
  )

可能存在问题

调起图形化界面问题

export DISPLAY=192.168.9.99:0.0 #地址为本机地址

xshell 中选择链接-属性-隧道-选中转发X11连接到Xmanager

yum -y groupinstall "X Window System" "Fonts"

或直接选择用oracle账号登录

增加 swap 空间

dd if=/dev/centos/swap of=/var/swap bs=1M count=10240
mkswap /var/swap
swapon /var/swap
vi /etc/fstab

/etc/fstab增加:

/var/swap swap swap defaults 0 0

安装rlwarp优化sqlplus编辑器

下载地址:
rlwrap安装包(一键安装)

解压后执行

./installrlwrap.sh

安装完成后配置Oracle用户环境变量

vi /home/oracle/.bash_profile
#末尾增加
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'

版权声明:
作者:SE_Meng
链接:https://www.cnesa.cn/2407.html
来源:CNESA
文章版权归作者所有,未经允许请勿转载。

THE END
打赏
海报
Oracle database oracle 12c 单节点 安装部署
oracle12c单节点部署 环境情况 linux环境: #cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) oracle版本: 12.2.0.1 下载地址:Oracle12c lin……
<<上一篇
下一篇>>