Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sec_P1 creates and grants roles

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Sec_P1 creates and grants roles

SQL > connect system/oracle

# create two roles

SQL > createrole usr_role

SQL > createrole mgr_role

# grant some permissions to these roles and grant usr_role to mgr_role

SQL > grantcreate session to usr_role

SQL > grantselect on sales.t1 on usr_role

SQL > grantusr_role to mgr_role with admin option

SQL > grantall on sales.t1 to mgr_role

SQL > connsystem/oracle

SQL > grantmgr_role to webapp

SQL > connwebapp/oracle

SQL > grantusr_role to accounts

SQL > insertinto sales.t1 values (sysdate)

SQL > commit

# has query permission, but does not have insert permission.

SQL > connaccounts/oracle

SQL > Select* from sales.t1

SQL > insertinto sales.t1 values (sysdate)

-- ORA-01031:insufficient privileges

# adjust the permissions of accounts so that it can log in by default, but have no other permissions.

SQL > connsystem/oracle

SQL > grantconnect to accounts

SQL > alteruser default role connect

# enable and disable the demo role

SQL > connaccounts/oracle

SQL > select* from sales.t1

-- ORA-00942:table or veiw does not exist

SQL > setrole usr_role

SQL > select* from sales.t1;-- It's OK

# View permissions for two new roles

SQL > select * from dba_role_privs

Wheregranted_role in ('USR_ROLE',' MGR_ROLE')

SQL > selectgrantee,owner, table_name,privilege,grantable

Fromdba_tab_privs where grantee in ('USR_ROLE',' MGR_ROLE')

Union all

Selectgrantee, to_char (null), to_char (null), privilege,admin_option

Fromdba_sys_privs where grantee in ('USR_ROLE',' MGR_ROLE')

Order bygrantee

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report