- 最后登录
- 2014-10-22
- 在线时间
- 47 小时
- 威望
- 0
- 金钱
- 270
- 注册时间
- 2011-10-13
- 阅读权限
- 10
- 帖子
- 108
- 精华
- 0
- 积分
- 0
- UID
- 18
|
3#
发表于 2013-5-12 20:03:15
select (case
when ((select count(*)
from dba_users
where username = '&&Username') > 0)
then dbms_metadata.get_ddl ('USER', '&&Username')
else to_clob (' -- Note: User not found!')
end ) Extracted_DDL from dual
UNION ALL
select (case
when ((select count(*)
from dba_ts_quotas
where username = '&&Username') > 0)
then dbms_metadata.get_granted_ddl( 'TABLESPACE_QUOTA', '&&Username')
else to_clob (' -- Note: No TS Quotas found!')
end ) from dual
UNION ALL
select (case
when ((select count(*)
from dba_role_privs
where grantee = '&&Username') > 0)
then dbms_metadata.get_granted_ddl ('ROLE_GRANT', '&&Username')
else to_clob (' -- Note: No granted Roles found!')
end ) from dual
UNION ALL
select (case
when ((select count(*)
from dba_sys_privs
where grantee = '&&Username') > 0)
then dbms_metadata.get_granted_ddl ('SYSTEM_GRANT', '&&Username')
else to_clob (' -- Note: No System Privileges found!')
end ) from dual
UNION ALL
select (case
when ((select count(*)
from dba_tab_privs
where grantee = '&&Username') > 0)
then dbms_metadata.get_granted_ddl ('OBJECT_GRANT', '&&Username')
else to_clob (' -- Note: No Object Privileges found!')
end ) from dual
/
----------------------分割线------------------------
EXTRACTED_DDL
--------------------------------------------------------------------------------
CREATE USER "XYZ" IDENTIFIED BY VALUES 'C4634D0ED8A90B04'
TEMPORARY TABLESPACE "TEMP"
ALTER USER "XYZ" QUOTA 12800 ON "SYSTEM"
GRANT "RESOURCE" TO "XYZ"
GRANT CREATE SESSION TO "XYZ"
GRANT ALTER ON "SYS"."AUD$" TO "XYZ"
GRANT DELETE ON "SYS"."AUD$" TO "XYZ"
GRANT INDEX ON "SYS"."AUD$" TO "XYZ"
GRANT INSERT ON "SYS"."AUD$" TO "XYZ"
GRANT SELECT ON "SYS"."AUD$" TO "XYZ"
GRANT UPDATE ON "SYS"."AUD$" TO "XYZ"
GRANT REFERENCES ON "SYS"."AUD$" TO "XYZ"
GRANT ON COMMIT REFRESH ON "SYS"."AUD$" TO "XYZ"
GRANT QUERY REWRITE ON "SYS"."AUD$" TO "XYZ"
GRANT DEBUG ON "SYS"."AUD$" TO "XYZ"
GRANT FLASHBACK ON "SYS"."AUD$" TO "XYZ"
|
|