重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3894|回复: 0
打印 上一主题 下一主题

[Oracle] 更改重做日志文件的大小

[复制链接]
跳转到指定楼层
楼主
发表于 2019-3-14 13:46:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
--查看现有日志组及其文件大小
SQL> set lines 200
SQL> col member for a120
SQL> select group#, bytes/1024/1024, status from v$log;

    GROUP# BYTES/1024/1024 STATUS
---------- --------------- ----------------
         1               50 CURRENT
         2               50 INACTIVE
         3               50 INACTIVE

SQL> select GROUP#,MEMBER from v$logfile order by 1,2;

    GROUP# MEMBER
---------- ------------------------------------------------------------------------------------------------------------------------
         1 /u01/app/oracle/oradata/orcl/redo01.log
         2 /u01/app/oracle/oradata/orcl/redo02.log
         3 /u01/app/oracle/oradata/orcl/redo03.log

--创建3个磁盘组,每个磁盘组大小200m
SQL> alter database add logfile group 4  '/u01/app/oracle/oradata/orcl/redo04.log ' size 200M;
Database altered.

SQL> alter database add logfile group 5  '/u01/app/oracle/oradata/orcl/redo05.log ' size 200M;
Database altered.

SQL> alter database add logfile group 6  '/u01/app/oracle/oradata/orcl/redo06.log ' size 200M;
Database altered.

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

    GROUP# BYTES/1024/1024 STATUS
---------- --------------- ----------------
         1               50 CURRENT
         2            50 INACTIVE
         3            50 INACTIVE
         4            200 UNUSED
         5            200 UNUSED
         6            200 UNUSED

6 rows selected.

--切换当前日志组到新的日志组,保证日志组1,2,3 不处于CURRENT 状态
SQL> alter system switch logfile;
System altered.

SQL> alter system checkpoint;
System altered.

SQL> alter system switch logfile;
System altered.

SQL> alter system switch logfile;
System altered.

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

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

6 rows selected.


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

    GROUP# BYTES/1024/1024 STATUS
---------- --------------- ----------------
         1               50 INACTIVE
         2            50 INACTIVE
         3            50 INACTIVE
         4            200 CURRENT
         5            200 INACTIVE
         6            200 INACTIVE

6 rows selected.

--删除日志组
SQL> alter database drop logfile group 1;
Database altered.

SQL> alter database drop logfile group 2;
Database altered.

SQL> alter database drop logfile group 3;
Database altered.

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

    GROUP# BYTES/1024/1024 STATUS
---------- --------------- ----------------
         4               200 CURRENT
         5               200 INACTIVE
         6               200 INACTIVE

SQL> alter database add logfile group 1  '/u01/app/oracle/oradata/orcl/redo01.log ' size 200M;
Database altered.

SQL> alter database add logfile group 2  '/u01/app/oracle/oradata/orcl/redo02.log ' size 200M;
Database altered.

SQL> alter database add logfile group 3  '/u01/app/oracle/oradata/orcl/redo03.log ' size 200M;
Database altered.

SQL> select group#, member from v$logfile;

    GROUP# MEMBER
---------- ------------------------------------------------------------------------------------------------------------------------
         1 /u01/app/oracle/oradata/orcl/redo01.log
         2 /u01/app/oracle/oradata/orcl/redo02.log
         3 /u01/app/oracle/oradata/orcl/redo03.log
         4 /u01/app/oracle/oradata/orcl/redo04.log
         5 /u01/app/oracle/oradata/orcl/redo05.log
         6 /u01/app/oracle/oradata/orcl/redo06.log

6 rows selected.

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

    GROUP# BYTES/1024/1024 STATUS
---------- --------------- ----------------
         1               200 UNUSED
         2               200 UNUSED
         3               200 UNUSED
         4               200 CURRENT
         5               200 INACTIVE
         6               200 INACTIVE

6 rows selected.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-16 07:17 , Processed in 0.084397 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表