STEP BY STEP CONFIGURATION FOR DATA GUARD
Manually Create a Physical Standby Database
Primary Database name:TEST3
Standby Database name:TEST4
Primary Database Side:
1. Create a password file if it doesn’t exist.
To check if a password file already exists, run the following command:
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
----------------- ----- ----- -----
SYS TRUE TRUE FALSE
2) If it doesn’t exist, use the following command to create one:
Linux:$orapwd file=$ORACLE_HOME/dbs/orapw<db name> password=sys
Standby Database name:TEST4
Primary Database Side:
1. Create a password file if it doesn’t exist.
To check if a password file already exists, run the following command:
SQL> select * from v$pwfile_users;
USERNAME SYSDB SYSOP SYSAS
----------------- ----- ----- -----
SYS TRUE TRUE FALSE
2) If it doesn’t exist, use the following command to create one:
Linux:$orapwd file=$ORACLE_HOME/dbs/orapw<db name> password=sys
3.
Configure a Standby Redo log.
The size of the standby redo log files should match the size of the current Primary database online redo log files. To find out the size of your online redo log files:
SQL> select bytes from v$log;
BYTES
----------
52428800
52428800
52428800
The size of the standby redo log files should match the size of the current Primary database online redo log files. To find out the size of your online redo log files:
SQL> select bytes from v$log;
BYTES
----------
52428800
52428800
52428800
4.
Use the following command to determine your
current log file groups:
SQL> select group#, member
from v$logfile;
GROUP# MEMBER
--------------------------------------------------------------------------------
3
/oracle/11gdb/oradata/TEST3/redo03.log
2 /oracle/11gdb/oradata/TEST3/redo02.log
1
/oracle/11gdb/oradata/TEST3/redo01.log
5. Create standby
Redo log groups.
My primary database had 3 log file groups originally and I created 3 standby redo log groups using the following commands:
My primary database had 3 log file groups originally and I created 3 standby redo log groups using the following commands:
SQL>ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 'location' SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 'location'SIZE 50M;
SQL>ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 'location'SIZE 50M;
6.
To verify the results of the standby redo log
groups creation, run the following query:
SQL>select * from v$standby_log;
SQL>select * from v$standby_log;
7.
Enable Archiving on Primary.
If your primary database is not already in Archive Log mode, enable the archive log mode:
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
SQL>archive log list;
5. Set Primary Database Initialization Parameters
Create a text initialization parameter file (PFILE) from the server parameter file (SPFILE), to add the new primary role parameters.
1) Create pfile from spfile for the primary database:
SQL>create pfile from spfile;
If your primary database is not already in Archive Log mode, enable the archive log mode:
SQL>shutdown immediate;
SQL>startup mount;
SQL>alter database archivelog;
SQL>alter database open;
SQL>archive log list;
5. Set Primary Database Initialization Parameters
Create a text initialization parameter file (PFILE) from the server parameter file (SPFILE), to add the new primary role parameters.
1) Create pfile from spfile for the primary database:
SQL>create pfile from spfile;
8.
Edit pfileTEST3.ora to add the new primary and
standby role parameters:
Ex:initTEST3.ora
[oracle@track dbs]$ cat initTEST3.ora
TEST3.__db_cache_size=687865856
TEST3.__java_pool_size=16777216
TEST3.__large_pool_size=16777216
TEST3.__oracle_base='/oracle/11gdb'#ORACLE_BASE
set from environment
TEST3.__pga_aggregate_target=687865856
TEST3.__sga_target=1006632960
TEST3.__shared_io_pool_size=0
TEST3.__shared_pool_size=268435456
TEST3.__streams_pool_size=0
*.audit_file_dest='/oracle/11gdb/admin/TEST3/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/11gdb/oradata/TEST3/control01.ctl','/oracle/11gdb/oradata/TEST3/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.DB_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST4/','/oracle/11gdb/oradata/TEST3/'
*.db_name='TEST3'
*.db_recovery_file_dest_size=10737418240
*.db_recovery_file_dest='/oracle/11gdb/product/11.2.0/dbhome_1/flash_back'
*.db_unique_name='TEST3'
*.diagnostic_dest='/oracle/11gdb'
#*.dispatchers='(PROTOCOL=TCP)
(SERVICE=TEST3XDB)'
*.FAL_CLIENT='TEST3'
*.FAL_SERVER='TEST4'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TEST3,TEST4)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST3/archivelog
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=TEST3'
*.LOG_ARCHIVE_DEST_2='SERVICE=TEST4
LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=TEST4'
*.LOG_ARCHIVE_DEST_STATE_1='ENABLE'
*.LOG_ARCHIVE_DEST_STATE_2='ENABLE'
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.arc'
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.LOG_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST4/','/oracle/11gdb/oradata/TEST3/','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST4/onlinelog','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST3/onlinelog'
*.memory_target=1680867328
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.STANDBY_FILE_MANAGEMENT='AUTO'
*.undo_tablespace='UNDOTBS1'
*.local_listener=TEST3
[oracle@track
dbs]$
9.
Create spfile from pfile, and restart primary
database using the new spfile.
Data Guard must use SPFILE. Create the SPFILE and restart database.
SQL> shutdown immediate;
SQL> startup nomount pfile='<Path>'
SQL> create spfile from pfile='<Path>';
SQL>shutdown immediate;
SQL>startup
Data Guard must use SPFILE. Create the SPFILE and restart database.
SQL> shutdown immediate;
SQL> startup nomount pfile='<Path>'
SQL> create spfile from pfile='<Path>';
SQL>shutdown immediate;
SQL>startup
10.
Standby
Database Site:
1. Create a copy of Primary database data files on the Standby Server:
On Primary DB:
SQL>shutdown immediate;
On Standby Server (While the Primary database is shut down):
1) Create directory for data files.
2) Copy the data files and temp files over.
3) Create directory (multiplexing) for online logs,
4) Copy the online logs over.
5. Create a Control File for the standby database:
On Primary DB, create a control file for the standby to use:
SQL>startup mount;
SQL>alter database create standby controlfile as ‘TEST4.ctl;
SQL>ALTER DATABASE OPEN;
6. Copy the Primary DB pfile to Standby server and rename/edit the file.
1. Create a copy of Primary database data files on the Standby Server:
On Primary DB:
SQL>shutdown immediate;
On Standby Server (While the Primary database is shut down):
1) Create directory for data files.
2) Copy the data files and temp files over.
3) Create directory (multiplexing) for online logs,
4) Copy the online logs over.
5. Create a Control File for the standby database:
On Primary DB, create a control file for the standby to use:
SQL>startup mount;
SQL>alter database create standby controlfile as ‘TEST4.ctl;
SQL>ALTER DATABASE OPEN;
6. Copy the Primary DB pfile to Standby server and rename/edit the file.
Ex:
[oracle@track dbs]$ cat initTEST4.ora
TEST4.__db_cache_size=687865856
TEST4.__java_pool_size=16777216
TEST4.__large_pool_size=16777216
TEST4.__oracle_base='/oracle/11gdb'#ORACLE_BASE set from environment
TEST4.__pga_aggregate_target=687865856
TEST4.__sga_target=1006632960
TEST4.__shared_io_pool_size=0
TEST4.__shared_pool_size=268435456
TEST4.__streams_pool_size=0
*.audit_file_dest='/oracle/11gdb/admin/TEST4/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/11gdb/oradata/TEST4/TEST4.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='TEST3'
*.db_recovery_file_dest_size=10737418240
*.db_recovery_file_dest='/oracle/11gdb/product/11.2.0/dbhome_1/flash_back'
*.diagnostic_dest='/oracle/11gdb'
#*.dispatchers='(PROTOCOL=TCP) (SERVICE=TEST4XDB)'
#*.memory_target=1680867328
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.db_unique_name=TEST4
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TEST3,TEST4)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST4/archivelog/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=TEST4'
*.LOG_ARCHIVE_DEST_2='SERVICE=TEST3 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=TEST3'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.remote_login_passwordfile='EXCLUSIVE'
*.FAL_SERVER=TEST3
*.FAL_CLIENT=TEST4
*.STANDBY_FILE_MANAGEMENT=AUTO
*.DB_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST3/','/oracle/11gdb/oradata/TEST4/'
*.LOG_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST3/','/oracle/11gdb/oradata/TEST4/','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST3/onlinelog','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST4/onlinelog'
*.local_listener=TEST4
[oracle@track dbs]$
7. On Standby server, create all required directories for dump and archived log destination:
Create directories adump, bdump, cdump, udump, and archived log destinations for the standby database.
8. Copy the standby control file ‘TEST4.ctl’ from primary to standby destinations ;
9. Copy the Primary password file to standby and rename it to pwdTEST4.ora.
[oracle@track dbs]$ cat initTEST4.ora
TEST4.__db_cache_size=687865856
TEST4.__java_pool_size=16777216
TEST4.__large_pool_size=16777216
TEST4.__oracle_base='/oracle/11gdb'#ORACLE_BASE set from environment
TEST4.__pga_aggregate_target=687865856
TEST4.__sga_target=1006632960
TEST4.__shared_io_pool_size=0
TEST4.__shared_pool_size=268435456
TEST4.__streams_pool_size=0
*.audit_file_dest='/oracle/11gdb/admin/TEST4/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/oracle/11gdb/oradata/TEST4/TEST4.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='TEST3'
*.db_recovery_file_dest_size=10737418240
*.db_recovery_file_dest='/oracle/11gdb/product/11.2.0/dbhome_1/flash_back'
*.diagnostic_dest='/oracle/11gdb'
#*.dispatchers='(PROTOCOL=TCP) (SERVICE=TEST4XDB)'
#*.memory_target=1680867328
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
*.db_unique_name=TEST4
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(TEST3,TEST4)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST4/archivelog/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=TEST4'
*.LOG_ARCHIVE_DEST_2='SERVICE=TEST3 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=TEST3'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.LOG_ARCHIVE_FORMAT=%t_%s_%r.arc
*.LOG_ARCHIVE_MAX_PROCESSES=30
*.remote_login_passwordfile='EXCLUSIVE'
*.FAL_SERVER=TEST3
*.FAL_CLIENT=TEST4
*.STANDBY_FILE_MANAGEMENT=AUTO
*.DB_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST3/','/oracle/11gdb/oradata/TEST4/'
*.LOG_FILE_NAME_CONVERT='/oracle/11gdb/oradata/TEST3/','/oracle/11gdb/oradata/TEST4/','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST3/onlinelog','/oracle/11gdb/product/11.2.0/dbhome_1/flash_back/TEST4/onlinelog'
*.local_listener=TEST4
[oracle@track dbs]$
7. On Standby server, create all required directories for dump and archived log destination:
Create directories adump, bdump, cdump, udump, and archived log destinations for the standby database.
8. Copy the standby control file ‘TEST4.ctl’ from primary to standby destinations ;
9. Copy the Primary password file to standby and rename it to pwdTEST4.ora.
Ex:
$oradim –NEW –SID STAN –STARTMODE manual
$oradim –NEW –SID STAN –STARTMODE manual
or
create a password file
Ex:
Linux:$orapwd
file=$ORACLE_HOME/dbs/orapw<db name> password=sys
10. Configure listeners for the primary and standby databases.
On Primary system: use Oracle Net Manager to configure a listener for TEST3 and TEST4. Then restart the listener.
Ex:listener.ora
[oracle@track
admin]$ cat listener.ora
# listener.ora Network Configuration File: /oracle/11gdb/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
TEST3 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1523))
)
)
SID_LIST_TEST3 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME=/oracle/11gdb/product/11.2.0/dbhome_1)
(SID_NAME = TEST3)
)
)
TEST4 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1524))
)
)
SID_LIST_TEST4 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME=/oracle/11gdb/product/11.2.0/dbhome_1/)
(SID_NAME = TEST4)
)
)
ADR_BASE_TEST3 = /oracle/11gdb
[oracle@track admin]$
$lsnrctl stop TEST3
# listener.ora Network Configuration File: /oracle/11gdb/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
TEST3 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1523))
)
)
SID_LIST_TEST3 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME=/oracle/11gdb/product/11.2.0/dbhome_1)
(SID_NAME = TEST3)
)
)
TEST4 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1524))
)
)
SID_LIST_TEST4 =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME=/oracle/11gdb/product/11.2.0/dbhome_1/)
(SID_NAME = TEST4)
)
)
ADR_BASE_TEST3 = /oracle/11gdb
[oracle@track admin]$
$lsnrctl stop TEST3
$lsnrctl
start TEST3
11. On Standby server: use Net Manager to configure a listener for TEST3 and TEST4. Then restart the listener.
$lsnrctl stop TEST4
11. On Standby server: use Net Manager to configure a listener for TEST3 and TEST4. Then restart the listener.
$lsnrctl stop TEST4
$lsnrctl
start TEST4
12.Create Oracle Net service names.
12.Create Oracle Net service names.
Ex:tnsnames.ora
[oracle@track admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /oracle/11gdb/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TEST3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1523))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST3)
(INSTANCE_NAME=TEST3)
)
)
TEST4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1524))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST4)
(INSTANCE_NAME=TEST4)
)
)
[oracle@track admin]$
13. On Primary system: use Oracle Net Manager to create network service names for TEST3 and TEST4. Check tnsping to both services:
$tnsping TEST3
$tnsping TEST4
14.On Standby system: use Oracle Net Manager to create network service names for TEST3 and TEST4. Check tnsping to both services:
$tnsping TEST3
$tnsping TEST4
15. On Standby server, setup the environment variables to point to the Standby database.
Set up ORACLE_HOME and ORACLE_SID.
16. Start up nomount the standby database and generate a spfile.
SQL>startup nomount pfile=<path>
# tnsnames.ora Network Configuration File: /oracle/11gdb/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TEST3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1523))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST3)
(INSTANCE_NAME=TEST3)
)
)
TEST4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.108)(PORT = 1524))
)
(CONNECT_DATA =
(SERVICE_NAME = TEST4)
(INSTANCE_NAME=TEST4)
)
)
[oracle@track admin]$
13. On Primary system: use Oracle Net Manager to create network service names for TEST3 and TEST4. Check tnsping to both services:
$tnsping TEST3
$tnsping TEST4
14.On Standby system: use Oracle Net Manager to create network service names for TEST3 and TEST4. Check tnsping to both services:
$tnsping TEST3
$tnsping TEST4
15. On Standby server, setup the environment variables to point to the Standby database.
Set up ORACLE_HOME and ORACLE_SID.
16. Start up nomount the standby database and generate a spfile.
SQL>startup nomount pfile=<path>
17.
Start Redo apply
On the standby database, to start redo apply:
SQL>alter database recover managed standby database disconnect from session;
If you ever need to stop log apply services:
SQL> alter database recover managed standby database cancel;
18. Verify the standby database is performing properly:
On Standby perform a query:
SQL>select sequence#, first_time, next_time from v$archived_log;
On Primary, force a logfile switch:
SQL>alter system switch logfile;
19. On Standby, verify the archived redo log files were applied:
SQL>select sequence#, applied from v$archived_log order by sequence#;
20. If you want the redo data to be applied as it is received without waiting for the current standby redo log file to be archived, enable the real-time apply.
To start real-time apply:
SQL> alter database recover managed standby database using current logfile disconnect;
On the standby database, to start redo apply:
SQL>alter database recover managed standby database disconnect from session;
If you ever need to stop log apply services:
SQL> alter database recover managed standby database cancel;
18. Verify the standby database is performing properly:
On Standby perform a query:
SQL>select sequence#, first_time, next_time from v$archived_log;
On Primary, force a logfile switch:
SQL>alter system switch logfile;
19. On Standby, verify the archived redo log files were applied:
SQL>select sequence#, applied from v$archived_log order by sequence#;
20. If you want the redo data to be applied as it is received without waiting for the current standby redo log file to be archived, enable the real-time apply.
To start real-time apply:
SQL> alter database recover managed standby database using current logfile disconnect;
Switchover to Physical Standby Database
Primary Database Side:
Step 1 : Verify whether it is possible to
perform a switchover
SQL>
select switchover_status from v$database ;
SWITCHOVER_STATUS
--------------------
TO STANDBY
Step 2: Check the status of primary
database.
SQL>
select name,open_mode,db_unique_name from v$database;
NAME
OPEN_MODE DB_UNIQUE_NAME
---------
-------------------- ------------------------------
TEST3 READ WRITE TEST3
Step 3: perform a log switch on the primary
database
SQL>
alter system switch logfile ;
System
altered.
SQL> /
System
altered.
SQL> /
System
altered.
Step 4:Switch the Primary to Standby
SQL>
alter database commit to switchover to
physical standby;
Database
altered.
SQL>
select name,open_mode,db_unique_name from v$database;
select
name,open_mode,db_unique_name from v$database
*
ERROR at
line 1:
ORA-01507:
database not mounted
SQL>
shu immediate;
ORA-01507:
database not mounted
ORACLE
instance shut down.
Step 5: Startup the database (mount)
SQL>
startup mount
ORACLE
instance started.
Total
System Global Area 1690705920 bytes
Fixed Size
1336960 bytes
Variable
Size 1426065792 bytes
Database
Buffers 251658240 bytes
Redo
Buffers 11644928 bytes
Database
mounted.
Step 6: Check the databases status
SQL>
select name,open_mode,db_unique_name from v$database;
NAME
OPEN_MODE DB_UNIQUE_NAME
---------
-------------------- ------------------------------
TEST3 MOUNTED TEST3
SQL>
select name,open_mode,db_unique_name,switchover_status from v$database;
NAME
OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS
---------
-------------------- ------------------------ --------------------
TEST3
MOUNTED TEST3 TO PRIMARY
SQL>
alter database open;
Database
altered.
SQL>
select name,open_mode ,db_unique_name,switchover_status from v$database;
NAME
OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS
---------
-------------------- ------------------------------ --------------------
TEST3 READ ONLY TEST3 RECOVERY NEEDED
Standby Database Side:
Step 1: Check the databases status
SQL> select name,open_mode,db_unique_name from v$database;
NAME OPEN_MODE DB_UNIQUE_NAME
--------- -------------------- ------------------------------
TEST3 READ ONLY TEST4
Step 2:Switch the target physical standby database role to the primary role
SQL> alter database commit to switchover to primary ;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
Step 3: Try to recover
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> alter database commit to switchover to primary ;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
Step 4: Down the database
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 150667264 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 6725632 bytes
Database mounted.
Database opened.
Step 5: Try to recover
SQL> alter database recover managed standby database disconnect from session;
Database altered.
Step 6:Switch the target physical standby database role to the primary role
SQL> alter database commit to switchover to primary ;
Database altered.
SQL> shu immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 150667264 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 6725632 bytes
Database mounted.
Database opened.
Step 7: Check the databases status
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select name,open_mode ,db_unique_name,switchover_status from v$database;
NAME OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS
--------- -------------------- - ----------------------------- --------------------
TEST3 READ WRITE TEST4 TO STANDBY
--------------
SQL> select name,open_mode,db_unique_name from v$database;
NAME OPEN_MODE DB_UNIQUE_NAME
--------- -------------------- ------------------------------
TEST3 READ ONLY TEST4
Step 2:Switch the target physical standby database role to the primary role
SQL> alter database commit to switchover to primary ;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
Step 3: Try to recover
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> alter database commit to switchover to primary ;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
Step 4: Down the database
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 150667264 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 6725632 bytes
Database mounted.
Database opened.
Step 5: Try to recover
SQL> alter database recover managed standby database disconnect from session;
Database altered.
Step 6:Switch the target physical standby database role to the primary role
SQL> alter database commit to switchover to primary ;
Database altered.
SQL> shu immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 150667264 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 6725632 bytes
Database mounted.
Database opened.
Step 7: Check the databases status
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> select name,open_mode ,db_unique_name,switchover_status from v$database;
NAME OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS
--------- -------------------- - ----------------------------- --------------------
TEST3 READ WRITE TEST4 TO STANDBY
--------------
No comments:
Post a Comment