SQL> conn / as sysdba;
SQL> alter system set log_archive_format='arc_%t_%s.dbf' scope=spfile;
System altered.
SQL> alter system set log_archive_dest_1 = 'location=/u01/gaudi/oracle/9204/dbs/arclog' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
SQL> startup restrict
ORACLE instance started.
Total System Global Area 1309742180 bytes
Fixed Size 451684 bytes
Variable Size 234881024 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1309742180 bytes
Fixed Size 451684 bytes
Variable Size 234881024 bytes
Database Buffers 1073741824 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> alter database archivelog;
????SQL> startup force mount;
SQL> alter database archivelog; ##起用归档模式
SQL> alter database open; ##打开数据库
SQL> archive log list -- 观看日志文件点
Database log mode Archive Mode
Automatic archival Disabled
Archive destination /u01/gaudi/oracle/9204/dbs/arch
Oldest online log sequence 4810
Next log sequence to archive 4812
Current log sequence 4812
SQL> alter system switch logfile; --强制系统进行日志切换,可马上观察到归档日志的产生语句已处理。
SQL> archive log list -- 观看日志文件点
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/gaudi/oracle/9204/dbs/arch
Oldest online log sequence 4811
Next log sequence to archive 4813
Current log sequence 4813
・Confirm that the database is in archivelog mode and that the archiver is
running with these two queries.
SQL> select log_mode from v$database;
SQL> select archiver from v$instance;
SQL> select name from v$archived_log;
■切换归档模式命令
alter database noarchivelog;
alter database archivelog;
■切换自动归档模式命令
alter system archive log stop;
alter system archive log start;
select * from V$ARCHIVED_LOG
select * from V$ARCHIVE_DEST
select * from V$LOG_HISTORY
select * from V$DATABASE
select * from V$ARCHIVE_PROCESSES
**************
tip:
修改相应的初始化参数
Oracle10g之前,你还需要修改初始化参数使数据库处于自动归档模式。
在pfile/spfile中设置如下参数:
log_archive_start = true
重启数据库此参数生效,此时数据库处于自动归档模式。
也可以在数据库启动过程中,手工执行:
archive log start
使数据库启用自动归档,但是重启后数据库仍然处于手工归档模式。
从Oracle10g开始,log_archive_start参数已经废除
阅读(490) | 评论(0) | 转发(0) |