Centos7 安装11.2.0.4
Oracle11.2.0.4
安装部署文档
(V1.0)
-
环境安装规划
1.1系统分区规划
分区名称
文件系统类型
分区大小
swap
swap
官方建议:
物理内存2-16G,swap等于内存大小
物理内存大于16G,swap为16G
/boot
xfs
1G
/
xfs
剩余空间
/u01(额外磁盘)
xfs
50G
/oradata(额外磁盘)
xfs
按需分配
1.2数据库内存规划
建议SGA+PGA占整个节点物理内存的65%,其中,建议SGA大小容量为PGA的3倍,
具体设置请参考实际业务。若实际配置内存容量大小为32GB,则建议规划
的SGA和PGA分别如下:
l SGA大小:32 GB * 65% * 75% = 15.6 GB
l PGA大小:32 GB * 65% * 25% = 5.2 GB
1.3数据库用户规划
用户名
用户ID
用户组
用户组id
用户密码
oracle
1000
oinstall
1005
自定义
dba
1006
1.4环境变量规划
用户
环境变量
路径
oracle
ORACLE_BASE
/u01/app/oracle
oracle
ORACLE_HOME
$ORACLE_BASE/product/11.2.0/db
oracle
ORACLE_SID
用户按需求自定义
-
操作系统安装及环境配置
2.1操作系统安装
Contiune
配置系统
选择时区:shanghai
Software选择server with gui
磁盘分区配置
分区规划
配置主机名
配置网络
开始安装
2.2环境配置
2.2.1安装rpm包
1挂载ISO
mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
2配置yum源
cd /etc/yum.repos.d/
vi /etc/yum.repos.d/local.repo
[yum]
name=yum
baseurl=file:///mnt
enabled=1
gpgcheck=0
3安装相关rpm包
for PACKAGE in lftp binutils compat-gcc-* compat-gcc-*-c++ compat-libstdc++-* \
control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel \
make pdksh openmotif setarch sysstat glibc-devel libgcc libaio compat-db \
libXtst libXp libXp.i686 libXt.i686 libXtst.i686 unixODBC unixODBC-devel \
elfutils-libelf-devel elfutils-libelf glibc-headers libaio-devel numactl-devel \
libaio.i686 libaio-devel.i686 compat-libstdc++-*.i686 libgcc.i686 unixODBC.i686 \
unixODBC-devel.i686 libstdc++.i686 lrzsz screen ;
do
yum -y install $PACKAGE
done
2.2.2配置host
vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.180.186.30 dbrecover
2.2.3关闭防火墙及selinux
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
2.2.4创建用户及用户组
/usr/sbin/groupadd -g 1005 oinstall
/usr/sbin/groupadd -g 1006 dba
/usr/sbin/useradd -u 1000 -g oinstall -G dba oracle
2.2.5配置用户环境变量
su - oracle
vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db
export ORACLE_SID=center
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
2.2.6修改系统参数
1 配置/etc/security/limits.conf
vi /etc/security/limits.conf
oracle soft nproc 65536
oracle hard nproc 65536
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft stack 65536
oracle soft memlock 1425011166
oracle hard memlock 1425011166
2配置/etc/sysctl.conf
kernel.shmmax参数:需要根据实际物理内存计算,此处按节点物理内存32GB计算;建议
kernel.shmmax参数取值为节点物理内存的70%,单位为字节,即
32*70%*1024*1024*1024=24051816857.6(向上取整为24051816858)。
kernel.shmall参数:根据SGA/PAGE_SIZE计算。
kernel.sem参数:如果客户单个数据库需要支持的process数超过1500,请按照实际情况配置
vi /etc/sysctl.conf
kernel.shmall = 5872026
kernel.shmmax = 24051816858
kernel.shmmni = 4096
kernel.sem = 1500 1536000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 3145728
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.ipfrag_high_thresh = 16777216
net.ipv4.ipfrag_low_thresh = 15728640
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vm.min_free_kbytes= 1048576
使系统参数生效
sysctl -p
2.2.7创建Oracle目录
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
Chmod -R 755 /u01
mkdir -p /oradata
chown oracle:oinstall /oradata
Chmod 755 /oradata
归档路径:
mkdir -p /oradata/arch
chown oracle:oinstall /oradata/arch
-
Oracle软件安装
3.1上传oracle安装包
[root@dbrecover software]# ls -lh p13390677_112040_Linux-x86-64_*
-rw-r--r--. 1 505 505 1.3G Jun 8 16:25 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r--. 1 505 505 1.1G Jun 8 16:25 p13390677_112040_Linux-x86-64_2of7.zip
解压
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
3.2安装oracle软件
Centos7安装oracle指定jdk1.7 jre目录(不然图形界面会有问题)
cd /u01/software/database
./runInstaller -jreLoc /u01/jdk1.7.0_80/jre
Pdksh rpm包可忽略
Centos7 会出现该问题
修改$ORACLE_HOME/sysman/lib/ins_emagent.mk
将$(MK_EMAGENT_NMECTL)修改为:$(MK_EMAGENT_NMECTL) -lnnz11
点击retry,继续安装。
Root用户下执行脚本:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db/root.sh
-
oracle补丁集安装
4.1官网查询最新psu补丁集及OPATCH补丁工具
meatalink号:1454618.1
下载psu 31537677后,查看readme文件要求opatch工具版本大于 11.2.0.3.23;
下载最新opatch工具
4.2上传文件及安装opatch
解压p6880880_112000_Linux-x86-64.zip
unzip p6880880_112000_Linux-x86-64.zip
替换原Opatch目录
[oracle@dbrecover software]$ mv /u01/app/oracle/product/11.2.0/db/OPatch /u01/app/oracle/product/11.2.0/db/OPatchbak
[oracle@dbrecover software]$ mv OPatch/ /u01/app/oracle/product/11.2.0/db/
查看opatch版本
[oracle@dbrecover software]$ opatch version
OPatch Version: 11.2.0.3.29
OPatch succeeded.
4.3安装psu
解压psu
unzip p31537677_112040_Linux-x86-64_db.zip
psu安装冲突检测
cd 31537677
[oracle@dbrecover 31537677]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
日志如下:
Oracle Interim Patch Installer version 11.2.0.3.29
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/db
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db/oraInst.loc
OPatch version : 11.2.0.3.29
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db/cfgtoollogs/opatch/opatch2021-06-16_11-16-42AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
psu安装
cd 31537677
[oracle@dbrecover 31537677]$ opatch apply
日志如下:
Oracle Interim Patch Installer version 11.2.0.3.29
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/db
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db/oraInst.loc
OPatch version : 11.2.0.3.29
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db/cfgtoollogs/opatch/opatch2021-06-16_11-18-22AM_1.log
Verifying environment and performing prerequisite checks...
--------------------------------------------------------------------------------
Start OOP by Prereq process.
Launch OOP...
Oracle Interim Patch Installer version 11.2.0.3.29
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/db
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/db/oraInst.loc
OPatch version : 11.2.0.3.29
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db/cfgtoollogs/opatch/opatch2021-06-16_11-18-41AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 17478514 18031668 18522509 19121551 19769489 20299013 20760982 21352635 21948347 22502456 23054359 24006111 24732075 25869727 26609445 26392168 26925576 27338049 27734982 28204707 28729262 29141056 29497421 29913194 30298532 30670774 31103343 31537677
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0/db')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH '/u01/app/oracle/product/11.2.0/db'
-
数据库创建
5.1创建数据库
oracle用户下执行dbca:
修改操作系统shm大小
编辑vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=3072M 0 0
调整redo大小,调整为500M(默认为50M)
安装完成
5.2创建监听
Oracle用户下,执行netca
全部默认即可。
-
Networker备份数据库
6.1配置host文件
cat >> /etc/hosts << EOF
###备份###
10.180.188.2 networker
10.180.188.15 dd2200
EOF
6.2安装Networker客户端
nmda18201_linux_x86_64.tar.gz (linux 下面各种数据库模块oracle,db2,mysql…)
nw18201_linux_x86_64.tar.gz (linux下面备份软件)
解压后,rpm安装
启动networker客户端
[root@dbrecover linux_x86_64]# systemctl start networker
安装oracle数据库模块
[root@dbrecover networker]# yum -y install ksh
6.3配置networker
name为主机名
默认
自己编辑备份脚本:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
RUN {
ALLOCATE CHANNEL CH1 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH2 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH3 TYPE 'SBT_TAPE';
ALLOCATE CHANNEL CH4 TYPE 'SBT_TAPE';
SEND DEVICE TYPE 'SBT_TAPE' 'NSR_ENV=(NSR_COMPRESSION=true)';
backup as compressed backupset section size 10g database
format 'full_%d_%T_%s_%p_%U'
plus archivelog
format 'arch_%d_%T_%s_%p'
delete all input;
backup current controlfile format 'ctl_%d_%T_%s_%p';
backup spfile format 'spfile_%d_%T_%s_%p';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
}
run{
allocate channel CH1 type 'SBT_TAPE';
crosscheck backup;
crosscheck archivelog all;
delete noprompt archivelog until time 'sysdate-7';
delete noprompt obsolete;
delete noprompt expired backup;
release channel CH1;
}
配置group及备份策略
默认即可
后续全部默认即可。
Networker(10.180.188.2)服务端添加权限:
备份测试:
备份成功。