IT开放社区

oracle重做日志文件管理

查看当前日志及分组;

centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- ------------------------------------
  1 /u01/app/oracle/oradata/centos/redo01.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  3 /u01/app/oracle/oradata/centos/redo03.log
centos@SYS>

查看当前日志组大小、成员数及状态;

centos@SYS> select GROUP#,bytes/1024/1024,MEMBERS,STATUS from v$log;
    GROUP# BYTES/1024/1024    MEMBERS STATUS
---------- --------------- ---------- ----------
  1  50                             1 CURRENT
  2  50                             1 UNUSED
  3  50                             1 UNUSED
centos@SYS>

为日志组1、2、3各添加一个大小为50M的成员,并新建分组4,添加两个成员,各50M;

centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- -------------------------------------

  1 /u01/app/oracle/oradata/centos/redo01.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  3 /u01/app/oracle/oradata/centos/redo03.log
  4 /u01/app/oracle/oradata/centos/redod1.log
  4 /u01/app/oracle/oradata/centos/redod2.log
centos@SYS> alter database drop logfile group 4;
Database altered.
centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- ------------------------------------

  1 /u01/app/oracle/oradata/centos/redo01.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  3 /u01/app/oracle/oradata/centos/redo03.log
centos@SYS> alter database add logfile member '/u01/app/oracle/oradata/centos/redo11.log';
alter database add logfile member '/u01/app/oracle/oradata/centos/redo11.log'
                                                                            *
ERROR at line 1:
ORA-00946: missing TO keyword

centos@SYS> alter database add logfile member '/u01/app/oracle/oradata/centos/redo11.log' to group 1;
Database altered.
centos@SYS> alter database add logfile member '/u01/app/oracle/oradata/centos/redo22.log' to group 2;
Database altered.
centos@SYS> alter database add logfile member '/u01/app/oracle/oradata/centos/redo33.log' to group 3;
Database altered.
centos@SYS> alter database add logfile group 4 ('/u01/app/oracle/oradata/centos/redo4.log','/u01/app/oracle/oradata/centos/redo44.log') size 50M;
Database altered.
centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- -------------------------------------
  1 /u01/app/oracle/oradata/centos/redo01.log
  1 /u01/app/oracle/oradata/centos/redo11.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  2 /u01/app/oracle/oradata/centos/redo22.log
  3 /u01/app/oracle/oradata/centos/redo03.log
  3 /u01/app/oracle/oradata/centos/redo33.log
  4 /u01/app/oracle/oradata/centos/redo4.log
  4 /u01/app/oracle/oradata/centos/redo44.log
8 rows selected.
centos@SYS>

手动切换日志;

centos@SYS> alter system switch logfile;
System altered.
centos@SYS>

删除日志组4成员1,再删除日志组4。

centos@SYS> alter database drop logfile member '/u01/app/oracle/oradata/centos/redo4.log';
Database altered.
centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- ------------------------------------
  1 /u01/app/oracle/oradata/centos/redo01.log
  1 /u01/app/oracle/oradata/centos/redo11.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  2 /u01/app/oracle/oradata/centos/redo22.log
  3 /u01/app/oracle/oradata/centos/redo03.log
  3 /u01/app/oracle/oradata/centos/redo33.log
  4 /u01/app/oracle/oradata/centos/redo44.log
7 rows selected.
centos@SYS> alter database drop logfile group 4;
Database altered.
centos@SYS> select group#,member from v$logfile order by 1,2;
    GROUP# MEMBER
---------- ------------------------------------
  1 /u01/app/oracle/oradata/centos/redo01.log
  1 /u01/app/oracle/oradata/centos/redo11.log
  2 /u01/app/oracle/oradata/centos/redo02.log
  2 /u01/app/oracle/oradata/centos/redo22.log
  3 /u01/app/oracle/oradata/centos/redo03.log
  3 /u01/app/oracle/oradata/centos/redo33.log
6 rows selected.
centos@SYS>


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站分类
最新文章
    随机文章
      站点信息
      • 文章总数:106
      • 页面总数:0
      • 分类总数:8
      • 标签总数:0
      • 评论总数:0
      • 浏览总数:15966
      DBA联盟
      DBA导师

      BlogPowerBy Z-BlogPHP 1.5 Zero ;Theme By 爱墙纸

      IT开放社区:京ICP备13044647号.初创于Oracle DBA实战班.邮箱:admin@itkaifang.com

      分享:

      支付宝

      微信