python 通过cx_Oracle操作oracle database
来源:互联网 发布:2016中国近几年gdp数据 编辑:程序博客网 时间:2024/06/05 03:07
python 通过cx_Oracle对oracle database的打开关闭操作
def dbShutdownImmediate(sid):
try:
os.environ['ORACLE_SID']=sid
# need to connect as SYSDBA or SYSOPER
connection = cx_Oracle.connect(“/”, mode = cx_Oracle.SYSDBA)
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)
print “dbShutdownImmediate OK!”
return True
except cx_Oracle.DatabaseError,info:
print “Error: “,info
return False
def dbShutdownAbort(sid):
try:
os.environ['ORACLE_SID']=sid
handle= cx_Oracle.connect(“/”,mode = cx_Oracle.SYSDBA | cx_Oracle.PRELIM_AUTH)
handle.shutdown(mode = cx_Oracle.DBSHUTDOWN_ABORT)
print “dbShutdownAbort OK!”
return True
except cx_Oracle.DatabaseError,info:
print “Error: “,info
return False
def dbStartup(sid):
lbok=True
if lbok: lbok=dbStartupNomount(sid)
if lbok: lbok=dbMount(sid)
if lbok: lbok=dbOpen(sid)
# startup nomount:
def dbStartupNomount(sid):
try:
os.environ['ORACLE_SID']=sid
connection = cx_Oracle.connect(“/”,mode = cx_Oracle.SYSDBA | cx_Oracle.PRELIM_AUTH)
connection.startup()
print “dbStartupNomount OK!”
return True
except cx_Oracle.DatabaseError,info:
print “Error: “,info
return False
# mount:
def dbMount(sid):
try:
os.environ['ORACLE_SID']=sid
handle=cx_Oracle.connect(“/”, mode = cx_Oracle.SYSDBA)
cursor = handle.cursor()
cursor.execute(“alter database mount”)
print “dbMount OK!”
return True
except cx_Oracle.DatabaseError,info:
print “Error: “,info
return False
# open
def dbOpen(sid):
try:
os.environ['ORACLE_SID']=sid
handle=cx_Oracle.connect(“/”, mode = cx_Oracle.SYSDBA)
cursor = handle.cursor()
cursor.execute(“alter database open”)
print “dbOpen OK!”
return True
except cx_Oracle.DatabaseError,info:
print “Error: “,info
return False
- python 通过cx_Oracle操作oracle database
- python通过cx_Oracle连接oracle设置
- python使用cx_Oracle操作oracle示例
- python通过cx_Oracle模块连接Oracle乱码问题
- cx_Oracle操作Oracle数据库
- python cx_Oracle简单操作
- 【Python Oracle】使用cx_Oracle 进行数据库操作介绍
- Python使用cx_Oracle模块连接操作Oracle数据库
- Windows下python连接、操作oracle数据库(cx_Oracle)
- python之oracle连接 cx_Oracle
- python中cx_Oracle的操作
- 【python】 python 连接oracle数据库 cx_Oracle插件
- Install Oracle (cx_Oracle) module for Python
- python 连接 Oracle 乱码问题(cx_Oracle)
- python 连接oracle 报错 cx_Oracle.DatabaseErro
- python使用cx_oracle连接oracle数据库
- Python cx_Oracle & Oracle Client for Mac OS
- python用cx_oracle连接oracle报错
- NP问题
- Mysql异常之Access denied for user 'root'@'localhost' (using password: NO/YES)
- Error: debugging information for 'myproject.exe' cannot be found or does not match. No symbols loade
- Surfaceflinger process流程分析
- C语言运算符优先级
- python 通过cx_Oracle操作oracle database
- Android 浮动搜索框 searchable 使用指南
- DBF格式
- #inclue<math.h>函数学习 不断更新
- 概率分布-二项分布、多项分布
- 虚拟机问题-提示找不到系统
- 二分搜索递归与非递归C语言实现
- mainWCRTStartup 与 wmain
- 读《黑客与画家》