oracle开启归档

版本:12c   单实例

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/12.2.0/db_1/dbs/arch
Oldest online log sequence 8
Current log sequence 10

1.关闭数据库并启动到mount

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 838860800 bytes
Fixed Size 8626240 bytes
Variable Size 553652160 bytes
Database Buffers 272629760 bytes
Redo Buffers 3952640 bytes
Database mounted.

2.开启归档

SQL> alter database archivelog;

Database altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/product/12.2.0/db_1/dbs/arch
Oldest online log sequence 8
Next log sequence to archive 10
Current log sequence 10
SQL>

我们发现归档默认存放的文职跟11g有所区别。

3.修改归档路径以及格式

SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/archivelog';

System altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archivelog
Oldest online log sequence 8
Next log sequence to archive 10
Current log sequence

SQL> alter system set log_archive_format="archive_%t_%s_%r.log" scope=spfile;

System altered.

log_archive_format的替换变量:

  1. %s  --archvied redo file 的文件序列号
  2. %t  --归档线程号
  3. %d  --dbid,注意不同于rman中format的%d,而是同%I
  4. %r  --resetlogsID号

4.重新启动。

shutdown immediate;

startup;

 

上一篇:VM虚拟机无法拖拽、粘贴、复制


下一篇:[转]Android通过NDK调用JNI,使用opencv做本地c++代码开发配置方法