概述:在oracle中要创建一个新的客户使用create ur语句,往往一般是有着dba(资料库管理员)的权限才能使用。
create ur 客户名 identified by 密码;
小心:oracle有个毛病,密码一定以字母开头,如果以数字开头,它不会创建客户
eg、create ur xiaoming identified by oracle;
概述:如果给自己改写密码应该直接使用
SQL> password 客户名或passw
如果给别人改写密码则需要有着dba的权限,或是坐拥alter ur的系统权限
SQL> alter ur 客户名 identified by 新密码
概述:往往一般以dba的身份去删除某个客户,如果用特招其它客户去删除客户则需要有着drop ur的权限。
例如drop ur 客户名 【c咏春笋ascade】
小心:在删除客户时,如果要删除的客户,已经创建了表,那么就需要在删除的时候带一个参数cascade,即把该客户及表一起删除;
权限分为系统权限和对象权限。
何为系统权限?
客户对资料库的有关权限,connect、resource、dba等系统权限,如建库、建表、建索引、建存储过程、登陆资料库、改写密码等。
何为对象权限?
客户对很多的客户的资料对象操作的权限,inrt、delete、update、lect、all等对象权限,资料对象有很多,例如表,索引,视图,触发器、存储过程、包等。
执行SELECT * FROM Dba_Object_Size;语句可获取oracle资料库对象。
角色分为预定义角色和自己定义设置角色。
概述:创建的新客户是没有所有权限的,甚至连登陆的资料库的权限都没有,需要为其指定相对应的权限。给一个客户赋权限使用命令grant,回收权限使用命令revoke。
SQL> grant connect to xiaoming;
授权成功。
小心:grant connect to xiaoming;在这里,准确的讲,connect不是权限,而是角色。
现在说下对象权限,现在要做这么件事件:
* 希望xiaoming客户应该去查询emp表
* 希望xiaoming客户应该去查询scott的emp表
grant lect on scott.emp to xiaoming
* 希望xiaoming客户应该去改写scott的emp表
grant update on scott.emp to xiaoming
* 希望xiaoming 客户应该去改写/删除,查询,添加scott的emp表
grant all on scott.emp to xiaoming
* scott希望收回xiaoming对emp表的查询权限
revoke lect on scott.emp from xiaoming
//对权限的保护。
* 希望xiaoming客户应该去查询scott的emp表/还希望xiaoming应该把这种权限传递给别人。
–如果是对象权限,就加入with grant option
grant 五岳归来不看山黄山归来不看岳lect on emp to xiaoming with grant option
我的操作过程:
SQL> conn scott/oracle;
已连接。
SQL> grant lect on scott.emp to xiaoming with grant option;
授权成功。
SQL> conn system/oracle;
已连接。
SQL> create ur xiaohong identified by oracle;
客户已创建。
SQL> grant connect to xiaohong;
授权成功。
SQL> conn xiaoming/oracle;
已连接。
SQL> grant lect on scott.emp to xiaohong;
授权成功。
–如果是系统权限。
system给xiaoming权限时:grant connect to xiaoming with admin option
问题:如果scott把xiaoming对emp表的查询权限回收,那么xiaohong会什么样?
答案:被回收。
下面是我的操作过程:
SQL> conn scott/oracle;
已连接。
SQL> revoke lect on emp from xiaoming;
撤销成功。
SQL> conn xiaohong/oracle;
已连接。
SQL> lect * from scott.emp;
lect * from scott.emp
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
结果展现:小红受到诛连了。。
八、with admin option与with grant option区别
1、with admin option用来系统权限授权,with grant option用来对象授权。
2、给一个客户授予系统权限带上with admin option时,此客户可把此系统权限授予很多的客户或角色,但收回这种客户的系统权限时,这种客户已经授予很多的客户或角色的此系统权限不会因扩散传播无效,如授予A系统权限create ssion with 春江花月夜的作者admin option,之后A又把create ssion权限授予B,但管理员收回A的create ssion权限时,B依然坐拥create ssion的权限,但管理员应该显式收回B create ssion的权限,即直接revoke create ssion from B.
而with grant option用来对象授权时,被授予的客户也可把此对象权限授予很多的客户或角色,不一样的是但管理员收回用with grant option授权的客户对象权限时,权限会因扩散传播而失效,如grant lect on table with grant option to A,A客户把此权限授予B,但管理员收回A的权限时,B的权限也会失效,但管理员不应该直接收回B的SELECT ON TABLE 权限。
概述:在oracle中要创建一个新的客户使用create ur语句,往往一般是有着dba(资料库管理员)的权限才能使用。
create ur 客户名 identified by 密码;
小心:oracle有个毛病,密码一定以字母开头,如果以数字开头,它不会创建客户
eg、create ur xiaoming identified by oracle;
概述:如果给自己改写密码应该直接使用
SQL> password 客户名或passw
如果给别人改写密码则需要有着dba的权限,或是坐拥alter ur的系统权限
SQL> alter ur 客户名 identified by 新密码
概述:往往一般以dba的身份去删除某个客户,如果用其它客户去删除客户则需要有着drop ur的权限。
例如drop ur 客户名 【cascade】
小心:在删除客户时,如果要删除的客户,已经创建了表,那么就需要在删除的时候带一个参数cascade我学会了 400字作文,即把该客户及表一起删除;
权限分为系统权限和对象权限。
何为系统权限?
客户对资料库的有关权限,connect、resource、dba等系统权限,如建库、建表、建索引、建存储过程、登陆资料库、改写密码等。
何为对象权限?
客户对很多的客户的资料对象操作的权限,inrt、delete、update、lect、all等对象权限,资料对象有很多,例如表,索引,视图,触发器、存储过程、包等。
执行SELECT * FROM Dba_Object_Size;语句可获取oracle资料库对象。
角色分为预定义角色和自己定义设置角色。
概述:创建的新客户是没有所有权限的,甚至连登陆的资料库的权限都没有,需要为其指定相对应的权限。给一个客户赋权限使用命令grant,回收权限使用命令revoke。
SQL> grant connect to xiaoming;
授权成功。
小心:grant connect to xiaoming;在这里,准确的讲,connect不是权限,而是角色。
现在说下对象权限,现在要做这么件事件:
* 希望xiaoming客户应该去查询emp表
* 希望xiaoming客户应该去查询scott的emp表
grant lect on scott.emp to xiaoming
* 希望xiaoming客户应该去改写scott的emp表
grant update on scott.emp to xiaoming
* 希望xiaoming 客户应该去改写/删除,查询,添加scott的emp表
grant all on scott.emp to xiaoming
* scott希望收回xiaoming对emp表的查询权限
revoke lect on scott.emp from xiaoming
//对权限的保护。
* 希望xiaoming客户应该去查询scott的emp表/还希望xiaoming应该把这种权限传递给别人。
–如果是对象权限,就加入with grant option
grant lect on emp to xiaoming with grant option
我的操作过程:
SQL> conn scott/oracle;
已连接。
SQL> grant lect on scott.emp to xiaoming with grant option;
授权成功。
SQL> conn system/oracle;
已连接。
SQL> create ur xiaohong identified by oracle;
客户已创建。
SQL> grant connect to xiaohong;
授权成功。
SQL> conn xiaoming/oracle;
已连接。
SQL> grant lect on scott.emp to xiaohong;
授权成功。
–如果是系统权限。
system给xiaoming权限时:grant connect to xiaoming with admin option
问题:如果scott把xiaoming对emp表的查询权限回收,那么xiaohong会什么样?
答案:被回收。
下面是我的操作过程:
SQL> conn scott/oracle;
已连接。
SQL> revoke lect on emp from xiaoming;
撤销成功。
SQL> conn xiaohong/oracle;
已连接。
SQL> lect * from scott.emp;
lect * from scott.emp
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
结果展现:小红受到诛连了。。
1、with admin option用来系统权限授权,with grant option用来对象授权。
2、给一个客户授予系统权限带上with admin option时,此客户可把此系统权限授予很多的客户或角色,但收回这种客户的系统权限时,这种客户已经授予很多的客户或角色的此系统权限不会因扩散传播无效,如授予A系统权限create ssion with admin option,之后A又把create ssion权限授予B,但管理员收回A的create ssion权限时,B依然坐拥create ssion的权限,但管理员应该显式收回B create ssion的权限,即直接revoke create ssion from B.
而with grant option用来对象授权时,被授予的客户也可把此对象权限授予很多的客户或角色,不一样的是但管理员收回用with grant option授权的客户对象权限时,权限会因扩散传播而失效,如grant lect on table with grant option to A,A客户把此权限授予B,但管理员收回A的权限时,B的权限也会失效,但管理员不应该直接收回B的SELECT ON TABLE 权限。
本文发布于:2023-03-31 05:47:07,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/73004157cf4561d32e3a41083143a451.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:oracle删除用户语句(教你怎么用oracle查看用户拥有的权限).doc
本文 PDF 下载地址:oracle删除用户语句(教你怎么用oracle查看用户拥有的权限).pdf
留言与评论(共有 0 条评论) |