Commands can use on Oracle Standby Database

Check Primary Sync

select thread#, max(sequence#) "Last Primary Seq Generated" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;

Standby Database Sync

select thread#, max(sequence#) "Last Standby Seq Received" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1;
select thread#, max(sequence#) "Last Standby Seq Applied" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# and val.applied in ('YES','IN-MEMORY') group by thread# order by 1;

Start Managed Recovery

alter database recover managed standby database disconnect from session;

Start Managed Recovery with Real time Apply

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

Register Database to Listener

alter system set local_listener ='(ADDRESS=(PROTOCOL=TCP)(HOST=10.172.20.23)(PORT=1521))';

Set Destination of Standby Database

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=stb1 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stb1';

Add Standby Logs in Standby Side Database

alter database add standby logfile thread 2 GROUP 15 ('+RECO','+DATA') size 100M;

Create Datafiles on Standby Database if it not created due to Wrong Path or due to Standby File Management is Manual (STANDBY_FILE_MANAGEMENT=Manual Error :ORA-01110: data file 11)

alter database create datafile '/u01/app/oracle/product/19.0.0/dbhome_1/dbs/UNNAMED00013' as ' /data/database/pri/STB1/datafile/users02.dbf';

Archive Delete Policy on Standby Database

rman target /

CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;

Check Database Roles and Status

select protection_mode,SWITCHOVER_STATUS,DATABASE_ROLE from v$database;

Check Archive / Standby Side Destination Status

SELECT Error, DESTINATION, STATUS, ARCHIVED_THREAD#, ARCHIVED_SEQ# FROM gV$ARCHIVE_DEST_STATUS WHERE STATUS <> 'DEFERRED' AND STATUS <> 'INACTIVE';

Open Standby Database in Read only mode

Alter database open read only;

Check Recovery Destination Size

select name, floor(space_limit / 1024 / 1024/1024) "Size GB", ceil(space_used / 1024 / 1024/1024) "Used GB" from v$recovery_file_dest order by name;

Check Managed Recovery Process Status

select status,process from v$managed_standby;