oracle 學習小結8

來源:互聯網
上載者:User

rman的一些常用小結。
1  備份
   rman target sys/sys@demo nocataglog
  rman>run {
configure channel device type disk maxpiecesize 400M;
        configure device type disk parallelism 3;(3通道)
      backup database format='d:\xxxx\xxx\%d_%s_%p.pak';   
     }

   list backup;

  rman>report schema;(查看方案)
  備份資料表空間:
       backup tablespace users format='d:\backup\rman\%N_%s.bak';
    列出情況:
     list backup of tablespace users;
    顯示備份配置
      show all;
   備份資料檔案和控制檔案:
      backup datafile 5 format='d:\xxx\xxx.dbf' include current controlfile;
   壓縮備份:
      backup as compressed backupset tablespace users format='d:\xxxx.dbf';

2  恢複
   恢複的路數其實和不用rman的真的差不多的,參加oracle 學習小結 7中,比如:
  A 恢複資料庫
    startup force mount 
      run
      {
       restore database;
       recover databse;
        sql 'alter database open';
      }
     如果所在磁碟故障,則對資料庫的每個資料檔案都用
      set newname for datafile 1 to 'c:\xxxx.dbf';
      .........
       restore database;
       switch datafile all;
        recover databse;
        sql 'alter database open';
      }
   B 恢複SYSTEM
        如果被刪除
         run
      {
       restore datafile 1;
       recover datafile 1;
        sql 'alter database open';
      }
     如果介質壞了的話
        startup force mount 
           run
      {
       set newname for datafile 1 to 'c:\xxxx.dbf';
       restore datafile 1;
        switch datafile 1;
       recover datafile 1;
        sql 'alter database open';
      }

   C  其他資料表空間的資料檔案損壞
        如果被刪除
          startup force mount 
           run
      {
       sql 'alter database datafile 1 offline'
       sql 'alter database open';
              restore datafile 1;
             recover datafile 1;
        sql 'alter database datafile 1 online';
      }
       如果介質壞了的話
 
        startup force mount 
           run
      {
       sql 'alter database datafile 1 offline'
       sql 'alter database open';
   set newname for datafile 1 to 'c:\xxxx.dbf';
                          restore datafile 1;

switch datafile 1;
             recover datafile 1;
        sql 'alter database datafile 1 online';
      }
    如果是資料表空間被刪除或介質損壞,原理和上面的差不多
      改為sql 'alter tablespace users offline for recover';

3  常用操作
     list backup of controlfile;
      list backup of archivelog all;
      list backup of spfile;
      核對所有備份組
        crosscheck backup;
        list backupset 備份組id;
        核對所有資料檔案備份組:
      crosscheck backup of database;
       crosscheck backup of tablespace users;
       crosscheck backup of datafile 4;
       crosscheck backup of controlfile;
       刪除陳舊備份:
          delete obsolete;
    
 
 
   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.