Oracle Example Export ddl for table/index


 ** Myself
 

Export ddl for table [USR02]
set feedback off heading off pages 0 lines 3000 long 400000
# dbms_metadata.get_ddl = 'table','table name','schema'
select dbms_metadata.get_ddl('TABLE','USR02','SAPSR3') from dual;


Query index of table [USR02]
SQL>
 select INDEX_NAME from dba_indexes
 where
 TABLE_OWNER='SAPSR3'
  and TABLE_NAME='USR02' ;

INDEX_NAME
------------------------------
USR02~0
USR02~001
USR02~002


Export ddl for index   USR02~0/ USR02~001/ USR02~002
set feedback off heading off pages 0 lines 3000 long 400000
# dbms_metadata.get_ddl = 'index','index name','schema'
select dbms_metadata.get_ddl('INDEX','USR02~0','SAPSR3') from dual;
select dbms_metadata.get_ddl('INDEX','USR02~001','SAPSR3') from dual;
select dbms_metadata.get_ddl('INDEX','USR02~002','SAPSR3') from dual;

0 comments:

Loading