Oracle技术之aix下rac环境rman备份策略部署

为客户部署的备份策略,替换了和客户相关的重要信息


数据库备份方案部署过程:


考虑到系统是高可用性系统(7×24),因此采用rman来热备份db,具体备份步骤部署如下:

1. 把db改为归档模式,2个节点的归档日志分别放在各自的/orabak/archlog目录下

2. 把db的备份文件放在2个节点各自的/orabak/dbbak目录下,每次备份的文件会分布在2个节点上,这样做的目的对2个节点来说相对都能节约一些空间,因为/orabak目前暂时挂载在rootvg下了,由于datavg里已经没有了空间

3. 备份脚本存放在节点1的/orabak/script里面

A.具体os层面的备份脚本是/orabak/script/dbbak.sh,内容如下:

--环境变量设置,最简单的办法就是把oracle用户的环境变量文件.profile的内容全部拿过来即可

PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.


export PATH


if [ -s "$MAIL" ] # This is at Shell startup. In normal

then echo "$MAILMSG" # operation, the Shell checks

fi # periodically.

ORACLE_BASE=/opt/oracle

ORACLE_HOME=/opt/oracle/product/11.1/db_1

CRS_HOME=/opt/oracle/product/11.1/crs

DISPLAY=198.14.2.56:0.0

ORACLE_SID=RACDB1

LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/lib:/usr/lib

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/rdbms/jlib

SHLIB_PATH=$ORACLE_HOME/bin:$ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32

PATH=$PATH:$ORACLE_HOME/bin:$CRS_HOME/bin:/usr/sbin:/usr/local/bin:/usr/lib/builtins:

ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data

export ORACLE_BASE ORACLE_HOME ORACLE_SID DISPLAY LD_LIBRARY_PATH CLASSPATH SHLIB_PATH PATH ORA_NLS33

NLS_LANG=american_america.zhs16gbk

export NLS_LANG

--备份脚本

rman target / cmdfile='/orabak/script/dbbak.sql' log='/orabak/script/dbbak.log' append <<EOF

B.os层面的备份脚本/orabak/script/dbbak.sh调用的db层面的脚本/orabak/script/dbbak.sql内容如下:

run{

allocate channel c1 device type disk connect sys/system@racdb1;

allocate channel c2 device type disk connect sys/system@racdb2;

backup as compressed backupset database format='/orabak/dbbak/racdb_%T_%U.bak';

delete noprompt obsolete;

crosscheck backup;

crosscheck archivelog all;

delete noprompt expired backup;

delete noprompt expired archivelog all;

backup as compressed backupset archivelog all format='/orabak/dbbak/archlog_%T_%U.bak';

}

exit;

EOF

4. 每天晚上11:30系统自动备份db,具体实现脚本如下:

$ crontab -l

30 23 * * * /orabak/script/dbbak.sh

5.受到/orabak目录所在的rootvg的空间限制,我们制定了备份保留3天的策略,db的备份和归档以及归档日志的备份保留3天之后自动删除,具体备份策略如下:

$ rman target /


Recovery Manager: Release 11.1.0.6.0 - Production on Wed Jun 9 16:24:41 2010


Copyright (c) 1982, 2007, Oracle. All rights reserved.


connected to target database: RACDB (DBID=3428846088)


RMAN> show all;


using target database control file instead of recovery catalog

RMAN configuration parameters for database with db_unique_name RACDB are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;


6. 通过测试,发现备份可以成功,目前没发现任何问题,具体测试时的备份日志如下:


Recovery Manager: Release 11.1.0.6.0 - Production on Wed Jun 9 15:01:00 2010


Copyright (c) 1982, 2007, Oracle. All rights reserved.


connected to target database: RACDB (DBID=3428846088)


RMAN> run{

2> allocate channel c1 device type disk connect *

3> allocate channel c2 device type disk connect *

4> backup as compressed backupset database format='/orabak/dbbak/racdb_%T_%U.bak';

5> delete noprompt obsolete;

6> crosscheck backup;

7> crosscheck archivelog all;

8> delete noprompt expired backup;

9> delete noprompt expired archivelog all;

10> backup as compressed backupset archivelog all format='/orabak/dbbak/archlog_%T_%U.bak';

11> }

12>

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=110 instance=RACDB1 device type=DISK


allocated channel: c2

channel c2: SID=112 instance=RACDB2 device type=DISK


Starting backup at 09-JUN-10

channel c1: starting compressed full datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00011 name=/dev/rtbs_big1

input datafile file number=00013 name=/dev/rtbs_big3

input datafile file number=00015 name=/dev/rtbs_zhufo

input datafile file number=00004 name=/dev/rundotbs2

input datafile file number=00002 name=/dev/rsysaux

input datafile file number=00001 name=/dev/rsystem

input datafile file number=00005 name=/dev/rusers

channel c1: starting piece 1 at 09-JUN-10

channel c2: starting compressed full datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00012 name=/dev/rtbs_big2

input datafile file number=00006 name=/dev/rtbs_common

input datafile file number=00007 name=/dev/rtbs_vts

input datafile file number=00008 name=/dev/rtbs_vesm

input datafile file number=00009 name=/dev/rtbs_idx

input datafile file number=00010 name=/dev/rtbs_x3sys

input datafile file number=00014 name=/dev/rtbs_bhjf

