1.SYS@ORCL>select GROUP# ,BYTES/1024/1024 size_M,STATUS,ARCHIVED from v$log;
GROUP# SIZE_M STATUS ARC
---------- ---------- ---------------- ---
1 50 INACTIVE YES
2 50 INACTIVE YES
3 50 CURRENT NO
2.删除原有的日志组;(只操作状态为inactive的日志组)
若要操作日志组为current时,需先进行日志切换:alter system switch logfile;
若为active时,则可强制进行检查点:alter system checkpoint;
SYS@ORCL>alter system switch logfile;
System altered.
SYS@ORCL>alter system checkpoint; --强制执行检查点
SYS@ORCL>select GROUP# ,BYTES/1024/1024 size_M,STATUS,ARCHIVED from v$log;
GROUP# SIZE_M STATUS ARC
---------- ---------- ---------------- ---
1 50 INACTIVE YES
2 50 INACTIVE YES
3 50 ACTIVE YES
SYS@ORCL>alter database drop logfile group 1;
Database altered.
SYS@ORCL>alter database drop logfile group 2;
Database altered.
---------------------------
删除后还需要去指定目录删除日志文件,后才能建立文件,如制定别的名字的日志组,应该没有此限制。
---------------------------
3.添加3组大小为200M的日志组;
SYS@ORCL>alter database add logfile group 1 '/u01/app/oracle/oradata/orcl11g/redo01.log'size 200m;
Database altered.
SYS@ORCL>alter database add logfile group 2 '/u01/app/oracle/oradata/orcl11g/redo02.log'size 200m;
Database altered.
SYS@ORCL>alter database add logfile group 3 '/u01/app/oracle/oradata/orcl11g/redo03.log'size 200m;
4.给日志组添加成员
cd /u01/app/oracle/oradata/orcl11g/
mkdir redo_bak
SYS@ORCL>alter database add logfile member '/u01/app/oracle/oradata/orcl11g/redo_bak/redo01_b.log' to group 1;
Database altered.
SYS@ORCL>alter database add logfile member '/u01/app/oracle/oradata/orcl11g/redo_bak/redo02_b.log' to group 2;
Database altered.
SYS@ORCL>alter database add logfile member '/u01/app/oracle/oradata/orcl11g/redo_bak/redo03_b.log' to group 3;
Database altered.
5.删除日志组成员
alter database drop logfile member '/u01/app/oracle/oradata/orcl11g/redo_bak/redo02_b.log';