RAC環境下節點歸檔目的地相互獨立的配置和備份要求

尛樣兒發表於2013-08-13

一.測試環境。

1.Oracle RAC Database版本。

select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production

2.log_archive_dest_1引數設定。
1).第一個節點:
SQL> show parameter log_archive_dest_1

NAME     TYPE
------------------------------------ ----------------------
VALUE
------------------------------
log_archive_dest_1     string
LOCATION=/arch1
log_archive_dest_10     string


2).第二個節點:
SQL> show parameter log_archive_dest_1

NAME     TYPE
------------------------------------ ----------------------
VALUE
------------------------------
log_archive_dest_1     string
LOCATION=/arch2
log_archive_dest_10     string

3.備份目的地。
1).第一個節點:
[oracle@linux ~]$ cd /
[oracle@linux /]$ ls -ald rmanbak
drwxr-xr-x 2 oracle oinstall 4096 Aug 11 05:07 rmanbak/

2).第二個節點:
[oracle@linux2 ~]$ cd /
[oracle@linux2 /]$ ls -ald rmanbak
ls: rmanbak: No such file or directory

第二個節點不存在/rmanbak備份目的地。

二.測試過程。

1).在節點1執行歸檔交叉檢查。
[oracle@linux /]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Sun Aug 11 05:14:59 2013

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

connected to target database: ORCL (DBID=1350843573)

RMAN> crosscheck archivelog all;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=128 instance=orcl1 devtype=DISK
validation succeeded for archived log
archive log filename=/arch1/1_7_823148545.dbf recid=26 stamp=823151383
validation succeeded for archived log
archive log filename=/arch1/1_8_823148545.dbf recid=31 stamp=823151395
validation succeeded for archived log
archive log filename=/arch1/1_9_823148545.dbf recid=33 stamp=823151446
validation succeeded for archived log
archive log filename=/arch1/1_10_823148545.dbf recid=34 stamp=823151447
validation succeeded for archived log
archive log filename=/arch1/1_11_823148545.dbf recid=35 stamp=823151453
validation succeeded for archived log
archive log filename=/arch1/1_12_823148545.dbf recid=36 stamp=823151453
validation succeeded for archived log
archive log filename=/arch1/1_13_823148545.dbf recid=38 stamp=823151456
validation failed for archived log
archive log filename=/arch2/2_1_823148545.dbf recid=13 stamp=823150629
validation failed for archived log
archive log filename=/arch2/2_7_823148545.dbf recid=24 stamp=823151368
validation failed for archived log
archive log filename=/arch2/2_8_823148545.dbf recid=25 stamp=823151371
validation failed for archived log
archive log filename=/arch2/2_9_823148545.dbf recid=27 stamp=823151376
validation failed for archived log
archive log filename=/arch2/2_10_823148545.dbf recid=28 stamp=823151376
validation failed for archived log
archive log filename=/arch2/2_11_823148545.dbf recid=29 stamp=823151383
validation failed for archived log
archive log filename=/arch2/2_12_823148545.dbf recid=30 stamp=823151383
validation failed for archived log
archive log filename=/arch2/2_13_823148545.dbf recid=32 stamp=823151387
validation failed for archived log
archive log filename=/arch2/2_14_823148545.dbf recid=37 stamp=823151441
Crosschecked 16 objects

        由於節點1不能訪問節點2歸檔目的地/arch2下的備份檔案,所有節點2所有歸檔交叉檢查都失敗。

        在這種情況下執行以下的命令備份所有節點的歸檔,並刪除所有目的地的INPUT歸檔:

RMAN> backup archivelog all delete all input;

Starting backup at 2013-08-11 05:15:40
current log archived
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 08/11/2013 05:15:50
RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
ORA-19625: error identifying file /arch2/2_15_823148545.dbf
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

        由於節點1不能訪問節點2歸檔目的地/arch2下的備份檔案,所有備份根本無法開始。

嘗試為兩個節點分配各自的通道:

