Friday, August 15, 2008

Setup Dataguard Broker

sqlplus '/ as sysdba'
alter system set dg_broker_start=true;

dgmgrl sys/password

create configuration 'A_B' as primary database is 'a' connect identifier is a;
add database 'b' as connect identifier is b maintained as physical;

edit database 'a' set property 'LogXptMode'='ASYNC';
edit database 'a' set property 'MaxFailure'=15;
edit database 'a' set property 'ReopenSecs'=60;
edit database 'a' set property StandbyFileManagement='AUTO';

edit database 'b' set property 'LogXptMode'='ASYNC';
edit database 'b' set property 'MaxFailure'=15;
edit database 'b' set property 'ReopenSecs'=60;
edit database 'b' set property StandbyFileManagement='AUTO';

# check configuration
show configuration;
show configuration verbose;
show database verbose 'a';
show database verbose 'b';

# disable and enable configuration
disable configuration;
enable configuration;

# disable and enable a database
disable database 'b';
enable database 'b';

# switchover
switchover to b;

# check archival status
select destination, status, fail_date, valid_now
from v$archive_dest
where dest_name in ('LOG_ARCHIVE_DEST_1')
and (status <> 'VALID' or valid_now <> 'YES');