日期:2014-05-16  浏览次数:20581 次

获取表空间和用户的DDL语句

工作中,需要现场返回所有表空间及用户信息

get_ddl_info.sql

spool get_ddl_info.log
set pagesize 0
set linesize 1000 
set feedback off 
set long 999999 
set pagesize 1000 
set heading off
prompt select dbms_metadata.get_ddl('TABLESPACE',TS.tablespace_name) from DBA_TABLESPACES TS;
select dbms_metadata.get_ddl('TABLESPACE',TS.tablespace_name) from DBA_TABLESPACES TS;
prompt select dbms_metadata.get_ddl('USER',U.username) from DBA_USERS U;
select dbms_metadata.get_ddl('USER',U.username) from DBA_USERS U;
prompt select username from dba_users;
select username from dba_users;
spool off

?

?