Re: [cx-oracle-users] Connection to Oracle 12c failing using cx_Oracle
Brought to you by:
atuining
|
From: Venky <ven...@gm...> - 2017-06-21 16:34:05
|
Hi Jakob,
Tried but getting as invalid keyword.
>>> import cx_Oracle
>>> db = cx_Oracle.connect('sys','apporbit','67.220.186.115:15210/standby',
sysdba=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'sysdba' is an invalid keyword argument for this function
Then tried as shown below with mode = cx_Oracle.SYSDBA and it worked.
Thanks Jakob for giving the pointer.
db = cx_Oracle.connect('sys','apporbit','67.220.186.115:15210/standby',
mode = cx_Oracle.SYSDBA)
>>> db = cx_Oracle.connect('sys','apporbit','67.220.186.115:15210/standby',
mode = cx_Oracle.SYSDBA)
>>> cursor = db.cursor()
>>> cursor.execute('select sequence# from v$archived_log order by rownum
desc')
<cx_Oracle.Cursor on <cx_Oracle.Connection to
sys@67.220.186.115:15210/standby>>
~ Venky
On Wed, Jun 21, 2017 at 1:54 PM, Jakob Gurnhofer <ja...@gu...> wrote:
> Hi Venky,
>
>
> have you tried connecting "as sysdba"?
>
> like:
>
> db = cx_Oracle.connect('sys','apporbit','67.220.186.115:15210/standby'
> <http://67.220.186.115:15210/standby%27>, *sysdba=True*)
>
> Jakob
>
>
>
> Am 21.06.2017 um 09:36 schrieb Venky:
>
> 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: ant...@gm...
>
> 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'
> <http://67.220.186.115:15210/standby%27>);
>
> 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 lis...@li...://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>
> --
> Ing. Jakob Gurnhofer, BSc...@gu...://gurn.at
>
>
> ------------------------------------------------------------
> ------------------
> 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-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>
|