阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

190次阅读
没有评论

共计 6016 个字符,预计需要花费 16 分钟才能阅读完成。

实验环境:Red Hat Enterprise Linux 7.2×64、Oracle 12c

系统要求:

1、Oracle 12c 对系统内存的最低要求为 1G,推荐 2G 或更大的内存

2、Oracle 对交换分区(Swap Space)的推荐设置如下:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

3、Oracle 12c 企业版需要 6.4G 大小的磁盘空间,标准版需要 6.1G 大小的磁盘空间。/tmp 需要至少 1G 的大小。

软件依赖:

yum -y install binutils compat-libcap1 gcc gcc-c++ glibcglibc.i686 glibc-devel glibc.i686 ksh libaio libaio.i686 libaio-devellibaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++-devellibstdc++-devel.i686 compat-libstdc++-33 compat-libstdc++-33.i686 libXilibXi.i686 libXtst libXtst.i686 make sysstat unixODBC unixODBC-devel xterm

系统配置:

关闭 selinux:

setenforce 0

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config

配置防火墙:

firewall-cmd –set-default-zone=trusted

修改 /etc/hosts,添加主机名解释:

vim /etc/hosts

192.168.100.104 www.oracle.com

配置内核参数:

MEMTOTAL=$(free -b | sed -n ‘2p’ | awk ‘{print $2}’)
SHMMAX=$(expr $MEMTOTAL \*4 / 5)
SHMMNI=4096
SHMALL=$(expr $MEMTOTAL /\( 4 \* 1024 \))
         
cp /etc/sysctl.conf /etc/sysctl.conf.bak
cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = $SHMMAX
kernel.shmall = $SHMALL
kernel.shmmni = $SHMMNI
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
kernel.panic_on_oops = 1
EOF
 
sysctl -p
 
# kernel.shmmax 大于共享内存区,小于物理内存
# kernel.shmall 物理内存 /4K

修改系统限制:
vim /etc/security/limits.conf
    # End offile 
    oracle soft  nproc  2047
    oracle hard  nproc  16384
    oracle soft  nofile  1024
    oracle hard  nofile  65536
    oracle soft  stack  10240
    oracle hard  stack  32768
     
vim /etc/security/limits.d/20-nproc.conf
    #第一行普通用户的进程限制注释掉,添加一行
    #*        soft    nproc    4096
    *      –      nproc  16384
     
 vim /etc/pam.d/login
    # near line 14:add 
    session    required    pam_limits.so

添加用户及相关目录:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
echo ‘oracle’ | passwd –stdin oracle
mkdir -p /oracle/app/oracle/product/12.1.0/db_1
mkdir -p /oracle/app/oraInventory
chown -R oracle:oinstall /oracle/
chmod -R 775 /oracle

解压安装包:
unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip

切换到 oracle 用户下,配置环境变量:
su – oracle
vim~/.bash_profile
    #export PATH
    ORACLE_BASE=/oracle/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 
    ORACLE_SID=orcl
    PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin 
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 
    export ORACLE_BASE ORACLE_HOME ORACLE_SID PATHLD_LIBRARY_PATH
 
    if [$USER = “oracle”]; then
        if [$SHELL =”/bin/ksh”]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
    fi
 
source ~/.bash_profile

安装 Oracle 软件:
# 远程调用图形界面安装 vnc
yum install tigervnc-server.x86_64 -y
su – oracle
vncserver
#winodws 客户端使用 vnc viewer 远程登录
 
# 进入安装包解压目录
cd database
./runInstaller

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

是否接受官方的补丁信息,需要的可以填写 oracle 的邮箱账号和密码:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

选择 save 保存一份配置资料文件,然后点击 install 安装:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

以 root 身份运行:

1

2

/Oracle/app/oraInventory/orainstRoot.sh

/oracle/app/oracle/product/12.1.0/db_1/root.sh

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

配置 oracle 监听:

1

2

#oracle 用户运行 netca 配置监听

[oracle@www ~]$ netca

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

最后这里点击 finish 完成监听的配置:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

实验环境:Red Hat Enterprise Linux 7.2×64、Oracle 12c

系统要求:

1、Oracle 12c 对系统内存的最低要求为 1G,推荐 2G 或更大的内存

2、Oracle 对交换分区(Swap Space)的推荐设置如下:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

3、Oracle 12c 企业版需要 6.4G 大小的磁盘空间,标准版需要 6.1G 大小的磁盘空间。/tmp 需要至少 1G 的大小。

