Oracle-克隆表-结构,数据约束及所有 [英] Oracle - Clone table - Structure, data constraints and all
本文介绍了Oracle-克隆表-结构,数据约束及所有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我可以通过以下方式复制故事结构和数据
I know I can copy a tale structure and data by
create table testtable1 as select * from sourcetable
是否有任何方法可以克隆所有内容,触发器,约束,授权等?
Is there any way to actually clone everything, triggers, constraints, grants etc?
先谢谢了.我们正在运行10G.
Thanks in advance. We are running 10G.
推荐答案
研究dbms_metadata
,尤其是其过程dbms_metadata.get_ddl
功能(请参见
Take a look into dbms_metadata
, especially its procedure dbms_metadata.get_ddl
function (see this tahiti link).
因此,在您的情况下,您首先要做一个
So, in your case, you would first do a
select dbms_metadata.get_ddl('TABLE', 'SOURCETABLE') from dual;
根据现在在这里的评论:不要忘记dbms_metadata.get_dependent_ddl
:
As per be here now's comment: dont forget the dbms_metadata.get_dependent_ddl
:
select dbms_metadata.get_dependent_ddl('TABLE', 'SOURCETABLE') from dual;
然后从给定的输出开始工作.
And then work from the given output.
这篇关于Oracle-克隆表-结构,数据约束及所有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文