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';