Monday, September 27, 2010

TNS-12542: TNS:address already in use Linux Error: 98

Problem Description
After changing listener entry while you start the oracle listener it fails with error TNS-12542 like below.
[grid@DC-DB-01 ~]$ lsnrctl start listener2

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 19-SEP-2010 11:41:48

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Starting /u01/app/11.2.0/grid/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/11.2.0/grid/network/admin/listener.ora
Log messages written to /u01/app/11.2.0/grid/log/diag/tnslsnr/DC-DB-01/listener2/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER2)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DC-DB-01)(PORT=1522)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DC-DB-01-vip)(PORT=1522)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use

Listener failed to start. See the error message(s) above...
The XML log file shows following message.
<msg time='2010-09-19T11:42:38.026+06:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='DC-DB-01'
host_addr='192.168.100.101'>
<txt>Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DC-DB-01-vip)(PORT=1522)))
</txt>
</msg>
<msg time='2010-09-19T11:42:38.026+06:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='DC-DB-01'
host_addr='192.168.100.101'>
<txt>TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
</txt>
</msg>
<msg time='2010-09-19T11:42:38.027+06:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='DC-DB-01'
host_addr='192.168.100.101'>
<txt>No longer listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER2)))
</txt>
</msg>
<msg time='2010-09-19T11:42:38.027+06:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='DC-DB-01'
host_addr='192.168.100.101'>
<txt>No longer listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DC-DB-01)(PORT=1522)))
</txt>
</msg>

Here goes listener.ora file contents.
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER2))
(ADDRESS = (PROTOCOL = TCP)(HOST =DC-DB-01)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =DC-DB-01-vip)(PORT = 1522))
)
)
Cause of the Problem
The "TNS-00512: Address already in use" is occurred as there is duplicate port used in same listener2 entry. It is not possible to start a listener using duplicate TCP port or IPC KEY values in a single listener.ora file configuration.

Solution of the Problem
The solution is edit the listener entry so that there does exist duplicate listener TCP port or IPC key. You can either change the port or IPC key or remove the duplicate entry. So either of the following two entries are valid.

LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER2))
(ADDRESS = (PROTOCOL = TCP)(HOST =DC-DB-01)(PORT = 1522))

)
)
or,
LISTENER2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = LISTENER2))
(ADDRESS = (PROTOCOL = TCP)(HOST =DC-DB-01)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST =DC-DB-01-vip)(PORT = 1523))
)
)

Sunday, September 26, 2010

ORA-12532: TNS:invalid argument

Problem Description
While connecting to oracle database it fails with ORA-12532: TNS:invalid argument like below.
$ sqlplus system@bddip

SQL*Plus: Release 11.1.0.6.0 - Production on Sun Sep 26 13:18:56 2010

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Enter password:
ERROR:
ORA-12532: TNS:invalid argument
Cause of the Problem
If you look for the Oracle error message for ORA-12532 you will see,
ORA-12532:TNS:invalid argument
Cause: An internal function received an invalid parameter.
Action: Not normally visible to the user. For further details, turn on tracing and reexecute the operation. If error persists, contact Oracle Customer Support.
It sounds like oracle bug. If you do tnsping it also fails like below,
$tnsping ddip
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.100.1)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = bddip.com)))
TNS-12532: TNS:invalid argument
If you enable client tracing you will see,
ntt2err: soc  error - operation=1, ntresnt[0]=502, ntresnt[1]=113, ntresnt[2]=0 
ntt2err: exit
nttcni: exit
nttcon: exit
nserror: entry
nserror: nsres: id=0, op=65, ns=12532, ns2=12560; nt[0]=502, nt[1]=113, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
nsopen: unable to open transport
The OS error 113 indicates that there is no route to host in Linux platform.

Based on tracing we can say the problem happened due to firewall settings or there is a network issue.

Note that the problem can also happened due to bad password definition for user that you are using connect. For example in the password there is '@' symbol.

Solution of the Problem
Ensure that firewall is not blocking the connection. You can easily test it from client machine by using telnet.
$ telnet {database server IP} {listener port}

If your database server IP address is 192.168.100.1 and listener port is 1521 then issue,

