rman 백업 명령

 、list  
1. List   RMAN       :
    1.1. list backup summary; --       
          list incarnation;--    
                     --              list               。
        B   backup
        A   Archivelog、 F   full backup、 0,1,2   incremental level  
        A     AVALIABLE、 X   EXPIRED
                       ,  
        list backup of database summary
        list backup of archivelog all summary
        list backup of tablespace users summary;
        list backup of datafile n,n,n summary
                          ,     。
    1.2.list backup by file;--          
           :      、      、      、SPFILE  
    1.3.list backup;
                    。
    1.4.list expired backup;
             
    1.5.list copy;
      copy  
    list copy of database;
    list copy of controlfile;
    list copy of tablespace users;
    list copy of datafile n,n,n;
    list copy of archivelog all;
    list copy of archivelog from scn 10000;
    list copy of archivelog until sequence 12;
   
2. List        
    list backup of {archivelog, controlfile, database, datafile, spfile, tablespace};
    list backup of database; --full,incremental,tablespace,datafile
2.1       :
    list backup of spfile;
2.2     :
    list backup of controlfile;
2.3     :
    list backup of datafle n,n,n,n;
2.4   :
    list backup of tablespace tablespace_name;--      backup
2.5    :
    list backup of archivelog {all, from, high, like, logseq, low, scn, sequence, time, until};
    list backup of archivelog all;
    list backup of archivelog until time 'sysdate-1';
    list backup of archivelog from sequence 10;
    list backup of archivelog until sequence 10;
    list backup of archivelog from scn 10000;
    list backup of archivelog until scn 200000;
    list archivelog from scn 1000;
    list archivelog until scn 2000;
    list archivelog from sequence 10;
    list archivelog until sequence 12;
 、report        
report              、            。
      report obsolete; report schema;
report {device, need, obsolete, schema, unrecoverable}
report schema;
report obsolete;
report unrecoverable;
report need backup;
report need backup days=3; --    3         
report need backup redundancy=3; --        3     。
report need backup recovery window of 2 days;
report schema;---       
report obsolete;---         (       )。
report unrecoverable;---                 (            、              )
report need backup;---           (      )
report need backup days=3;
        --             (       ,           3          )
report need backup incremental=3;
        --                    。(     ,         3         )
report need backup redundancy=3;
        --         3     
        --         2     system01.dbf users01.dbf.
        -- 3   3         system01.dbf      , users01.dbf   3 
        --  ,           users01.dbf
        -- ,              n      
report need backup recovery window of 2 days;
        --       2          
 、backup        
    1.      
        backup database tag='full_bak1';
         :        ,                     。
    2.       (               ,        )
        backup database maxsetsize=100m tag='datafile1';
         :maxsetsize        。                 ,     。
      RMAN-06183: datafile or datafile copy larger than MAXSETSIZE: file# 1 /data/oradata/system01.dbf
    3.       (         )
        run {
        allocate channel c1 type disk maxpicecsize 100m format '/data/backup/full_0_%U_%T';
        backup database tag='full_0';
        release channel c1;
        }
           allocate             ,          。
            configure        。
        Configure channel device type disk maxpiecesize 100 m;
        configure channel device type disk clear;
    4.        
        backup database keep forever;                  --        
        backup database keep until time='sysdate+30'; --    30 
    5.  configure exclude  
        backup databas noexclude keep forever tag='test backup';
    6.       
        backup validate database;
          RMAN         /    ,        。
    7.    ,         
        backup database skip readonly;
        backup database skip offline;
        backup database skip inaccessible;
        backup database skip readonly skip offline skip inaccessible;
    8.    
        backup database force;
    9.              
        1>           
            backup database not backed up;
        2>  "        "          
            backup database not backed up since time='sysdate-2';
    10.            
        backup check logical database;
        backup validate check logical database;
    11.      
        backup database copies=2;
    12.      
        backup database device type disk includ current controlfile;
 、configure        
4.1          
4.1.1 RMAN> show all;
RMAN      :
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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:/ORACLE/PRODUCT/10.2.0/DB_1/DATABASE/S
NCFDBA.ORA'; # default
4.1.2   RMAN       :
    SQL> select name,value from v$rman_configuration;
4.2.    configure  
4.2.1      (retention policy)
   configure retention policy to recovery window of 7 days;
   configure retention policy to redundancy 5;
   configure retention policy clear;
