备查询
c.sh
for i in $(ps -ef|grep pmon|grep oracle|grep -v grep|awk -F ‘pmon_’ ‘{print $2}’|grep -v $2)
do
./dg.sh $i
done
dg.sh
export ORACLE_SID=$1
sqlplus -S / as sysdba <<EOF
show parameter name
set lines 200 pages 200
select process,status,client_process,thread#,sequence#,block# from v$managed_standby;
set linesize 1000;
set pagesize 9999;
col SOURCE_DB_UNIQUE_NAME format a10;
col NAME format a20;
col VALUE format a20;
col UNIT format a15;
col DATUM_TIME format a20;
select * from v$dataguard_stats;
select open_mode from v$database;
EOF
主库查询
c.sh
for i in ps -ef|grep pmon|grep oracle|grep -v grep|awk -F '_' '{print $3}'
do
./dg.sh $i
done
dg.sh
export ORACLE_SID=$1
sqlplus / as sysdba <<EOF
show parameter name
set linesize 1000;
col DEST_NAME format a20;
col RECOVERY_MODE format a20;
select dest_name,status,type,recovery_mode,SYNCHRONIZATION_STATUS,ERROR from v$archive_dest_status where “DEST_ID” = 2;
select t.“STATUS”, t.“GAP_STATUS”,t.“ARCHIVED_SEQ#”,t.“APPLIED_SEQ#” from v$archive_dest_status t where t.“DEST_ID” = 2;
select distinct thread#,max(sequence#) over(partition by thread#) a from v$archived_log;
EOF




