Toad나 Orange 에서는 schema DDL Generator 의 기능을 이용하여
해당 스키마의 생성에 관한 Script를 생성할수 있습니다.
이관등에 자주 사용되는 기능인데, sqlplus 상에서는 아래의 쿼리로써 동일하게
schema 생성 스크립트를 출력할수 있습니다.
10g, 11g 둘다 사용가능 합니다.
set escape on
set pagesize 0
select 'create user ' || U.username || ' identified ' ||
DECODE(S.password,
NULL, 'EXTERNALLY',
' by values ' || '''' || S.password || ''''
)
|| chr(10) ||
'default tablespace ' || default_tablespace || chr(10) ||
'temporary tablespace ' || temporary_Tablespace || chr(10) ||
' profile ' || profile || chr(10) ||
'quota ' ||
decode ( Q.max_bytes, -1, 'UNLIMITED', NULL, 'UNLIMITED', Q.max_bytes) ||
' on ' || default_tablespace ||
decode (U.account_status,'LOCKED', ' account lock',
'EXPIRED', ' password expire',
'EXPIRED \& LOCKED', ' account lock password expire',
null)
||
';'
from dba_users U, dba_ts_quotas Q, sys.user$ S
-- Comment this clause out to include system \& default users
where U.username not in ('SYS','SYSTEM',
'SCOTT','DBSNMP','OUTLN','WKPROXY','WMSYS','ORDSYS','ORDPLUGINS','MDSYS',
'CTXSYS','XDB','ANONYMOUS','OWNER','WKSYS','ODM_MTR','ODM','OLAPSYS',
'HR','OE','PM','SH','QS_ADM','QS','QS_WS','QS_ES','QS_OS','QS_CBADM',
'QS_CB','QS_CS','PERFSTAT')
and U.username=Q.username(+) and U.default_tablespace=Q.tablespace_name(+)
and s.name=u.username;
set pagesize 100
set escape off
파이어폭스에 최적화 되어있습니다
이 포스트가 유용하셨다면 구독하세요




0