Thursday, June 27, 2013

query for user DDL - ORACLE

query for user DDL - ORACLE

set long 200000 pages 0 lines 131
column meta format a121 word_wrapped
select dbms_metadata.get_ddl('USER', '&&username') meta from dual;
select dbms_metadata.get_granted_ddl('OBJECT_GRANT', '&&username') meta from dual;
select dbms_metadata.get_granted_ddl('ROLE_GRANT', '&&username') meta from dual;
select dbms_metadata.get_granted_ddl('SYSTEM_GRANT', '&&username') meta from dual;




Query to find the DDL of schema's in Oracle Database


select dbms_metadata.get_ddl( 'USER','username' ) from dual
     UNION ALL
     select dbms_metadata.get_granted_ddl('SYSTEM_GRANT','username') from dual
          UNION ALL 
          select dbms_metadata.get_granted_ddl('OBJECT_GRANT','username') from dual
               UNION ALL 
               select dbms_metadata.get_granted_ddl('ROLE_GRANT','username') from dual;

No comments:

Post a Comment