Suppose that we have 3 log group(50 m ) and we will resize then to 200m
- Check the existing redo groups and files
SELECT a.group#, b.member, a.status, a.bytes
FROM v$log a, v$logfile b
WHERE a.group#=b.group#;
GROUP# MEMBER STATUS BYTES
--------- ------------------- ---------------- ------------
1 /redo01/redo01a.log CURRENT 52,428,800 1 /redo02/redo01b.log CURRENT 52,428,800 2 /redo01/redo02a.log INACTIVE 52,428,800 2 /redo02/redo02b.log INACTIVE 52,428,800 3 /redo01/redo03a.log INACTIVE 52,428,800 3 /redo02/redo03b.log INACTIVE 52,428,800 - Add new groups (e.x group 4,5,6) and check them
ALTER DATABASE ADD LOGFILE group 4
('/redo01/redo04a.log', '/redo02/redo04b.log') SIZE 200m;
ALTER DATABASE ADD LOGFILE group 5
('/redo01/redo05a.log', '/redo02/redo05b.log') SIZE 200m;
ALTER DATABASE ADD LOGFILE group 6
('/redo01/redo06a.log', '/redo02/redo06b.log') SIZE 200m;
SELECT a.group#, b.member, a.status, a.bytes
FROM v$log a, v$logfile b
WHERE a.group#=b.group#;
GROUP# MEMBER STATUS BYTES
--------- ------------------- ---------------- ------------1 /redo01/redo01a.log ACTIVE 52,428,800 1 /redo02/redo01b.log ACTIVE 52,428,800 2 /redo01/redo02a.log INACTIVE 52,428,800 2 /redo02/redo02b.log INACTIVE 52,428,800 3 /redo01/redo03a.log CURRENT 52,428,800 3 /redo02/redo03b.log CURRENT 52,428,800 4 /redo01/redo04a.log UNUSED 209,715,200 4 /redo02/redo04b.log UNUSED 209,715,200 5 /redo01/redo05a.log UNUSED 209,715,200 5 /redo02/redo05b.log UNUSED 209,715,200 6 /redo01/redo06a.log UNUSED 209,715,200 6 /redo02/redo06b.log UNUSED 209,715,200 - Drop the online redo log groups that are not needed (Group 3,4,5).
- First check the status of the logs you can not drop if status in ACTIVE (Is archiving now ) or CURRENT (This is the current ).You can drop it if status ='INACTIVE'.
SELECT GROUP#, ARCHIVED, STATUS FROM V$LOG;
GROUP# ARC STATUS
--------- --- ----------------
1 YES ACTIVE ----This archived by arc process
2 YES INACTIVE
3 NO CURRENT ---This is written by log writer process
4 YES UNUSED
5 YES UNUSED
6 YES UNUSED - If you want to drop current log then switch logfile (alter system switch logfile) or if you want to drop active log then wait until it is archived and status become INACTIVE
- Then drop 3 log group
ALTER DATABASE DROP LOGFILE GROUP 2;
alter system switch logfile; --We want to drop current log
ALTER DATABASE DROP LOGFILE GROUP 3;
ALTER DATABASE DROP LOGFILE GROUP 1; - Note that An instance requires at least two groups of online redo log files, regardless of the number of members in the groups. (A group is one or more members.)
- Use operating system command to delete the dropped online redo log files (Be sure that the files belongs to dropped groups )
rm /redo01/redo01a.log
rm /redo02/redo01b.log
rm /redo01/redo02a.log
rm /redo02/redo02b.log
rm /redo01/redo03a.log
rm /redo02/redo03b.log
No comments:
Post a Comment