Oracle歸檔的開啟和關閉


  --1、開啟歸檔

  【步驟】

  a.一致性關閉數據庫(shutdown [immediate | transactional |normal])

  b.啟動到mount階段(startup mount)

  c.切換到歸檔模式(alter database archivelog[manual])

  d.切換到open階段(alter database open)

  e.對數據做一個完整備份(full backup)

  show parameter spfile

  alter system set log_archive_dest_1='location=/ggs/arch_data' scope=spfile;

  alter system set db_recovery_file_dest_size=100g scope=spfile sid='*';

  alter system set db_recovery_file_dest='/ggs/ora_recovery' scope=spfile;

  alter system set log_archive_format='arch_%t_%s_%r.arc' scope=spfile;

  shutdown immediate;

  startup mount;

  alter database archivelog;

  alter database open ;

  archive log list;

  --2、關閉歸檔

  【步驟】歸檔模式切換到非歸檔模式

  a. [immediate | transactional |normal])一致性關閉數據庫(shutdown

  b.啟動到mount階段(startup mount)

  c.切換到歸檔模式(alter database noarchivelog)

  d.切換到open階段(alter database open)

  關閉歸檔模式:

  shutdown immediate;

  startup mount;

  alter database noarchivelog;

  alter database open;

  查看歸檔文件:

  select * from v$log;

  select * from v$logfile;

  select * from v$flash_recovery_area_usage;

  report obsolete;

  delete obsolete;

  備份歸檔文件:

  backup archivelog all;

  也可以:

  先執行alter system switch logfile;

  再找到歸檔日志位置,復制到別的地方即可。

  rman target /

  delete archivelog all completed before 'sysdate-7';

  backup first

  backup format '/tmp/arch-%t_%s_%u' archivelog all delete input;

  或者backup database plus archivelog;

  刪除歸檔文件:

  rman target / 或者 rman target user/password@tns

  list archivelog all;

  crosscheck archivelog all;

  list expired archivelog all;

  delete expired archivelog all;(編輯:雷林鵬 來源:網絡)


免責聲明!

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



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