CONFIGURE RETENTION POLICY TO NONE;
   recover window          ,                     。                   obsolete。
   redundancy              5      ,      5          redundancy。      1 。
   :NONE             ,Clear           
                  。
4.2.2      backup optimization
   configure backup optimization on;
   configure backup optimization off;
   configure backup optimization clear;
      ,    ,rman                        。
4.2.3      default device type
   configure default device type to disk;
   configure default device type to stb;
   configure default device type clear;
     I/O              ,      
      CONFIGURE DEFAULT DEVICE TYPE TO SBT;
4.3.4      controlfile
   configure controlfile autobackup on;
   configure controlfile autobackup format for device type disk to '/cfs01/backup/conf/conf_%F';
   configure controlfile autobackup clear;
   configrue controlfile autobackup format for device type disk clear;
   configrue snapshot controlfile name to '/cfs01/backup/snapcf/scontrofile.snp';
--                     ,               ,           。
   configrue snapshot controlfile name clear;
                                   ,      。           catalog   ,          。
4.3.5    (   ) 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 'e/:rmanback_%U';
   configure channel device type disk maxpiecesize 100m
   configure channel device type disk rate 1200K
    configure channel 1 device type disk format 'e/:rmanback_%U';
    configure channel 2 device type disk format 'e/:rmanback_%U';
    configure channel 1 device type disk maxpiecesize 100m
             。
4.3.6        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';
            copy  ,oracle                   。
4.3.7      exclude
   configure exclude for tablespace 'users';
   configrue exclude clear;
                    ,                。
4.3.8       maxsetsize
   configure maxsetsize to 1G|1000M|1000000K|unlimited;
   configure maxsetsize clear;
4.3.9      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;
 、delete  
                            ,       DELETE       ,        ,             。
    RMAN> delete backupset;
    RMAN> delete backupset n;
    RMAN> delete obsolete ;
    RMAN> delete obsolete redundancy 2;
    RMAN> delete noprompt copy;
    RMAN> delete noprompt backupset tag TAG20101016T143521;
    RMAN> delete obsolete recovery window of 7 days;
    RMAN> delete expired backupset;
    RMAN> delete expired copy;
    RMAN> delete expired archivelog all;
   RMAN> delete archivelog until time 'sysdate-5';
 、crosscheck  
                  ,      ,                  ,        。
RMAN          :
Expired:           。        expired  ,                expired  。
Available:        。        ,                。
Unavailable:         。        ,                 
    RMAN> crosscheck backupset;  
    RMAN> crosscheck copy;                 
    RMAN> crosscheck backup of controlfile;   
    RMAN> crosscheck backup of archivelog all;
    RMAN> crosscheck backup of datafile 1,2; 
    RMAN> crosscheck backup of tablespace sysaux,system;                    
    RMAN> crosscheck backup completed between '13-OCT-10' and '23-OCT-10';
    RMAN> crosscheck backupset 1067,1068;
 、validate  
                      。RMAN           ,      ,             ,validate  crosscheck         ,crosscheck             ,        ,validate        。
RMAN> validate backupset <primary key> [check logical]
 、change
1、       
        CHANGE BACKUPSET .. UNAVAILABLE/AVAILABLE            。
      RMAN>CHANGE BACKUPSET 22 UNAVAILABLE
 2、        
          :CHANGE DATAFILECOPY .. AVAILABLE/UNAVAILABLE
          :CHANGE CONTROLFILECOPY .. AVAILABLE/UNAVAILABLE
          :CHANGE ARCHIVELOG .. AVAILABLE/UNAVAILABLE
        :
       RMAN>CHANGE DATAFILECOPY 'D:\BACKUP\DEMO_37.BAK' UNAVAILABLE;
3、      
                      ,                             。          ,RMAN         
             ,    ,                。
        :CHANGE .. KEEP/NOKEEP
      (1)    156    
         RMAN>CHANGE BACKUPSET 156 KEEP FOREVER LOGS;
      (2)    198  60 
         RMAN>CHANGE BACKUPSET 198 KEEP UNTIL TIME 'SYSDATE+60' LOGS;
      (3)     156     
         RMAN>CHANGE BACKUPSET 156 NOKEEP

좋은 웹페이지 즐겨찾기