$ telnet 192.168.100.1 1521

You would get a blank screen with blinking cursor. It will fail to connect if there is either firewall or network transport issue.

Remove underlying firewall.

Also if you have '@' character with the password field then remove the character.

ORA-12709: error while loading create database character set

Problem Description
While mounting oracle database it fails with ORA-12709 like below.

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-12709: error while loading create database character set

Cause of the Problem
The error ORA-12709 is returned due to incorrect setting of environmental variable NLS_LANG
or ORA_NLS33.

Solution of the Problem
Check your NLS_LANG environmental variable by,
$echo $NLS_LANG.
If it is set to wrong value and your database character set is WE8ISO8859P1 then set by,
$export NLS_LANG=American_America.WE8ISO8859P1

Note that, For Oracle7 V7.3.2 version ORA_NLS33 environmental parameter is called ORA_NLS,
for Oracle7 V7.3.3 and V7.3.4 it is called ORA_NLS32,
for Oracle8 it is called ORA_NLS33 because of NLS libraries version.

When using both Oracle8 V8.x and Developer/2000 V1.6.1 in the same Oracle Home, ORA_NLS33 needs to be set to $ORACLE_HOME/ocommon/nls/admin/datad2k
The environmental variable along with database version is given below.
RDBMS 7.2.x -> ORA_NLS
RDBMS 7.3.x -> ORA_NLS32
RDBMS 8.0.x -> ORA_NLS33
RDBMS 8.1.x -> ORA_NLS33
RDBMS 9.X.X -> ORA_NLS33
RDBMS 10.X -> ORA_NLS10

After you set both parameters correctly login as sys user.

$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.8.0 - Production on Sun Sep 26 00:40:18 2010

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.8.0 - Production

Shutdown and Startup the database.

SQL> startup force;
ORACLE instance started.

Total System Global Area 320300808 bytes
Fixed Size 734984 bytes
Variable Size 285212672 bytes
Database Buffers 33554432 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
SQL>

Adding client to server's list failed, CORBA error: IDL:omg.org/CORBA/COMM_FAILURE:1.0

Problem Description
Whenever you login to your gnome GUI window to your linux machine several pop ups appear. If you click on details you will notice following same messages across all windows.

Adding client to server's list failed, CORBA error: IDL:omg.org/CORBA/COMM_FAILURE:1.0
Adding client to server's list failed, CORBA error: IDL:omg.org/CORBA/COMM_FAILURE:1.0

Problem Investigation
If you look for OS log message entry inside /var/log/messages you will see following entries.

Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23060): Failed to get lock for daemon,
exiting: Directory /tmp/gconfd-oracle has a problem, gconfd can't use it
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23062): starting (version 2.14.0), pid 2
3062 user 'oracle'
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23062): Bad permissions 777 on directory
/tmp/gconfd-oracle
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23062): Failed to get lock for daemon,
exiting: Directory /tmp/gconfd-oracle has a problem, gconfd can't use it
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23064): starting (version 2.14.0), pid 2
3064 user 'oracle'
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23064): Bad permissions 777 on directory
/tmp/gconfd-oracle
Sep 23 12:34:44 DC-DB-01 gconfd (oracle-23064): Failed to get lock for daemon,
exiting: Directory /tmp/gconfd-oracle has a problem, gconfd can't use it
Sep 23 12:35:26 DC-DB-01 pcscd: winscard.c:304:SCardConnect() Reader E-Gate 0 0
Not Found
Sep 23 12:35:26 DC-DB-01 last message repeated 4 times
Sep 23 12:35:26 DC-DB-01 gconfd (oracle-23229): starting (version 2.14.0), pid 2
3229 user 'oracle'
Sep 23 12:35:26 DC-DB-01 gconfd (oracle-23228): starting (version 2.14.0), pid 2
3228 user 'oracle'

Cause of the Problem
From OS log message, we see the problem happened due to wrong permission on the file /tmp/gconfd-oracle. It is needed to lock the directory /tmp/gconfd-oracle exclusively but because of 777 permission linux can't lock the file and so gconfd can't use it.

