You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to do the equivalent of "startup force mount pfile='/tmp/pfile.ora'" from a cx_oracle connection.
When I try to do this, I get DatabaseError: ORA-00900: invalid SQL statement both with a PRELIM_AUTH connection and a normal connection.
There is also the startup command, but it does not allow one to specify a pfile.
What is your version of Python? Is it 32-bit or 64-bit?
Python 2.6.6 64 bit
What is your cx_Oracle version?
5.1.2
What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?
cur.execute("startup force mount pfile='/tmp/pfile.ora'")
What error(s) you are seeing?
DatabaseError: ORA-00900: invalid SQL statement
What OS (and version) is Python executing on?
RHEL 6.3
What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed?
Client version 11.2.0.3.0
Installed via custom RPM.
Installed at
/usr/lib64/*
/usr/include/oracle/11.2/client64/*
What is your Oracle Database version?
11.2.0.4
What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?
not set
What Oracle environment variables did you set? How exactly did you set them?
None
Do you have a small, single Python script that immediately runs to show us the problem?
conn_perm = cx_Oracle.connect(conn_string % (user, password, conn_protocol, cname, port, service_name, cert_dn), mode=cx_Oracle.SYSDBA | cx_Oracle.PRELIM_AUTH, threaded=threaded)
cur = conn.cursor()
cur.execute("create spfile='/tmp/spfile.ora' from pfile")
cur.execute("alter system set spfile='/tmp/spfile.ora'")
cur.execute("create pfile='/tmp/pfile.ora' from spfile='/tmp/spfile.ora'")
# all the above work fine
cur.execute("startup force mount pfile='/tmp/pfile.ora'") # This statement causes an error
The text was updated successfully, but these errors were encountered:
The "startup" command is a SQL*Plus command. You need to use the startup method instead. That currently doesn't support pfile, though. So I've marked this as an enhancement.
Support has now been added. To startup a database as you are requesting you would perform something like this. See the sample for details.
# the connection must be in PRELIM_AUTH mode
connection = cx_Oracle.connect("/",
mode = cx_Oracle.SYSDBA | cx_Oracle.PRELIM_AUTH)
connection.startup(force=True, pfile="/tmp/pfile.ora")
# the following statements must be issued in normal SYSDBA mode
connection = cx_Oracle.connect("/", mode = cx_Oracle.SYSDBA)
cursor = connection.cursor()
cursor.execute("alter database mount")
cursor.execute("alter database open")
For general questions:
I am trying to do the equivalent of "startup force mount pfile='/tmp/pfile.ora'" from a cx_oracle connection.
When I try to do this, I get
DatabaseError: ORA-00900: invalid SQL statement
both with a PRELIM_AUTH connection and a normal connection.There is also the startup command, but it does not allow one to specify a pfile.
What is your version of Python? Is it 32-bit or 64-bit?
Python 2.6.6 64 bit
What is your cx_Oracle version?
5.1.2
What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?
cur.execute("startup force mount pfile='/tmp/pfile.ora'")
What error(s) you are seeing?
DatabaseError: ORA-00900: invalid SQL statement
What OS (and version) is Python executing on?
RHEL 6.3
What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed?
Client version 11.2.0.3.0
Installed via custom RPM.
Installed at
/usr/lib64/*
/usr/include/oracle/11.2/client64/*
What is your Oracle Database version?
11.2.0.4
What is the
PATH
environment variable (on Windows) orLD_LIBRARY_PATH
(on Linux) set to? On macOS, what is in~/lib
?not set
What Oracle environment variables did you set? How exactly did you set them?
None
Do you have a small, single Python script that immediately runs to show us the problem?
The text was updated successfully, but these errors were encountered: