Oracle建立唯讀許可權使用者

2021-10-25 02:32:54 字數 1318 閱讀 6622

我們使用者histest下面有很多表,需建立使用者 hongshu

no1.先建立乙個使用者hongshu,密碼hongshu

no2.給他一些許可權,包括連線許可權,因為他要建立同義詞,還需要給他同義詞

grant connect to hongshu ;

grant create synonym to hongshu;

grant create session to hongshu;

no3.因為需要把histest的所有表的查詢許可權給hongshu。所以需要所有表的grant select on table_name to hongshu語句,不可能一句一句去寫,因此用select 吧所有的grant語句查出來直接執行,注意:histest要大寫,不然結果是空的

select 'grant select on '||owner||'.'||object_name||' to hongshu;'

from dba_objects

where owner in ('histest')

and object_type='table';

把上述語句查詢出來的結果(如下圖)全部選中複製出來,在histest 下執行一遍

no4.需要給histest使用者下所有表建立同義詞,但是考慮到之前已經建立過一些表的同義詞,因此把所有建立同義詞的語句select出來在hongshu使用者下執行。

select 'create or replace synonym  hongshu. ' || object_name|| ' for ' || owner || '.' || object_name|| ';'  from dba_objects 

where owner in ('portal_his')

and object_type='table';

執行結果如下圖所示,把所有結果複製出來登入hongshu使用者執行

no5.在hongshu使用者下就可以看到已經有了很多同義詞,如下圖

並能直接查詢

select *from table_name 測試即可

linux建立使用者唯讀許可權

6.將允許執行的命令鏈結到 home bin目錄 第二步 在相應服務的log日誌資料夾授權 本文摘自 useradd s bin bash test這步不要指定rbash,否側cd等內建命令無法使用 passwd testmkdir home test binchown root.home test...

Oracle資料建立唯讀使用者

記得授權完成後重新登入使用者,不然也會遇到許可權不足的一些問題 建立乙個使用者 create user test identified by 123456授予連線許可權 grant connect to test 授予只能查詢的許可權 授權所有表的唯讀許可權 grant select any tab...

ORACLE許可權管理 建立唯讀賬號

建立唯讀使用者 grant connect to user grant create session to user 1.建立角色 create role select role 2.給角色分配許可權 grant select any dictionary to select role grant ...