Solution of the Problem
The solution of the problem is give 700 permission and change ownership on the folder /tmp/gconfd-$USER.
If user is root then just do following,
#chmod 700 /tmp/gconfd-root/
#chown -R root:root /tmp/gconfd-root/
Now exit the window and re-login.

You can also try by removing /tmp/orbit- and then restarting X window.
#rm /tmp/orbit-root

Friday, September 24, 2010

ORA-16086: Redo data cannot be written to the standby redo log

Problem Description
Oracle physical standby database is not able to synchronize with the primary database. From the standby database alert log we see the following logs.

Thu Sep 23 14:57:47 2010
RFS[2237]: Assigned to RFS process 8174
RFS[2237]: Identified database type as 'physical standby': Client is ARCH pid 25089
RFS[2236]: Opened log for thread 2 sequence 1532 dbid 1323895516 branch 728508318
RFS[2237]: Opened log for thread 2 sequence 1533 dbid 1323895516 branch 728508318
Thu Sep 23 14:58:32 2010
RFS[2226]: Possible network disconnect with primary database
Deleted Oracle managed file +RECOVERY/bdafisdrs/archivelog/2010_09_23/thread_1_seq_2044.9918.730479031
Thu Sep 23 14:58:33 2010
RFS[2176]: Possible network disconnect with primary database
Deleted Oracle managed file +RECOVERY/bdafisdrs/archivelog/2010_09_23/thread_2_seq_1466.9896.730477033
Thu Sep 23 14:58:35 2010
RFS[2168]: Possible network disconnect with primary database
Deleted Oracle managed file +RECOVERY/bdafisdrs/archivelog/2010_09_23/thread_2_seq_1545.9817.730476973
Thu Sep 23 14:58:40 2010
RFS[2238]: Assigned to RFS process 8319
RFS[2238]: Identified database type as 'physical standby': Client is ARCH pid 2094
RFS[2238]: Opened log for thread 2 sequence 1466 dbid 1323895516 branch 728508318
Thu Sep 23 14:58:41 2010
RFS[2239]: Assigned to RFS process 8321
RFS[2239]: Identified database type as 'physical standby': Client is ARCH pid 25230
Thu Sep 23 14:58:43 2010
RFS[2240]: Assigned to RFS process 8323
RFS[2240]: Identified database type as 'physical standby': Client is ARCH pid 31899
RFS[2240]: Opened log for thread 1 sequence 2044 dbid 1323895516 branch 728508318
Thu Sep 23 14:58:51 2010
RFS[2241]: Assigned to RFS process 8334
RFS[2241]: Identified database type as 'physical standby': Client is LGWR SYNC pid 22086
Primary database is in MAXIMUM AVAILABILITY mode
Standby controlfile consistent with primary
Standby controlfile consistent with primary
RFS[2241]: No standby redo logfiles of size 102400 blocks available
RFS[2241]: No standby redo logfiles selected (reason:7)
Errors in file /u01/app/oracle/diag/rdbms/bdafisdrs/bdafisdc1/trace/bdafisdc1_rfs_8334.trc:
ORA-16086: Redo data cannot be written to the standby redo log
Thu Sep 23 14:58:59 2010
RFS[2242]: Assigned to RFS process 8341
RFS[2242]: Identified database type as 'physical standby': Client is LGWR SYNC pid 6586
Thu Sep 23 14:58:59 2010
RFS[2178]: Possible network disconnect with primary database

From the trace file it is logged following entry.

[oracle@DRS-DB-01 ~]$ cat /u01/app/oracle/diag/rdbms/bdafisdrs/bdafisdc1/trace/bdafisdc1_rfs_8334.trc
Trace file /u01/app/oracle/diag/rdbms/bdafisdrs/bdafisdc1/trace/bdafisdc1_rfs_8334.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, Oracle Label Security,
OLAP, Data Mining, Oracle Database Vault and Real Application Testing option
ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1
System name: Linux
Node name: DRS-DB-01
Release: 2.6.18-92.el5
Version: #1 SMP Tue Apr 29 13:16:15 EDT 2008
Machine: x86_64
Instance name: bdafisdc1
Redo thread mounted by this instance: 1
Oracle process number: 124
Unix process pid: 8334, image: oracle@DRS-DB-01


