大佬教程收集整理的这篇文章主要介绍了如何生成Oracle模式的整个DDL(可编写脚本)?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在某种计划的工作这样做,而不是每次手动,所以在SQL Developer中排除使用向导。
理想情况下,由于我将在几个模式上运行它们的授权和同义词,我想有一个方法来在输出中做一个find / replace,所以模式名称匹配任何我的新模式的名称成为。
谢谢!
sqlplus<<EOF set long 100000 set head off set echo off set pagesize 0 set verify off set FeedBACk off spool scheR_700_11845@a.out @R_801_10288@ct DBMS_R_700_11845@etadata.get_ddl(object_type,object_name,owner) from ( --Convert dba_objecTs.object_type to DBMS_R_700_11845@etaDATA object type: @R_801_10288@ct owner,--Java object names may need to be converted with DBMS_JAVA.LONGname. --That code is not included since many database don't have Java installed. object_name,decode(object_type,'DATABASE link','DB_link','JOB','PROCOBJ','RulE SET','RulE','EVALUATION COntexT','PACKAGE','PACKAGE_SPEC','PACKAGE BODY','PACKAGE_BODY','TYPE','TYPE_SPEC','@R_946_3772@','TYPE_BODY','MATERIAliZED VIEW','MATERIAliZED_VIEW','QUEUE','AQ_QUEUE','JAVA CLASS','JAVA_CLASS','JAVA TYPE','JAVA_TYPE','JAVA sourcE','JAVA_sourcE','JAVA resourcE','JAVA_resourcE',object_type ) object_type from dba_objects where owner in ('owneR1') --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,table_name from dba_tables where iot_type = 'IOT_OVERFLOW') ) order by owner,object_type,object_name; spool off quit EOF cat scheR_700_11845@a.out|sed 's/owneR1/MYowneR/g'>scheR_700_11845@a.out.change.sql
把一切放在一个脚本中,并通过cron(调度程序)运行它。使用高级功能时导出对象可能很棘手。不要惊讶,如果你需要添加一些更多的例外到上面的代码。
以上是大佬教程为你收集整理的如何生成Oracle模式的整个DDL(可编写脚本)?全部内容,希望文章能够帮你解决如何生成Oracle模式的整个DDL(可编写脚本)?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。