ORA-01919: role 'PLUSTRACE' does not exist
阿新 • • 發佈:2018-11-16
環境:Oracle 10g,11g.
現象:在一次遷移測試中,發現有這樣的角色賦權會報錯不存在:
[email protected]> grant PLUSTRACE to jingyu;
grant PLUSTRACE to jingyu
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist
查詢發現這個角色是需要手工執行指令碼建立,直接執行Oracle自帶的SQL指令碼@?/sqlplus/admin/plustrce.sql即可:
[email protected]> @?/sqlplus/admin/plustrce.sql
[email protected]>
[email protected]> drop role plustrace;
drop role plustrace
*
ERROR at line 1:
ORA-01919: role 'PLUSTRACE' does not exist
[email protected]> create role plustrace;
Role created.
[email protected]>
[email protected]> grant select on v_$sesstat to plustrace;
Grant succeeded.
[email protected]> grant select on v_$statname to plustrace;
Grant succeeded.
[email protected]> grant select on v_$mystat to plustrace;
Grant succeeded.
[email protected]> grant plustrace to dba with admin option;
Grant succeeded.
[email protected]>
[email protected] > set echo off
[email protected]>
可以看到這個角色就是封裝了對v_$sesstat,v_$statname,v_$mystat這幾個檢視的查詢許可權。
執行以後就可以直接賦予使用者PLUSTRACE的角色了:
[email protected]> grant PLUSTRACE to jingyu;
Grant succeeded.