RMAN> run{
2> allocate channel c1 device type disk format '/rmanbak/%p_%s_%d.BAK' connect 'sys/oracle123@orcl1';
3> allocate channel c2 device type disk format '/rmanbak/%p_%s_%d.BAK' connect 'sys/oracle123@orcl2';
4> backup archivelog all delete all input;
5> release channel c1;
6> release channel c2;}

released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=131 instance=orcl1 devtype=DISK

allocated channel: c2
channel c2: sid=140 instance=orcl2 devtype=DISK

Starting backup at 2013-08-11 05:17:26
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=13 recid=38 stamp=823151456
input archive log thread=1 sequence=14 recid=39 stamp=823151740
input archive log thread=1 sequence=15 recid=42 stamp=823151849
channel c1: starting piece 1 at 2013-08-11 05:17:38
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=15 recid=40 stamp=823151729
input archive log thread=2 sequence=16 recid=41 stamp=823151835
channel c2: starting piece 1 at 2013-08-11 05:17:26
RMAN-03009: failure of backup command on c2 channel at 08/11/2013 05:17:38
ORA-19504: failed to create file "/rmanbak/1_13_ORCL.BAK"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory
channel c2 disabled, job failed on it will be run on another channel
channel c1: finished piece 1 at 2013-08-11 05:17:39
piece handle=/rmanbak/1_12_ORCL.BAK tag=TAG20130811T051736 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
channel c1: deleting archive log(s)
archive log filename=/arch1/1_13_823148545.dbf recid=38 stamp=823151456
archive log filename=/arch1/1_14_823148545.dbf recid=39 stamp=823151740
archive log filename=/arch1/1_15_823148545.dbf recid=42 stamp=823151849
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7 recid=26 stamp=823151383
input archive log thread=1 sequence=8 recid=31 stamp=823151395
input archive log thread=1 sequence=9 recid=33 stamp=823151446
input archive log thread=1 sequence=10 recid=34 stamp=823151447
input archive log thread=1 sequence=11 recid=35 stamp=823151453
input archive log thread=1 sequence=12 recid=36 stamp=823151453
channel c1: starting piece 1 at 2013-08-11 05:17:40
channel c1: finished piece 1 at 2013-08-11 05:17:41
piece handle=/rmanbak/1_14_ORCL.BAK tag=TAG20130811T051736 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
channel c1: deleting archive log(s)
archive log filename=/arch1/1_7_823148545.dbf recid=26 stamp=823151383
archive log filename=/arch1/1_8_823148545.dbf recid=31 stamp=823151395
archive log filename=/arch1/1_9_823148545.dbf recid=33 stamp=823151446
archive log filename=/arch1/1_10_823148545.dbf recid=34 stamp=823151447
archive log filename=/arch1/1_11_823148545.dbf recid=35 stamp=823151453
archive log filename=/arch1/1_12_823148545.dbf recid=36 stamp=823151453
released channel: c1
released channel: c2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================

RMAN-03009: failure of backup command on c2 channel at 08/11/2013 05:17:38
ORA-19504: failed to create file "/rmanbak/1_13_ORCL.BAK"
ORA-27040: file create error, unable to create file
Linux-x86_64 Error: 2: No such file or directory

        為兩個節點分配了各自的通道後,在節點1執行備份能夠正常的訪問到節點的歸檔目的地/arch2下的歸檔檔案,但節點2不存在/rmanbak備份目的地,無法建立備份。

