當(dāng)前位置:首頁(yè) > IT技術(shù) > 數(shù)據(jù)庫(kù) > 正文

Oracle 重做日志調(diào)整 SQL語句
2021-09-13 10:21:23

Oracle 數(shù)據(jù)庫(kù)安裝之后,重做日志默認(rèn)為 3組,如果需要新增刪除,可以通過以下方式!

查詢:

set line222
col member for a60
select a.group#,b.member member,a.bytes/1024/1024 "size(M)" from v$log a,v$logfile b where a.group#=b.group#;

新增:

單機(jī)數(shù)據(jù)庫(kù):

alter database add logfile group 4 '/oradata/orcl/redo04.log' size 50M;
alter database add logfile group 5 '/oradata/orcl/redo05.log' size 50M;
alter database add logfile group 16 '/oradata/orcl/redo16.log' size 1024M;
alter database add logfile group 17 '/oradata/orcl/redo17.log' size 1024M;
alter database add logfile group 18 '/oradata/orcl/redo18.log' size 1024M;

RAC集群數(shù)據(jù)庫(kù):

alter database add logfile thread 1 
group 4 '/oradata/orcl/redo04.log' size 50M,
group 5 '/oradata/orcl/redo05.log' size 50M,
group 6 '/oradata/orcl/redo06.log' size 50M;

alter database add logfile thread 2
group 7 '/oradata/orcl/redo07.log' size 50M,
group 8 '/oradata/orcl/redo08.log' size 50M,
group 9 '/oradata/orcl/redo09.log' size 50M;

刪除:

alter database drop logfile group 16; 
alter database drop logfile group 17; 
alter database drop logfile group 18; 

???? 注意:如果當(dāng)前要?jiǎng)h除的 logfile 狀態(tài)不是 INACTIVE,那么刪除會(huì)報(bào)錯(cuò),需要執(zhí)行 ALTER SYSTEM SWITCH LOGFILE; 來切換日志,直到狀態(tài)為 INACTIVE 才可以刪除!


本次分享到此結(jié)束啦~

如果覺得文章對(duì)你有幫助,點(diǎn)贊、收藏、關(guān)注、評(píng)論,一鍵四連支持,你的支持就是我創(chuàng)作最大的動(dòng)力。

?? 技術(shù)交流可以 關(guān)注公眾號(hào):Lucifer三思而后行 ??

本文摘自 :https://blog.51cto.com/l

開通會(huì)員,享受整站包年服務(wù)立即開通 >