cx_Oracle 連線 Oracle
cx_Oracle has the capability of starting up the database using a privileged connection. This example shows a script that could be run as the ‘oracle’ operating system user who administers a local database installation on Linux. It assumes that the environment variable
ORACLE_SID has been set to the SID of the database that should be started:
# the connection must be in PRELIM_AUTH mode to perform startup
connection = cx_Oracle.connect("/", mode = cx_Oracle.SYSDBA | cx_Oracle.PRELIM_AUTH)
connection.startup()# the following statements must be issued in normal SYSDBA mode
connection = cx_Oracle.connect("/", mode = cx_Oracle.SYSDBA, encoding="UTF-8")
cursor = connection.cursor()
cursor.execute("alter database mount")
cursor.execute("alter database open")
Similarly, cx_Oracle has the ability to shutdown the database using a privileged connection. This example also assumes that the environment variable
ORACLE_SID has been set:
# need to connect as SYSDBA or SYSOPER
connection = cx_Oracle.connect("/", mode = cx_Oracle.SYSDBA)# first shutdown() call must specify the mode, if DBSHUTDOWN_ABORT is used,
# there is no need for any of the other steps
connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_IMMEDIATE)
# now close and dismount the database
cursor = connection.cursor()
cursor.execute("alter database close normal")
cursor.execute("alter database dismount")
# perform the final shutdown call
connection.shutdown(mode = cx_Oracle.DBSHUTDOWN_FINAL)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31560527/viewspace-2673871/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- python連線Oracle的外掛cx_Oracle安裝PythonOracle
- 【Python Oracle】使用cx_Oracle 連線oracle的簡單介紹PythonOracle
- python使用cx_Oracle連線oracle資料庫獲取常用資訊PythonOracle資料庫
- cx_oracle 使用Oracle
- CX_ORACLE 庫使用Oracle
- 體驗cx_OracleOracle
- python cx_Oracle SYSDBAPythonOracle
- Oracle(+)連線與Join連線Oracle
- Oracle左連線,右連線Oracle
- ORACLE 半連線與反連線Oracle
- python安裝模組cx_OraclePythonOracle
- Oracle的左連線和右連線Oracle
- PHP 連線 OraclePHPOracle
- Servlet連線OracleServletOracle
- PHP 連線oraclePHPOracle
- jdbc連線oracleJDBCOracle
- sqlserver連線oracleSQLServerOracle
- mysql 連線oracleMySqlOracle
- navicat 連線 oracleOracle
- Oracle 表連線Oracle
- SQLSERVER 連線 ORACLESQLServerOracle
- ruby連線OracleOracle
- oracle外連線Oracle
- ORACLE 連線方式Oracle
- Oracle連線方式Oracle
- QTP連線OracleQTOracle
- thinkphp連線OraclePHPOracle
- Oracle內連線、外連線、右外連線、全外連線小總結Oracle
- Oracle 表連線方式詳解(外連結、內連線、自連線)Oracle
- python資料庫模組-Cx_OraclePython資料庫Oracle
- 【SQL】Oracle的內連線、左外連線、右外連線及全外連線SQLOracle
- oracle 連線查詢Oracle
- DBA ORACLE連線操作Oracle
- ORACLE 表連線方式Oracle
- jdbc 連線 oracle racJDBCOracle
- Python連線oraclePythonOracle
- Oracle 連線池配置Oracle
- oracle中字串連線Oracle字串