RMAN> crosscheck archivelog all;

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=128 instance=orcl1 devtype=DISK
validation failed for archived log
archive log filename=/arch2/2_1_823148545.dbf recid=13 stamp=823150629
validation failed for archived log
archive log filename=/arch2/2_7_823148545.dbf recid=24 stamp=823151368
validation failed for archived log
archive log filename=/arch2/2_8_823148545.dbf recid=25 stamp=823151371
validation failed for archived log
archive log filename=/arch2/2_9_823148545.dbf recid=27 stamp=823151376
validation failed for archived log
archive log filename=/arch2/2_10_823148545.dbf recid=28 stamp=823151376
validation failed for archived log
archive log filename=/arch2/2_11_823148545.dbf recid=29 stamp=823151383
validation failed for archived log
archive log filename=/arch2/2_12_823148545.dbf recid=30 stamp=823151383
validation failed for archived log
archive log filename=/arch2/2_13_823148545.dbf recid=32 stamp=823151387
validation failed for archived log
archive log filename=/arch2/2_14_823148545.dbf recid=37 stamp=823151441
validation failed for archived log
archive log filename=/arch2/2_15_823148545.dbf recid=40 stamp=823151729
validation failed for archived log
archive log filename=/arch2/2_16_823148545.dbf recid=41 stamp=823151835
Crosschecked 11 objects

       透過簡單的交叉檢查可以發現節點1的所有歸檔成功備份,但節點2的歸檔未備份。

        在節點2執行以下的步驟建立/rmanbak備份目的地:
[root@linux2 /]# cd /
[root@linux2 /]# mkdir rmanbak
[root@linux2 /]# chown -R oracle:oinstall rmanbak
[root@linux2 /]# ls -ald rmanbak
drwxr-xr-x 2 oracle oinstall 4096 Aug 11 05:18 rmanbak

回到節點1執行交叉檢查:

RMAN> run{
2> allocate channel c1 device type disk connect 'sys/oracle123@orcl2';
3> allocate channel c2 device type disk connect 'sys/oracle123@orcl1';
4> crosscheck archivelog all;
5> release channel c1;
6> release channel c2;}

released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=140 instance=orcl2 devtype=DISK

allocated channel: c2
channel c2: sid=131 instance=orcl1 devtype=DISK

validation succeeded for archived log
archive log filename=/arch2/2_1_823148545.dbf recid=13 stamp=823150629
validation succeeded for archived log
archive log filename=/arch2/2_7_823148545.dbf recid=24 stamp=823151368
validation succeeded for archived log
archive log filename=/arch2/2_8_823148545.dbf recid=25 stamp=823151371
validation succeeded for archived log
archive log filename=/arch2/2_9_823148545.dbf recid=27 stamp=823151376
validation succeeded for archived log
archive log filename=/arch2/2_10_823148545.dbf recid=28 stamp=823151376
validation succeeded for archived log
archive log filename=/arch2/2_11_823148545.dbf recid=29 stamp=823151383
validation succeeded for archived log
archive log filename=/arch2/2_12_823148545.dbf recid=30 stamp=823151383
validation succeeded for archived log
archive log filename=/arch2/2_13_823148545.dbf recid=32 stamp=823151387
validation succeeded for archived log
archive log filename=/arch2/2_14_823148545.dbf recid=37 stamp=823151441
validation succeeded for archived log
archive log filename=/arch2/2_15_823148545.dbf recid=40 stamp=823151729
validation succeeded for archived log
archive log filename=/arch2/2_16_823148545.dbf recid=41 stamp=823151835
Crosschecked 11 objects


released channel: c1

released channel: c2

交叉檢查兩個節點歸檔都成功。

執行歸檔備份操作:

RMAN> run{
2> allocate channel c1 device type disk format '/rmanbak/%p_%s_%d.BAK' connect 'sys/oracle123@orcl1';
3> aloocate channel c2 device type disk format '/rmanbak/%p_%s_%d.BAK' connect 'sys/oracle123@orcl2';
4> backup archivelog all delete all input;
5> release channel c1;
6> release channel c2;}

allocated channel: c1
channel c1: sid=131 instance=orcl1 devtype=DISK

allocated channel: c2
channel c2: sid=140 instance=orcl2 devtype=DISK

