ORA-12545: Connect failed because target host or object does not exist

11.2.0.4 data Guard has prepared broker, which is normal when switching from the main library to the standby library. When you switch from the backup library to the main library. Something went wrong.

DGMGRL> switchover to testogg;
Performing switchover NOW, please wait...
Operation requires a connection to instance "testogg" on database "testogg"
Connecting to instance "testogg"...
Connected.
New primary database "testogg" is opening...
Operation requires startup of instance "testogg_stdby" on database "testogg_stdby"
Starting instance "testogg_stdby"...
Unable to connect to database
ORA-12545: Connect failed because target host or object does not exist

Failed.
Warning: You are no longer connected to ORACLE.

Please complete the following steps to finish switchover:
	start up instance "testogg_stdby" of database "testogg_stdby"

DGMGRL> 

View the Alert log log, indicating that log_archive_dest_2 is invalid. Db_unique_name is not correct.

Switchover: Primary highest seen SCN set to 0x0.0x1a410d
ARCH: Noswitch archival of thread 1, sequence 113
ARCH: End-Of-Redo Branch archival of thread 1 sequence 113
ARCH: LGWR is actively archiving destination LOG_ARCHIVE_DEST_3
ARCH: Standby redo logfile selected for thread 1 sequence 113 for destination LOG_ARCHIVE_DEST_3
Archived Log entry 32 added for thread 1 sequence 113 ID 0xe0779467 dest 1:
ARCH: Archiving is disabled due to current logfile archival
Primary will check for some target standby to have received alls redo
Final check for a synchronized target standby. Check will be made once.
Archive destination LOG_ARCHIVE_DEST_2 invalidated
DB_UNIQUE_NAME tesgogg is not in the Data Guard configuration
LOG_ARCHIVE_DEST_3 is a potential Physical Standby switchover target
Active, synchronized target has been identified
Target has also received all redo

Check the setting of log_archive_dest_2, there is a problem with db_unique_name, change, prompt and log_archive_dest_3 because the value is the same.

[email protected]_stdby>alter system set log_archive_dest_2= 'SERVICE=tesgogg ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testogg';
alter system set log_archive_dest_2= 'SERVICE=tesgogg ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testogg'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16021: session LOG_ARCHIVE_DEST_3 destination cannot be the same as session
LOG_ARCHIVE_DEST_2 destination

If you look at log_ARCHIve_dest_3, you see that log_archive_dest_3 is configured. However, this parameter is not set when you build the Data Guard. This parameter is generated by the Broker itself after the Broker is configured. After clearing, set log_archive_dest_2.

[email protected]_stdby>show parameter log_archive_dest_3

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_3		     string	 service="testogg", LGWR ASYNC
						 NOAFFIRM delay=0 optional comp
						 ression=disable max_failure=0
						 max_connections=1 reopen=300 d
						 b_unique_name="testogg" net_ti
						 meout=30, valid_for=(all_logfi
						 les,primary_role)
log_archive_dest_30		     string
log_archive_dest_31		     string
[email protected]_stdby>alter system set log_archive_dest_3='';

System altered.

[email protected]_stdby>alter system set log_archive_dest_2= 'SERVICE=tesgogg ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=testogg';

System altered.

Once set up, there is still a problem with not being able to switch data Guard. Check the configuration of the Broker. Discover that in the configuration of the database, the host being connected is hostname, not IP address.

DGMGRL> show database verbose testogg_stdby;

Database - testogg_stdby

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   (unknown)
  Apply Lag:       (unknown)
  Apply Rate:      (unknown)
  Real Time Query: OFF
  Instance(s):
    testogg_stdby

  Properties:
    DGConnectIdentifier             = 'testogg_stdby'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ASYNC'
    DelayMins                       = '0'
    Binding                         = 'OPTIONAL'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'AUTO'
    ArchiveLagTarget                = '0'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = '/u01/app/oracle/oradata/testogg/, /u01/app/oracle/oradata/testogg_stdby/'
    LogFileNameConvert              = '/u01/app/oracle/oradata/testogg/, /u01/app/oracle/oradata/testogg_stdby/'
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    ApplyLagThreshold               = '0'
    TransportLagThreshold           = '0'
    TransportDisconnectedThreshold  = '30'
    SidName                         = 'testogg_stdby'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbtrain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=testogg_stdby_DGMGRL)(INSTANCE_NAME=testogg_stdby)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '/archive_log/'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.dbf'
    TopWaitEvents                   = '(monitor)'

Database Status:
DGM-17016: failed to retrieve status for database "testogg_stdby"
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-16625: cannot reach database "testogg_stdby"

DGMGRL> 

Check the hosts file of the host and backup library and find that there is no host address. Add. Perform the switch again under the DGMGRL command line. The switch between main and backup is normal.

DGMGRL> switchover to testogg
Performing switchover NOW, please wait...
Operation requires a connection to instance "testogg" on database "testogg"
Connecting to instance "testogg"...
Connected.
New primary database "testogg" is opening...
Operation requires startup of instance "testogg_stdby" on database "testogg_stdby"
Starting instance "testogg_stdby"...
ORACLE instance started.
Database mounted.
Database opened.
Switchover succeeded, new primary is "testogg"

结束

Read More: