Based on ML Note 90817.1 -> Check it!!
Here are the Steps to work with the Standby Database as a Prod
Database.
This doc consists in three Parts:
I - Activate Standby
Database as Production
II - Siwtchover between
Production and Standby Database (without resetlogs)
III - Siwtchback between Standby
Database and Production (without resetlogs)
Activate Standby as Production
Primary Site | Standby Site |
Archive the current online redo log ALTER SYSTEM ARCHIVE LOG CURRENT; |
Start the database in nomount STARTUP NOMOUNT ALTER DATABASE MOUNT STANDBY DATABASE; |
Send the ARCH files to the standby site | Start Recovery Mode RECOVER MANAGED STANDBY DATABASE; or RECOVER STANDBY DATABASE; |
Check the alert file to review the last applied logs | |
Modify your init.ora file. Specifically LOG_ARCHIVE_DEST=<Value> LOG_ARCHIVE_START = TRUE LOG_ARCHIVE_DEST_STATE = ENABLE And Comment the parameter: STANDBY_ARCHIVE_DEST = <Value> |
|
Ensure that your standby database is mounted in EXCLUSIVE
mode by executing the following query: SELECT name,value FROM v$parameter WHERE name='parallel_server'; If the value is TRUE, then the database is not mounted exclusively; if the value is FALSE, then the database is mounted exclusively. |
|
Activate the standby database (this command resets the online
redo logs): ALTER DATABASE ACTIVATE STANDBY DATABASE; |
|
Shut down the NEW PROD instance: SHUTDOWN IMMEDIATE |
|
Make a COLD BACKUP and check init.ora parameters | |
Start the new production instance: STARTUP |
Important Note: These steps MUST be tested and understood because a mistake can result in the loss of the production or standby database.
The main Advantage of a graceful switchover or switchback is that it avoids the resetlogs operation. So the source database can resume its role as the standby database almost immediately. When the primary site requires scheduled maintenance, the production database can gracefully switch over to the standby database. Thereby, the graceful switchover technique may be useful for planned site repairs, hardware changes, O/S upgrades.
Prerequisites of Graceful Switchover or Switchbak
Steps in detail
Primary Site | Standby Site |
Alter system archive log current; | DB is in Recover Mode |
alter database backup controlfile to
trace noresetlogs; Send the trace file. |
Copy the controlfile script from prod to standby. You will need to modify this file with the appropiate data file and log file path names. Validate status and existence of all data files (all the online, datafiles from offline tablespaces and read only tablespaces will be offlined in the create controlfile script) and log files. Comment out the RECOVER DATABASE and the ALTER DATABASE OPEN. (Appendix C) |
shutdown immediate (check alert.log file for ALTER DATABASE CLOSE NORMAL) | Apply last set of archives log files and cancel recovery |
Copy control files and online redo logs to standby (do not delete them from prod) | shutdown immediate (check alert.log file for ALTER DATABASE CLOSE NORMAL and ALTER DATABASE DISMOUNT) |
Reverse production and standby network connections (if necessary) | Reverse production and standby network connections (if necessary) |
Modify your init.ora file to adapt it to the new changes (Appendix A) | |
Execute the create controlfile script. startup nomount create controlfile ...... |
|
Recover database; (will recover only online datafiles) | |
Validate oracle database (Appendix B) | |
alter database open; At this point this DB is open in
read-write mode |
|
alter
database create standby
controlfile as '/path/standby.ctl'; And
copy that file to the OLD PROD DB. |
|
Copy the standby.ctl
overwritting the existing controlfiles that you had before. |
alter system archive log all (to send archives to the new standby database) |
Server start to receive archives log files | Now clients can reconnect here, Standby becomes PRODUCTION |
Validate existence of all Oracle datafiles and standby controlfiles. Modify your init.ora file to adapt it to the new changes (Appendix A) | |
Startup nomount; alter database mount standby database; |
|
Rename datafiles and control files is necessary (alter database rename file '/path/name' to '/newpath/name'; ) | |
Offline data files if requiered (alter database datafile 'name' offline;) | |
Check Apendix B for validation | |
Initiate recovery: alter database recover managed standby database or recover standby database; |
|
Oracle start to apply archive logs (check alert file) | |
PRODUCTION BECOMES STANDBY |
The "new" standby init.ora file
db_file_name_convert = "oldpath","newpath"
log_file_name_convert = "oldpath","newpath"
control_files = pointing to standby controlfile or backup
controlfile
standby_archive_dest = <Value>
For Tuning
db_block_buffers
recovery_parallelism
log_buffer
db_writers
The "new" production init.ora
db_file_name_convert = "oldpath","newpath"
log_file_name_convert = "oldpath","newpath"
control_files = pointing to the production controlfiles
Log_archive_format = arch_NAMEDB_%S.arc
Log_archive_start = true
log_archieve_dest_1 = "location=<Value> MANDATORY"
log_archieve_state_1 = enable
log_archive_dest_2 = "service=<service_name> OPTIONAL reopen=60"
log_archive_dest_state_2 = enable
log_archive_min_succeed_dest = 1
Apendix B: Validate Standby Database
The following scripts will help you to validate the databases.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TICPBT09" NORESETLOGS ARCHIVELOG
#Validate all settings
MAXLOGFILES 32
MAXLOGMEMBERS 2
MAXDATAFILES 1000
MAXINSTANCES 8
MAXLOGHISTORY 5899
LOGFILE
#Validate and correct log file names and paths.
GROUP 1 (
'/u05/oradata/TICPBT09/redo01A.log',
'/u06/oradata/TICPBT09/redo01B.log'
) SIZE 5000K,
GROUP 2 (
'/u06/oradata/TICPBT09/redo02A.log',
'/u07/oradata/TICPBT09/redo02B.log'
) SIZE 5000K,
GROUP 3 (
'/u07/oradata/TICPBT09/redo03A.log',
'/u05/oradata/TICPBT09/redo03B.log'
) SIZE 5000K
DATAFILE
#Validate and correct data file names and paths.
'/u05/oradata/TICPBT09/system01.dbf',
'/u05/oradata/TICPBT09/rbs01.dbf',
'/u06/oradata/TICPBT09/temp01.dbf',
'/u06/oradata/TICPBT09/users01.dbf',
'/u06/oradata/TICPBT09/llownerndx01.dbf',
'/u07/oradata/TICPBT09/llownerdata01.dbf',
'/u07/oradata/TICPBT09/lpownerndx01.dbf',
'/u08/oradata/TICPBT09/lpownerdata01.dbf',
'/u05/oradata/TICPBT09/CO_SNP_LOGS.dbf',
'/u06/oradata/TICPBT09/temp01_01.dbf',
'/u07/oradata/TICPBT09/coownerndx01.dbf',
'/u06/oradata/TICPBT09/coownerdata01.dbf',
'/u07/oradata/TICPBT09/PB_OWNER_NDX1.dbf',
'/u08/oradata/TICPBT09/PB_OWNER.dbf',
'/u04/oradata/TICPBT09/rbs02.dbf'
CHARACTER SET US7ASCII
;
# Comment out recover and all commands from this point
#RECOVER DATABASE
# All logs need archiving and a log switch is needed.
#ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
#ALTER DATABASE OPEN;
# Commands to add tempfiles to temporary tablespaces.
# Online tempfiles have complete space information.
# Other tempfiles may require adjustment.
#ALTER TABLESPACE TEMP_LOCAL ADD TEMPFILE
'/u04/oradata/TICPBP02/temp_local01.dbf' REUSE;
# End of tempfile additions.
Graceful Switchback between Standby and Prod DB
As you can imagine, the steps are the same as the previous table
but changing the columns.