*** 2010-09-23 14:58:52.578
*** SESSION ID:(88.91) 2010-09-23 14:58:52.578
*** CLIENT ID:() 2010-09-23 14:58:52.578
*** SERVICE NAME:() 2010-09-23 14:58:52.578
*** MODULE NAME:(oracle@DC-DB-01 (TNS V1-V3)) 2010-09-23 14:58:52.578
*** ACTION NAME:() 2010-09-23 14:58:52.578

The primary database is operating in MAXIMUM PROTECTION
or MAXIMUM AVAILABILITY mode, and the standby database does
not contain any viable standby redo logfiles.
ORA-16086: Redo data cannot be written to the standby redo log

Cause of the Problem
The problem happened due to recovery area of standby database becomes full and standby redo logs have no place for archival. As the standby redo logs can't be archived, so they can't free space in order to accommodate/write new logs.

Solution of the Problem
Increase the recovery area size of standby database. You can check the location of archived redo log file by,
SQL> connect / as sysdba
SQL> archive log list

If you see that archive destination is USE_DB_RECOVERY_FILE_DEST then the location will be specified by parameter DB_RECOVERY_FILE_DEST.
SQL> SHOW PARAMETER DB_RECOVERY_FILE_DEST
+RECOVERY

Note that you have sufficient storage under +RECOVERY and also you have set proper size of the parameter db_recovery_file_dest_size.

To check the size of parameter db_recovery_file_dest_size issue,
SQL> show parameter db_recovery_file_dest_size

In order to increase the size of db_recovery_file_dest_size parameter issue,
SQL> alter system set db_recovery_file_dest_size = 1000G scope=both sid='*';

Wednesday, September 22, 2010

New Features in Oracle Data Guard Broker 11g

As 11g has two releases 11.2g and 11.1g so I will include new features into two sections.
New features in Oracle Data Guard Broker 11.1g
1. Fast start failover can be performed from a Data Guard broker if the database configuration is operating in maximum performance mode.

2. The new DBMS_DG PL/SQL package allows applications to notify the observer process to initiate a fast-start failover to the target standby database.

3. We can configure data guard broker to perform fast start failover based errors raised by the Oracle server.

4. After a failover, the observer automatically attempts to reinstate bystander standby databases.

5. Through DGMGRL CONVERT DATABASE command, you can convert physical standby database to a snapshot standby database, or reverts the snapshot standby database back to a physical standby database.

6. You can specify a connect identifier for Redo Transport Services as you want.

7. No need to shutdown database when changing the protection mode to and from maximum availability and maximum performance.

8. Support for Redo Apply on physical standby databases opened for read.

9. Allow a primary or logical standby database in a Data Guard Broker configuration to be mounted without having to be opened automatically.

10. The DGMGRL client ADD DATABASE command can import a pre-configured service attribute from a LOG_ARCHIVE_DEST_n parameter when adding a standby database to the configuration. So we can only issue "ADD DATABASE {DATABASE_NAME}" command instead of specifying any connect identifier.

11. A primary database can be in either the TRANSPORT-OFF or TRANSPORT-ON state. A standby database can be in either the APPLY-OFF or APPLY-ON state. In this way, database states become simpler.

12. In 11.1g the network bandwidth utilization in a Data Guard configuration is done efficiently by compressing archived redo logs as they are transmitted over the network to standby databases, when the log is sent to satisfy a gap at a standby database.

13. You can now specify USE_DB_RECOVERY_FILE_DEST as the value for the AlternateLocation and StandbyArchiveLocation instance-specific properties.

14. The following new Data Guard command-line interface (DGMGRL) commands are available:

CONVERT DATABASE TO SNAPSHOT STANDBY

CONVERT DATABASE TO PHYSICAL STANDBY

DISABLE FAST_START FAILOVER CONDITION

ENABLE FAST_START FAILOVER CONDITION

SHOW FAST_START FAILOVER

15. The following new database properties are available:

DGConnectIdentifier (replaces InitialConnectIdentifier)

ObserverConnectIdentifier

RedoCompression

16. The following new configuration properties are available:

FastStartFailoverAutoReinstate

