BACKUP OPTIMIZATION OFF 确保rman备份含有所有文件

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the
Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual
environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Tablespace Name: READONLY

Segment Name: TABLE_READONLY

**********

Read only tablespaces are not included in the backup if the configure parameter backup optimization is ON.

CHANGES

CAUSE

If backup optimization is ON then RMAN will take one backup of readonly tablespace and latter skip it from being the part of backup.

C:\Users> sqlplus "/ as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Wed Oct 5 18:55:48 2011

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create tablespace readonly datafile 'D:\<path>\ORADATA\<dbname>\readonly.dbf' size 10m;

Tablespace created.

SQL> conn <userid>/<password>;

Connected.

SQL> create table table_readonly tablespace readonly as select * from sys.dba_users;

Table created.

SQL> conn sys as sysdba

Enter password:

Connected.

SQL> select tablespace_name, bytes/1024 from dba_segments where segment_name='TABLE_READONLY';

TABLESPACE_NAME BYTES/1024


READONLY 64

SQL> alter tablespace readonly read only;

Tablespace altered.

SQL> exit;

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

rman configuration parameters are

C:\Users\>rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Oct 5 19:01:23 2011

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

connected to target database: <dbname> (DBID=1290132590)

RMAN> show all;

using target database control file instead of recovery catalog

RMAN configuration parameters for database with db_unique_name <dbname> are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default

CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP ON;

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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\<path>\DATABASE\SNCF<dbname>.ORA'; # default

Taking the backup of the database first time.

RMAN> backup database plus archivelog;

Starting backup at 05-OCT-11

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=36 RECID=34 STAMP=763758533

input archived log thread=1 sequence=37 RECID=35 STAMP=763759232

channel ORA_DISK_1: starting piece 1 at 05-OCT-11

channel ORA_DISK_1: finished piece 1 at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_ANNNN_TAG20111005T192032_78RR59BR_.BKP tag=TAG20111005T192032 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 05-OCT-11

Starting backup at 05-OCT-11

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=00001 name=D:\<path>\ORADATA\<dbname>\SYSTEM01.DBF

input datafile file number=00002 name=D:\<path>\ORADATA\<dbname>\SYSAUX01.DBF

input datafile file number=00005 name=D:\<path>\ORADATA\<dbname>\EXAMPLE01.DBF

input datafile file number=00003 name=D:\<path>\ORADATA\<dbname>\UNDOTBS01.DBF

input datafile file number=00006 name=D:\<path>\ORADATA\<dbname>\RMAN.DBF

input datafile file number=00007 name=D:\<path>\ORADATA\<dbname>\READONLY.DBF

input datafile file number=00004 name=D:\<path>\ORADATA\<dbname>\USERS01.DBF

channel ORA_DISK_1: starting piece 1 at 05-OCT-11

channel ORA_DISK_1: finished piece 1 at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T192034_78RR5CH9_.BKP tag=TAG20111005T192034 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55

Finished backup at 05-OCT-11

Starting backup at 05-OCT-11

current log archived

using channel ORA_DISK_1

channel ORA_DISK_1: starting archived log backup set

channel ORA_DISK_1: specifying archived log(s) in backup set

input archived log thread=1 sequence=38 RECID=36 STAMP=763759290

channel ORA_DISK_1: starting piece 1 at 05-OCT-11

channel ORA_DISK_1: finished piece 1 at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_ANNNN_TAG20111005T192130_78RR730L_.BKP tag=TAG20111005T192130 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02

Finished backup at 05-OCT-11

Starting Control File and SPFILE Autobackup at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\AUTOBACKUP\2011_10_05\O1_MF_S_763759292_78RR75GR_.BKP comment=NONE

Finished Control File and SPFILE Autobackup at 05-OCT-11

RMAN> list backup of tablespace "READONLY";

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time


35 Full 1.10G DISK 00:00:48 05-OCT-11

BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20111005T192034

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T192034_78RR5CH9_.BKP

List of Datafiles in backup set 35

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


38 Full 1.10G DISK 00:00:50 05-OCT-11

BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20111005T193048

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193048_78RRRKGT_.BKP

List of Datafiles in backup set 38

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

After enabling the backup optimization

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 05-OCT-11

using channel ORA_DISK_1
skipping datafile 7; already backed up 2 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=00001 name=D:\<path>\ORADATA\<dbname>\SYSTEM01.DBF

