Anda di halaman 1dari 4

Startup commands

================
startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect;

To remove a delay from a standby


==============================
alter database recover managed standby database cancel;
alter database recover managed standby database nodelay disconnect;

Cancel managed recovery


=======================
alter database recover managed standby database cancel;

Register a missing log file


=======================
alter database register physical logfile '<fullpath/filename>';

If FAL doesn't work and it says the log is already registered


==================================================
alter database register or replace physical logfile '<fullpath/filename>';
if that doesn't work, try this...
shutdown immediate
startup nomount
alter database mount standby database;
alter database recover automatic standby database;
wait for the recovery to finish - then cancel
shutdown immediate
startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect;

Check which logs are missing


=========================
Run this on the standby...
select local.thread#
,
local.sequence# from
(select thread#
,
sequence#
from
v$archived_log
where dest_id=1) local
where local.sequence# not in
(select sequence#
from v$archived_log

where dest_id=2 and


thread# = local.thread#)
/
Disable/Enable archive log destinations
==================================
alter system set log_archive_dest_state_2 = 'defer';
alter system set log_archive_dest_state_2 = 'enable';

Turn on fal tracing on the primary db


===============================
alter system set LOG_ARCHIVE_TRACE = 128;

Stop the Data Guard broker


========================
alter system set dg_broker_start=false
/

Show the current instance role


=========================
select database_role
from
v$database
/

Logical standby apply stop/start


============================
Stop...
alter database stop logical standby apply;
Start...
alter database start logical standby apply;

See how up to date a physical standby is


===================================
Run this on the primary
set numwidth 15
select max(sequence#) current_seq
from
v$log
/
Then run this on the standby
set numwidth 15
select max(applied_seq#) last_seq
from
v$archive_dest_status
/

Display info about all log destinations


================================
To be run on the primary
set lines 100
set numwidth 15
column ID format 99
column "SRLs" format 99
column active format 99
col type format a4
select ds.dest_id id
,
ad.status
,
ds.database_mode db_mode
,
ad.archiver type
,
ds.recovery_mode
,
ds.protection_mode
,
ds.standby_logfile_count "SRLs"
,
ds.standby_logfile_active active
,
ds.archived_seq#
from
v$archive_dest_status ds
,
v$archive_dest
ad
where ds.dest_id = ad.dest_id
and
ad.status != 'INACTIVE'
order by
ds.dest_id
/

Display log destinations options


============================
To be run on the primary
set numwidth 8 lines 100
column id format 99
select dest_id id
,
archiver
,
transmit_mode
,
affirm
,
async_blocks async
,
net_timeout net_time
,
delay_mins delay
,
reopen_secs reopen
,
register,binding
from
v$archive_dest
order by
dest_id
/
List any standby redo logs
=======================
set lines 100 pages 999
col member format a70
select st.group#
,
st.sequence#

,
,
from
,
where
/

ceil(st.bytes / 1048576) mb
lf.member
v$standby_log st
v$logfile
lf
st.group# = lf.group#

Read-Only Standby and Active Data Guard


======================================
Once a standby database is configured, it can be opened in read-only mode to all
ow query access. This is often used to offload reporting to the standby server,
thereby freeing up resources on the primary server. When open in read-only mode,
archive log shipping continues, but managed recovery is stopped, so the standby
database becomes increasingly out of date until managed recovery is resumed.
To switch the standby database into read-only mode, do the following.
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE OPEN READ ONLY;
To resume managed recovery, do the following.
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
In 11g, Oracle introduced the Active Data Guard feature. This allows the standby
database to be open in read-only mode, but still apply redo information. This m
eans a standby can be available for querying, yet still be up to date. There are
licensing implications for this feature, but the following commands show how ac
tive data guard can be enabled.
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE OPEN READ ONLY;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Anda mungkin juga menyukai