Rman 管理 archivelog 的命令


  

因為archivelog的相關信息是記錄在controlfile中的,當物理刪除后不會改變controlfile的設置。並且在查詢相關的動態視圖(例如v$archived_log)時,該部分日志仍然標注為存在,也就是說

Oracle並不認為這些日志被刪除了。

這種錯誤信息會導致在rman在備份archivelog終止,出現不能完成備份,並且阻塞后續的備份操作。

一、直接使用RMAN刪除archivelog
RMAN>crosscheck  archivelog all;
RMAN>delete noprompt archivelog until time 'sysdate-3';
刪除三天前的歸檔日志,不經過提示、直接刪除。

或者
RMAN>delete archivelog all completed before 'sysdate3';

二、使用RMAN備份archivelog之后,進行刪除動作。
RMAN>backup format '/backup/archlog_%T_%s_%U' archivelog all delete input;


RMAN>backup format '/backup/archlog_%T_%s_%U' archivelog all delete all input;
這個表示備份所有的archivelog之后,刪除所有路徑下archivelog 因為有些庫的archivelog 是多份的。

或者在備份database的語句中加上plus archivelog;
RMAN>backup database plus archivelog;

三、如果是在OS層手工進行了archivelog或者文件丟失。
先進行archivelog 交叉檢查
RMAN>crosscheck archivelog all;
RMAN>delete noprompt expired archivelog all;

四、查出某個時間段所涉及到的archivelog;
RMAN>list backup of archivelog time between "to_date('2012-04-12 12:00:00','yyyy-mm-dd,hh24:mi:ss')"  and "to_date('2012-04-25 12:00:00','yyyy-mm-dd hh24:mi:ss')";

根據以上查出的類容,我們就可以通過備份還原出archivelog
RMAN>restore archivelog from logseq 11111 until logseq 11150;

五、與archivelog相關的命令

RMAN>crosscheck archivelog all;        -----交叉檢查歸檔日志信息。
RMAN>list expired archivelog all;         -----列出所有過期的歸檔日志信息。
RMAN>list archivelog all;                -----查看當前歸檔日志列表信息。
RMAN>list archivelog from time='sysdate-2';       -----查看至今兩天的日志信息。
RMAN>backup archivelog all  format '/u03/rman/arch_log_%d_%T_%s_%p';           -------備所有歸檔。
RMAN>backup as compressed backupset  archivelog all  format '/u03/rman/arch_log_%d_%T_%s_%p';       -------采用壓縮,備所有歸檔。
RMAN>backup archivelog from time 'sysdate-3';       -------備份3天以來的歸檔日志。
RMAN>backup archivelog from sequence 5;       -------從日志序列是5的開始備份。
RMAN>backup archivelog from sequence 5 until sequence 10;     -------備份日志序列從5到10的日志。
RMAN>backup archivelog all delete all input;       --------備份完所有的日志后,刪除所有歸檔目錄的日志。
RMAN>delete noprompt expired archivelog all;       --------刪除過期的archivelog
RMAN>restore archivelog all;         --------還原所有的archivelog日志
RMAN>restore archivelog all preview;        --------不真實還原,只是預覽操作
RMAN>delete  archivelog all;         --------刪除所有的archivelog日志
RMAN>restore archivelog from logseq 11111 until logseq 11150;     -------還原某個段的archivelog日志
RMAN>restore archivelog from sequence 36 until sequence 50;
RMAN>restore archivelog low sequence 36 high sequence 50;
RMAN>restore archivelog time between "to_date('2012-04-22 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2012-04-26 16:20:00','yyyy-mm-dd hh24:mi:ss')" preview;
RMAN>restore archivelog time between "to_date('2012-04-22 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2012-04-26 16:20:00','yyyy-mm-dd hh24:mi:ss')" ;

指定archivelog的恢復目的地,如你想把archivelog恢復到一個臨時目錄時有用
RMAN>run {
set archivelog destination to '/home/temp';
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM