RMAN SHOW ALL 配置信息浅析
1. 显示当前的配置信息
1.01 RMAN> show all;
2. 常用的configure选项
2.01 保存策略 (retention policy)configure retention policy to recovery window of 7 days;
configure retention policy to redundancy 3; configure retention policy clear;
2.02 备份优化 backup optimization
configure backup optimization on;
configure backup optimization off;
configure backup optimization clear;
2.03 默认设备 default device type
configure default device type to disk; configure default device type to stb; configure default device type clear;
2.04 控制文件 controlfile configure controlfile autobackup on; configure controlfile autobackup format for device type disk to '/u02/backup/conf/ctl_%F';
configure controlfile autobackup clear; configrue controlfile autobackup format for device type disk clear; configrue snapshot controlfile name to '/u02/backup/snapcf/scontrofile.snp';
configrue snapshot controlfile name clear;
2.05 并行数(通道数) device type disk|stb pallelism n; configure device type disk|stb parallelism 2; configure device type disk|stb clear;
configure channel device type disk format '/u02/backup/rman_backup_%U'; configure channel device type disk maxpiecesize 100m configure channel device type disk rate 1200K configure channel 1 device type disk format '/u02/backup/rman_backup_%U'; configure channel 2 device type disk format '/u02/backup/rman_backup_%U'; configure channel 1 device type disk maxpiecesize 100m
2.06 生成备份副本 datafile|archivelog backup copies configure datafile backup copies for device type disk|stb to 3; configure archivelog backup copies for device type disk|stb to 3;
configure datafile|archivelog backup copies for device type disk|stb clear
BACKUP DEVICE TYPE DISK DATABASE FORMAT '/disk1/backup/%U'', '/disk2/backup/%U', '/disk3/backup/%U';
2.07 排除选项 exclude configure exclude for tablespace 'users'; configrue exclude clear;
2.08 备份集大小 maxsetsize configure maxsetsize to 1G|1000M|1000000K|unlimited; configure maxsetsize clear;
2.09 其它选项 auxiliary
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oracle/auxfiles/aux_2.f'; CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oracle/auxfiles/aux_3.f'
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oracle/auxfiles/aux_4.f'; CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR; CONFIGURE AUXNAME FOR DATAFILE 3 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR;
下面我将做一个简单的实验,在数据库结构发生重大改变时,将控制文件与参数文件的自动备份位置由flash_recovery_area转到/u02/backup/目录
实验环境:
SYSTEM: IBM AIX 5L ORACLE VERSION: 11gR2
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 14 07:54:13 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> select * from v$version; --查看数据库版本
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> archive log list; --查看DB是否处于归档模式
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL> show parameter recovery; --USE_DB_RECOVERY_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/flash_recovery
_area
db_recovery_file_dest_size big integer 3852M
recovery_parallelism integer 0
$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Thu Apr 14 08:03:58 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1276219506)
RMAN> show all; --查看当前的配置信息
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL 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 '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup/ctl_%F'; --更改控制文件和参数文件自动备份的位置
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup/ctl_%F';
new RMAN configuration parameters are successfully stored
RMAN> show all; --查看当前的配置信息
RMAN configuration parameters for database with db_unique_name ORCL 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 '/u02/backup/ctl_%F';
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 '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default
对数据库做一个全备,看看配置是否生效
RMAN> backup database format '/u02/backup/rman_all_%U';
Starting backup at 14-APR-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=199 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=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/orcl/app01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/app201.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 14-APR-11
channel ORA_DISK_1: finished piece 1 at 14-APR-11
piece handle=/u02/backup/rman_all_07m9o505_1_1 tag=TAG20110414T081045 comment=NONE --全备命令产生的piece
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:16
Finished backup at 14-APR-11
Starting Control File and SPFILE Autobackup at 14-APR-11
piece handle=/u02/backup/ctl_c-1276219506-20110414-05 comment=NONE --控制文件和参数文件自动备份产生的备份piece
Finished Control File and SPFILE Autobackup at 14-APR-11
实验结束,RMAN配置生效