input datafile file number=00002 name=D:\<path>\ORADATA\<dbname>\SYSAUX01.DBF

input datafile file number=00005 name=D:\<path>\ORADATA\<dbname>\EXAMPLE01.DBF

input datafile file number=00003 name=D:\<path>\ORADATA\<dbname>\UNDOTBS01.DBF

input datafile file number=00006 name=D:\<path>\ORADATA\<dbname>\RMAN.DBF

input datafile file number=00004 name=D:\<path>\ORADATA\<dbname>\USERS01.DBF

channel ORA_DISK_1: starting piece 1 at 05-OCT-11

channel ORA_DISK_1: finished piece 1 at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193749_78RS5PD9_.BKP tag=TAG20111005T193749 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55

Finished backup at 05-OCT-11

Starting Control File and SPFILE Autobackup at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\AUTOBACKUP\2011_10_05\O1_MF_S_763760325_78RS7GCH_.BKP comment=NONE

Finished Control File and SPFILE Autobackup at 05-OCT-11

In the above logs readonly tablespace is not included..same can be verified the logs too.

RMAN> list backup of tablespace "READONLY";

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time


35 Full 1.10G DISK 00:00:48 05-OCT-11

BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20111005T192034

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T192034_78RR5CH9_.BKP

List of Datafiles in backup set 35

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


38 Full 1.10G DISK 00:00:50 05-OCT-11

BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20111005T193048

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193048_78RRRKGT_.BKP

List of Datafiles in backup set 38

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

But you can see the normal tablespace (read write) users is included in the backup.

Listing backup of READ WRITE tablespace such as users,

RMAN> list backup of tablespace "USERS";

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time


30 Full 1.10G DISK 00:00:49 04-OCT-11

BP Key: 30 Status: EXPIRED Compressed: NO Tag: TAG20111004T152050

Piece Name: D:\TRACABC.BKUP

List of Datafiles in backup set 30

File LV Type Ckp SCN Ckp Time Name


4 Full 1560831 04-OCT-11 D:\<path>\ORADATA\<dbname>\USERS01.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


35 Full 1.10G DISK 00:00:48 05-OCT-11

BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20111005T192034

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T192034_78RR5CH9_.BKP

List of Datafiles in backup set 35

File LV Type Ckp SCN Ckp Time Name


4 Full 1617400 05-OCT-11 D:\<path>\ORADATA\<dbname>\USERS01.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


38 Full 1.10G DISK 00:00:50 05-OCT-11

BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20111005T193048

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193048_78RRRKGT_.BKP

List of Datafiles in backup set 38

File LV Type Ckp SCN Ckp Time Name


4 Full 1618128 05-OCT-11 D:\<path>\ORADATA\<dbname>\USERS01.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


40 Full 1.10G DISK 00:00:46 05-OCT-11

BP Key: 40 Status: AVAILABLE Compressed: NO Tag: TAG20111005T193749

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193749_78RS5PD9_.BKP

List of Datafiles in backup set 40

File LV Type Ckp SCN Ckp Time Name


4 Full 1618783 05-OCT-11 D:\<path>\ORADATA\<dbname>\USERS01.DBF

Now with OPTIMIZATION OFF

running the full database backup also will let readonly tablespace again be part of it.

RMAN> CONFIGURE BACKUP OPTIMIZATION off ;

RMAN> backup database;

Starting backup at 05-OCT-11

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=00001 name=D:\<path>\ORADATA\<dbname>\SYSTEM01.DBF

input datafile file number=00002 name=D:\<path>\ORADATA\<dbname>\SYSAUX01.DBF

input datafile file number=00005 name=D:\<path>\ORADATA\<dbname>\EXAMPLE01.DBF

input datafile file number=00003 name=D:\<path>\ORADATA\<dbname>\UNDOTBS01.DBF

input datafile file number=00006 name=D:\<path>\ORADATA\<dbname>\RMAN.DBF

input datafile file number=00007 name=D:\<path>\ORADATA\<dbname>\READONLY.DBF

input datafile file number=00004 name=D:\<path>\ORADATA\<dbname>\USERS01.DBF

channel ORA_DISK_1: starting piece 1 at 05-OCT-11

channel ORA_DISK_1: finished piece 1 at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T200427_78RTQNF0_.BKP tag=TAG20111005T200427 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55