Starting backup at 2013-08-11 05:21:50
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=16 recid=43 stamp=823152110
channel c1: starting piece 1 at 2013-08-11 05:21:54
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=13 recid=32 stamp=823151387
input archive log thread=2 sequence=14 recid=37 stamp=823151441
input archive log thread=2 sequence=15 recid=40 stamp=823151729
channel c2: starting piece 1 at 2013-08-11 05:21:42
channel c1: finished piece 1 at 2013-08-11 05:21:55
piece handle=/rmanbak/1_15_ORCL.BAK tag=TAG20130811T052152 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
channel c1: deleting archive log(s)
archive log filename=/arch1/1_16_823148545.dbf recid=43 stamp=823152110
channel c2: finished piece 1 at 2013-08-11 05:21:43
piece handle=/rmanbak/1_16_ORCL.BAK tag=TAG20130811T052152 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c2: deleting archive log(s)
archive log filename=/arch2/2_13_823148545.dbf recid=32 stamp=823151387
archive log filename=/arch2/2_14_823148545.dbf recid=37 stamp=823151441
archive log filename=/arch2/2_15_823148545.dbf recid=40 stamp=823151729
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=1 recid=13 stamp=823150629
input archive log thread=2 sequence=7 recid=24 stamp=823151368
input archive log thread=2 sequence=8 recid=25 stamp=823151371
input archive log thread=2 sequence=9 recid=27 stamp=823151376
input archive log thread=2 sequence=10 recid=28 stamp=823151376
input archive log thread=2 sequence=11 recid=29 stamp=823151383
input archive log thread=2 sequence=12 recid=30 stamp=823151383
channel c2: starting piece 1 at 2013-08-11 05:21:44
channel c2: finished piece 1 at 2013-08-11 05:21:46
piece handle=/rmanbak/1_17_ORCL.BAK tag=TAG20130811T052152 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
channel c2: deleting archive log(s)
archive log filename=/arch2/2_1_823148545.dbf recid=13 stamp=823150629
archive log filename=/arch2/2_7_823148545.dbf recid=24 stamp=823151368
archive log filename=/arch2/2_8_823148545.dbf recid=25 stamp=823151371
archive log filename=/arch2/2_9_823148545.dbf recid=27 stamp=823151376
archive log filename=/arch2/2_10_823148545.dbf recid=28 stamp=823151376
archive log filename=/arch2/2_11_823148545.dbf recid=29 stamp=823151383
archive log filename=/arch2/2_12_823148545.dbf recid=30 stamp=823151383
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=16 recid=41 stamp=823151835
input archive log thread=2 sequence=17 recid=44 stamp=823152099
channel c2: starting piece 1 at 2013-08-11 05:21:47
channel c2: finished piece 1 at 2013-08-11 05:21:48
piece handle=/rmanbak/1_18_ORCL.BAK tag=TAG20130811T052152 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:02
channel c2: deleting archive log(s)
archive log filename=/arch2/2_16_823148545.dbf recid=41 stamp=823151835
archive log filename=/arch2/2_17_823148545.dbf recid=44 stamp=823152099
Finished backup at 2013-08-11 05:22:00

released channel: c1

released channel: c2

備份操作成功。

在節點2的/rmanbak目錄下能看到備份檔案。
[root@linux2 /]# cd rmanbak
[root@linux2 rmanbak]# ls
1_16_ORCL.BAK  1_17_ORCL.BAK  1_18_ORCL.BAK
[root@linux2 rmanbak]# ll
total 324
-rw-r----- 1 oracle oinstall 259584 Aug 11 05:21 1_16_ORCL.BAK
-rw-r----- 1 oracle oinstall  53248 Aug 11 05:21 1_17_ORCL.BAK
-rw-r----- 1 oracle oinstall   6656 Aug 11 05:21 1_18_ORCL.BAK

        在這個例子中,兩個節點的歸檔目的地,備份目的地都是相互獨立的空間。透過以上的例子,我們可以看到,在RAC環境下,如果每個節點的歸檔目的地只有自己可見,那麼在備份的時候需要為每個節點分配通道,備份目的地在RAC所有節點必須都存在,並可讀可寫。

        如果RAC所有節點的歸檔日誌放在共享儲存上(叢集檔案系統),或者透過NFS等方式備份節點能夠讀寫所有節點的歸檔目的地,那麼在備份節點的備份操作就不需要為每個節點分配通道,且備份目的地只需要備份節點能讀寫就可以了。

--end--


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

相關文章