Oracle11新特性——備份恢復功能增強(八)

yangtingkun發表於2007-12-07

打算寫一系列的文章介紹11g的新特性和變化。

Oracle11g在備份和恢復方面新增了很多的功能,無論是效能、功能性、安全性和可操作性方面都有了不同程度的提高。

這一篇介紹DATA GUARD整合性方面的提高。

Oracle11新特性——備份恢復功能增強(一):http://yangtingkun.itpub.net/post/468/412991

Oracle11新特性——備份恢復功能增強(二):http://yangtingkun.itpub.net/post/468/414647

Oracle11新特性——備份恢復功能增強(三):http://yangtingkun.itpub.net/post/468/414834

Oracle11新特性——備份恢復功能增強(四):http://yangtingkun.itpub.net/post/468/414941

Oracle11新特性——備份恢復功能增強(五):http://yangtingkun.itpub.net/post/468/416015

Oracle11新特性——備份恢復功能增強(六):http://yangtingkun.itpub.net/post/468/423531

Oracle11新特性——備份恢復功能增強(七):http://yangtingkun.itpub.net/post/468/426943


由於物理STANDBY相當於PRIMARY資料庫的備份,因此物理STANDBYPRIMARY資料庫可以共用一套備份。

在11g中,為了實現DATA GUARD環境中備份的通用性,rmanDATA GUARD環境整合方面有了很大的提高。

首先rman可以為DATA GUARD環境中的各個資料庫設定不同的配置。這個功能需要在CATALOG模式下實現,首先兩邊登陸RMAN並連線CATALOG註冊資料庫資訊:

[oracle@yangtk ~]$ rman target / catalog catalog_11g/CATALOG_11G

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Nov 8 10:52:33 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> backup spfile;

Starting backup at 08-NOV-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-NOV-07
channel ORA_DISK_1: finished piece 1 at 08-NOV-07
piece handle=/data1/backup/1ej0hbk3_1_1 tag=TAG20071108T105250 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-NOV-07

RMAN> exit


Recovery Manager complete.

登陸standby資料庫,同樣執行備份,來註冊資料庫資訊:

[oracle@yangtk2 ~]$ rman target / catalog catalog_11g/CATALOG_11G@ora11g_p

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Nov 30 23:00:36 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> backup spfile;

Starting backup at 30-NOV-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=145 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 30-NOV-07
channel ORA_DISK_1: finished piece 1 at 30-NOV-07
piece handle=/data1/backup/18j2cmgt_1_1 tag=TAG20071130T230045 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-NOV-07

RMAN> exit


Recovery Manager complete.

下面可以為不同db_unique_name設定不同的引數:

[oracle@yangtk ~]$ rman target / catalog catalog_11g/CATALOG_11G

Recovery Manager: Release 11.1.0.6.0 - Production on Thu Nov 8 10:44:35 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> configure controlfile autobackup on for db_unique_name all;


new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure controlfile autobackup format for device type disk to '/data1/backup/%F' for db_unique_name ora11g_p;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data1/backup/%F';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure controlfile autobackup format for device type disk to '/data1/%F' for db_unique_name ora11g_s;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data1/%F';
new RMAN configuration parameters are successfully stored

RMAN> show controlfile autobackup;

RMAN configuration parameters for database with db_unique_name ORA11G_P are:
CONFIGURE CONTROLFILE AUTOBACKUP ON;

RMAN> show controlfile autobackup format;

RMAN configuration parameters for database with db_unique_name ORA11G_P are:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data1/backup/%F';

RMAN> show controlfile autobackup format for db_unique_name all;


RMAN configuration parameters for database with db_unique_name ORA11G_P are:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data1/backup/%F';

RMAN configuration parameters for database with db_unique_name ORA11G_S are:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/data1/%F';

RMAN> backup tablespace yangtk;

Starting backup at 08-NOV-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
input datafile file number=00006 name=/data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf
channel ORA_DISK_1: starting piece 1 at 08-NOV-07
channel ORA_DISK_1: finished piece 1 at 08-NOV-07
piece handle=/data1/backup/1cj0hbh3_1_1 tag=TAG20071108T105114 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 08-NOV-07

