Wednesday, 1 October 2014

DGM-17016: failed to retrieve status for database ORA-16664: unable to receive the result from a database



ORA-16664: unable to receive the result from a database
Cause: During execution of a command, a database in the Data Guard broker configuration failed to return a result.
Action: Check Data Guard broker logs for the details of the failure. Fix any possible network problems and try the command again.


DGM-17016: failed to retrieve status for database 

Opening standby database in read only mode causes to error affecting data guard broker configuration. You should open database in "mount" state. If operating system is Windows, then you should edit registry editor for that database is not automatically started.


In Registry editor:

ORA_DBUNIQUENAME_AUTOSTART should be false in "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_ORACLEHOMENAME".

After  this, you should start database in mount state. I give an example script for that:


   @ECHO off

   set dbuser=sys

   set dbpass=oracle

   set dbtns=orcl

   set primaryDB=PRIMARY

   set physicalSB=PHYSICAL STANDBY

   set telaysServiceName=telays

   reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1" /v "ORA_%dbtns%_AUTOSTART" /t REG_SZ /d "FALSE" /f

   set oracle_sid=%dbtns%

  
   lsnrctl start listener

   rem waits 10 seconds

   ping 199.987.4.4 -n 1 -w 10000 > nul

  
   net start oracleservice%dbtns%

   rem waits 1 second

   ping 199.987.4.4 -n 1 -w 1000 > nul
  
  
   echo  startup mount;> c:\startmount.sql

   echo exit; >> c:\startmount.sql

   sqlplus -s "%dbuser%/%dbpass%@%dbtns%" as sysdba @c:\startmount.sql

  
   echo set pagesize 0; > c:\temp.sql

   echo spool c:\temp.txt; >> c:\temp.sql

   echo select database_role from v$database; >> c:\temp.sql

   echo spool off; >> c:\temp.sql

   echo exit; >> c:\temp.sql

   sqlplus -s "%dbuser%/%dbpass%@%dbtns%" as sysdba @c:\temp.sql

  
   FOR /F "tokens=* delims=" %%a IN (c:\temp.txt) do set src=%%a

   setlocal enabledelayedexpansion

   for /f "tokens=* delims= " %%a in ("%src%") do set src=%%a

   for /l %%a in (1,1,100) do if "!src:~-1!"==" " set src=!src:~0,-1!

   echo."%src%"

  
           if "%src%" == "%primaryDB%" (
               rem start the database
               echo  alter database open;> c:\start.sql

           echo exit; >> c:\start.sql
               sqlplus -s "%dbuser%/%dbpass%@%dbtns%" as sysdba @c:\start.sql
               rem start application server
               net start %telaysServiceName%
               eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO "TELAYS WINDOWS ACILISI" /D "Veritabani ve application server veritabani rolune gore acildi"
           ) else if "%src%" == "%physicalSB%" (
               rem start replication
           echo alter database recover managed standby database disconnect from session; >> c:\start.sql
               echo exit; >> c:\start.sql
           sqlplus -s "%dbuser%/%dbpass%@%dbtns%" as sysdba @c:\start.sql
               eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO "TELAYS WINDOWS ACILISI" /D "Veritabani veritabani rolune gore acildi"
       ) else (
               eventcreate /ID 1 /L APPLICATION /T ERROR /SO "TELAYS WINDOWS ACILISI" /D "Veritabani rolu yanlis"
       )
   del c:\temp.txt
   del c:\temp.sql
   del c:\start.sql
   del c:\startmount.sql
  
   endlocal & exit

No comments:

Post a Comment