Finished backup at 05-OCT-11

Starting Control File and SPFILE Autobackup at 05-OCT-11

piece handle=D:\<path>\FLASH_RECOVERY_AREA\<dbname>\AUTOBACKUP\2011_10_05\O1_MF_S_763761923_78RTSCW2_.BKP comment=NONE

Finished Control File and SPFILE Autobackup at 05-OCT-11

RMAN> list backup of tablespace "READONLY";

List of Backup Sets

===================

BS Key Type LV Size Device Type Elapsed Time Completion Time


35 Full 1.10G DISK 00:00:48 05-OCT-11

BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20111005T192034

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T192034_78RR5CH9_.BKP

List of Datafiles in backup set 35

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


38 Full 1.10G DISK 00:00:50 05-OCT-11

BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20111005T193048

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T193048_78RRRKGT_.BKP

List of Datafiles in backup set 38

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


42 Full 1.07M DISK 00:00:01 05-OCT-11

BP Key: 42 Status: AVAILABLE Compressed: NO Tag: TAG20111005T195130

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T195130_78RSZC2R_.BKP

List of Datafiles in backup set 42

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

BS Key Type LV Size Device Type Elapsed Time Completion Time


44 Full 1.10G DISK 00:00:53 05-OCT-11

BP Key: 44 Status: AVAILABLE Compressed: NO Tag: TAG20111005T200427

Piece Name: D:\<path>\FLASH_RECOVERY_AREA\<dbname>\BACKUPSET\2011_10_05\O1_MF_NNNDF_TAG20111005T200427_78RTQNF0_.BKP

List of Datafiles in backup set 44

File LV Type Ckp SCN Ckp Time Name


7 Full 1615965 05-OCT-11 D:\<path>\ORADATA\<dbname>\READONLY.DBF

Note:


RMAN> BACKUP TABLESPACE READONLY ; # TABLESPACE backup does NOT use optimization

See REference:


Configuring the RMAN Environment

Oracle® Database Backup and Recovery User's Guide

11g Release 2 (11.2)

E10642-06

.

5 Configuring the RMAN Environment

.

Backup Optimization and the CONFIGURE command

....

RMAN uses backup optimization when the following conditions are true:

The CONFIGURE BACKUP OPTIMIZATION ON command has been run to enable backup optimization.

You run BACKUP DATABASE,
BACKUP ARCHIVELOG with ALL or LIKE options, or
BACKUP BACKUPSET ALL,
BACKUP RECOVERY AREA,
BACKUP RECOVERY FILES, or
BACKUP DATAFILECOPY.

...

Please note: -> rman> "BACKUP TABLESPACE" does not use optimization "

Conclusion: BACKUP OPTIMIZATION ON excludes backups of Read Only Tablespaces (as long as there is at least 1 backup of the Tablespace

SOLUTION

If one want to include the read only tablespace in the backup always then there is need to turn off the backup optimization.

相关推荐
yunhuibin1 小时前
ffmpeg面向对象——拉流协议匹配机制探索
学习·ffmpeg
cuijiecheng20187 小时前
音视频入门基础:FLV专题(13)——FFmpeg源码中,解析任意Type值的SCRIPTDATAVALUE类型的实现
ffmpeg·音视频
小神.Chen1 天前
YouTube音视频合并批处理基于 FFmpeg的
ffmpeg·音视频
昱禹3 天前
记一次因视频编码无法在浏览器播放、编码视频报错问题
linux·python·opencv·ffmpeg·音视频
寻找09之夏3 天前
【FFmpeg 深度解析】:全方位视频合成
ffmpeg·音视频
zanglengyu3 天前
ffmpeg取rtsp流音频数据保存声音为wav文件
ffmpeg·音视频
cuijiecheng20183 天前
音视频入门基础:FLV专题(11)——FFmpeg源码中,解析SCRIPTDATASTRING类型的ScriptDataValue的实现
ffmpeg·音视频
汪子熙3 天前
什么是 LDAC、SBC 和 AAC 音频编码技术
ffmpeg·音视频·aac
cpp_learners3 天前
Windows环境 源码编译 FFmpeg
windows·ffmpeg·源码编译·ffmpeg源码编译
cuijiecheng20184 天前
音视频入门基础:FLV专题(8)——FFmpeg源码中,解码Tag header的实现
ffmpeg·音视频