oracle 模式,用户,角色

xiaoxiao2022-06-14  31

oracle 中的模式和用户: [quote] 创建一个用户,就相应的创建了 一个模式。[/quote] [quote]CREATE SCHEMA有时只是为了满足SQL标准[/quote] 要想在新建一个schema 则只有新建一个用户。 用户和角色 : [quote] 角色就是一些权限的集合: 为了方便管理,我们把某些常用的权限组织成一个集合。赋予角色。然后把角色赋予用户。提高管理的效率。例如创建一个数据库某个模式,某几个用户下的的只读用户,可读可插入用户,等等。在实质生产中还是有很大的意义。 1.创建角色,不指定密码: create role testrole; 2.创建角色,指定密码: create role testrole identified by tanfufa; 3.修改角色: alter role testrole identified by luqiaoling; 给角色授予权限。 Grant select on t1 to testrole; Grant select on t2 to testrole; Grant select on t3 to testrole; 把角色赋予用户:(特别说明,授予角色不是实时的。如下:) grant testrole to testdb; 起用角色:给用户赋予角色,角色并不会立即起作用。 1.角色不能立即起作用。必须下次断开此次连接,下次连接才能起作用。 2.或者执行命令:有密码的角色set role testrole identified by tanfufa 立即生效; 3.无密码的角色:set role testrole;或set role all except rolename_withpassword. 把角色赋予角色,角色嵌套。 create role testrole1; grant select on t1 to testrole1; create role testrole2; grant testrole1 to testrole2; grant r2 to testdb; 角色管理: 与角色有关系的视图: 所有角色: select * from dba_roles; 当前用户scott有哪些角色: select * from session_roles; [/quote]
转载请注明原文地址: https://www.6miu.com/read-4936584.html

最新回复(0)