input datafile file number=00003 name=/dev/rundotbs1

channel c2: starting piece 1 at 09-JUN-10

channel c1: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/racdb_20100609_09lfqath_1_1.bak tag=TAG20100609T150104 comment=NONE

channel c1: backup set complete, elapsed time: 00:05:40

channel c1: starting compressed full datafile backup set

channel c1: specifying datafile(s) in backup set

including current control file in backup set

channel c1: starting piece 1 at 09-JUN-10

channel c1: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/racdb_20100609_0blfqb86_1_1.bak tag=TAG20100609T150104 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c1: starting compressed full datafile backup set

channel c1: specifying datafile(s) in backup set

including current SPFILE in backup set

channel c1: starting piece 1 at 09-JUN-10

channel c1: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/racdb_20100609_0clfqb88_1_1.bak tag=TAG20100609T150104 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

channel c2: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/racdb_20100609_0alfqatu_1_1.bak tag=TAG20100609T150104 comment=NONE

channel c2: backup set complete, elapsed time: 00:05:54

Finished backup at 09-JUN-10


RMAN retention policy will be applied to the command

RMAN retention policy is set to redundancy 1

Deleting the following obsolete backups and copies:

Type Key Completion Time Filename/Handle

-------------------- ------ ------------------ --------------------

Backup Set 4 09-JUN-10

Backup Piece 4 09-JUN-10 /orabak/dbbak/racdb_20100609_03lfq98d_1_1.bak

Backup Set 1 09-JUN-10

Backup Piece 1 09-JUN-10 /orabak/dbbak/racdb_20100609_04lfq98r_1_1.bak

Backup Set 2 09-JUN-10

Backup Piece 2 09-JUN-10 /orabak/dbbak/racdb_20100609_05lfq9j6_1_1.bak

Archive Log 3 09-JUN-10 /orabak/archlog/1_1910_718202824.dbf

Backup Set 3 09-JUN-10

Backup Piece 3 09-JUN-10 /orabak/dbbak/racdb_20100609_06lfq9jc_1_1.bak

Archive Log 4 09-JUN-10 /orabak/archlog/2_367_718202824.dbf

Backup Set 5 09-JUN-10

Backup Piece 5 09-JUN-10 /orabak/dbbak/archivelog_20100609_07lfq9lp_1_1.bak

Backup Set 6 09-JUN-10

Backup Piece 6 09-JUN-10 /orabak/dbbak/archivelog_20100609_08lfq9m6_1_1.bak

deleted backup piece

backup piece handle=/orabak/dbbak/racdb_20100609_03lfq98d_1_1.bak RECID=4 STAMP=721233165

deleted archived log

archived log file name=/orabak/archlog/1_1910_718202824.dbf RECID=3 STAMP=721233587

deleted backup piece

backup piece handle=/orabak/dbbak/archivelog_20100609_07lfq9lp_1_1.bak RECID=5 STAMP=721233593

Deleted 3 objects


deleted backup piece

backup piece handle=/orabak/dbbak/racdb_20100609_04lfq98r_1_1.bak RECID=1 STAMP=721233186

deleted backup piece

backup piece handle=/orabak/dbbak/racdb_20100609_05lfq9j6_1_1.bak RECID=2 STAMP=721233515

deleted backup piece

backup piece handle=/orabak/dbbak/racdb_20100609_06lfq9jc_1_1.bak RECID=3 STAMP=721233521

deleted archived log

archived log file name=/orabak/archlog/2_367_718202824.dbf RECID=4 STAMP=721233601

deleted backup piece

backup piece handle=/orabak/dbbak/archivelog_20100609_08lfq9m6_1_1.bak RECID=6 STAMP=721233611

Deleted 5 objects



crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/orabak/dbbak/racdb_20100609_09lfqath_1_1.bak RECID=7 STAMP=721234865

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/orabak/dbbak/racdb_20100609_0blfqb86_1_1.bak RECID=8 STAMP=721235207

crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/orabak/dbbak/racdb_20100609_0clfqb88_1_1.bak RECID=9 STAMP=721235208

Crosschecked 3 objects


crosschecked backup piece: found to be 'AVAILABLE'

backup piece handle=/orabak/dbbak/racdb_20100609_0alfqatu_1_1.bak RECID=10 STAMP=721234885

Crosschecked 1 objects



specification does not match any archived log in the recovery catalog



specification does not match any archived log in the recovery catalog


Starting backup at 09-JUN-10

current log archived

channel c1: starting compressed archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=1911 RECID=5 STAMP=721235228

channel c1: starting piece 1 at 09-JUN-10

channel c2: starting compressed archived log backup set

channel c2: specifying archived log(s) in backup set

input archived log thread=2 sequence=368 RECID=6 STAMP=721235242

channel c2: starting piece 1 at 09-JUN-10

channel c1: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/archlog_20100609_0dlfqb92_1_1.bak tag=TAG20100609T150713 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:04

channel c2: finished piece 1 at 09-JUN-10

piece handle=/orabak/dbbak/archlog_20100609_0elfqb9f_1_1.bak tag=TAG20100609T150713 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

Finished backup at 09-JUN-10

released channel: c1

released channel: c2


Recovery Manager complete.

#


oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html

你可能感兴趣的:(oracle,AIX,RAC,rman备份)