RMAN備份學習筆記

來源:互聯網
上載者:User

講到rman就要講到catalog,也就是恢複目錄,這個東東我覺得沒有太大的用,如果資料庫沒有打到open狀態,恢複目錄資料庫根本串連不上。我個人建議可以不使用catalog資料庫,當然為了全面的瞭解rman,還是要簡單瞭解下catalog資料庫是用來做什麼的,catalog資料庫是專門供rman使用,用來儲存備份資訊(不是儲存備份檔案)及備份指令碼的地方。

如果我們不用catalog的時候,備份資訊就存放在控制檔案當中,這些備份資訊是做恢複的時候需要用到的資訊。
 
情景一:使用catalog資料庫
 
1.建立catalog資料表空間
create tablespace rman_ts
datafile ‘xxxxxxxx/rman_ts01.dbf’
size 10m;
 
2.建立rman使用者
create user rman identified by rman
 default tablespace rman_ts
 temporary tablespace temp
 quota unlimited on rman_ts
 
3.使用者授權
grant recovery_catalog_owner to rman
grant resource,connect to rman
 
4.在目錄資料庫中建立恢複目錄
rman catalog rman/rman
create catalog tablespace rman_ts
 
這個時候我們就可以正常使用catalog資料庫了,可以做下測試
[Oracle@ora10 ~]$ rman target / catalog rman/rman
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Mar 28 15:05:06 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: QDYX (DBID=3280546065)
connected to recovery catalog database
 
情景二:不使用恢複目錄
 
rman target /
 
做個全備份
run {
allocate channel n1 type disk;
allocate channel n2 type disk;
backup as compressed backupset database
format '/disk01/backup/ora10_%d_%s_%p';
release channel n1;
release channel n2;
}
 
做增量備份(差異增量)
run {
allocate channel c1 type disk;
backup incremental level 0
format '/disk01/backup/rmanbak/inc0_%u_%T'
database;
release channel c1;
}
 
備份資料檔案
backup datafile 8;
 
備份資料表空間
backup tablespace users;
 
備份歸檔日誌
backup archivelog all delete all input;
 
備份資料庫同時備份歸檔日誌,並刪除歸檔日誌
backup as compressed backupset database plus archivelog delete all input
format '/disk01/backup/ora10_%d_%s_%p';
 
注意:這裡可以使用run{}產生一段代碼,定製一些參數就行備份,也可以直接使用預設參數備份。在備份時如果不指定備份的路徑,則預設儲存在flash_recovery_area目錄下。

  • 1
  • 2
  • 3
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.