首页 > 代码库 > backup archivelog all

backup archivelog all

 OLTP系统的生产库一般都是打开归档模式,当CUD操作频繁并且时常使用大批量处理时,每天的归档日志也是超级大的,如果长期保留这些归档日志磁盘空间消耗是很恐怖的,所以我们在使用RMAN进行数据库备份时,将归档日志进行备份,来释放磁盘空间。
 
         
               备份归档日志方式:
                         单独备份归档日志:backup archivelog all
                         在执行备库时一起备份归档日志:backup database plus archivelog;
 
 
                         这两种方式有什么区别呢?
                        
                         运行backup archivelog all  命令时执行的步骤:
                           1.alter system archive log current;                           归档当前日志 
                           2.backup  archivelog all ;                                          备份所有归档日志
 
                         而运行backup database plus archivelog,的运行步骤是;
                            1.alter system archive log current;                         归档当前日志
                            2.backup archivelog all;                                       备份所有归档日志
                            3.backup database;                                                备份数据库
                            4.alter system archive log current;                          归档当前日志
                            5.backup archivelog recently generated ;               备份刚生成的归档日志
 
 
                
                 删除归档日志一般在备份归档日志同时加上一个参数:delete all input
                       例如:backup database plus archivelog delete all input;    执行此命令是会将所有的归档日志进行备份,并且在备份的同时删除已备份的归档日志。
 
 
                   
                 所以如果在RMAN备份脚本中有plus archivelog 参数 就无需在备份归档日志之前执行: sql ‘alter system archive log current‘;

backup archivelog all