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.

相关推荐
lxkj_202410 小时前
使用线程局部存储解决ffmpeg中多实例调用下自定义日志回调问题
ffmpeg
runing_an_min14 小时前
ffmpeg视频滤镜:替换部分帧-freezeframes
ffmpeg·音视频·freezeframes
ruizhenggang15 小时前
ffmpeg本地编译不容易发现的问题 — Error:xxxxx not found!
ffmpeg
runing_an_min17 小时前
ffmpeg视频滤镜:提取缩略图-framestep
ffmpeg·音视频·framestep
韩曙亮1 天前
【FFmpeg】FFmpeg 内存结构 ③ ( AVPacket 函数简介 | av_packet_ref 函数 | av_packet_clone 函数 )
ffmpeg·音视频·avpacket·av_packet_clone·av_packet_ref·ffmpeg内存结构
oushaojun21 天前
ubuntu中使用ffmpeg和nginx推流rtmp视频
nginx·ubuntu·ffmpeg·rtmp
莫固执,朋友1 天前
网络抓包工具tcpdump 在海思平台上的编译使用
网络·ffmpeg·音视频·tcpdump
lxkj_20241 天前
修改ffmpeg实现https-flv内容加密
网络协议·https·ffmpeg
cuijiecheng20181 天前
音视频入门基础:MPEG2-TS专题(6)——FFmpeg源码中,获取MPEG2-TS传输流每个transport packet长度的实现
ffmpeg·音视频
VisionX Lab2 天前
数据脱敏工具:基于 FFmpeg 的视频批量裁剪
python·ffmpeg·音视频