Connection to Oracle 12c failing using cx_Oracle

Venky <[email protected]> Wed, 21 Jun 2017 13:06:27 +0530
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <CAFm3R6=Ht3+XjOrAz_s_gi1r05A8BekwbDb1d4MHw5xa9UR-Rw@mail.gmail.com>
Hi Folks,

I need your help wrt below issue faced while connecting to SQL*Plus:
Release 12.1.0.2.0 Production on Wed Jun 21 06:50:43 2017
using the below cx_Oracle python module.

pip show cx_Oracle

Name: cx-Oracle

Version: 5.3

Summary: Python interface to Oracle

Home-page: https://oracle.github.io/python-cx_Oracle

Author: Anthony Tuininga

Author-email: [email protected]

License: BSD License

Location: /usr/lib64/python2.7/site-packages

Requires:

Below are the oracle instant client files used.

   1. oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
   2. oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
   3. oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm


>>> import cx_Oracle

>>> db = cx_Oracle.connect('sys','apporbit','67.220.186.115:15210/standby');

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

cx_Oracle.OperationalError: ORA-01033: ORACLE initialization or shutdown in
progress

Process ID: 0

Session ID: 0 Serial number: 0



   - Master Oracle 12c is on the host 67.220.182.210 at port 1521
   - Below is the Oracle 12c instance running on host 67.220.186.115 at
   port 15210
   - This instance will always be in mounted mode since this instance is
   the result of the replication from master.
   - I can connect to it using below manual steps but can't using cx_Oracle
   as shown above.


ps -aef| grep pmon

oracle     106     1  0 06:47 ?        00:00:00 ora_pmon_standby

root       334   231  0 07:34 ?        00:00:00 grep --color=auto pmon



cat $ORACLE_HOME/network/admin/listener.ora

LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))))

SID_LIST_LISTENER=(SID_LIST=(SID_DESC=(GLOBAL_DBNAME=standby)(ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1)(SID_NAME=standby)))



cat $ORACLE_HOME/network/admin/tnsnames.ora

TESTDB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=67.220.182.210)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=TESTDB)))

standby=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=0.0.0.0)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=standby)))



lsnrctl status


LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 21-JUN-2017 07:28:49


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


Connecting to
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production

Start Date                21-JUN-2017 06:47:09

Uptime                    0 days 0 hr. 41 min. 40 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File
/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora

Listener Log File
/u01/app/oracle/diag/tnslsnr/oracle-ldt1/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))

Services Summary...

Service "standby" has 2 instance(s).

  Instance "standby", status UNKNOWN, has 1 handler(s) for this service...

  Instance "standby", status READY, has 1 handler(s) for this service...

The command completed successfully



$export ORACLE_SID=standby; sqlplus sys/apporbit as sysdba


SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 21 07:26:55 2017


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



Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application
Testing options


SQL> select status, database_status from v$instance;


STATUS     DATABASE_STATUS

------------ -----------------

MOUNTED      ACTIVE


SQL> select open_mode, database_role from v$database;


OPEN_MODE     DATABASE_ROLE

-------------------- ----------------

MOUNTED      PHYSICAL STANDBY



~Venky

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users