oracle 歸檔/非歸檔

haoge0205發表於2013-11-28

1、檢視oralce是歸檔模式還是非歸檔模式

SQL> select name,log_mode from v$database;

NAME LOG_MODE
---------------------------------------- ------------------------------------
YOON ARCHIVELOG

SQL> select name,log_mode from v$database;

NAME LOG_MODE
---------------------------------------- ------------------------------------
YOON ARCHIVELOG

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 326
Next log sequence to archive 328
Current log sequence 328

2、檢視歸檔存放路徑

SQL> show parameter db_recovery;

NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
db_recovery_file_dest string /u01/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 4122M

3、修改歸檔路徑大小

SQL> alter system set db_recovery_file_dest_size=5G;

4、檢視歸檔路徑

SQL> select name,SPACE_LIMIT,SPACE_USED from v$recovery_file_dest;

NAME SPACE_LIMIT SPACE_USED
---------------------------------------- ----------- ----------
/u01/oracle/fast_recovery_area 5368709120 2539942912

5、修改歸檔路徑

SQL> alter system set db_recovery_file_dest='/u01/archivelog';

6、刪除歸檔日誌

①檢視歸檔路徑狀態

②到系統目錄下刪除歸檔日誌

③crosscheck archivelog all;

④delete expired archivelog all;

7、刪除7天前

DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

8、7天前到現在

DELETE ARCHIVELOG FROM TIME 'SYSDATE-7';

9、修改歸檔格式

修改歸檔格式alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;
還可以設定一個引數alter system set log_archive_max_processes = 2; //作業系統為oracle歸檔開啟多少個歸檔程式;重新啟動資料庫。
SQL> alter system set log_archive_dest_1='location=/u01/archivelog' scope =both;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28939273/viewspace-1061506/,如需轉載,請註明出處,否則將追究法律責任。

相關文章