为什么在cx_Oracle.SYSDBA模式下拒绝系统登录 [英] why system login is denied in cx_Oracle.SYSDBA mode
问题描述
我正在尝试通过cx_Oracle模块连接到Oracle 12c。
使用以下代码登录可以在cx_Oracle.connect方法中未提及任何模式的情况下工作
I am trying to connect to Oracle 12c through cx_Oracle module. Login using following code works where no mode is mentioned in cx_Oracle.connect method
import cx_Oracle
ip = 'ip'
port='1521'
SID='orcl'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
db = cx_Oracle.connect('system', 'password', dsn_tns)
但是对于以下方式,它显示cx_Oracle.SYSDBA无效的登录错误
but for following way it shows invalid login error for cx_Oracle.SYSDBA mode.
db = cx_Oracle.connect('system', 'password', dsn_tns, cx_Oracle.SYSDBA)
错误:
cx_Oracle.DatabaseError: ORA-01017: invalid username/password; logon denied
我在这里错过了什么?凭据相同。
我尝试如下手动登录并成功
What am I missing here ?? credentials are same. I tried login manually as follows and is successful
>sqlplus system/password as sysdba
推荐答案
如果以用户 sys 连接,则需要使用 cx_Oracle.SYSDBA
模式:
If you connect as user sys, you need to use the cx_Oracle.SYSDBA
mode:
conn = cx_Oracle.connect('sys', 'password', dsn_tns, cx_Oracle.SYSDBA)
ok
conn = cx_Oracle.connect('sys', 'password', dsn_tns)
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
但是,如果以用户身份连接系统,则不能使用 cx_Oracle.SYSDBA
模式:
However, if you connect as user system, you mustn't use the cx_Oracle.SYSDBA
mode:
conn = cx_Oracle.connect('system', 'password', dsn_tns)
ok
conn = cx_Oracle.connect('system', 'password', dsn_tns, cx_Oracle.SYSDBA)
ORA-01017: invalid username/password; logon denied
用户sys与系统的差异以实例此处。
The difference of the users sys and system is explained for instance here.
这篇关于为什么在cx_Oracle.SYSDBA模式下拒绝系统登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!