tft每日頭條

 > 生活

 > oracle怎麼查看用戶權限

oracle怎麼查看用戶權限

生活 更新时间:2024-07-20 11:13:39

oracle怎麼查看用戶權限?權限:create session,接下來我們就來聊聊關于oracle怎麼查看用戶權限?以下内容大家不妨參考一二希望能幫到您!

oracle怎麼查看用戶權限(oracle用戶創建及權限設置)1

oracle怎麼查看用戶權限

權限:

create session

create table

unlimited tablespace

connect

resource

dba

例:

#sqlplus /nolog

SQL> conn / as sysdba;

SQL>create user username identified by password

SQL> grant dba to username;

SQL> conn username/password

SQL> select * from user_sys_privs;

我從創建Oracle用戶權限表開始,然後講解登陸等一般性動作

一、創建

sys;//系統管理員,擁有最高權限

system;//本地管理員,次高權限

scott;//普通用戶,密碼默認為tiger,默認未解鎖

二、登陸

sqlplus / as sysdba;//登陸sys帳戶

sqlplus sys as sysdba;//同上

sqlplus scott/tiger;//登陸普通用戶scott

三、管理用戶

create user zhangsan;//在管理員帳戶下,創建用戶zhangsan

alert user scott identified by tiger;//修改密碼

四,授予權限

1、默認的普通用戶scott默認未解鎖,不能進行那個使用,新建的用戶也沒有任何權限,必須授予權限

grant create session to zhangsan;//授予zhangsan用戶創建session的權限,即登陸權限

grant unlimited tablespace to zhangsan;//授予zhangsan用戶使用表空間的權限

grant create table to zhangsan;//授予創建表的權限

grante drop table to zhangsan;//授予删除表的權限

grant insert table to zhangsan;//插入表的權限

grant update table to zhangsan;//修改表的權限

grant all to public;//這條比較重要,授予所有權限(all)給所有用戶(public)

2、oralce對權限管理比較嚴謹,普通用戶之間也是默認不能互相訪問的,需要互相授權

grant select on tablename to zhangsan;//授予zhangsan用戶查看指定表的權限

grant drop on tablename to zhangsan;//授予删除表的權限

grant insert on tablename to zhangsan;//授予插入的權限

grant update on tablename to zhangsan;//授予修改表的權限

grant insert(id) on tablename to zhangsan;

grant update(id) on tablename to zhangsan;//授予對指定表特定字段的插入和修改權限,注意,隻能是insert和update

grant alert all table to zhangsan;//授予zhangsan用戶alert任意表的權限

1.create user userName identified by password;

2.grant select any table to userName; --授予查詢任何表

3.grant select any dictionary to userName;--授予 查詢任何字典

執行上面三步就行了,那麼這個用戶就隻有查詢權限,其他的權限都沒有!!

五、撤銷權限

基本語法同grant,關鍵字為revoke

六、查看權限

select * from user_sys_privs;//查看當前用戶所有權限

select * from user_tab_privs;//查看所用用戶對表的權限

七、操作表的用戶的表

select * from zhangsan.tablename

八、權限傳遞

即用戶A将權限授予B,B可以将操作的權限再授予C,命令如下:

grant alert table on tablename to zhangsan with admin option;//關鍵字 with admin option

grant alert table on tablename to zhangsan with grant option;//關鍵字 with grant option效果和admin類似

九、角色

角色即權限的集合,可以把一個角色授予給用戶

create role myrole;//創建角色

grant create session to myrole;//将創建session的權限授予myrole

grant myrole to zhangsan;//授予zhangsan用戶myrole的角色

drop role myrole;删除角色

希望可以對各位有用。

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关生活资讯推荐

热门生活资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved