返回顶部

欢迎来到菜鸟大明儿哥的博客

我们一起交流学习,不断提升自我

Oracle归档的开启和关闭

 

一、开启归档

1.设置归档目录

alter system set log_archive_dest_1='location=/arch' scope=spfile;

 

2.设置归档日志格式

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

 

3.一致性关闭数据库

shutdown [immediate | normal]

 

4.启动到mount阶段(startup mount)

5.切换到归档模式(alter database archivelog[manual])

6.切换到open阶段(alter database open)

7.查看是否归档模式(archive log list;)

Database log mode     Archive Mode
Automatic archival      Enabled
Archive destination      /arch/orcl
Oldest online log sequence     32855
Next log sequence to archive  32859
Current log sequence         32859

 

select log_mode from v$database;  

 

LOG_MODE

-------------------

ARCHIVELOG

 

select archiver from v$instance;  

 

ARCHIVE

-----------------

STARTED

 

8.手工切换日志

alter system switch logfile;  

 

  

select name from v$archived_log; 

 

 

二、关闭归档

 

1.一致性关闭数据库

shutdown [immediate | normal]

 

2.启动到mount阶段(startup mount)

3.切换到归档模式(alter database noarchivelog)

4.切换到open阶段(alter database open)

5.查看是否归档模式(archive log list;)

Database log mode       No Archive Mode
Automatic archival        Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence    35837
Current log sequence                  35841

 

select log_mode from v$database;

 

LOG_MODE

-------------------

NOARCHIVELOG

 

select archiver from v$instance;

 

ARCHIVE

-----------------

STOPPED

 

posted @ 2021-07-13 10:55  菜鸟大明儿哥  阅读(729)  评论(0编辑  收藏  举报