如何为oracle添加重做日志组及重做日志成员


本篇内容主要讲解“如何为oracle添加重做日志组及重做日志成员”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何为oracle添加重做日志组及重做日志成员”吧! 添加重做日志组:
SYS@orcl 08-SEP-14>select group#,type,member from v$logfile;

GROUP# TYPE MEMBER
——- ——- ————————————————–
3 ONLINE /u01免费云主机域名/app/oracle/oradata/orcl/redo03.log
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log
SYS@orcl 08-SEP-14>alter database add logfile group 4
2 (‘/u01/app/oracle/oradata/orcl/redo04.log’)
3 size 50m;
SYS@orcl 08-SEP-14>select group#,sequence#,bytes/1024/1024||’MB’,status from v$log;

GROUP# SEQUENCE# BYTES/1024/1024||’MB’ STATUS
——- ———- —————————————— —————-
1 25 50MB CURRENT
2 23 50MB INACTIVE
3 24 50MB INACTIVE
4 0 50MB UNUSED
为日志组添加成员:
SYS@orcl 09-SEP-14>select group#,status,member from v$logfile;

GROUP# STATUS MEMBER
——- ——- ————————————————–
3 /u01/app/oracle/oradata/orcl/redo03.log
2 /u01/app/oracle/oradata/orcl/redo02.log
1 /u01/app/oracle/oradata/orcl/redo01.log
4 /u01/app/oracle/oradata/orcl/redo04.log
SYS@orcl 09-SEP-14>alter database add logfile member
2 ‘/u01/app/redolog/redo01a.log’ to group 1,
3 ‘/u01/app/redolog/redo02a.log’ to group 2,
4 ‘/u01/app/redolog/redo03a.log’ to group 3,
5 ‘/u01/app/redolog/redo04a.log’ to group 4;

Database altered.
SYS@orcl 09-SEP-14>select group#,status,member,type from v$logfile;

GROUP# STATUS MEMBER TYPE
——- ——- ————————————————– ——-
3 /u01/app/oracle/oradata/orcl/redo03.log ONLINE
2 /u01/app/oracle/oradata/orcl/redo02.log ONLINE
1 /u01/app/oracle/oradata/orcl/redo01.log ONLINE
4 /u01/app/oracle/oradata/orcl/redo04.log ONLINE
1 INVALID /u01/app/redolog/redo01a.log ONLINE
2 INVALID /u01/app/redolog/redo02a.log ONLINE
3 INVALID /u01/app/redolog/redo03a.log ONLINE
4 INVALID /u01/app/redolog/redo04a.log ONLINE

8 rows selected.
切换日志四次之后,状态为invalid的日志组成员变为null。
SYS@orcl 09-SEP-14>select group#,status,member,type from v$logfile;

GROUP# STATUS MEMBER TYPE
——- ——- ————————————————– ——-
3 /u01/app/oracle/oradata/orcl/redo03.log ONLINE
2 /u01/app/oracle/oradata/orcl/redo02.log ONLINE
1 /u01/app/oracle/oradata/orcl/redo01.log ONLINE
4 /u01/app/oracle/oradata/orcl/redo04.log ONLINE
1 /u01/app/redolog/redo01a.log ONLINE
2 /u01/app/redolog/redo02a.log ONLINE
3 /u01/app/redolog/redo03a.log ONLINE
4 /u01/app/redolog/redo04a.log ONLINE

8 rows selected.
删除日志组成员:(注意,如果这个组里面只有唯一的一个成员,那么是不能删除的)
SYS@orcl 09-SEP-14>alter database drop logfile member
2 ‘/u01/app/redolog/redo01a.log’,
3 ‘/u01/app/redolog/redo02a.log’,
4 ‘/u01/app/redolog/redo03a.log’,
5 ‘/u01/app/redolog/redo04a.log’;
alter database drop logfile member
*
ERROR at line 1:
ORA-01609: log 1 is the current log for thread 1 – cannot drop members
ORA-00312: online log 1 thread 1: ‘/u01/app/oracle/oradata/orcl/redo01.log’
ORA-00312: online log 1 thread 1: ‘/u01/app/redolog/redo01a.log’
可以看到实例正在使用的redo log是不能删除的,于是我们先删除其他组的成员:
SYS@orcl 09-SEP-14>alter database drop logfile member
2 ‘/u01/app/redolog/redo02a.log’,
3 ‘/u01/app/redolog/redo03a.log’,
4 ‘/u01/app/redolog/redo04a.log’;

Database altered.

接着,我们再切换日志:
SYS@orcl 09-SEP-14>select group#,sequence#,status from v$log;

GROUP# SEQUENCE# STATUS
——- ———- —————-
1 29 CURRENT
2 27 INACTIVE
3 28 INACTIVE
4 26 INACTIVE
SYS@orcl 09-SEP-14>alter system switch logfile;

System altered.

SYS@orcl 09-SEP-14>select group#,sequence#,status from v$log;

GROUP# SEQUENCE# STATUS
——- ———- —————-
1 29 ACTIVE
2 27 INACTIVE
3 28 INACTIVE
4 30 CURRENT
再删除日志组1的成员redo01a.log:
SYS@orcl 09-SEP-14>alter database drop logfile member
2 ‘/u01/app/redolog/redo01a.log’;

Database altered.
查看日志组及日志组成员信息:
SYS@orcl 09-SEP-14>select group#,status,type,member from v$logfile;

GROUP# STATUS TYPE MEMBER
——- ——- ——- ————————————————–
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log
4 ONLINE /u01/app/oracle/oradata/orcl/redo04.log

到此,相信大家对“如何为oracle添加重做日志组及重做日志成员”有了更深的了解,不妨来实际操作一番吧!这里是百云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

相关推荐: 清空redis中数据的方法

这篇文章将为大家详细讲解有关清空redis中数据的方法,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。Redis 免费云主机域名Flushall 命令用于清空整个 Redis 服务器的数据(删除所有数据库的所有 key )。语…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

(0)
打赏 微信扫一扫 微信扫一扫
上一篇 01/05 10:59
下一篇 01/05 11:04