Академический Документы
Профессиональный Документы
Культура Документы
Overview
This section will detail OEM 9i Data Guard setup as well as 10g Data Guard
broker setup. Additional information has been included covering Flashback
Database options and failover versus switchover configurations.
DataGuard can be set up manually (i.e. the Data Guard Broker) or it can be set
up through Enterprise Manager (i.e. OEM).
init.ora Parameters
Verify the following init.ora parameters for the Data Guard Broker:
dg_broker_config_file1 =
/u01/app/oracle/product/10.1.0/db_1/dbs/dr1DBSID_DG1.dat
dg_broker_config_file2 =
/u01/app/oracle/product/10.1.0/db_1/dbs/dr2DBSID_DG1.dat
dg_broker_start = TRUE
Primary Site
$ dgmgrl
DGMGRL for Linux: Version 9.2.0.1.0 - Production.
(c) Copyright 2002 Oracle Corporation. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /
Connected.
DGMGRL> show configuration
Configuration 'DBSID' is
Primary Site is 'DBSID_DG1_site'
Standby Site is 'DBSID_DG2_site'
Current status for "DBSID":
SUCCESS
DGMGRL> show configuration verbose;
Configuration
Name:
'DBSID'
Enabled:
'yes'
Default state:
'ONLINE'
Intended state:
'ONLINE'
Protection Mode: 'MaxPerformance'
Number of sites: 2
Sites:
Primary Site: DBSID_DG1_site
Standby Site: DBSID_DG2_site
Current status for "DBSID":
SUCCESS
DGMGRL>
Standby Site
$ dgmgrl
DGMGRL for Linux: Version 9.2.0.1.0 - Production.
(c) Copyright 2002 Oracle Corporation. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /
Connected.
DGMGRL> show configuration
Configuration 'DBSID' is
Primary Site is 'DBSID_DG1_site'
Standby Site is 'DBSID_DG2_site'
Current status for "DBSID":
SUCCESS
DGMGRL> show configuration verbose
Configuration
Name:
'DBSID'
Enabled:
'yes'
Default state:
'ONLINE'
Intended state:
'ONLINE'
Protection Mode: 'MaxPerformance'
Number of sites: 2
Sites:
Primary Site: DBSID_DG1_site
Standby Site: DBSID_DG2_site
Current status for "DBSID":
SUCCESS
DGMGRL>
boolean
TRUE
TYPE
VALUE
-------------------------- -------------------------------------------db_unique_name
string
DBSID_DG2
SQL> show parameters dg
NAME
TYPE
VALUE
-------------------------- -------------------------------------------dg_broker_config_file1
string
/u01/app/oracle/product/10.1.0/db_1/dbs/dr1DBSID_DG2.dat
dg_broker_config_file2
string
/u01/app/oracle/product/10.1.0/db_1/dbs/dr2DBSID_DG2.dat
dg_broker_start
boolean
TRUE
1.
Data Guard configuration name make this the unqualified database name.
Connected.
DGMGRL> show configuration
Error: ORA-16532: Data Guard broker configuration does not
exist.
unable to describe configuration
DGMGRL> create configuration 'DBSID_DG' AS
> primary database is 'DBSID_dg2'
> connect identifier is DBSID_dg2;
Configuration "DBSID_DG" created with primary database
"DBSID_dg2".
DGMGRL> show configuration
Configuration
Name:
DBSID_DG
Enabled:
NO
Protection Mode: MaxPerformance
Databases:
DBSID_dg2 - Primary database
Current status for "DBSID_DG":
DISABLED
DGMGRL> add database 'DBSID_dg1' as
> connect identifier is DBSID_dg1
> maintained as physical;
Database "DBSID_dg1" added.
DGMGRL> show configuration
Configuration
Name:
DBSID_DG
Enabled:
NO
Protection Mode: MaxPerformance
Databases:
DBSID_dg2 - Primary database
DBSID_dg1 - Physical standby database
Current status for "DBSID_DG":
DISABLED
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration
Configuration
Name:
Enabled:
DBSID_DG
YES
dbcontrol Support
The custom utility dbcontrol supports DataGuard commands through the hidden
cmd interface. By running the command "dbcontrol cmd DBSID" with the
appropriate option, the following commands are supported:
cmd
[ SID ]
[ dg [ enable | disable | show ] ]
Where:
SID - specified database
dg - Issue Data Guard dgmgrl commands:
enable
- enable configuration
disable
- disable configuration
show
- show configuration
failover - failover to standby database
Manual Switchover
The following will show the steps and procedures required to perform a
switchover where the primary and standby database reverse roles.
On the primary database:
1. Verify that it is possible to perform a switchover.
2. Initiate the switchover on the primary database.
3. Shut down and restart the former primary instance.
On the standby database:
1. Verify the switchover status in the v$database view.
2. Switch the target physical standby database to the primary role.
3. Shut down and restart the target standby database.
4. If necessary, restart log apply services on the standby databases.
On the new primary database:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-----------------------------------------------------------TO STANDBY
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL
STANDBY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size
1322520 bytes
Variable Size
400282088 bytes
Database Buffers
1174405120 bytes
Redo Buffers
1048576 bytes
Database mounted.
SQL>
The primary database is now configured as a physical standby database.
Dataguard Switchover
Primary Database
/u01/app/oracle/admin/DBSID/bdump$ dgmgrl
DGMGRL for Linux: Version 10.1.0.2.0 Production
Copyright (c) 2000, 2004, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /
Connected.
DGMGRL> show database verbose 'DBSID_DG2';
Database
Name:
Role:
Enabled:
Intended State:
Instance(s):
DBSID
DBSID_DG2
PRIMARY
YES
ONLINE
Properties:
InitialConnectIdentifier
LogXptMode
Dependency
DelayMins
Binding
MaxFailure
ReopenSecs
AsyncBlocks
NetTimeout
LogShipping
PreferredApplyInstance
ApplyInstanceTimeout
RealTimeApply
ApplyNoDelay
ApplyNext
ApplyParallel
StandbyFileManagement
ArchiveLagTarget
LogArchiveMaxProcesses
LogArchiveMinSucceedDest
DbFileNameConvert
LogFileNameConvert
StatusReport
InconsistentProperties
InconsistentLogXptProps
SendQEntries
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
'DBSID_dg2'
'ASYNC'
''
'0'
'OPTIONAL'
'0'
'300'
'61440'
'30'
'ON'
''
'120'
'OFF'
'NO'
'0'
'AUTO'
'AUTO'
'0'
'10'
'1'
''
''
'(monitor)'
'(monitor)'
'(monitor)'
'(monitor)'
LogXptStatus
= '(monitor)'
RecvQEntries
= '(monitor)'
HostName
= 'dg-2.appsdba.com'
SidName
= 'DBSID'
LocalListenerAddress
=
'(ADDRESS=(PROTOCOL=tcp)(HOST=dg-2.appsdba.com)(PORT=1521))'
StandbyArchiveLocation
=
'LOCATION=USE_DB_RECOVERY_FILE_DEST'
AlternateLocation
= ''
LogArchiveTrace
= '0'
LogArchiveFormat
= 'DBSID_%t_%s_%r.arc'
LatestLog
= '(monitor)'
TopWaitEvents
= '(monitor)'
Current status for "DBSID_DG2":
SUCCESS
DGMGRL> exit
/u01/app/oracle/admin/DBSID/bdump$
Standby Database
/u01/app/oracle$ dgmgrl
DGMGRL for Linux: Version 10.1.0.2.0 Production
Copyright (c) 2000, 2004, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect /
Connected.
DGMGRL> show database verbose 'DBSID_DG1';
Database
Name:
Role:
Enabled:
Intended State:
Instance(s):
DBSID
DBSID_DG1
PHYSICAL STANDBY
YES
ONLINE
Properties:
InitialConnectIdentifier
LogXptMode
Dependency
DelayMins
Binding
MaxFailure
=
=
=
=
=
=
'DBSID_dg1'
'ASYNC'
''
'0'
'OPTIONAL'
'0'
ReopenSecs
= '300'
AsyncBlocks
= '61440'
NetTimeout
= '0'
LogShipping
= 'ON'
PreferredApplyInstance
= ''
ApplyInstanceTimeout
= '120'
RealTimeApply
= 'OFF'
ApplyNoDelay
= 'NO'
ApplyNext
= '0'
ApplyParallel
= 'AUTO'
StandbyFileManagement
= 'AUTO'
ArchiveLagTarget
= '0'
LogArchiveMaxProcesses
= '2'
LogArchiveMinSucceedDest
= '1'
DbFileNameConvert
= ''
LogFileNameConvert
= ''
StatusReport
= '(monitor)'
InconsistentProperties
= '(monitor)'
InconsistentLogXptProps
= '(monitor)'
SendQEntries
= '(monitor)'
LogXptStatus
= '(monitor)'
RecvQEntries
= '(monitor)'
HostName
= 'nspdg-1.llnl.gov'
SidName
= 'DBSID'
LocalListenerAddress
=
'(ADDRESS=(PROTOCOL=tcp)(HOST=dg-1.appsdba.com)(PORT=1521))'
StandbyArchiveLocation
=
'LOCATION=USE_DB_RECOVERY_FILE_DEST'
AlternateLocation
= ''
LogArchiveTrace
= '0'
LogArchiveFormat
= 'DBSID_%t_%s_%r.arc'
LatestLog
= '(monitor)'
TopWaitEvents
= '(monitor)'
Current status for "DBSID_DG1":
SUCCESS
DGMGRL> switchover to "DBSID_DG1";
Performing switchover NOW. Please wait...
Operation requires shutdown of instance "DBSID" on database
"DBSID_DG2".
Shutting down instance "DBSID"...
ORA-01017: invalid username/password; logon denied
You are no longer connected to ORACLE
Please connect again.
Unable to shut down instance "DBSID".
Manual Failover
The following will show the steps and procedures to initiate a manual failover to a
standby database.
/u01/app/oracle/admin/DBSID/bdump$ sqlplus / as sysdba
SQL*Plus: Release 10.1.0.5.0 - Production on Mon Dec 18
15:39:36 2006
Copyright (c) 1982, 2005, Oracle.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> SELECT UNIQUE THREAD# AS THREAD, MAX(SEQUENCE#)
2 OVER (PARTITION BY thread#) AS LAST from
V$ARCHIVED_LOG;
THREAD
LAST
---------- ---------1
117
SQL> SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM
V$ARCHIVE_GAP;
no rows selected
SQL> select * from v$logfile;
GROUP# STATUS
TYPE
MEMBER
IS_RECOVE
------- --------- ------- ---------------------------------------3
ONLINE
/u01/oradata/DBSID/log03a.rdo NO
2
ONLINE
/u01/oradata/DBSID/log02a.rdo
NO
ONLINE
/u01/oradata/DBSID/log01a.rdo
NO
STANDBY
/u01/oradata/DBSID/srl01a.rdo
NO
STANDBY
/u01/oradata/DBSID/srl02a.rdo
NO
STANDBY
/u01/oradata/DBSID/srl03a.rdo
NO
STANDBY
/u01/oradata/DBSID/srl04a.rdo
NO
7 rows selected.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
Database altered.
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;
Database altered.
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1577058304 bytes
Fixed Size
1322520 bytes
Variable Size
400282088 bytes
Database Buffers
1174405120 bytes
Redo Buffers
1048576 bytes
Database mounted.
Database opened.
SQL>
oratab Changes After A Failover
The following oratab changes are required after a failover to insure that the
custom system management utilities recognize that the standby database has
now transitioned to a primary database role.
1. The database entry should have its third flag changed from N to Y.
2. The #STANDBY comment should be removed or disabled as in the
example.
Role Reversal
Standby oratab Example Pre-transition
#
DBSID:/u01/app/oracle/product/10.1.0/db_1:N
#STANDBY:DBSID:MANAGED:DBSID_DG2
#SNET:/u01/app/oracle/product/10.2.0/db_1:LISTENER
Standby oratab Example Post-transition (Now the primary DB)
#
DBSID:/u01/app/oracle/product/10.1.0/db_1:Y
#XXANDBY:DBSID:MANAGED:DBSID_DG2
#SNET:/u01/app/oracle/product/10.2.0/db_1:LISTENER
Primary oratab Example Pre-transition
#
DBSID:/u01/app/oracle/product/10.1.0/db_1:Y
#SNET:/u01/app/oracle/product/10.2.0/db_1:LISTENER
Primary oratab Example Post-transition (Now the standby DB)
#
DBSID:/u01/app/oracle/product/10.1.0/db_1:N
#STANDBY:DBSID:MANAGED:DBSID_DG1
#SNET:/u01/app/oracle/product/10.2.0/db_1:LISTENER
DBSID_DG
YES
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select * from v$database;
DBID NAME
CREATED
RESETLOGS_CHANGE# RESETLOGS
PRIOR_RESETLOGS_CHANGE#
PRIOR_RES LOG_MODE
CHECKPOINT_CHANGE# ARCHIVE_CHANGE#
CONTROL
---------- --------- --------- ----------------- --------------------------------------- ------------ ------------------ --------------------CONTROLFI CONTROLFILE_SEQUENCE# CONTROLFILE_CHANGE#
CONTROLFI OPEN_RESETL VERSION_T
OPEN_MODE PROTECTION_MODE
PROTECTION_LEVEL REMOTE_A
--------- --------------------- --------------------------- ----------- ---------
Database mounted.
Database opened.
SQL> select * from v$database;
DBID NAME
CREATED
RESETLOGS_CHANGE# RESETLOGS
PRIOR_RESETLOGS_CHANGE#
PRIOR_RES LOG_MODE
CHECKPOINT_CHANGE# ARCHIVE_CHANGE#
CONTROL
---------- --------- --------- ----------------- --------------------------------------- ------------ ------------------ --------------------CONTROLFI CONTROLFILE_SEQUENCE# CONTROLFILE_CHANGE#
CONTROLFI OPEN_RESETL VERSION_T
OPEN_MODE PROTECTION_MODE
PROTECTION_LEVEL REMOTE_A
--------- --------------------- --------------------------- ----------- ------------------ -------------------- --------------------------ACTIVATION# SWITCHOVER# DATABASE_ROLE
ARCHIVELOG_CHANGE#
ARCHIVEL SWITCHOVER_STATUS
DATAGUAR GUARD_S SUPPLEME SUP SUP FOR PLATFORM_ID
----------- ----------- ---------------- ------------------------- --------------------------- ------- -------- --- --- --- ----------PLATFORM_NAME RECOVERY_TARGET_INCARNATION#
--------------------------------------------------------------------------------------------------- ---------------------------LAST_OPEN_INCARNATION# CURRENT_SCN FLA SUP SUP
DB_UNIQUE_NAME
STANDBY_BECAME_PRIMARY_SCN
---------------------- ----------- --- --- --------------------------------------------------------1472273621 DBSID 09-NOV-06
516551 09-NOV06
1
07-FEB-06 ARCHIVELOG
7.2443E+12
7.2443E+12
CURRENT
09-NOV-06
6395
7.2443E+12 19-DEC06 NOT ALLOWED 18-DEC-06
READ WRITE MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
ENABLED
1475777450 1475777450 PRIMARY
7.2443E+12
DISABLED NOT ALLOWED
ENABLED NONE
NO
NO NO YES
13
Linux 64-bit for AMD
2
7.2443E+12 NO NO NO
7.2443E+12
SQL>
Managing a Standby Database, Pg. 3-7
DBSID_dg1