- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想得到表CARD_TABLE
的DDL在 XT
模式
SQL> select dbms_metadata.get_ddl('TABLE','CARD_TABLE','XT') from dual;
ERROR:
ORA-31603: object "CARD_TABLE" of type TABLE not found in
schema "XT"
ORA-06512: at "SYS.DBMS_METADATA", line 5746
ORA-06512: at "SYS.DBMS_METADATA", line 8333
ORA-06512: at line 1
select count(*) from XT.CARD_TABLE;
count(*)
---------
0
dba_objects
它仍然得到了 table :
SQL> select owner,object_type from DBA_OBJECTS
where object_name='CARD_TABLE' 2
3 ;
PUBLIC SYNONYM
XT TABLE PARTITION
XT TABLE PARTITION
XT TABLE PARTITION
XT TABLE
XT TABLE PARTITION
VAT TABLE
7 rows selected.
最佳答案
从 dbms_metadata
documentation :
If nonprivileged users are granted some form of access to an object in someone else's schema, they will be able to retrieve the grant specification through the Metadata API, but not the object's actual metadata.
SYS
的身份连接,或者将
SELECT_CATALOG_ROLE
角色授予您的用户才能获得 XT 的对象定义。
In stored procedures, functions, and definers-rights packages, roles (such as SELECT_CATALOG_ROLE) are disabled. Therefore, such a PL/SQL program can only fetch metadata for objects in its own schema. If you want to write a PL/SQL program that fetches metadata for objects in a different schema (based on the invoker's possession of SELECT_CATALOG_ROLE), you must make the program invokers-rights.
dbms_metadata
,但如果您从一个过程调用它,则必须在过程声明中包含
an AUTHID
clause ,并添加
AUTHID CURRENT_USER
。
关于sql - dbms_metadata.get_ddl 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26026068/
我正在开发一个用于获取 Oracle 数据库对象的 ddl 的应用程序。 使用以下查询获取数据库的对象 SELECT object_name, object_type FROM dba_object
我想为大多数数据库对象创建ddl脚本。 dbms_metadata.get_ddl适用于大多数对象类型。例如,以下为 View 创建ddl: select dbms_metadata.get_ddl
这是获取 DDL 或过程并使其美观的命令: EXEC DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM , 'PRET
我想得到表CARD_TABLE的DDL在 XT模式 SQL> select dbms_metadata.get_ddl('TABLE','CARD_TABLE','XT') from dual;
我正在使用 Oracle 12c 作为数据库并使用以下方法获取表或其他对象的 ddl:- dbms_metadata.get_ddl('TABLE','TABLE_NAME','SCHEMA_NAME
dbms_metadata.get_ddl()用于获取对象的DDL,其具体用法如下。 注意:在sqlplus里,为了更好的展示DDL,需要设置如下参数: 复制代码代码如下: set line
我正在尝试使用 JAVA 调用生成 DDL: DBMS_METADATA.GET_DDL; DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSIO
我想获取所有表的所有表定义。我想快速完成(这是我经常运行的脚本的一部分) 我使用的是 oracle 11g,我有 700 个表。在普通的 jdbc 代码上,它需要 4 分钟并执行以下操作: s = c
exec dbms_metadata.set_transform_param(DBMS_METADATA.SESSION_TRANSFORM, 'CONSTRAINTS_AS_ALTER', TRUE
我正在开发我们正在使用 get_ddl 创建表 ddl 的 Java 项目Oracle 12c 中的方法. 例如我的表名是 PARENT_EMP 和架构是 次要用户 然后我使用 get_ddl 方法。
我正在创建一个包来在我的模式中生成对象的 DDL(您解析对象名称,并使用 DDL 返回 clob),因此我可以生成文件,并将它们直接放入 SVN。 我正在使用 dbms_metadata.get_dd
我要 DDL s of Tables 以便我可以使用 UTL 将其放入数据库服务器Oracle 中的包。 问题是:当我们 select dbms_metadata.get_ddl('TABLE','T
(请原谅我的无知 - 我不是经验丰富的 Oracle 用户。) 我正在尝试使用 DBMS_METADATA.GET_DDL 函数(与 ALL_OBJECTS 或类似函数结合使用)来获取特定模式中所有表
这是我在这里发布的第一个问题,所以我希望格式是可以接受的。 我能够为我们所有的存储过程执行 get_ddl() 和 DESC PROCEDURE 但有些有一个空 body使用 describe 时,使
我正在寻找命令行或脚本化解决方案,以便从 SQL Server 2005+ 中为所有数据库对象提取 DDL:表、存储过程、 View 、索引/索引、约束等。GUI 工具不感兴趣。 优先选择内置工具,因
我们有一个很大的现有脚本,可以在我们的客户数据库(的克隆)中删除和重新创建表。我们的客户可能稍微更改了表或索引定义,因此我们的脚本尝试使用 dbms_metadata.get_ddl 的输出来重新创建
我是一名优秀的程序员,十分优秀!