ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle11新特性——备份恢复功能增强(八)

Oracle11新特性——备份恢复功能增强(八)

原创 Linux操作系统 作者:yangtingkun 时间:2007-12-07 00:00:00 0 删除 编辑

打算写一系列的文章介绍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/,如需转载,请注明出处,否则将追究法律责任。

下一篇: Oracle VM发布
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10355567