1、查看当前的日志文件信息

SQL> select group#,status from v$log ;

GROUP# STATUS
---------- ------------------------------------------------
1 CURRENT
2 INACTIVE

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/oracle/oradata/test/redo02.log
/oracle/oradata/test/redo01.log

SQL> select bytes from v$log;

BYTES
----------
52428800
52428800

2、增加2个redo日志组
SQL> alter database add logfile thread 1 group 4 ('/oracle/oradata/test/redo04.log') size 30M;
alter database add logfile thread 1 group 5 ('/oracle/oradata/test/redo05.log') size 30M;
Database altered.

SQL>

Database altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/oracle/oradata/test/redo04.log
/oracle/oradata/test/redo02.log
/oracle/oradata/test/redo01.log
/oracle/oradata/test/redo05.log

SQL> select group#,status from v$log;

GROUP# STATUS
---------- ------------------------------------------------
1 CURRENT
2 INACTIVE
4 UNUSED
5 UNUSED

3、进行日志切换,切换到新的组上。
SQL> alter system switch logfile;

System altered.

SQL> select group#,status from v$log;

GROUP# STATUS
---------- ------------------------------------------------
1 ACTIVE
2 INACTIVE
4 CURRENT      ---》当前的日志组
5 UNUSED

SQL> select group#,status from v$log;

GROUP# STATUS
---------- ------------------------------------------------
1 ACTIVE
2 INACTIVE
4 CURRENT
5 UNUSED

由于日志切换的增量检查点ACTIVE状态有可能会很久才会变更为INACTIVE,需要发布全量检查点。

SQL> alter system checkpoint;

System altered.

SQL> select group#,status from v$log;

GROUP# STATUS
---------- ------------------------------------------------
1 INACTIVE
2 INACTIVE
4 INACTIVE
5 CURRENT

4、删除group 1、group 2

SQL> alter database drop logfile group 1;

Database altered.

SQL> alter database drop logfile group 2;

Database altered.

SQL> select group#,status from v$log;

GROUP# STATUS
---------- ------------------------------------------------
4 INACTIVE
5 CURRENT

SQL> alter system switch logfile;

System altered.

SQL> /

Related Posts

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注