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使用cx_Oracle連線oracle資料庫獲取常用資訊PythonOracle資料庫
- cx_oracle 使用Oracle
- CX_ORACLE 庫使用Oracle
- Servlet連線OracleServletOracle
- PHP 連線 OraclePHPOracle
- thinkphp連線OraclePHPOracle
- PHP 連線oraclePHPOracle
- python資料庫模組-Cx_OraclePython資料庫Oracle
- oracle 連線查詢Oracle
- DBA ORACLE連線操作Oracle
- 3.2.2 python連線oraclePythonOracle
- CentOS7.1安裝Oracle 12.1客戶端以及cx_OracleCentOSOracle客戶端
- python cx_Oracle: UnicodeEncodeError: 'ascii' codec can't encode charactersPythonOracleUnicodeErrorASCII
- Oracle左外連線、右外連線、完全外連線以及(+)號用法Oracle
- Oracle連線Db2OracleDB2
- [Oracle-> MySQL] Oracle通過dblink連線MySQL--Oracle 19c連線到MySQL 5.7OracleMySql
- java操作Oracle 方式一 ( 連線-》操作-》斷開連線 )JavaOracle
- 【JDBC】java連線池模擬測試 連線oracleJDBCJavaOracle
- 【JDBC】使用OracleDataSource建立連線池用於連線OracleJDBCOracle
- pyinstaller打包cx_Oracle庫問題處理記錄Oracle
- 第八篇:cx_Oracle出現的問題Oracle
- Python安裝cx_Oracle模組遇到的問題PythonOracle
- Oracle 自動化運維-Python連線OracleOracle運維Python
- 配置Oracle DBlink連線MySQL庫OracleMySql
- PL/Plus本地連線oracle配置Oracle
- cx_Oracle.SessionPool 連線池OracleSession
- Python 連線 Oracle資料庫PythonOracle資料庫
- oracle連線查詢詳解Oracle
- 使用instantclient連線oracle資料庫clientOracle資料庫
- Sqlcl 連線Oracle DataBase 19cSQLOracleDatabase
- [20191112]oracle共享連線模式埠.txtOracle模式
- [Navicate]Navicate連線Oracle資料庫Oracle資料庫
- Oracle 19c中連線RMAN客戶端的連線方法Oracle客戶端
- C#連線和操作Oracle資料C#Oracle
- Oracle RAC 環境下的連線管理Oracle
- Oracle dos連線資料庫基本操作Oracle資料庫
- Oracle共享伺服器的連線模式Oracle伺服器模式