oracle 切换redo日志,增加REDO日志文件及切换

要将日志文件组1,2,3从100M修改到200M方法如下

$ ls

control01.ctl  drsys01.dbf    redo01.log     temp01.dbf     xdb01.dbf

control02.ctl  example01.dbf  redo02.log     tools01.dbf

control03.ctl  indx01.dbf     redo03.log     undotbs01.dbf

cwmlite01.dbf  odm01.dbf      system01.dbf   users01.dbf

$ ls -l redo01.log

-rw-r-----   1 oracle   dba       104858112 Jan 04 16:34 redo01.log

$ du -m redo01.log

100.00  redo01.log

登陆SQLPLUS

--------------------

$ sqlplus /nolog

SQL*Plus: Release 9.2.0.7.0 - Production on Fri Jan 4 16:48:40 2008

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> conn / as sysdba;

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 1377274120 bytes

Fixed Size                   743688 bytes

Variable Size             738197504 bytes

Database Buffers          637534208 bytes

Redo Buffers                 798720 bytes

Database mounted.

Database opened.

SQL> select group# from v$log;

GROUP#

----------

1

2

3

创建日志文件组4,5

---------------------------

SQL> alter database add logfile group 4 '/opt/oracle/product/9i/oradata/oracle9i/redo04.log' size 200M;

Database altered.

SQL> alter database add logfile group 5 '/opt/oracle/product/9i/oradata/oracle9i/redo05.log' size 200M;

Database altered.

将日志文件组切换到新建立的4,5日志文件组上

--------------------------------------------------------------

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 INACTIVE

5 CURRENT

删除已有的1,2,3日志文件组

---------------------------------------

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.

增加新的日志文件1,2,3,并设定容量为200M

------------------------------------------------------------

SQL> alter database add logfile group 1 '/opt/oracle/product/9i/oradata/oracle9i/redo01.log' size 200M;

Database altered.

SQL> alter database add logfile group 2 '/opt/oracle/product/9i/oradata/oracle9i/redo02.log' size 200M;

Database altered.

SQL> alter database add logfile group 3 '/opt/oracle/product/9i/oradata/oracle9i/redo03.log' size 200M;

Database 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 CURRENT

3 UNUSED

4 INACTIVE

5 INACTIVE

删除刚刚增加的日志文件组4,5

-----------------------------------------

SQL> alter database drop logfile group 4;

Database altered.

SQL> alter database drop logfile group 5;

Database altered.

注意:每一步删除drop操作,都需要手工删除os中的实体文件。

另外注意备份控制文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值