oracle ORA-31603,即使是sysdba

oracle ORA-31603,即使是sysdba,oracle,types,dbms-metadata,Oracle,Types,Dbms Metadata,我通过sqlplus和sys作为sysdba连接到oracle数据库11.2.0.4企业版。如果我运行查询: select DBMS_METADATA.GET_DDL ( 'TYPE' , 'SYS_PLSQL_9131_DUMMY_1' , 'SYS' ) from dual ; 我得到了错误 *ORA-31603: object "SYS_PLSQL_9131_DUMMY_1" of type TYPE not found in schema "SYS" O

我通过sqlplus和sys作为sysdba连接到oracle数据库11.2.0.4企业版。如果我运行查询:

   select DBMS_METADATA.GET_DDL ( 'TYPE' , 'SYS_PLSQL_9131_DUMMY_1' , 'SYS' ) from dual ; 
我得到了错误

     *ORA-31603: object "SYS_PLSQL_9131_DUMMY_1" of type TYPE not found in  schema "SYS"
      ORA-06512: at "SYS.DBMS_METADATA", line 5805
      ORA-06512: at "SYS.DBMS_METADATA", line 8344*
如果我跑步,我也会犯类似的错误

      select DBMS_METADATA.GET_DDL ( 'TYPE_BODY' , 'SYS_PLSQL_9131_DUMMY_1' , 'SYS' ) from dual ;
      select DBMS_METADATA.GET_DDL ( 'TYPE_SPEC' , 'SYS_PLSQL_9131_DUMMY_1' , 'SYS' ) from dual ;
如果我查询
DBA\u对象
DBA\u源
,类型的对象就在那里


即使查询SYS架构中的其他类型对象,我也会遇到这些错误,但并非所有类型对象都会出现此问题。

这些类型应该由包隐式创建。查询DBA_对象以获取对象_id 9131(类型名称中的数字)


它可能是指一个包,该包具有一个函数,该函数返回的值具有包规范中定义的数据类型,而不是简单的VARCHAR2/NUMBER/DATE。

这些类型应由包隐式创建。查询DBA_对象以获取对象_id 9131(类型名称中的数字)


它可能指的是一个包,该包具有一个函数,该函数返回的值具有包规范中定义的数据类型,而不是简单的VARCHAR2/NUMBER/DATE。

为什么会引发错误?问题不在于权限或代码。问题在于,有时Oracle对象并不是它所声称的对象类型。不是所有的“表”都是真实的表,也不是所有的“类型”都是真实的类型。Oracle可以创建对象来支持其他对象,例如嵌套表和系统生成的集合类型

我如何提前知道什么会引发错误?据我所知,没有官方文档或数据字典视图可以告诉您对象何时不是真正的对象。最好的指南可能是中的条件。具体而言,本部分:

    ...
   --These objects are included with other object types.
    and object_type not in ('INDEX PARTITION','INDEX SUBPARTITION',
       'LOB','LOB PARTITION','TABLE PARTITION','TABLE SUBPARTITION')
    --Ignore system-generated types that support collection processing.
    and not (object_type = 'TYPE' and object_name like 'SYS_PLSQL_%')
    --Exclude nested tables, their DDL is part of their parent table.
    and (owner, object_name) not in (select owner, table_name from dba_nested_tables)
    --Exlclude overflow segments, their DDL is part of their parent table.
    and (owner, object_name) not in (select owner, table_name from dba_tables where iot_type = 'IOT_OVERFLOW')

某些对象无法导出,需要忽略。

为什么会引发错误?问题不在于权限或代码。问题在于,有时Oracle对象并不是它所声称的对象类型。不是所有的“表”都是真实的表,也不是所有的“类型”都是真实的类型。Oracle可以创建对象来支持其他对象,例如嵌套表和系统生成的集合类型

我如何提前知道什么会引发错误?据我所知,没有官方文档或数据字典视图可以告诉您对象何时不是真正的对象。最好的指南可能是中的条件。具体而言,本部分:

    ...
   --These objects are included with other object types.
    and object_type not in ('INDEX PARTITION','INDEX SUBPARTITION',
       'LOB','LOB PARTITION','TABLE PARTITION','TABLE SUBPARTITION')
    --Ignore system-generated types that support collection processing.
    and not (object_type = 'TYPE' and object_name like 'SYS_PLSQL_%')
    --Exclude nested tables, their DDL is part of their parent table.
    and (owner, object_name) not in (select owner, table_name from dba_nested_tables)
    --Exlclude overflow segments, their DDL is part of their parent table.
    and (owner, object_name) not in (select owner, table_name from dba_tables where iot_type = 'IOT_OVERFLOW')
某些对象无法导出,需要忽略