Eri*_*son 4 oracle ddl oracle11g
目前 Oracle 11.1 数据库中大约有 30 个表。
有没有办法用一个命令生成所有的ddl?(或者一些命令?)
编辑: 按照下面的建议,我尝试过:
SELECT dbms_metadata.get_ddl( 'TABLE', table_name, owner )
FROM all_tables;
Run Code Online (Sandbox Code Playgroud)
并得到:
ORA-31603: object "HS_PARTITION_COL_NAME" of type TABLE not found in schema "SYS"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3241
ORA-06512: at "SYS.DBMS_METADATA", line 4812
ORA-06512: at line 1
31603. 00000 - "object \"%s\" of type %s not found in schema \"%s\""
*Cause: The specified object was not found in the database.
*Action: Correct the object specification and try the call again.
Run Code Online (Sandbox Code Playgroud)
很明显,dbms_metadata我不明白一些非常基本的东西。
以下是对我有用的内容:
SELECT dbms_metadata.get_ddl('TABLE', table_name)
FROM user_tables;
Run Code Online (Sandbox Code Playgroud)