论坛首页 综合技术论坛

RMAN跳过read only表空间备份

浏览 2996 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2010-11-20   最后修改:2010-11-20
rman自身提供了跳过read only,offline等表空间的备份,具体语法如下:
RMAN> RUN
{
  SET MAXCORRUPT FOR DATAFILE 1 TO 10;
  BACKUP DATABASE
    SKIP INACCESSIBLE
    SKIP READONLY
    SKIP OFFLINE;
}
但也可以通过参数设置再次备份时跳过read only表空间备份,以下为测试过程,注意黑体部分
引用
[ora11g@mchz ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on Sat Nov 20 12:47:18 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP

SQL> alter tablespace users read only;

Tablespace altered.

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name DB11G are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BZIP2'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/ora11g/app/product/11.1/dbs/snapcf_db11g.f'; # default

RMAN> CONFIGURE BACKUP OPTIMIZATION ON;

new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored

RMAN> backup database; 

Starting backup at 20-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=143 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=00002 name=/opt/ora11g/oradata/db11g/sysaux01.dbf
input datafile file number=00001 name=/opt/ora11g/oradata/db11g/system01.dbf
input datafile file number=00003 name=/opt/ora11g/oradata/db11g/undotbs01.dbf
input datafile file number=00004 name=/opt/ora11g/oradata/db11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 20-NOV-10
channel ORA_DISK_1: finished piece 1 at 20-NOV-10
piece handle=/opt/ora11g/flash_recovery_area/DB11G/backupset/2010_11_20/o1_mf_nnndf_TAG20101120T125122_6ggnyjnf_.bkp tag=TAG20101120T125122 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 20-NOV-10
channel ORA_DISK_1: finished piece 1 at 20-NOV-10
piece handle=/opt/ora11g/flash_recovery_area/DB11G/backupset/2010_11_20/o1_mf_ncsnf_TAG20101120T125122_6ggo210p_.bkp tag=TAG20101120T125122 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 20-NOV-10

RMAN> CONFIGURE RETENTION POLICY TO NONE;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO NONE;
new RMAN configuration parameters are successfully stored

RMAN> backup database; 

Starting backup at 20-NOV-10
using channel ORA_DISK_1
skipping datafile 4; already backed up 1 time(s)

channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/opt/ora11g/oradata/db11g/sysaux01.dbf
input datafile file number=00001 name=/opt/ora11g/oradata/db11g/system01.dbf
input datafile file number=00003 name=/opt/ora11g/oradata/db11g/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 20-NOV-10
channel ORA_DISK_1: finished piece 1 at 20-NOV-10
piece handle=/opt/ora11g/flash_recovery_area/DB11G/backupset/2010_11_20/o1_mf_nnndf_TAG20101120T125943_6ggog50n_.bkp tag=TAG20101120T125943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:56
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 20-NOV-10
channel ORA_DISK_1: finished piece 1 at 20-NOV-10
piece handle=/opt/ora11g/flash_recovery_area/DB11G/backupset/2010_11_20/o1_mf_ncsnf_TAG20101120T125943_6ggokz7m_.bkp tag=TAG20101120T125943 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-NOV-10


顺便提一句,在数据库非归档模式下,可以对read only,offline的表空间进行备份,原理不过多表述了。
引用
SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            /tmp
Oldest online log sequence     1134
Current log sequence           1136

SQL>  alter tablespace users read only;

Tablespace altered.

RMAN> backup tablespace users;

Starting backup at 20-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=140 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=00004 name=/opt/ora11g/oradata/db11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 20-NOV-10
channel ORA_DISK_1: finished piece 1 at 20-NOV-10
piece handle=/opt/ora11g/flash_recovery_area/DB11G/backupset/2010_11_20/o1_mf_nnndf_TAG20101120T140944_6ggskglt_.bkp tag=TAG20101120T140944 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-NOV-10
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics