[terry笔记]RMAN综合学习之配置
[terry笔记]RMAN综合学习之备份http://www.cnblogs.com/kkterry/p/3308405.html
[terry笔记]RMAN综合学习之恢复 http://www.cnblogs.com/kkterry/p/3308407.html
[terry笔记]RMAN综合学习之配置 http://www.cnblogs.com/kkterry/p/3308409.html
一、rman所有配置参数:
show all; /*如果配置后面有# default,则说明此项为默认,没有被修改过。*/ configure … clear; /*恢复默认。*/ CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
/*冗余策略,基于时间*/ CONFIGURE RETENTION POLICY TO redundancy n;
/*冗余策略,基于冗余数量*/ CONFIGURE BACKUP OPTIMIZATION OFF; # default
/*是否开启备份优化(只读表空间等不备份)*/ CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
/*默认向磁盘备份,可改为默认向磁带备份sbt*/ CONFIGURE CONTROLFILE AUTOBACKUP ON;
/*是否自动备份控制文件(备份任意对象时备份控制文件)*/ CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'c:\backup\%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
/*压缩,有basic、law、medium、high选项*/ CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
/*to applied on standby,归档删除策略,大多对DG使用,因为主节点的归档备份后想要删除,可能备节点还未使用,此参数限制主节点的归档不能轻易删除*/ CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'C:\U01\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFKKTERRY.ORA'; # default
/*在控制文件备份时,产生一个控制文件快照,以用来控制文件的读一致性*/
二、list查看备份信息:
1)list backup; 2)list backup of controlfile; 3)list backup of archivelog all; 4)list archivelog all; 5)list expired backup;
三、delete删除备份
1)delete obsolete; 通过冗余策略,删除过期备份。 2)delete expired backup; 需要先crosscheck,再删除无效备份 3)delete backupset n,n,n; 4)delete backup; 删除所有备份
四、crosscheck 用来检查备份,如果物理磁盘上存在,并且控制文件中有记录,则显示available,否则expired
1)crosscheck archivelog all; 2)crosscheck backup;
五、report 用来分析当前归档信息
1)report need backup; 2)report obsolete;
六、通道
1.手动分配通道: run{allocate channel c1 device type disk format '/xxx/xxx%U'; backup database;} /*手动分配通道allocate channel只能再run中出现。*/ 2.自动分配通道: /*如果没有手动分配通道,rman会按照配置信息自动分配通道。*/ CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; CONFIGURE DEFAULT DEVICE TYPE TO DISK;
七、复合备份 一次备份出多份
1)backup copies 3 database; /*会在默认目录多备份2份*/ 2)run{ set backup copies 2; backup device type disk format 'c:\backup\%U','c:\backup2\%U' database;} CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
八、备份集的大小 为了传输方便,或者某些操作系统不支持大文件,可以使用maxpiecesize=xxM参数指定最大的备份片段。
backup database maxpiecesize=200M;
九、as compressed backupset 备份集压缩(效果很明显)
backup as compressed backupset database format '/xxx/xxx/%T_%u';
十、命名
%T=yyyymmdd %u=唯一编号 %F=c-dbid-yyyymmdd-qq %U=%p_%u_%c %s=备份集号 %p=备份集中备份片段编号
十一、与rman有关的动态性能试图
v$archived_log
name 位置和名称
thread# 归档线程号(RAC下)
sequence# 归档序号
first_time 创建时间
creator 创建的进程(ARCH归档进程、FGRD前台进程、RMAN进程、SRMN备节点的rman进程、LGWR进程)
applied 是否被应用(DG下)
status (A正常、D已被删除、U已不存用、X失效,执行过crosscheck archivelog)
v$backup_set v$backup_set_details 备份集信息
当前创建的备份集信息
backup_type (L归档、D数据文件全备、I增量备份)
v$backup_piece v$backup_piece_details备份片段信息
set_stamp列可与v$backup_set.set_stamp关联
----------------------------------------------------------------------------------------------------------------------------
作者:terry
blog:http://www.cnblogs.com/kkterry/
Weibo:http://weibo.com/kkterry
E-mail:doubleginger@163.com
欢迎转载,还请标明出处!多谢多谢!
blog:http://www.cnblogs.com/kkterry/
Weibo:http://weibo.com/kkterry
E-mail:doubleginger@163.com
欢迎转载,还请标明出处!多谢多谢!