SQL> select object_type,count(*) from dba_objects group by object_type;
OBJECT_TYPE COUNT(*)
------------------- ----------
CONSUMER GROUP 25
INDEX PARTITION 2343
TABLE SUBPARTITION 956
EDITION 1
SEQUENCE 10882
QUEUE 180
TABLE PARTITION 2983
JAVA DATA 323
RULE 26
SCHEDULE 3
PROCEDURE 161
OPERATOR 46
LOB PARTITION 52
WINDOW 9
SCHEDULER GROUP 4
DESTINATION 2
DATABASE LINK 6
LOB 2345
PACKAGE 47758
PACKAGE BODY 46664
LIBRARY 204
RULE SET 110
PROGRAM 28
INDEX SUBPARTITION 924
JAVA RESOURCE 1019
TYPE BODY 321
CONTEXT 34
XML SCHEMA 97
TRIGGER 4186
MATERIALIZED VIEW 723
DIRECTORY 12
JOB CLASS 15
UNDEFINED 11
INDEX 51197
TABLE 29661
SYNONYM 78008
VIEW 31007
FUNCTION 364
JAVA CLASS 30005
INDEXTYPE 9
JAVA SOURCE 2
CLUSTER 10
TYPE 4713
RESOURCE PLAN 11
EVALUATION CONTEXT 44
JOB 14
LOB SUBPARTITION 96
47 rows selected.
Step-01 ( Script for Procedure )
PROCEDURE
--------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PROCEDURE'
order by owner;
Step-02 ( Script For Function)
FUNCTION
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='FUNCTION'
order by owner;
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE BODY'
order by owner;
Step-03 ( Script For Package)
PACKAGE
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE'
order by owner;
Step-04 ( Script For Package Body)
PACKAGE BODY
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE BODY'
order by owner;
Step-04 ( Script For Trigger)
TRIGGER
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TRIGGER'
order by owner;
Step-04 ( Script For Table)
TABLE
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TABLE'
order by owner;
Step-04 ( Script For TABLE SUBPARTITION)
TABLE SUBPARTITION
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TABLE SUBPARTITION'
order by owner;
-----------------------------------------------------------------------------------
================= :Example: ===============
-----------------------------------------------------------------------------------
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool ddl_list.sql
select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
spool off;
OBJECT_TYPE COUNT(*)
------------------- ----------
CONSUMER GROUP 25
INDEX PARTITION 2343
TABLE SUBPARTITION 956
EDITION 1
SEQUENCE 10882
QUEUE 180
TABLE PARTITION 2983
JAVA DATA 323
RULE 26
SCHEDULE 3
PROCEDURE 161
OPERATOR 46
LOB PARTITION 52
WINDOW 9
SCHEDULER GROUP 4
DESTINATION 2
DATABASE LINK 6
LOB 2345
PACKAGE 47758
PACKAGE BODY 46664
LIBRARY 204
RULE SET 110
PROGRAM 28
INDEX SUBPARTITION 924
JAVA RESOURCE 1019
TYPE BODY 321
CONTEXT 34
XML SCHEMA 97
TRIGGER 4186
MATERIALIZED VIEW 723
DIRECTORY 12
JOB CLASS 15
UNDEFINED 11
INDEX 51197
TABLE 29661
SYNONYM 78008
VIEW 31007
FUNCTION 364
JAVA CLASS 30005
INDEXTYPE 9
JAVA SOURCE 2
CLUSTER 10
TYPE 4713
RESOURCE PLAN 11
EVALUATION CONTEXT 44
JOB 14
LOB SUBPARTITION 96
47 rows selected.
Step-01 ( Script for Procedure )
PROCEDURE
--------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PROCEDURE'
order by owner;
Step-02 ( Script For Function)
FUNCTION
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='FUNCTION'
order by owner;
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE BODY'
order by owner;
Step-03 ( Script For Package)
PACKAGE
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE'
order by owner;
Step-04 ( Script For Package Body)
PACKAGE BODY
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='PACKAGE BODY'
order by owner;
Step-04 ( Script For Trigger)
TRIGGER
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TRIGGER'
order by owner;
Step-04 ( Script For Table)
TABLE
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TABLE'
order by owner;
Step-04 ( Script For TABLE SUBPARTITION)
TABLE SUBPARTITION
---------------------
select 'select dbms_metadata.get_ddl('||''''||object_type||''''||','||''''||object_name||''''||','||''''||owner||''''||')'||' from dual ;'
from dba_objects where object_type='TABLE SUBPARTITION'
order by owner;
-----------------------------------------------------------------------------------
================= :Example: ===============
-----------------------------------------------------------------------------------
set heading off;
set echo off;
Set pages 999;
set long 90000;
spool ddl_list.sql
select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;
select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;
spool off;
No comments:
Post a Comment