Starting Control File and SPFILE Autobackup at 08-NOV-07
piece handle=/data1/backup/c-4026820313-20071108-00 comment=NONE
Finished Control File and SPFILE Autobackup at 08-NOV-07

下面登陸STANDBY資料庫執行備份:

[oracle@yangtk2 ~]$ rman target / catalog catalog_11g/CATALOG_11G@ora11g_p

Recovery Manager: Release 11.1.0.6.0 - Production on Fri Nov 30 22:58:53 2007

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

connected to target database: ORA11G (DBID=4026820313)
connected to recovery catalog database

RMAN> backup tablespace yangtk;

Starting backup at 30-NOV-07
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=142 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
input datafile file number=00006 name=/data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf
channel ORA_DISK_1: starting piece 1 at 30-NOV-07
channel ORA_DISK_1: finished piece 1 at 30-NOV-07
piece handle=/data1/backup/16j2cmdl_1_1 tag=TAG20071130T225901 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
Finished backup at 30-NOV-07

Starting Control File and SPFILE Autobackup at 30-NOV-07
piece handle=/data1/c-4026820313-20071130-00 comment=NONE
Finished Control File and SPFILE Autobackup at 30-NOV-07

有了這種方式,就可以根據主庫和備份的不同來設定不同的備份格式以及備份策略。

除了這個功能,11g還可以在standby controlfilecontrolfile檔案之間轉化,避免了create standby controlfile的步驟,這個例子在上面一篇文章中DUPLICATE FROM ACTIVE DATABASE建立STANDBY資料庫中已經展示過了。

另外,RMAN還可以設定備份專門為某個資料庫恢復之用,登陸PRIMARY資料庫,檢查剛才備份的表空間:

RMAN> list backup of tablespace yangtk;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
759 Full 196.27M DISK 00:00:27 08-NOV-07
BP Key: 760 Status: AVAILABLE Compressed: NO Tag: TAG20071108T105114
Piece Name: /data1/backup/1cj0hbh3_1_1
List of Datafiles in backup set 759
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
5 Full 4389571 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
6 Full 4389571 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf

登陸STANDBY資料庫檢查備份,並設定這個備份為主庫恢復所用:

RMAN> list backup of tablespace yangtk;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
813 Full 196.22M DISK 00:00:18 30-NOV-07
BP Key: 814 Status: AVAILABLE Compressed: NO Tag: TAG20071130T225901
Piece Name: /data1/backup/16j2cmdl_1_1
List of Datafiles in backup set 813
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
5 Full 4384953 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
6 Full 4384953 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf

RMAN> change backup of tablespace yangtk reset db_unique_name to ora11g_p;

change backup piece db_unique_name
backup piece handle=/data1/backup/16j2cmdl_1_1 RECID=30 STAMP=640047541
Changed 1 objects db_unique_name


RMAN> list backup of tablespace yangtk;


RMAN>

下面再檢查主庫備份:

RMAN> list backup of tablespace yangtk;


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


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
759 Full 196.27M DISK 00:00:27 08-NOV-07
BP Key: 760 Status: AVAILABLE Compressed: NO Tag: TAG20071108T105114
Piece Name: /data1/backup/1cj0hbh3_1_1
List of Datafiles in backup set 759
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
5 Full 4389571 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
6 Full 4389571 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf

BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
813 Full 196.22M DISK 00:00:18 30-NOV-07
BP Key: 814 Status: AVAILABLE Compressed: NO Tag: TAG20071130T225901
Piece Name: /data1/backup/16j2cmdl_1_1
List of Datafiles in backup set 813
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
5 Full 4384953 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3d3kn7k4_.dbf
6 Full 4384953 08-NOV-07 /data/oracle/oradata/ora11g/ORA11G_P/datafile/o1_mf_yangtk_3g73q02m_.dbf

相應的備份資訊已經出現在主庫中了。不過要進行恢復的話,仍然需要將備份複製到主站點上才可以。

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

相關文章