aix下rac環境rman備份策略部署

warehouse發表於2010-06-10
為客戶部署的備份策略,替換了和客戶相關的重要資訊[@more@]

資料庫備份方案部署過程

考慮到系統是高可用性系統(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 <

Bos層面的備份指令碼/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. 每天晚上1130系統自動備份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.

#

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/19602/viewspace-1034302/,如需轉載,請註明出處,否則將追究法律責任。

相關文章