select dbms_metadata.get_ddl('USER', u.username) AS ddl
from dba_users u
where u.username = :user_name
and rownum = 1
union all -- 获取系统权限
select dbms_metadata.get_granted_ddl('SYSTEM_GRANT', sp.grantee) AS ddl
from dba_sys_privs sp
where sp.grantee = :user_name
and rownum = 1
union all -- 获取对象权限
select dbms_metadata.get_granted_ddl('OBJECT_GRANT', op.grantee) AS ddl
from (
select tp.grantee
from dba_tab_privs tp
where tp.grantee = :user_name
union all
select cp.grantee
from dba_col_privs cp
where cp.grantee = :user_name
) op
where rownum = 1
union all -- 获取用户角色
select dbms_metadata.get_granted_ddl('ROLE_GRANT', rp.grantee) AS ddl
from dba_role_privs rp
where rp.grantee = :user_name
and rownum = 1
union all -- 获取默认角色
select dbms_metadata.get_granted_ddl('DEFAULT_ROLE', rp.grantee) AS ddl
from dba_role_privs rp
where rp.grantee = :user_name
and rp.default_role = 'YES'
and rownum = 1
union all -- 获取表空间配额
select dbms_metadata.get_granted_ddl('TABLESPACE_QUOTA', tq.username) AS ddl
from dba_ts_quotas tq
where tq.username = :user_name
and rownum = 1
union all -- 获取非默认的资源配置
select dbms_metadata.get_ddl('PROFILE', u.profile) AS ddl
from dba_users u
where u.username = :user_name
and u.profile <> 'DEFAULT'
and rownum = 1;
如果觉得文章对你有用,欢迎关注❤️、评论?、点赞?!
不剪发的Tony老师
CSDN认证博客专家
数据库架构师
毕业于北京航空航天大学,十多年数据库管理与开发经验,拥有OCP以及RHCE证书。目前在一家全球性的博彩企业从事数据库架构设计和开发,CSDN学院签约讲师以及GitChat专栏作者。
关注博主即可阅读全文
原创:https://www.panoramacn.com
源码网提供WordPress源码,帝国CMS源码discuz源码,微信小程序,小说源码,杰奇源码,thinkphp源码,ecshop模板源码,微擎模板源码,dede源码,织梦源码等。
专业搭建小说网站,小说程序,杰奇系列,微信小说系列,app系列小说
免责声明,若由于商用引起版权纠纷,一切责任均由使用者承担。
您必须遵守我们的协议,如果您下载了该资源行为将被视为对《免责声明》全部内容的认可->
联系客服
投诉资源
www.panoramacn.com资源全部来自互联网收集,仅供用于学习和交流,请勿用于商业用途。如有侵权、不妥之处,请联系站长并出示版权证明以便删除。
敬请谅解! 侵权删帖/违法举报/投稿等事物联系邮箱:2640602276@qq.com
关注我们小说电影免费看
关注我们,获取更多的全网素材资源,有趣有料!
120000+人已关注