FastStartFailoverLagLimit

FastStartFailoverPmyShutdown

17. The LsbyTxnConsistency database property has been renamed to LsbyPreserveCommitOrder.

18. New default of ASYNC for the LogXptMode database property.


New features in Oracle Data Guard Broker 11.2g
1. Now the broker configuration consist of 1 primary database and up to 30 standby databases.

2. The value of an instance-specific property can be changed for all instances in one command.

3. In 11.1g redo transport compression was limited to compressing redo data only when a redo gap is being resolved. In 11.2g when compression is enabled for a destination, all redo data sent to that destination is compressed.

4. Improved status and error reporting for the SHOW CONFIGURATION and SHOW DATABASE commands.

5. The SHOW DATABASE command displays the apply lag and transport lag of a standby database.

6. Shutting down all instances but one on a target physical standby for role changes is no longer required.

7. FAN/ONS (Fast Application Notification/Oracle Notification Services) notification is sent after a failover for databases configured with Oracle Clusterware and for single-instance databases registered with Oracle Restart.

8. FAN/AQ (Fast Application Notification/Advanced Queueing) notification is sent after a failover to a logical standby database.

9. Integration with Active Data Guard (automatic stop and restart of apply) when an apply instance is opened.

10. Reinstatement of the old (original) primary database after an immediate failover.

11. Improved hang detection and resolution for broker network communications. In addition, a new configuration property, CommunicationTimeout, enables the user to select an appropriate timeout value for their environment.

12. New database property, StaticConnectIdentifier, which allows the user to specify a static connect identifier that the DGMGRL client will use to start database instances.

13. Protection mode upgrades from maximum availability to maximum protection no longer require a restart of the primary database. This means that when upgrading from maximum performance mode to maximum protection mode, you can avoid a restart of the primary database by first upgrading to maximum availability. Once in maximum availability mode, you can then upgrade to maximum protection mode.

14. Data Recovery Adviser now uses Data Guard to suggest viable repair options for a primary database that cannot be repaired in a timely manner.

Sunday, September 19, 2010

Diagnosis Oracle Data Guard Primary Site Configuration

-- NAME: DG_Primary_Database_Diagnosis.sql
-- ------------------------------------------------------------------------
-- AUTHOR: Mohammad Abdul Momin Arju
-- September 2010.
-- ------------------------------------------------------------------------
-- PURPOSE:
-- This script is used to troubleshoot Oracle Data Guard issues for
-- Data Guard Primary database.
-- ------------------------------------------------------------------------
-- DISCLAIMER:
-- This script is provided for educational purposes only.
-- Test it before you run in your production database.
-- ------------------------------------------------------------------------
-- Content of the Script
set echo off 
set feedback off
column timecol new_value timestamp
column spool_extension new_value suffix
select to_char(sysdate,'Mondd_hhmi') timecol,
'.out' spool_extension from sys.dual;
column output new_value dbname
select value || '_' output
from v$parameter where name = 'db_name';
spool dg_prim_diag_&&dbname&×tamp&&suffix
set linesize 79
set pagesize 35
set trim on
set trims on
alter session set nls_date_format = 'MON-DD-YYYY HH24:MI:SS';
set feedback on
select to_char(sysdate) time from dual;

set echo on
-- Select from v$database will give us the generic information about how this standby is
-- setup. The database_role can be SNAPSHOT STANDBY/LOGICAL STANDBY/PHYSICAL STANDBY/PRIMARY
-- It should be standby for standby database. PROTECTION_MODE can be,
-- MAXIMUM PROTECTION - Database is running in maximized protection mode
-- MAXIMUM AVAILABILITY - Database is running in maximized availability mode
-- RESYNCHRONIZATION - Database is running in resynchronization mode
-- MAXIMUM PERFORMANCE - Database is running in maximized protection mode
-- UNPROTECTED - Database is unprotected (this normally occurs when the primary database is mounted and not open)

-- If protection_level is different than protection_mode then for some
-- reason the mode listed in protection_mode experienced a need to downgrade. Once the
-- error condition has been corrected the protection_level should match the protection_mode
-- after the next log switch.
column role format a7 tru 
column name format a10 wrap

