【问题标题】:Getting "ORA-28000: the account is locked" while connecting from Python to Oracle从 Python 连接到 Oracle 时出现“ORA-28000:帐户已锁定”
【发布时间】:2023-03-17 15:30:01
【问题描述】:

我的本​​地系统中安装了 Python (3.8.3) 和 Oracle DB(11g 第 2 版服务器)。这两个软件都可以单独运行。我可以在 python 中运行程序,也可以使用 Oracle DB 中的数据创建表,我可以通过 Oracle SQL Developer 和 SQL Plus 访问这些表。 但是,当我尝试从 python 连接 Oracle DB 时,由于帐户被锁定,我收到错误消息。我已经成功安装并执行了 import cx_Oracle。但是当我尝试执行以下代码时出现错误。

1.本地初始化方法- connection = cx_Oracle.connect("oe/oracle@localhost:1522/orcl11g2")

2。通过 TNSNAMES.ORA 连接 - connection = cx_Oracle.connect("oe", "oracle", "orcl11g2")

错误 -

Traceback(最近一次通话最后一次): 文件“”,第 1 行,在 cx_Oracle.DatabaseError: ORA-28000: 账户被锁定

我的 TNS 详细信息 -

文件位置 - D:\app\Admin\product\11.2.0\dbhome_2\NETWORK\ADMIN

ORCL11G2 = (描述= (地址 =(协议 = TCP)(主机 = 本地主机)(端口 = 1522)) (连接数据 = (服务器 = 专用) (SERVICE_NAME = ORCL11G2) ) )

请帮助我。如果您需要了解更多信息来指导我,请告诉我。

【问题讨论】:

    标签: cx-oracle python-3.8 oracle11gr2 tnsnames


    【解决方案1】:

    SQL Developer 或 SQL*Plus 中,以特权用户(例如 SYSTEM 或 SYS)的身份连接到数据库,例如:

    sqlplus system/yourpassword@localhost:1522/orcl11g2
    

    然后运行SQL语句:

    alter user oe account unlock;
    

    【讨论】:

      猜你喜欢
      • 2015-01-07
      • 2014-01-26
      • 2015-06-29
      • 1970-01-01
      • 2019-04-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多