Oracle DBA – A lifelong learning experience

Scripts to resize standby redolog files

Posted by John Hallas on February 28, 2011

I have already posted about an issue that required me to drop and recreate standby log files so I thought I would post the scripts I used.

Resize Standby Redo Logs

1. On primary defer log shipping (dynamic change)

alter system set log_archive_dest_state_2 = defer scope = memory;

2. On standby database cancel managed recovery

alter database recover managed standby database cancel;

3. Drop standby logs on standby database

ALTER DATABASE DROP STANDBY LOGFILE GROUP 4;

ALTER DATABASE DROP STANDBY LOGFILE GROUP 5;

ALTER DATABASE DROP STANDBY LOGFILE GROUP 6;

ALTER DATABASE DROP STANDBY LOGFILE GROUP 7;

4. Recreate the new Standby logs

alter database add standby logfile THREAD 1 group 4 ('+DATA(ONLINELOG)','+FRA(ONLINELOG)') SIZE 1000M;

alter database add standby logfile THREAD 1 group 5 ('+DATA(ONLINELOG)','+FRA(ONLINELOG)') SIZE 1000M;

alter database add standby logfile THREAD 1 group 6 ('+DATA(ONLINELOG)','+FRA(ONLINELOG)') SIZE 1000M;

alter database add standby logfile THREAD 1 group 7 ('+DATA(ONLINELOG)','+FRA(ONLINELOG)') SIZE 1000M;

5. Enable log shipping on the Primary database

alter system set log_archive_dest_state_2 = enable scope = memory;

6. Enable managed recovery on standby database

alter database recover managed standby database using current logfile disconnect;

7. Check the the standby logs are being used by running following query :

set lines 155 pages 9999
col thread# for 9999990
col sequence# for 999999990
col grp for 990
col fnm for a50 head "File Name"
col "Fisrt SCN Number" for 999999999999990
break on thread
# skip 1
select a.thread#
,a.sequence#
,a.group# grp     
, a.bytes/1024/1024 Size_MB     
,a.status     
,a.archived     
,a.first_change# "First SCN Number"     
,to_char(FIRST_TIME,'DD-Mon-RR HH24:MI:SS') "First SCN Time"   
,to_char(LAST_TIME,'DD-Mon-RR HH24:MI:SS') "Last SCN Time"  from
 v$standby_log a  order by 1,2,3,4
 /

Should return the following :

THREAD#  SEQUENCE#  GRP    SIZE_MB STATUS     ARC Fisrt SCN Number First SCN Time              Last SCN Time
-------- ---------- ---- ---------- ---------- --- ---------------- --------------------------- ---------------------------
       1          0    4        100 UNASSIGNED NO                 0
                  0    6        100 UNASSIGNED YES                0
                  0    7        100 UNASSIGNED YES                0
               7316    5        100 ACTIVE     YES        153517071 04-Feb-11 13:39:32          04-Feb-11 13:40:41
Advertisements

7 Responses to “Scripts to resize standby redolog files”

  1. […] parameter actually do? « Changing redo log size – standby database Scripts to resize standby redolog files […]

  2. venkat said

    Do you have the standby_file_management set to ‘AUTO’ in order to follow the above approach

  3. don said

    the alter system set log_archive_dest_state_2 = defer scope = memory, im my init.ora file i have this paramater set:
    log_archive_dest_1=’location=use_db_recovery_file_dest valid_for=(ALL_LOGFILES,ALL_ROLES)’

    should the alter be log_archive_dest_state_1 or are these two seperate paramters ???

  4. MalcolmT said

    Nice one John – thanks

  5. […] Here ‘s two very well written articles on this error and how to resize logs. […]

  6. […] https://jhdba.wordpress.com/2011/02/28/scripts-to-resize-standby-redolog-files/ […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: