oracle 10g RAC 添加日志组和成员以及删除日志成员
SQL alter database add logfile thread 1 group5('+data/myrac/onlinelog/myrac1_redolog_group5_01') size 100m; SQL alter database add logfilemember '+data/myrac/onlinelog/myrac1_redolog_group5_02' to group 5; SQL alter database add logfile th
SQL> alter database add logfile thread 1 group5('+data/myrac/onlinelog/myrac1_redolog_group5_01') size 100m;
SQL> alter database add logfile member '+data/myrac/onlinelog/myrac1_redolog_group5_02' to group 5;
SQL> alter database add logfile thread 2 group 6('+data/myrac/onlinelog/myrac1_redolog_group6_01')size 100m;
手误 添加错了名字
先增加成员再说
SQL> alter database add logfile member '+data/myrac/onlinelog/myrac1_redolog_group6_02' to group 6;
SQL> alter database add logfile member '+data/myrac/onlinelog/myrac1_redolog_group6_01' to group 6;
删除不了
SQL> alter database drop logfile member'+DATA/myrac/onlinelog/myrac1_redolog_group6_01';
alter database drop logfile member'+DATA/myrac/onlinelog/myrac1_redolog_group6_01'
*
第 1 行出现错误:
ORA-00362: 要求输入成员以组成组 6 中的有效日志文件
ORA-01517: 日志成员: '+DATA/myrac/onlinelog/myrac1_redolog_group6_01'
日志状态 未使用当中啊!
SQL> select group#,archived,status from v$log;
GROUP# ARC STATUS
---------- --- ----------------
1 NO ACTIVE
2 NO INACTIVE
3 NO CURRENT
4 NO INACTIVE
5 NO CURRENT
6 YES UNUSED
已选择6行。
在节点2 实例2数据库实例上 切换日志
SQL> alter system switch logfile;
??????
SQL> /
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------------------- ------------- --------------
1 1 87 52428800 1 NO INACTIVE 4427645 25-9月 -12
2 1 86 52428800 1 NO INACTIVE 4356268 25-9月 -12
3 2 43 52428800 1 NO ACTIVE 4402972 25-9月 -12
4 2 42 52428800 1 NO INACTIVE 4206757 24-9月 -12
5 1 88 104857600 2 NO CURRENT 4495802 26-9月 -12
6 2 44 104857600 3 NO CURRENT 4497190 26-9月 -12
已选择6行。
SQL> alter system switch logfile;
??????
SQL> /
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------------------- ------------- --------------
1 1 87 52428800 1 NO INACTIVE 4427645 25-9月 -12
2 1 86 52428800 1 NO INACTIVE 435626825-9月 -12
3 2 43 52428800 1 NO ACTIVE 4402972 25-9月 -12
4 2 45 52428800 1 NO CURRENT 4497215 26-9月 -12
5 1 88 104857600 2 NO CURRENT 4495802 26-9月 -12
6 2 44 104857600 3 NO ACTIVE 4497190 26-9月 -12
已选择6行。
SQL> alter system switch logfile;
??????
SQL> /
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------------------- ------------- --------------
1 1 87 52428800 1 NO INACTIVE 4427645 25-9月 -12
2 1 86 52428800 1 NO INACTIVE 4356268 25-9月 -12
3 2 46 52428800 1 NO CURRENT 4497279 26-9月 -12
4 2 45 52428800 1 NO INACTIVE 449721526-9月 -12
5 1 88 104857600 2 NO CURRENT 4495802 26-9月 -12
6 2 44 104857600 3 NO INACTIVE 4497190 26-9月 -12
已选择6行。
SQL> alter database droplogfile member '+DATA/myrac/onlinelog/myrac1_redolog_group6_01';
数据库已更改。
SQL> select group#,member from v$logfile where group#=6;
GROUP# MEMBER
---------- --------------------------------------------------------
6+DATA/myrac/onlinelog/myrac2_redolog_group6_02
6+DATA/myrac/onlinelog/myrac2_redolog_group6_01
已经成功删除了
下面去ASMCMD删除物理文件
ASMCMD> ls
group_1.257.772910379
group_2.258.772910389
group_3.265.772919275
group_4.266.772919281
group_5.268.795028735
group_5.269.795029891
group_6.270.795030293
group_6.271.795030355
group_6.272.795030429
myrac1_redolog_group5_01
myrac1_redolog_group5_02
myrac1_redolog_group6_01
myrac2_redolog_group6_01
myrac2_redolog_group6_02
ls –ls 可以看到 别名关联
ASMCMD> pp
commands:
--------
cd
du
find
help
ls
lsct
lsdg
mkalias
mkdir
pwd
rm
rmalias
ASMCMD> rm myrac1_redolog_group6_01
ASMCMD> ls
group_1.257.772910379
group_2.258.772910389
group_3.265.772919275
group_4.266.772919281
group_5.268.795028735
group_5.269.795029891
group_6.271.795030355
group_6.272.795030429
myrac1_redolog_group5_01
myrac1_redolog_group5_02
myrac2_redolog_group6_01
myrac2_redolog_group6_02
ASMCMD>
下面介绍关于日志一些原则:
原则:删除前必须遵守如下原则,每个实例必须至少有两个日志组;当一个组处于ACTIVE或者CURRENT的状态时不可删除;删除日志组的操作只对数据库进行更改,操作系统的文件尚未删除;当删除时适用DROP LOGFILE GROUP N语句时,此时GROUP N内的所有成员都将被删除。
ALTER DATABASE DROP LOGFILE GROUP N;
删除日志成员的原则:当你删除一个是该组中最后一个成员的时候,你不能删除此成员;当组的转台处于current的状态时,不能删除组成员;在归档模式下,必须得归档之后才能删除;删除日志组成员的操作只对数据库进行更改,操作系统的文件尚未删除
ALTER DATABASE DROP LOGFILE MEMBER '/LOCATION_DUST/REDO0N_N.LOG';