版权声明:转载请以链接形式注明出处 https://blog.csdn.net/pan_tian/article/details/46809327
通过RMAN有两种不同类型的备份方式:创建镜像复制和创建备份集。
备份集(Backup Sets):
为RMAN默认备份选项。备份集是RMAN创建的具有特定格式的逻辑备份对象,备份集在逻辑上由一个或多个备份片段(Backup Piece)组成,每个备份片段在物理上对应一个操作系统文件,一个备份片段中可能包含多个数据文件、控制文件或归档文件,括弧之一。通过RMAN创建备份集的优势在于,备份时只读取数据库中已经使用的数据块,因此不管是从备份效率,或是节省存储空间的角度,创建备份集的方式都更有优势。
镜像复制(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的配置:
RMAN> 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;
作者:田攀
来源:CSDN
原文:https://blog.csdn.net/pan_tian/article/details/46809327
版权声明:本文为博主原创文章,转载请附上博文链接!