Sunteți pe pagina 1din 7

v$dataguard_config to get unique database names in the dataguard configuration

v$log_archive_dest to see the current setting of log_archive_dest_n


Primary Database
>startup
>database must be in archive log mode
>alter database force logging
>select member from v$logfile
>alter database add standby logfile group 4('/u01/oradata/proddb/redo04.log') si
ze 50m;
>alter database add standby logfile group 5('/u01/oradata/proddb/redo05.log') si
ze 50m;
>alter database add standby logfile group 6('/u01/oradata/proddb/redo06.log') si
ze 50m;
>select member from v$logfile
>show parameter spfile;
>alter system set db_unique_name=proddb scope = spfile;
dg_config atrribute to list the db_unique_name from primary and each standby dat
abase in datagurad configuration
>alter system set log_archive_config='DG_CONFIG=(proddb,standb)' scope=spfile;
options'DG_CONFIG=(proddb send/nosend, standb receive/noreceive)'
specify for local database archiving log and standby database archiving log loc
ation
primary dest
>alter system set log_archive_dest_1='location=/u02/archive VALID_FOR=(ALL_LOGFI
LES,ALL_ROLES) DB_UNIQUE_NAME=proddb' scope=spfile;
standby dest
service refers to the tns entry for standby instance for shifting online redo lo
gfiles to standy database
--sync and async
specify that network i/o operations are to be performed synch/asynch when using
lgwr
async is the default gives max performance
specifies that redo data generated by a transcation need not have been received
at a destination that has this attribute before the transaction can commit.
sync give max avail/max protection
specifies that redo data generated by a transcation must have been received at a

destination that has this attribute before the transcation can commit.
--affirm and noaffirm
ensure that redo was successfully written to disk on the standyby destination.
noaffirm is the default when async is specified
noaffirm specifes that redo transport destination acknowledges recived redo data
before writing it to the standby redolog
affirm specifes that redo transport destination acknowledges recived redo data a
fter writing it to the standby redolog
>alter system set log_archive_dest_2='service=standb LGWR ASYNC VALID_FOR=(ONLIN
E_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standb' scope=spfile;
Define state of archiving enable/difer
>alter system set log_archive_dest_state_1=enable
>alter system set log_archive_dest_state_2=enable
Remote_login_passwordfile = must be in exclusive mode
FAL_SERVER-- use for archivelog gap resolution(required only in physical standby
server)
>alter system set fal_server=standb scope spfile;
>alter system set fal_client=proddb scope spfile;
STANDBY_FILE_MANAGEMENT--keep auto to create file automatically on standby.
>alter sytem set standby_file_management=auto scope=spfile;
DB_FILE_NAME_CONVERT--Required when directory structure is different datafile
>alter system set db_file_name_convert='/u01/oradata/proddb','/u01/oradata/stand
b' scope = spfile;
LOG_FILE_NAME_CONVERT--Required when directory structure is different logfile
>alter system set log_file_name_convert='/u01/oradata/proddb','/u01/oradata/stan
db' scope = spfile;
>shutdown immediate;
>startup
>create pfile from spfile;
>scp initprodb.ora dbserver2:/u01/11g/dbs/initstand.ora
>orapwd file=orapwproddb password=oracle force=y

>scp orapwproddb dbserver2:/u01/11g/dbs/orapwstandb


>netca
create on both servers listener and tnsname.ora file
> rman target /
rman>backup database plus archivelog;
rman>backup current controlfile for standby;
>scp backups to standby of same location
standby database
open pfile and edit standb in place of proddb be carefull while editing
>mkdir
>mkdir
>mkdir
>mkdir
>mkdir
>mkdir
>mkdir

-p
-p
-p
-p
-p
-p
-p

/u01/11g/admin/standb/bdump
/u01/11g/admin/standb/cdump
/u01/11g/admin/standb/adump
/u01/11g/admin/standb/udump
/u01/oradata/standb
/u01/11g/flash_recovery_area
/u02/archives

>rman target sys/sysdba@proddb auxilary sys/sysdba@standb


rman>duplicate target database for standby dorecover nofilenamecheck;
>startup nomount
>alter database mount standby database
>alter database recover managed standby database disconnect from session
$ps -ef | grep mrp
>select database_role from v$database
>select name,open_mode,database_role,protection_mode from v$database;
open_mode---mounted
>select max(sequence#) from v$log_history
>select sequence#,first_time,next_time,archived,applied from v$archived_log orde
r by sequence#;
>alter database recover managed standby database cancel
>alter database read only
open_mode---Read only
>select name,open_mode,database_role,protection_mode from v$database;
---Active Dataguard from 11g only for reporting/testing purpose to decrease over

load on physical database


>shutdown immediate;
>startup mount;
>alter database read only;
>>alter database recover managed standby database disconnect from session;
>select name,open_mode,database_role,protection_mode from v$database;
open_mode---Read only with apply
---Snapshot standby with read write mode required for updating standby database
and reverting back to standby
>shutdown immediate
>startup mount
>select flashback_on from v$database
no
>alter database convert to snapshot standby;
>select flashback_on from v$database
Restore point only
here we can update the standby database for testing
now revert back to standby
>shutdown immediate;
>startup mount
>alter database convert to physical standby
>shutdown immediate
>startup nomount;
>alter database mount standby database;
>alter database recover managed standby database disconnect from session;
>select flashback_on from v$database
no
>>select name,open_mode,database_role,protection_mode from v$database;
open_mode---mounted
>select sequence#,first_time,next_time,archived,applied from v$archived_log orde
r by sequence#;

-----switch over
on primary database
>>select name,open_mode,database_role,protection_mode from v$database;
open_mode---read write
>alter database commit to switchover to standby;
open log file and see what is happening
>shutdown immediate
>startup nomount
>alter database mount standby database;
>>alter database recover managed standby database disconnect from session;
>>select name,open_mode,database_role,protection_mode from v$database;
open_mode---mounted
on physical standby database
>alter database commit to switchover to primary;
>shutdown immediate
>startup
>>select name,open_mode,database_role,protection_mode from v$database;
open_mode---read write
-----Failover
on standby database
alter database recover standby database finish;
alter database activate standby database;
DATA GUARD PROTECTION MODES
There are 3 protection modes. Summarized in the table below.
Mode
The risk of data loss Transfer method Primary status
Maximum Protection
Zero data loss
two-sided protection SYNC
waits for the receipt of information. if it doesn t respond to primary,
ngs
Maximum Availability
Zero data loss single-sided protection
waits for the receipt of information. if it doesn t respond to primary,
its until the timeout parameter . (NET_TIMEOUT)
Maximum Performance
least data loss ASYNC primary never waits for
ipt of information

primary
primary ha
SYNC
primary
primary wa
the rece

Modes of Operation
The following table shows the options giving the benefits and drawbacks.
Mode of Operation
SYNC/
ASYNC
Benefits
Drawbacks
Maximum Protection
SYNC
Never any data loss, no data ever accepted on primary
without being on standby.
Slower response times on primary. Network disruption
between primary and secondary causes downtime of primary database.
Mode of Operation
SYNC/
ASYNC
Benefits
Drawbacks
Maximum Availability
SYNC
Updates must be on standby before accepted on primary,
network disruption means the primary continues running with updates sent to
standby when it is available again.
Slower response times on primary. Data loss possible if
network fails and then site fails.
Mode of Operation
SYNC/
ASYNC
Benefits
Drawbacks

Maximum Performance
ASYNC
No performance slowdown for applications on primary.
Data loss will happen

S-ar putea să vă placă și