【Oracle】 rman 刪除歸檔日誌的命令
因為資料倉儲上asm的磁碟空間不足,需要刪除早期的歸檔日誌,檢視資料有以下兩種方式:
delete archivelog until time 'sysdate-N';
delete archivelog all completed before 'sysdate-N';
這兩個命令的差別在哪裡呢?
使用list 命令來檢視一下究竟...
RMAN> list archivelog until time 'sysdate-1';
using target database control file instead of recovery catalog
List of Archived Log Copies for database with db_unique_name YANGDB
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
459 1 463 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_463_762800109.log
460 1 464 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_464_762800109.log
461 1 465 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_465_762800109.log
462 1 466 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_466_762800109.log
463 1 467 A 09-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_467_762800109.log
464 1 468 A 09-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_468_762800109.log
465 1 469 A 10-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_469_762800109.log
466 1 470 A 11-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_470_762800109.log
467 1 471 A 11-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_471_762800109.log
468 1 472 A 12-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_472_762800109.log
469 1 473 A 13-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_473_762800109.log
470 1 474 A 13-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_474_762800109.log
471 1 475 A 14-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_475_762800109.log
472 1 476 A 15-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_476_762800109.log
歸檔日誌的序列號碼到476
RMAN> list archivelog all completed before 'sysdate-1';
List of Archived Log Copies for database with db_unique_name YANGDB
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
459 1 463 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_463_762800109.log
460 1 464 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_464_762800109.log
461 1 465 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_465_762800109.log
462 1 466 A 08-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_466_762800109.log
463 1 467 A 09-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_467_762800109.log
464 1 468 A 09-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_468_762800109.log
465 1 469 A 10-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_469_762800109.log
466 1 470 A 11-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_470_762800109.log
467 1 471 A 11-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_471_762800109.log
468 1 472 A 12-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_472_762800109.log
469 1 473 A 13-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_473_762800109.log
470 1 474 A 13-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_474_762800109.log
471 1 475 A 14-JAN-12 Name: /opt/oracle/yangdb_arch/yangdb_1_475_762800109.log
歸檔日誌的序列號碼到475
檢視v$archived_log 檢視從中獲取 時間和序列號資訊!
SYS@yangdb> select THREAD#,sequence#,FIRST_TIME,COMPLETION_TIME
2 from v$archived_log order by thread#,sequence#;
THREAD# SEQUENCE# FIRST_TIME COMPLETION_TIME
------- ---------- -------------- -------------------
1 470 2012-01-11 11:00:10 2012-01-11 22:08:23
1 471 2012-01-11 22:08:20 2012-01-12 17:00:10
1 472 2012-01-12 17:00:10 2012-01-13 02:00:28
1 473 2012-01-13 02:00:28 2012-01-13 22:09:56
1 474 2012-01-13 22:09:55 2012-01-14 22:01:02
1 475 2012-01-14 22:01:02 2012-01-15 06:46:14 ==list archivelog all completed 以COMPLETION_TIME為基準
1 476 2012-01-15 06:46:14 2012-01-30 14:10:18 ==list archivelog until 以FIRST_TIME 為基準 編號476的日誌橫跨15號和30號兩天,以first_time的值來擷取!
1 477 2012-01-30 14:10:15 2012-01-30 14:10:23
1 478 2012-01-30 14:10:22 2012-01-30 14:10:29
1 479 2012-01-30 14:10:28 2012-01-30 14:10:33
1 480 2012-01-30 14:10:32 2012-01-30 14:10:40
總結:
delete archivelog until time 'sysdate-N';
該命令刪除日誌時的時間基準是first_name
delete archivelog all completed before 'sysdate-N';
該命令刪除日誌時的時間基準是completion_time
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-715261/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman刪除歸檔日誌命令集
- 作用RMAN 刪除歸檔日誌
- RMAN delete archivelog命令刪除歸檔日誌及歸檔日誌拷貝deleteHive
- oracle刪除歸檔日誌Oracle
- Oracle歸檔日誌刪除Oracle
- rman刪除舊的歸檔日誌問題
- rman 刪除指定時間點的歸檔日誌
- 用rman 正確地刪除歸檔日誌
- 歸檔日誌的刪除
- oracle 刪除過期的歸檔日誌Oracle
- oracle rman不能自動刪除歸檔日誌備份解決Oracle
- 11gR2 RMAN歸檔日誌刪除策略
- 當ORACLE歸檔日誌滿後如何正確刪除歸檔日誌Oracle
- oracle dataguard 自動刪除歸檔日誌Oracle
- 刪除歸檔日誌檔案
- Oracle RMAN 清除歸檔日誌Oracle
- Oracle RMAN清除歸檔日誌Oracle
- RMAN刪除歸檔日誌時將ASM上空目錄同時刪除ASM
- 如何正確刪除ORACLE歸檔日誌檔案Oracle
- rman 刪除日誌的幾有用的命令
- oracle rman 刪除過期的歸檔Oracle
- 刪除data guard歸檔日誌
- 手動刪除歸檔日誌
- 配置rman來自動刪除應用過的歸檔日誌
- rman刪除指定節點指定sequence範圍的歸檔日誌
- ORACLE RMAN 還原歸檔日誌Oracle
- 刪除歸檔,保留最近的5個歸檔日誌
- RMAN刪除歸檔日誌出現RMAN-0813錯誤的處理
- 歸檔日誌刪除的五種方法
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- 誤刪歸檔日誌除導致備份歸檔日誌失敗
- 在Oracle中,如何定時刪除歸檔日誌檔案?Oracle
- Oracle11g的RMAN-06207: WARNING:不能刪除歸檔日誌Oracle
- 通過RMAN設定standby接收日誌後主庫歸檔日誌才可刪除
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- rman清理歸檔日誌
- crontab不能自動刪除歸檔日誌
- 如何定期自動刪除歸檔日誌