软件依赖:

yum -y install binutils compat-libcap1 gcc gcc-c++ glibcglibc.i686 glibc-devel glibc.i686 ksh libaio libaio.i686 libaio-devellibaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++-devellibstdc++-devel.i686 compat-libstdc++-33 compat-libstdc++-33.i686 libXilibXi.i686 libXtst libXtst.i686 make sysstat unixODBC unixODBC-devel xterm

系统配置:

关闭 selinux:

setenforce 0

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config

配置防火墙:

firewall-cmd –set-default-zone=trusted

修改 /etc/hosts,添加主机名解释:

vim /etc/hosts

192.168.100.104 www.oracle.com

配置内核参数:

MEMTOTAL=$(free -b | sed -n ‘2p’ | awk ‘{print $2}’)
SHMMAX=$(expr $MEMTOTAL \*4 / 5)
SHMMNI=4096
SHMALL=$(expr $MEMTOTAL /\( 4 \* 1024 \))
         
cp /etc/sysctl.conf /etc/sysctl.conf.bak
cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = $SHMMAX
kernel.shmall = $SHMALL
kernel.shmmni = $SHMMNI
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
kernel.panic_on_oops = 1
EOF
 
sysctl -p
 
# kernel.shmmax 大于共享内存区,小于物理内存
# kernel.shmall 物理内存 /4K

修改系统限制:
vim /etc/security/limits.conf
    # End offile 
    oracle soft  nproc  2047
    oracle hard  nproc  16384
    oracle soft  nofile  1024
    oracle hard  nofile  65536
    oracle soft  stack  10240
    oracle hard  stack  32768
     
vim /etc/security/limits.d/20-nproc.conf
    #第一行普通用户的进程限制注释掉,添加一行
    #*        soft    nproc    4096
    *      –      nproc  16384
     
 vim /etc/pam.d/login
    # near line 14:add 
    session    required    pam_limits.so

添加用户及相关目录:
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
echo ‘oracle’ | passwd –stdin oracle
mkdir -p /oracle/app/oracle/product/12.1.0/db_1
mkdir -p /oracle/app/oraInventory
chown -R oracle:oinstall /oracle/
chmod -R 775 /oracle

解压安装包:
unzip linuxamd64_12102_database_1of2.zip
unzip linuxamd64_12102_database_2of2.zip

切换到 oracle 用户下,配置环境变量:
su – oracle
vim~/.bash_profile
    #export PATH
    ORACLE_BASE=/oracle/app/oracle
    ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 
    ORACLE_SID=orcl
    PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin 
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib 
    export ORACLE_BASE ORACLE_HOME ORACLE_SID PATHLD_LIBRARY_PATH
 
    if [$USER = “oracle”]; then
        if [$SHELL =”/bin/ksh”]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
    fi
 
source ~/.bash_profile

安装 Oracle 软件:
# 远程调用图形界面安装 vnc
yum install tigervnc-server.x86_64 -y
su – oracle
vncserver
#winodws 客户端使用 vnc viewer 远程登录
 
# 进入安装包解压目录
cd database
./runInstaller

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

是否接受官方的补丁信息,需要的可以填写 oracle 的邮箱账号和密码:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

# 监听查看命令

[Oracle@www ~]$ lsnrctl status/start/stop

创建数据库实例:

# 在 oracle 用户上运行 dbca

[oracle@www~]$ dbca

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

开启日志的镜像功能:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

闪回和归档功能在安装时暂时不要选,待创建完实例后手动启动:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

在生产环境中,SCA 大小设置物理内存的一半,PCA 大小设置物理内存 *80%*20%:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

数据库连接数,可以设置大一些:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

字符集选择 UTF-8

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

点击配置控制文件和表空间设置:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

在生产环境中,把控制文件设为 8192,表空间数据文件的参数都设置以下参数:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

在生产环境中需要 6 - 8 组,每组 200M 容量:

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

Red Hat Enterprise Linux 7.2 安装 Oracle 12c

配置归档和闪回:

# 先配归档才可以启动闪回
mkdir /Oracle/arch
sqlplus“/as sysdba”
    altersystem set db_recovery_file_dest_size=2g scope=both;
    altersystem set db_recovery_file_dest=’/oracle/arch’scope=both;
    shutdown immediate;
    startup mount;
    alter database archivelog;
    alter database flashback ON;
    alter database open;
    archive log list;

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-05/143564.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计6016字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中