【问题标题】:Inspectdb in Oracle-Django gets OCI-22061: invalid format text [TOracle-Django 中的 Inspectdb 获取 OCI-22061:格式文本无效 [T
【发布时间】:2012-05-16 21:29:19
【问题描述】:

我正在使用Oracle Database 10g xe universal Rel.10.2.0.1.0 against cx_Oracle-5.0.4-10g-unicode-py26-1.x86_64 on a django project on Ubuntu 10.04

我的数据库由Oracle 10gr2 enterprise edition 生成(在Windows XP 上,导入在US7ASCII character set and AL16UTF16 NCHAR character set 中完成,导入服务器使用AL32UTF8 character set,导出客户端使用EL8MSWIN1253 character set

当我尝试django-admin.py inspectdb 时,我收到以下错误:

......."indexes = connection.introspection.get_indexes(cursor, 表名)文件 “/usr/lib/pymodules/python2.6/django/db/backends/oracle/introspection.py”, 第 116 行,在 get_indexes 中 对于 cursor.fetchall() 中的行:文件“/usr/lib/pymodules/python2.6/django/db/backends/oracle/base.py”,行 483,在 fetchall 中 for r in self.cursor.fetchall()]) cx_Oracle.DatabaseError: OCI-22061: invalid format text [T".

我知道"inspectdb works with PostgreSQL, MySQL and SQLite",但正如我从其他帖子中了解到的那样,它也以某种方式与 Oracle 一起工作。

有谁知道我为什么会收到此错误或如何修复它?

【问题讨论】:

    标签: django django-models oracle-xe cx-oracle inspectdb


    【解决方案1】:

    您可以尝试更新 cx_Oracle 5.1.1 软件包,然后试试这个:

    python manage.py inspectdb --database dbname
    

    【讨论】:

      【解决方案2】:

      您可以下载 cx_Oracle-5.1.2 并使用以下命令修复问题。

      $ wget -c http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-5.1.2-11g-py27-1.x86_64.rpm

      安装rpm命令

      $ sudo yum install cx_Oracle-5.0.4-11g-unicode-py27-1.x86_64.rpm

      同时下载 Oracle 即时客户端 http://download.oracle.com/otn/linux/instantclient/11101/basic-11.1.0.6.0-linux-x86_64.ziphttp://download.oracle.com/otn/linux/instantclient/11101/sdk-11.1.0.6.0-linux-x86_64.zip

      解压上面下载的 zip 文件。 从 sdk-11.1.0.6.0-linux-x86_64 复制 include 文件夹并粘贴到 basic-11.1.0.6.0-linux-x86_64.bashrc 文件中设置以下路径

      导出 $LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/oracle_lib/oracle_instantclient_11_1

      导出 $ORACLE_HOME = /oracle_lib/oracle_instantclient_11_1

      $ ls /oracle_lib/oracle_instantclient_11_1

      您应该找到包含文件列表的 include 文件夹

      然后使用 $ source ~/.bashrc

      执行 .bashrc 文件

      我已经测试过了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-10-23
        • 1970-01-01
        • 2011-05-16
        • 2018-07-07
        • 1970-01-01
        • 2011-06-22
        • 2020-07-24
        相关资源
        最近更新 更多