魔兽世界虚空梦魇:NetBackup备份与恢复Oracle on CLUSTER LINUX SOP

来源:百度文库 编辑:九乡新闻网 时间:2024/05/01 07:49:50

NetBackup备份与恢复Oracle on CLUSTER LINUX SOP

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://wto0228.blogbus.com/logs/44423281.html


一. 安装准备事项

1.1 Software List

硬件环境 :VMware Server 1.0.2
操作系统 :RedHat AS4 U4 x86_64
内核版本 :2.6.9-42.ELsmp
RHCS版本:RHCS AS4 U4 x86_64
Oracle软件:Oracle 10g R2 x86_64 10.2.0.3
NetBackup版本:6.0

1.2 Server Information
  
Server Name IP Submask Description
node1 10.201.6.181 255.255.255.0 Physical IP
node2 10.201.6.182 255.255.255.0 Physical IP
Nodeclus 10.201.6.180 255.255.255.0 Service IP
node1-pri 10.0.0.1 255.255.255.0 Heartbeat IP
node2-pri 10.0.0.2 255.255.255.0 Heartbeat IP
netbackuptest 10.201.6.133 255.255.255.0 NBU Master server
restorenbu 10.201.6.45 255.255.255.0 Restore database

二. 安装NBU Master Server
在机器名为netbackuptest中安装NBU Master Server,安装过程
2.1 安装NBU Master Server
2.2 配置Driver
2.3 配置policy

三. 安装NBU Client和for Oracle Agent
3.1 配置host
分别在node1和node2中添加netbackuptest;
Vi /etc/hosts
添加:10.201.6.133    netbackuptest;
最终是:
127.0.0.1       localhost.localdomain   localhostckuptest
10.201.6.180    nodeclus
10.201.6.181    node1
10.201.6.182    node2
10.0.0.1         node1
10.0.0.2         node2
10.201.6.133    netbackuptest
3.1安装NBU Client和Agent
分别在node1和node2中安装client和angent

四. NBU备份Oracle on cluster linux
4.1配置备份脚本
注意点:红色部分中NB_ORA_CLIENT=nodeclus,其中nodeclus是cliuster name,以后用nodeclus进行恢复
脚本:
$RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOF
RUN {
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'parms='ENV=(NB_ORA_CLIENT=nodeclus)';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'parms='ENV=(NB_ORA_CLIENT=nodeclus)';
BACKUP
    $BACKUP_TYPE
    SKIP INACCESSIBLE
    TAG hot_db_bk_level0
    FILESPERSET 5
    # recommended format
    FORMAT 'bk_%s_%p_%t'
    DATABASE;
    sql 'alter system archive log current';
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
# backup all archive logs
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'parms='ENV=(NB_ORA_CLIENT=nodeclus)';
ALLOCATE CHANNEL ch01 TYPE 'SBT_TAPE'parms='ENV=(NB_ORA_CLIENT=nodeclus)';
BACKUP
   filesperset 20
   FORMAT 'al_%s_%p_%t'
   ARCHIVELOG ALL DELETE INPUT;
RELEASE CHANNEL ch00;
RELEASE CHANNEL ch01;
#
# Note: During the process of backing up the database, RMAN also backs up the
# control file.  This version of the control file does not contain the
# information about the current backup because "nocatalog" has been specified.
# To include the information about the current backup, the control file should
# be backed up as the last step of the RMAN section.  This step would not be
# necessary if we were using a recovery catalog.
#
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE'parms='ENV=(NB_ORA_CLIENT=nodeclus)';
BACKUP
    # recommended format
    FORMAT 'cntrl_%s_%p_%t'
    CURRENT CONTROLFILE;
RELEASE CHANNEL ch00;
allocate channel dsk00 type disk;
copy    current controlfile to '/usr/openv/script/control.bak';
release channel dsk00;
}

五. NBU异机恢复Oracle
5.1 添加No.Restrictions(非常重要)
在master server的机器中/usr/openv/netbackup/db/altnames目录下:
touch No.Restrictions

5.2 配置host文件
5.2.1 在机器名netbackuptest中添加
Vi /etc/hosts
添加:10.201.6.45    restorenbu;
最终是:
127.0.0.1        localhost.localdomain   localhost netbackuptest
10.201.6.180    nodeclus
10.201.6.181    node1
10.201.6.182    node2
10.201.6.133    netbackuptest
10.201.6.45     restorenbu

5.2.2 在机器名restorenbu中添加
Vi /etc/hosts
添加:10.201.6.133    netbackuptest;
最终是:
127.0.0.1       localhost.localdomain   localhos restorenbu
10.201.6.180    nodeclus
10.201.6.133    netbackuptest

5.3 安装NBU Client和Agent
在restorenbu机器中安装client和angent
5.4  NBU恢复Oracle
5.4.1恢复ORACLE_HOME
 
5.4.2打开命令行工具,创建必要有相关目录。

5.4.3 配置环境
(1)创建用户和修改环境变量
没啥说的,照着官方文档的思路做就行了
# /usr/sbin/groupadd oinstall  /创建组用户/
# /usr/sbin/groupadd dba   /创建组用户/
# /usr/sbin/useradd -g oinstall -G dba oracle  /创建用户,并设定用户组/
# passwd oracle  /设定oracle用户的密码/

(2)用oracle登陆进操作系统,编辑.bash_profile文件,由于linux默认的shell使用的是bash,故要编辑这个文件,如果你设定的使用csh,请编辑.login文件。
我的.bash_profile添加的内容
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/jre:/sbin/usr/ccs/bin:/usr/bin/X11:/usr/local/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TMPDIR=/oratmp
export ORACLE_SID=oracluster
umask 022

(3)设定系统核心参数
按照官方文档做
#cat >> /etc/sysctl.conf <kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
EOF
# /sbin/sysctl –p

(4)创建安装目录
按照官方文档的思路去做,就是创建ORACLE_BASE的目录,要和刚才定义的oracle用户环境变量一致。
mkdir -p /oracle/product/
mkdir -p /oracle//product/10.2.0/
chown -R oracle:oinstall /oracle/ /oracle/product/10.2.0/
chmod -R 777 /oracle/ /oracle/product/10.2.0/

5.4.4  恢复CONTROLFILE
(1)Rman target / nocatalog
Set dbid= 4293532534
Startup nomount
run{
 allocate channel ch00 type 'sbt_tape';
   SEND 'NB_ORA_SERV=netbackuptest, NB_ORA_CLIENT=nodeclus';
 restore controlfile from autobackup;
 release channel c1;
 }

5.4.5  恢复Oracle Data
(1) Alter database mount
(2) run{ allocate channel ch00 type 'sbt_tape';
   SEND 'NB_ORA_SERV=netbackuptest, NB_ORA_CLIENT=nodeclus';
restore database;
recover database;
release channel ch00;
}
(3) Alter database open resetlogs