Академический Документы
Профессиональный Документы
Культура Документы
Oracle Database
Search this site Search
components
Notes
1. Logical Standby - Uses SQL Apply and does not have to be structurally identical or on the
same infrastructure. Can be open in read only whilst being updated from the primary.
2. Physical Standby - Uses redo/archive log shipping to remote standby database and by
definition will be structurally in sync.
3. Active Data Guard - Allows you to setup a BCT file for backups on the physical standby
and have the standby database open for read-only.
_bct_chunk_size tells Oracle how to read and write the BCT file for backups and
defaults to 32k because this is the largest block-size for a DB. However, for 8k
databases then performance gains can be got by setting this to 8k.
4. Snapshot Standby - Under 11g this can be automated using the DG broker. Effectively, it
is using flashback technology and allows the standby database to be taken out of standby
mode and used for testing purposes. After testing is complete, the database is flashed back
and put back into standby where the redo logs are applied to bring the standby back up to
date. Prior to 11g, this could be done, but not in an automated fashion.
Useful Views
Below are some useful views for Data Guard
~ dba_logstdby_unsupported_table
~ dba_logstdby_unsupported
Shows which objects and data types are unsupported in logical standby.
For example, abstract data types are not shipped in logical standby.
~ dba_logstdby_not_unique
Shows tables that do not have PKs or that oracle cannot identify as having
unique data.
General Views
~ v$controlfile_record_section
~ v$rman_configuration
~ v$dataguard_status
~ v$managed_standby
~ v$dataguard_stats
http://www.oracle-wiki.net/startdocsdataguardfeatures 2/17
13/12/2017 Data Guard Features - Oracle Database
Background Processes
MRP0 is the recovery process on the Standby Database
Best Practice
1. Advisable to use redundant networks for redo transport. Consideration
should be given to using a dedicated VLAN.
2. Have a least one extra standby redo log group than on-line redo log
groups
Protection Modes
Data Guard can be run in a number of protection modes which determine
the performance and availability impact of the primary and standby. The
different modes are detailed below.
Maximum protection
This protection mode ensures that no data loss will occur if the primary
database fails. To provide this level of protection, the redo data needed to
recover a transaction must be written to both the online redo log and to
the standby redo log on at least one synchronized standby database before
the transaction commits. To ensure that data loss cannot occur, the
primary database will shut down, rather than continue processing
transactions, if it cannot write its redo stream to at least one synchronized
standby database.
Because this data protection mode prioritizes data protection over primary
database availability, Oracle recommends that a minimum of two standby
databases be used to protect a primary database that runs in maximum
protection mode to prevent a single standby database failure from causing
the primary database to shut down.
Maximum availability
This protection mode provides the highest level of data protection that is
possible without compromising the availability of a primary database.
Transactions do not commit until all redo data needed to recover those
transactions has been written to the online redo log and to the standby
http://www.oracle-wiki.net/startdocsdataguardfeatures 3/17
13/12/2017 Data Guard Features - Oracle Database
redo log on at least one synchronized standby database. If the primary
database cannot write its redo stream to at least one synchronized standby
database, it operates as if it were in maximum performance mode to
preserve primary database availability until it is again able to write its redo
stream to a synchronized standby database.
This mode ensures that no data loss will occur if the primary database
fails, but only if a second fault does not prevent a complete set of redo
data from being sent from the primary database to at least one standby
database.
This protection mode provides the highest level of data protection that is
possible without affecting the performance of a primary database. This is
accomplished by allowing transactions to commit as soon as all redo data
generated by those transactions has been written to the online log. Redo
data is also written to one or more standby databases, but this is done
asynchronously with respect to transaction commitment, so primary
database performance is unaffected by delays in writing redo data to the
standby database(s).
This protection mode offers slightly less data protection than maximum
availability mode and has minimal impact on primary database
performance.
1. Prepare primary
2. Set parameters for primary
3. Set-up TNS requirements
4. Prepare Standby
5. Start standby database
6. Duplicate target DB for standby
7. Start transport and apply mechanism
Step 2
a) Create standby redo logs. Logs must be the same size as on-line redo
logs and must have a least one extra group to accommodate lag.
http://www.oracle-wiki.net/startdocsdataguardfeatures 4/17
13/12/2017 Data Guard Features - Oracle Database
Notes
LOG_ARCHIVE_CONFIG must be set - This has various parameters in its own right.
e.g. DG_CONFIG, Send, Nosend etc. When configuring for data Guard, the
DG_CONFIG parameter must list the DB Unique name for the primary database and
all standby databases in the Data Guard configuration. For example,
LOG_ARCHIVE_CONFIG='DG_CONFIG=(myprimarydb,mystandbydb)'
Step 3
vi tnsnames.ora
PC01SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME =
pc01sby1.us.oracle.com))
)
Step 4
b) Create an initialization parameter file for the standby database with just
one line
db_name=mystandbydb
cd /u01/app/oracle/admin
mkdir -p pc01sby1/adump
mkdir -p pc01sby1/dpdump
mkdir -p pc01sby1/pfile
Step 5
http://www.oracle-wiki.net/startdocsdataguardfeatures 5/17
13/12/2017 Data Guard Features - Oracle Database
Step 6
a) Start RMAN and connect to both the primary and the standby database.
RMAN>
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from
active database
spfile
parameter_value_convert
'pc01prmy','pc01sby1'
set db_unique_name='pc01sby1'
set db_create_file_dest='+SBDAT'
set db_recovery_file_dest='+SBFRA'
set db_recovery_file_dest_size='5G'
set control_files='+SBDAT'
set log_archive_max_processes='5'
set fal_client='pc01sby1'
set fal_server='pc01prmy'
set standby_file_management='AUTO'
set log_archive_config='dg_config=
(pc01prmy,pc01sby1)'
set
log_archive_dest_2='service=pc01prmy
ASYNC
valid_for=
(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=pc01prmy'
;
}
c) Update the oratab on the standby machine with the new standby
database
Step 7
Step 2
http://www.oracle-wiki.net/startdocsdataguardfeatures 6/17
13/12/2017 Data Guard Features - Oracle Database
a) Create listener services for the databases using
db_unique_name_DGMGRL.db_domain values for GLOBAL_DBNAME.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =
pc01prmy_DGMGRL.us.oracle.com)
(ORACLE_HOME =
/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = pc01prmy)
)
)
SID_LIST_LISTENER1 =
(SID_DESC =
(GLOBAL_DBNAME =
pc01sby1_DGMGRL.us.oracle.com)
(ORACLE_HOME =
/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = pc01sby1)
)
)
Step 3
a) Create some tns service entries on the standby database that point to
the primary and the standby
PC01PRMY =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST =
edbvr6p1.us.oracle.com) (PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME =
pc01prmy.us.oracle.com))
)
PC01SBY1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
edbvr6p2.us.oracle.com)(PORT = 1521))
)
(CONNECT_DATA = (SERVICE_NAME =
pc01sby1.us.oracle.com))
)
http://www.oracle-wiki.net/startdocsdataguardfeatures 7/17
13/12/2017 Data Guard Features - Oracle Database
4. Create the Data Guard Broker Configuration
Check configuration
DGMGRL> show configuration
b) ** PERFORM TESTING **
http://www.oracle-wiki.net/startdocsdataguardfeatures 8/17
13/12/2017 Data Guard Features - Oracle Database
Use db_lost_write_protection set to typical to enable lost write
protection
When you update the DG Config using dgmgrl, then dmon communicates
with the standby dmon process prompting it to update the dmon config file
on the standby database.
Note - the dmon config files between standby and primary do not have to
be on shared storage.
In the event of a fail-over whereby the new primary is at a lower scn than
the old primary, perhaps as a result of a delay in the apply of redo, then
the broker can be used to reconfigure the old primary db to a new standby.
It does this by flashing back the old primary database to an SCN prior to
the new primary. It use flashback to do this, so flashback needs to be on.
Logical Standby
Not overly useful due to the following
1) Some objects/data types are unsupported. e.g. mat. views and tables
supporting mat. views, xml data types, bfile etc
3) Because the row IDs on a logical standby database might not be the
same as the row IDs on the primary database, a different mechanism must
be used to match the updated row on the primary database to its
corresponding row on the logical standby database. Oracle does this using
the PK. As such, ideally all tables need a PK. Without a PK oracle cannot
easily identify which row to update on the standby database. It tries to
automatically detect the row when no PK is available by using all the data
in row to imply uniqueness. But tables whose data is not unique, will cause
an issue. The tables that cause issues are identified in
DBA_LOGSTDBY_NOT_UNIQUE.
WARNING - If ever used, read the training docs for key usage
information. e.g. guard data, deleting shipped logs, filter settings etc.
and
Notes
http://www.oracle-wiki.net/startdocsdataguardfeatures 9/17
13/12/2017 Data Guard Features - Oracle Database
Client Connections
Role based services is available in Grid Infrastructure.
This is where you create various services for different database roles. So a
"production" service will only be running and accepting connections when
the database role is "primary" e.g.
Notes
1. The production service does not get started on the standby database as it cannot be
started on the standby node as it is already running on the production node. At failover time
the service will be moved to the standby node.
Step 1
a) Create production service
Step 2
a) Start service
Step 3
a) Add standby database to the srvctl on standby node.
Step 4
a) Create the production service on the standby node
http://www.oracle-wiki.net/startdocsdataguardfeatures 10/17
13/12/2017 Data Guard Features - Oracle Database
Step 5
a) Create the service entries in the tnsnames on both nodes
PC10PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST =
edu3r4p10.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST =
edu3r4p9.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME =
pc10prod.us.oracle.com)
)
PC10PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST =
edu3r4p10.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST =
edu3r4p9.us.oracle.com)(PORT = 12001))
)
(CONNECT_DATA =
(SERVICE_NAME =
pc10prod.us.oracle.com)
)
Notes
1. The address list is specified for each node in the DG configuration. In RAC this would be the
scan listener in each configuration. e.g. a-racprd-scan-d, a-racsby-scan-d
RAC Considerations
1. In DGMGRL configure preferred instance apply.
2. On RAC you need an address list in the TNS names. With each address
pointing to a scan address for each DG node.
3. In 11.2 the snapshot control file needs to be on shared storage. i.e. ASM
RMAN
Backups can be performed on the standby database to "off load" the work.
In order to do this there are a few prerequisites.
Configure RMAN
Notes
Notes
1. The connect identifiers are the TNS
entries for the database and tell RMAN
how to connect to each database. At the
point when you create the connect
identifier RMAN will perform a full resync
with the catalog. When the entry for the
standby database is created RMAN will try
to connect to the standby database and if
available catalog the standby database in
the RMAN catalog.
IMPORTANT
The standby database will have the same
DBID as the primary database because it
is effectively the same database. However,
it has a different DB UNIQUE name.
Therefore, when the command list
db_unique_name of database; is run,
both the standby database and the
primary database will show up. They are
in the same catalog.
http://www.oracle-wiki.net/startdocsdataguardfeatures 12/17
13/12/2017 Data Guard Features - Oracle Database
f) It is now possible to use the standby database to
backup and recover the database.
Backup
Use the following commands to backup the database.
Recovery
The following is an example of a datafile recovery from the standby
database
run {
set newname for datafile 6 to
'/home/oracle/labs/newex01.dbf';
switch datafile 6;
}
Notes
IMPORTNAT - The restore above is not restoring from a backup, but restoring from the live
standby file on the standby database.
http://www.oracle-wiki.net/startdocsdataguardfeatures 13/17
13/12/2017 Data Guard Features - Oracle Database
Or
Enterprise manage can be used to monitor, manage and trigger alerts for
DG configurations
Notes
Interesting Information
Active Data Guard is actually the usage of RTQ (Real Time Query) and
BCT for Standby (Block Change Tracking for Standby).
RTQ allows you to open a standby database for read-only, whilst at the
same time being able to apply changes to the standby database.
However, it is possible to have the standby database open, have the redo
shipped (but not applied) and not invoke the usage of the RTQ component
of Active Data Guard.
Obviously, when you shut the database down and restart it in mount mode,
then the REDO would need to be applied and may take some time if the
database has been open for read-only for a long period.
A clever implementation of data guard allows for applications that are read
mostly, i.e. do lots of reads but only update tables infrequently (perhaps
PCI), to use the standby database as their main connection, but update
tables on the primary database.
http://www.oracle-wiki.net/startdocsdataguardfeatures 15/17
13/12/2017 Data Guard Features - Oracle Database
2. This link then gets propagated to the standby database. (but clearly
points back to the primary)
3. Create a user on the primary database with private synonyms that point
to
* the read only tables
* the update tables via the dblink
* NOTE This will get propagated to the Standby database
5. Connect to the standby database as the user with the private synonyms.
6. Run the read-only query. This will read its data from the standby
database via the private synonyms.
7. Run the update statements. This will update the tables via the private
synonym using the dblink. i.e the tables on the primary database. After a
few seconds the data will be propagated across to the redo on the standby.
8. If using active data guard then the data will be available for query in a
few seconds. If not using active data guard then the data will get applied
once the database is put back into standby mode.
Notes
1. If you did not want to have to log on as a different user in step 5. You could create a logon
trigger that checked the dbname and if on the standby database, then the trigger could
switch the current users schema to the schema with the private synonyms.
General Warnings
Switch over to a logical standby from a physical is possible, but not
advisable because all physical standbys will no longer be valid as the
logical DB is not the same DB as the physical standby.
Common Questions
Q1 - On the create standby, how many param are mandatory?
A1 - Certainly not as many as there are above. Test to see what is
required.
Q2 - Why did we specify the fal parameters in the create standby database
command?
Q2 - You don't need to.
Q6 - Do the files in the standby database have a different name to the files
in the primary?
A6 - With standby_file_management set to AUTO, definitely.
active data database dataguard guard logical logs physical redo shipping standby
Powered by Wikidot.com Help | Terms of Service | Privacy | Report a bug | Flag as objectionable
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License
http://www.oracle-wiki.net/startdocsdataguardfeatures 17/17