【Oracle】新創建用戶時,授予Connect和Resouce權限報ORA-01045 錯誤

【問題】oracle11g,新創建用戶user1時,授予Connect,Resource權限,按正常理解 Connect已具備Create Session權限,user1應該可以登陸,但是實際登錄時報 ORA-01045: user USER01 lacks CREATE SESSION privilege; logon denied
【分析】
  查看 ddl:
     -- Create the user
     create user user1
       default tablespace ECPDATA1
       temporary tablespace TEMP
       profile DEFAULT
       password expire;
     -- Grant/Revoke role privileges
     grant connect to user1;
     grant resource to user1;
     -- Grant/Revoke system privileges
     grant unlimited tablespace to user1;
     -- Set the user's default roles
     alter user user1
       default role none;

發現最後一行代碼
alter user user1   default role none;
百度
當爲一個用戶授予角色時,如果是授予的DEFAULT的時候,那麼這個用戶登錄的時候自動就具備了這個角色,不需要進行這個角色的密碼驗證的。如果不是DEFAULT的,那麼可以使用SET ROLE ROLE_NAME IDENTIFIED ROLE_PASSWORD來進行密碼驗證後,用戶才能具有相應的角色。

【結論】
Oracle11g授予用戶權限時,需要指定默認role。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章