Documente Academic
Documente Profesional
Documente Cultură
STANDBY_FILE_MANAGEMENT
The default value is MANUAL. Once you set to AUTO whenever you add or drop files on Primary
database, those files are reflected automatically on the Standby database. Lets check.
ENVIRONMENT DETAILS
Database Name
: crms
: SERVER1 192.168.117.131
Standby Site
: SERVER2 192.168.117.129
: Physical Standby
: MAXIMUM PERFORMANCE
TYPE
VALUE
string
AUTO
TYPE
VALUE
string
AUTO
TYPE
VALUE
string
/u01/app/oracle/oradata/crms/,
/u01/app/oracle/oradata/stbycrms/
# ON PRIMARY DATABASE
SYS> select file_name, file_id from dba_data_files where tablespace_name='CRMS';
FILE_NAME
FILE_ID
------------------------------------------------------ --------/u01/app/oracle/oradata/crms/crms_file01.dbf
STATUS
RECOVER
STATUS
RECOVER
datafile 6
datafile 6
STATUS
OFFLINE
STATUS
ONLINE
You should do above steps manually to make the equivalent modifications on the standby database.
# ON THE STANDBY DATABASE, STOP REDO APPLY
SYS> alter database recover managed standby database cancel;
Database altered.
SYS> shutdown immediate;
...
STATUS
ONLINE
RELOCATE A DATAFILE
Suppose you create a datafile in different location which is NOT in the db_file_name_convert path
in the standby init.ora and how to recover the standby database in this case.
TYPE
VALUE
string
/u01/app/oracle/oradata/crms/,
/u01/app/oracle/oradata/stbycrms/
TYPE
VALUE
string
AUTO
# ON STANDBY DATABASE
SYS> select name from v$datafile where ts#=7;
NAME
-----------------------------------------------/u01/app/oracle/oradata/stbycrms/crms01.dbf
/u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00007
SYS> alter system set standby_file_management=manual;
System altered.
It is required to resize the online redo log files in Data Guard configuration you need to perform
resize for both online redo logfiles and Standby Redo logfiles
SRL is not mandatory for Primary database but its good and useful in role conversion from Primary
to Standby Database. Oracle recommends that you create a Standby redo log on the Primary database
so that the primary database can switch over quickly to the standby role without any extra step.
It is good to create SRL on both sides (Primary and Standby) you switchover quickly.
The SRL files will NOT be used on the Primary database side until you perform Switchover operation
i.e. (when Primary database becomes Standby database).
On Primary Site, Standby Redo Logs will not be used unless you do switchover.
On Standby Site, Online Redo logs will not be used, instead Standby RedoLogs (SRL) will be used.
It is important to configure the Standby Redo Logs (SRL) with the same size as the online redo logs.
# ON PRIMARY DATABASE
SYS> select name, db_unique_name, database_role from v$database;
NAME
DB_UNIQUE_NAME
--------- --------------CRMS
crms
DATABASE_ROLE
---------------PRIMARY
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$log;
THREAD#
50
INACTIVE
50
INACTIVE
50
CURRENT
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$standby_log;
THREAD#
50 UNASSIGNED
50 UNASSIGNED
50 UNASSIGNED
50 UNASSIGNED
It is very basic requirement in an Oracle database that minimum 2 Redo Log Groups are required.
Hence we cannot drop any Redo Group if there are only 2 Groups. So I would add GROUP #1 first.
# ADD REDO LOG GROUP #1
SYS> alter database add logfile group 1
'/u01/app/oracle/oradata/crms/redo02.log' size 100m reuse;
Database altered.
SYS> alter database add logfile group 2
'/u01/app/oracle/oradata/crms/redo02.log' size 100m reuse;
Database altered.
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$log;
THREAD#
100 UNUSED
100 UNUSED
50 CURRENT
100 CURRENT
100 UNUSED
50 ACTIVE
NOW GROUP #3 STATUS is ACTIVE means (if the Database crashes now, you need this Group for recovery.)
We need to make this group Inactive before proceeding ahead:
Do switch logfiles manually until Group 3 becomes INACTIVE; you can do couple of log switches, to
make GROUP #3 status as INACTIVE.
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$log;
THREAD#
100 CURRENT
100 INACTIVE
50 INACTIVE
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$log;
THREAD#
100 CURRENT
100 INACTIVE
100 UNUSED
We have changed the Redo Log file size from 50M to 100M on the Primary database.
SYS> select group#, sum(bytes/1024/1024)"size in MB" from v$standby_log group by group#;
GROUP# size in MB
---------- ---------6
50
50
50
50
Directly we can drop the UNASSIGNED SRLs and re-create them with the new size. As I told earlier
SRL will be used on the Primary, when Primary database starts to behave as a Standby database.
BYTES STATUS
104857600 UNASSIGNED
104857600 UNASSIGNED
104857600 UNASSIGNED
104857600 UNASSIGNED
On the Primary side, we have changed ORL and SRL files size from 50m to 100m. On the Primary
database changes of the ORL/SRL file changes are not propagated to the standby database.
DB_UNIQUE_NAME
DATABASE_ROLE
stbycrms
PHYSICAL STANDBY
SYS> select thread#, group#, bytes/1024/1024 "SIZE IN MB", status from v$log;
THREAD#
GROUP#
SIZE IN MB STATUS
50 CLEARING_CURRENT
50 CLEARING
50 CLEARING
More over Status of Group #2 is still clearing, lets clear it manually before dropping the group.
Check STATUS column of V$LOG V$VIEW.
GROUP#
SIZE IN MB STATUS
50 CLEARING
100 UNUSED
50 CLEARING_CURRENT
SIZE IN MB
--------------- --------------1
100
100
100
SIZE IN MB
--------------- --------------6
50
50
50
50
For the SRL groups whose status is UNASSIGNED, just drop the group and recreate them with the
size same as that of the Online Redo Logs.
size in MB
--------------- --------------6
100
100
100
100
We have done all SRL & ORL files on Primary and standby database. Next we have to set the parameter
STANDBY_FILE_MANAGEMENT to AUTO as well as start the recovery (MRP) on Standby database.
# ON STANDBY DATABASE
SYS> alter system set standby_file_management=auto scope=both;
System altered.
SYS> select sequence#, first_time, next_time, applied
from v$archived_log order by sequence#;
SEQUENCE# FIRST_TIM NEXT_TIME APPLIED
--------------- --------- --------- --------256 12-DEC-15 12-DEC-15 YES
257 12-DEC-15 12-DEC-15 YES
258 12-DEC-15 12-DEC-15 YES
259 12-DEC-15 12-DEC-15 NO
260 12-DEC-15 12-DEC-15 NO
261 12-DEC-15 12-DEC-15 NO
262 12-DEC-15 12-DEC-15 NO
263 12-DEC-15 12-DEC-15 NO
264 12-DEC-15 12-DEC-15 NO
265 12-DEC-15 12-DEC-15 NO
266 12-DEC-15 12-DEC-15 NO
267 12-DEC-15 12-DEC-15 NO
SYS> select thread#, max(sequence#) from v$archived_log
where applied='YES' group by thread#;
THREAD#
MAX(SEQUENCE#)
--------------- --------------1
258
SYS> alter database recover managed standby database using current logfile disconnect;
Database altered.
SYS> select open_mode from v$database;
OPEN_MODE
-------------------READ ONLY WITH APPLY
STATUS
SEQUENCE#
CLOSING
258
ARCH
CLOSING
252
ARCH
CONNECTED
ARCH
CLOSING
RFS
IDLE
RFS
IDLE
RFS
IDLE
RFS
IDLE
268
MRP0
APPLYING_LOG
260
0
259
267
# ON PRIMARY DATABASE
SYS> select thread#, max(sequence#) from v$archived_log group by thread#;
THREAD# MAX(SEQUENCE#)
---------- -------------1
267
SEQUENCE#
USED
BYTES STATUS
512
104857600 UNASSIGNED
270
61952
512
104857600 UNASSIGNED
512
104857600 UNASSIGNED
104857600 ACTIVE