镜像复制(Image Copies): 镜像复制实际上就是创建数据文件、控制文件或归档文件的备份文件,与用户通过操作系统命令创建的备份一样(甚至连执行的命令都相同,RMAN镜像复制使用COPY命令,Windows下复制文件也用COPY命令,Linux/UNIX下则是用cp命令),只不过RMAN是利用目标数据库中的服务进程来完成文件复制,而用户则是用操作系统命令。这种方式本质仍是复制数据库中的物理文件,包括数据文件、控制文件等,复制出的文件与原始文件一模一样,所以镜像复制的方式体现不出RMAN的优势。 如何查看当前的备份方式
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name PTIAN 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 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'E:\APP\TIANPAN\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFPTIAN.ORA'; # default
RMAN> 红色部分的配置说明当前的备份方式为备份集备份。 CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default 不改变RMAN的配置,也可以直接以镜像复制的方式备份,命令为: RMAN> backup as copy database;
Starting backup at 08-JUL-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=72 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=E:\APP\TIANPAN\ORADATA\PTIAN\SYSTEM01.DBF
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\DATAFILE\O1_MF_SYSTEM_BSTBH904_.DBF tag=TAG20150708T214720 RECID=2 STAMP=884555266
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=E:\APP\TIANPAN\ORADATA\PTIAN\SYSAUX01.DBF
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\DATAFILE\O1_MF_SYSAUX_BSTBJDFQ_.DBF tag=TAG20150708T214720 RECID=3 STAMP=884555292
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=E:\APP\TIANPAN\ORADATA\PTIAN\UNDOTBS01.DBF
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\DATAFILE\O1_MF_UNDOTBS1_BSTBK5V1_.DBF tag=TAG20150708T214720 RECID=4 STAMP=884555305
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=E:\APP\TIANPAN\ORADATA\PTIAN\EXAMPLE01.DBF
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\DATAFILE\O1_MF_EXAMPLE_BSTBKF80_.DBF tag=TAG20150708T214720 RECID=5 STAMP=884555312
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\CONTROLFILE\O1_MF_TAG20150708T214720_BSTBKJJC_.CTL tag=TAG20150708T214720 RECID=6 STAMP=884555313
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=E:\APP\TIANPAN\ORADATA\PTIAN\USERS01.DBF
output file name=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\DATAFILE\O1_MF_USERS_BSTBKKVB_.DBF tag=TAG20150708T214720 RECID=7 STAMP=884555314
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-JUL-15
channel ORA_DISK_1: finished piece 1 at 08-JUL-15
piece handle=E:\APP\TIANPAN\FLASH_RECOVERY_AREA\PTIAN\BACKUPSET\2015_07_08\O1_MF_NNSNF_TAG20150708T214720_BSTBKM7K_.BKP tag=TAG20150708T214720 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-JUL-15
RMAN> 当然你也可以修改RMAN的配置: MAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COPY;
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO COPY;
new RMAN configuration parameters are successfully stored
RMAN> 配置备份类型的命令:
To configure the default type of backup:
-
Start RMAN and connect to a target database and a recovery catalog (if used).
-
Configure backup sets or image copies as the default backup type.
The following examples configure the backup type for disk backups to copies and backup sets:
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY; # image copies CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; # uncompressed
The following examples configure compression for backup sets:
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET; CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;