1. 程式人生 > >RAC下RMAN備份的一些問題 - RMAN指令碼分配通道連線不同的節點

RAC下RMAN備份的一些問題 - RMAN指令碼分配通道連線不同的節點

最近RAC下的一個備份指令碼,在分配通道的時候,發現不同的通道連線到了不同的節點上。這樣也存在一些弊端,比如備份檔案是分散在兩個不同的節點上的。 而且備份資料不是均勻分佈的。主要還是看美每個通道都備份了那些表空間等等

--兩個節點上的目錄路徑都一樣,比如都有/rmanbackup這個資料夾

以下是測試過程

[[email protected] ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 9 17:59:50 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RAC (DBID=2505207930)

RMAN> run{
allocate channel c1 type disk connect sys/
[email protected]
; allocate channel c2 type disk connect sys/[email protected]; crosscheck backup; crosscheck archivelog all; sql 'alter system archive log current'; backup tag='cmd_data' database format '/rmanbackup/CDM2> /%d_%T_%s.data'; backup tag='cdm_arch' archivelog all format '/rmanbackup/CDM/%d_%T_%s.arch'; backup current controlfile format '/rmanbackup/CDM/%d_%T_%s.ctl'; backup spfile format '/rmanbackup/CDM/%d_%T_%s.spf'; crosscheck backup; delete noprompt expired backup; delete noprompt backup completed before 'sysdate -3'; crosscheck archivelog all; delete noprompt archivelog until time 'sysdate-3'; release channel c1;3> release channel c2; }4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> using target database control file instead of recovery catalog allocated channel: c1 channel c1: SID=32 instance=RAC1 device type=DISK allocated channel: c2 channel c2: SID=30 instance=RAC2 device type=DISK specification does not match any backup in the repository specification does not match any archived log in the repository sql statement: alter system archive log current Starting backup at 09-OCT-18 channel c1: starting full datafile backup set channel c1: specifying datafile(s) in backup set input datafile file number=00002 name=+ASMDISK/rac/datafile/sysaux.257.917225827 input datafile file number=00004 name=+ASMDISK/rac/datafile/users.259.917225827 channel c1: starting piece 1 at 09-OCT-18 channel c2: starting full datafile backup set channel c2: specifying datafile(s) in backup set input datafile file number=00001 name=+ASMDISK/rac/datafile/system.256.917225827 input datafile file number=00003 name=+ASMDISK/rac/datafile/undotbs1.258.917225827 input datafile file number=00005 name=+ASMDISK/rac/datafile/undotbs2.267.917226053 channel c2: starting piece 1 at 09-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_1.data tag=CMD_DATA comment=NONE channel c1: backup set complete, elapsed time: 00:00:46 channel c1: starting 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-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_3.data tag=CMD_DATA comment=NONE channel c1: backup set complete, elapsed time: 00:00:04 channel c1: starting 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-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_4.data tag=CMD_DATA comment=NONE channel c1: backup set complete, elapsed time: 00:00:04 channel c2: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_2.data tag=CMD_DATA comment=NONE channel c2: backup set complete, elapsed time: 00:00:52 Finished backup at 09-OCT-18 Starting backup at 09-OCT-18 current log archived channel c1: starting archived log backup set channel c1: specifying archived log(s) in backup set input archived log thread=2 sequence=62 RECID=2 STAMP=989085627 input archived log thread=1 sequence=124 RECID=1 STAMP=989085626 channel c1: starting piece 1 at 09-OCT-18 channel c2: starting archived log backup set channel c2: specifying archived log(s) in backup set input archived log thread=1 sequence=125 RECID=3 STAMP=989085721 input archived log thread=2 sequence=63 RECID=4 STAMP=989085721 channel c2: starting piece 1 at 09-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_5.arch tag=CDM_ARCH comment=NONE channel c1: backup set complete, elapsed time: 00:00:02 channel c2: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_6.arch tag=CDM_ARCH comment=NONE channel c2: backup set complete, elapsed time: 00:00:07 Finished backup at 09-OCT-18 Starting backup at 09-OCT-18 channel c1: starting 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-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_7.ctl tag=TAG20181009T180218 comment=NONE channel c1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-OCT-18 Starting backup at 09-OCT-18 channel c1: starting 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-OCT-18 channel c1: finished piece 1 at 09-OCT-18 piece handle=/rmanbackup/CDM/RAC_20181009_8.spf tag=TAG20181009T180224 comment=NONE channel c1: backup set complete, elapsed time: 00:00:01 Finished backup at 09-OCT-18 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_1.data RECID=1 STAMP=989085633 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_3.data RECID=2 STAMP=989085687 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_4.data RECID=3 STAMP=989085694 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_5.arch RECID=5 STAMP=989085723 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_7.ctl RECID=7 STAMP=989085742 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_8.spf RECID=8 STAMP=989085744 Crosschecked 6 objects crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_2.data RECID=4 STAMP=989085666 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/rmanbackup/CDM/RAC_20181009_6.arch RECID=6 STAMP=989085724 Crosschecked 2 objects specification does not match any backup in the repository specification does not match any backup in the repository validation succeeded for archived log archived log file name=+ASMDISK/rac/archivelog/2018_10_09/thread_1_seq_124.273.989085623 RECID=1 STAMP=989085626 validation succeeded for archived log archived log file name=+ASMDISK/rac/archivelog/2018_10_09/thread_1_seq_125.275.989085719 RECID=3 STAMP=989085721 validation succeeded for archived log archived log file name=+ASMDISK/rac/archivelog/2018_10_09/thread_2_seq_62.274.989085627 RECID=2 STAMP=989085627 validation succeeded for archived log archived log file name=+ASMDISK/rac/archivelog/2018_10_09/thread_2_seq_63.276.989085721 RECID=4 STAMP=989085721 Crosschecked 4 objects List of Archived Log Copies for database with db_unique_name RAC ===================================================================== Key Thrd Seq S Low Time ------- ---- ------- - --------- 2 2 62 A 01-OCT-18 Name: +ASMDISK/rac/archivelog/2018_10_09/thread_2_seq_62.274.989085627 deleted archived log archived log file name=+ASMDISK/rac/archivelog/2018_10_09/thread_2_seq_62.274.989085627 RECID=2 STAMP=989085627 Deleted 1 objects released channel: c1 released channel: c2 RMAN>

通過以上的RMAN log,可以看到不同的通道,產生了不同的備份檔案:
通道1 ,備份的是sysaux和users表空間 ,生成的備份檔案是RAC_20181009_1.data、RAC_20181009_3.data,RAC_20181009_4.data,RAC_20181009_5.arch,RAC_20181009_7.ctl,RAC_20181009_8.spf
通道2 ,備份的是system,undotbs1,undotbs2 表空間。生成的備份檔案是RAC_20181009_2.data,RAC_20181009_6.arch,

在兩個節點上檢視產生的備份檔案,與上面各個通道產生的備份檔案吻合(也就是說,備份檔案分散到了不同的節點上)
-- 節點1   ,注意檔案後面的1-8序號

[[email protected] CDM]$ ll
total 908620
-rw-r----- 1 oracle oinstall 889077760 Oct  9 18:01 RAC_20181009_1.data
-rw-r----- 1 oracle oinstall  18546688 Oct  9 18:01 RAC_20181009_3.data
-rw-r----- 1 oracle oinstall     98304 Oct  9 18:01 RAC_20181009_4.data
-rw-r----- 1 oracle oinstall   4051456 Oct  9 18:02 RAC_20181009_5.arch
-rw-r----- 1 oracle oinstall  18546688 Oct  9 18:02 RAC_20181009_7.ctl
-rw-r----- 1 oracle oinstall     98304 Oct  9 18:02 RAC_20181009_8.spf
[[email protected] CDM]$ 

--節點2

[[email protected] CDM]$ ll
total 653196
-rw-r----- 1 oracle oinstall 668852224 Oct  9 18:01 RAC_20181009_2.data
-rw-r----- 1 oracle oinstall     14336 Oct  9 18:02 RAC_20181009_6.arch
[[email protected] CDM]$ 

RMAN上驗證:
-- 節點2上登入RMAN,查看錶空間sysaux的備份,顯示備份檔案是/rmanbackup/CDM/RAC_20181009_1.data

[[email protected] CDM]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Tue Oct 9 18:14:40 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RAC (DBID=2505207930)

RMAN> list backup of tablespace sysaux;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    847.88M    DISK        00:00:44     09-OCT-18      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: CMD_DATA
        Piece Name: /rmanbackup/CDM/RAC_20181009_1.data
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 7402886    09-OCT-18 +ASMDISK/rac/datafile/sysaux.257.917225827

RMAN> 

-- 在節點2上進行檢視該檔案,是不存在的,因為該檔案在節點1上。

[[email protected] u01]# ll /rmanbackup/CDM/RAC_20181009_1.data
ls: cannot access /rmanbackup/CDM/RAC_20181009_1.data: No such file or directory
[[email protected] u01]# 

[[email protected] CDM]$ ll /rmanbackup/CDM/RAC_20181009_1.data
-rw-r----- 1 oracle oinstall 889077760 Oct  9 18:01 /rmanbackup/CDM/RAC_20181009_1.data
[[email protected] CDM]$ 

結論: 通過這樣的方式備份,分配通道到了不同的節點上。會在不同的節點上產生備份,但是每個節點上的備份不是一個完整的資料庫備份。其實是把一個數據庫的備份檔案,分散到了兩個節點上。

END