select name,database_role role,log_mode,
protection_mode,protection_level
from v$database;
-- ARCHIVER can be STOPPED/STARTED/FAILED -
-- Archiver FAILED means archiver failed to archive a log last time but will try
-- again within 5 minutes
-- LOG_SWITCH_WAIT can be ARCHIVE LOG/CLEAR LOG/CHECKPOINT/NULL -
-- NULL means ALTER SYSTEM SWITCH LOGFILE is hung but there is room in the current online redo log
column host_name format a20 tru 
column version format a9 tru

select instance_name,host_name,version,archiver,log_switch_wait
from v$instance;
-- Force logging is not mandatory but is recommended. Supplemental
-- logging must be enabled if the standby associated with this primary is
-- a logical standby. During normal operations it is acceptable for
-- SWITCHOVER_STATUS to be SESSIONS ACTIVE or TO STANDBY.
column force_logging format a13 tru 
column remote_archive format a14 tru
column dataguard_broker format a16 tru

select force_logging,remote_archive,
supplemental_log_data_pk,supplemental_log_data_ui,
switchover_status,dataguard_broker
from v$database;
-- This query produces a list of all archive destinations and shows if they are enabled,
-- what process is servicing that destination, if the destination is local or remote,
-- and if remote what the current mount ID is.
-- Status can be, VALID - Initialized and available
-- INACTIVE - No destination information
-- DEFERRED - Manually disabled by the user
-- ERROR - Error during open or copy
-- DISABLED - Disabled after error
-- BAD PARAM - Parameter has errors
-- ALTERNATE - Destination is in an alternate state
-- FULL - Exceeded quota size for the destination.
-- For a physical standby we should have at least one remote destination that points the primary set.
COLUMN destination FORMAT A35 WRAP 
column process format a10
column archiver format a10
column ID format 99

select dest_id "ID",destination,status,target,
archiver,schedule,process,mountid
from v$archive_dest order by 1;
-- This select will give further detail on the destinations as to what
-- options have been set. Register indicates whether or not the archived
-- redo log is registered in the remote destination control file.
set numwidth 8
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;
-- The following select will show any errors that occured the last time an attempt to
-- archive to the destination was attempted. If ERROR is blank and status is VALID then
-- the archive completed correctly.
column error format a80 tru 
select dest_id,status,error from v$archive_dest;
-- Determine if any error conditions have been reached by querying the v$dataguard_status
column message format a100 
select message, timestamp
from v$dataguard_status
where severity in ('Error','Fatal')
order by timestamp;
-- The following query will determine the current sequence number
-- and the last sequence archived. If you are remotely archiving
-- using the LGWR process then the archived sequence should be one
-- higher than the current sequence. If remotely archiving using the
-- ARCH process then the archived sequence should be equal to the
-- current sequence. The applied sequence information is updated at
-- log switch time.
select ads.dest_id,max(sequence#) "Current Sequence",
max(log_sequence) "Last Archived"
from v$archived_log al, v$archive_dest ad, v$archive_dest_status ads
where ad.dest_id=al.dest_id
and al.dest_id=ads.dest_id
group by ads.dest_id;
-- The following select will attempt to gather as much information as
-- possible from the standby.
set numwidth 8
column ID format 99
column "SRLs" format 99
column Active format 99

select dest_id id,database_mode db_mode,recovery_mode,
protection_mode,standby_logfile_count "SRLs",
standby_logfile_active ACTIVE,
archived_seq#
from v$archive_dest_status;

-- Query v$managed_standby to see the status of processes involved in
-- the shipping redo on this system. Does not include processes needed to
-- apply redo.
select process,status,client_process,sequence#
from v$managed_standby;
-- The following query is run on the primary to see if SRL's have been
-- created in preparation for switchover.
select group#,sequence#,bytes from v$standby_log; 
-- The above SRL's should match in number and in size with the ORL's
-- returned below:
select group#,thread#,sequence#,bytes,archived,status from v$log; 
-- Verify all the Non-default init parameters.
set numwidth 5 
column name format a30 tru
column value format a48 wra
select name, value
from v$parameter
where isdefault = 'FALSE';

spool off