oracle定時刪除歸檔指令碼

2021-06-28 20:21:50 字數 1542 閱讀 8603

#! /bin/bash

exec >> delarch`date +%y%m%d%h`.log

$oracle_home/bin/rman target / <

#說明:以上指令碼刪除14天以前所有歸檔日誌,同時記錄log

$oracle_home/bin/rman target / 等同於delete noprompt archivelog until time 'sysdate-14';

-------

archivelog list commands

rman>list archivelog all;

rman>list copy of archivelog until time 『sysdate-10′;

rman>list copy of archivelog from time 『sysdate-10′

rman>list copy of archivelog from time 『sysdate-10′ until time 『sysdate-2′;

rman>list copy of archivelog from sequence 1000;

rman>list copy of archivelog until sequence 1500;

rman>list copy of archivelog from sequence 1000 until sequence 1500;

-------

archivelog delete commands

rman>delete archivelog all;

rman>delete archivelog until time 『sysdate-10′;

rman>delete archivelog from time 『sysdate-10′

rman>delete archivelog from time 『sysdate-10′ until time 『sysdate-2′;

rman>delete archivelog from sequence 1000;

rman>delete archivelog until sequence 1500;

rman>delete archivelog from sequence 1000 until sequence 1500;

note : also, you can use noprompt statement for do not yes-no question.

rman>delete noprompt archivelog until time 『sysdate-10′;

aix下計畫任務

以下為rman定時刪除歸檔日誌方法:

將附件中del_arch.sh檔案上傳至資料庫伺服器,oracle使用者的可讀取目錄,例如/home/oracle。賦予可執行許可權(chmod +x del_arch.sh)

在root使用者下,crontab -e

20 20 * * 3 su - oracle -c '/home/oracle/del_arch.sh' 引號內為指令碼位置。(代表每週三20:20執行指令碼,刪除日誌)

Oracle 刪除歸檔日誌指令碼

歸檔日誌記錄著資料庫的操作記錄,是做資料恢復的依據,如果資料庫開啟了歸檔模式,那麼就會產生大量的歸檔日誌,當然如果有rman備份的話,可以在備份之後刪除已經備份過的日誌,如果是沒有採用rman備份的話,就需要自己來刪除這寫歸檔日誌。下面的幾個指令碼就減輕了dba的工作量。linux 平台 0 2 h...

Oracle 刪除歸檔日誌指令碼

歸檔日誌記錄著資料庫的操作記錄,是做資料恢復的依據,如果資料庫開啟了歸檔模式,那麼就會產生大量的歸檔日誌,當然如果有rman備份的話,可以在備份之後刪除已經備份過的日誌,如果是沒有採用rman備份的話,就需要自己來刪除這寫歸檔日誌。下面的幾個指令碼就減輕了dba的工作量。linux 平台 0 2 h...

Oracle 刪除歸檔日誌指令碼

歸檔日誌記錄著資料庫的操作記錄,是做資料恢復的依據,如果資料庫開啟了歸檔模式,那麼就會產生大量的歸檔日誌,當然如果有rman備份的話,可以在備份之後刪除已經備份過的日誌,如果是沒有採用rman備份的話,就需要自己來刪除這寫歸檔日誌。下面的幾個指令碼就減輕了dba的工作量。linux 平台 0 2 h...