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.

相关推荐
matianlongg1 天前
实战工具:用 ffmpeg-skill 在本地给编码 Agent 装上视频编辑器
ffmpeg·视频编辑·agent skill·ffmpeg-skill·本地剪辑
JonaHu2 天前
博客转视频总返工?用章节清单、样片和 FFmpeg 搭一条可控流水线
ffmpeg·ai视频·内容创作·acedatacloud
StarsGreen7 天前
ffmpeg中常用结构体以及函数简介以及版本变化情况
ffmpeg
大飞哥软件自习室8 天前
视频批量截图并自动拼图是怎么做的:从四步向导、三种截帧模式到等距抽样与日志兜底的实现拆解,附 FFmpeg 调用与线程模型说明
ffmpeg·音视频·批量截图
todoitbo9 天前
把 K-Lite「什么都能播」搬上鸿蒙 PC:影匣播放器的 FFmpeg + libass 原生移植实录
华为·ffmpeg·harmonyos·鸿蒙
FlightYe10 天前
音视频修炼之容器与协议(四):RTSP详解
android·linux·ffmpeg·音视频·dash
架构师伯子明12 天前
ffmpeg学习4:opencv在音视频领域常用指令
opencv·学习·ffmpeg
Android系统攻城狮12 天前
Linux FFmpeg深度解析之avio_open调用流程与实战(三十八)
linux·运维·服务器·ffmpeg·音视频进阶·ffmpeg音视频
Android系统攻城狮13 天前
Linux FFmpeg深度解析之av_guess_format调用流程与实战(三十六)
linux·运维·服务器·ffmpeg·ffmpeg音视频进阶
Android系统攻城狮14 天前
Linux FFmpeg深度解析之av_write_frame调用流程与实战(三十三)
linux·运维·服务器·ffmpeg·音视频进阶·ffmpeg音视频