创建一个新用户,登录时,提示如下错误:ORA-01045:user ZG_GRSDS lacks CREATE SESSION privilege :logon denied
ORA-01045:用户ZG_GRSDS缺乏创建会话权限:登录被拒绝后,根据提示,我添加了如下语句:grant create session to ZG_GRSDS;当执行此句时,仍然提示错误:ORA-01031:insufficient privileges 请问如何解决?

解决方案 »

  1.   

    grant connect to ZG_GRSDS
      

  2.   

    grant connect to ZG_GRSDS;
    grant create session to ZG_GRSDS; 
      

  3.   

    普通用户授予connect 和resource两个角色权限就好了
      

  4.   

    回复3楼 4楼:从这个错误提示可以看出,首先是要有连接数据库的能力,其次才可能进行连接数据库的操作。所以 connect 这个权限我授权了,但没有给 resource .但这样有影响吗?
      

  5.   

    你的意思是,创建用户的用户,要有 dba 的权限?!
      

  6.   

    赋予resource 权限才能CONNECTSQL>CONN SYS/PWD AS SYSDBA;
    SQL>GRANT RESOURCE TO U_NAME;
    SQL>CONN U_NAME/PWD;
      

  7.   

    不需要dba权限的你把你登陆的命令贴出来看看
    就是产生ORA-01031:insufficient privileges的语句
      

  8.   

    你没在语句后面加/ as sysdba吧?
     
      

  9.   

    ORA-01031: insufficient privileges 
    Cause: An attempt was made to change the current username or password without the appropriate privilege. This error also occurs if attempting to install a database without the necessary operating system privileges. When Trusted Oracle is configure in DBMS MAC, this error may occur if the user was granted the necessary privilege at a higher label than the current login.
     
    Action: Ask the database administrator to perform the operation or grant the required privileges. For Trusted Oracle users getting this error although granted the the appropriate privilege at a higher label, ask the database administrator to regrant the privilege at the appropriate label.
     
      

  10.   

    grant create session to ZG_GRSDS;
      

  11.   

    强调一下:我是在 PL/SQL 中运行此段命令的。
    在运行此段命令前,已经运行完了创建用户,授权等的一系列命令:
    SQL语句如下:
    -----------------------------建立用户及授权---------------------------
    -- Create the user 
    create user ZG_GRSDS  --创建用户 ZG_GRSDS
      identified by "ZG_GRSDS"  --设置密码 ZG_GRSDS
      default tablespace TS_ZGXT --默认表空间 
      temporary tablespace TEMP --临时表空间
      profile DEFAULT; --默认配置文件
    -- Grant/Revoke role privileges 
    grant create session to ZG_GRSDS; --此句是新添加的,因为报错提示是没有 CREATE SESSION .
    grant connect to ZG_GRSDS;  --授权 连接数据库
    grant dba to ZG_GRSDS;  --授权 dba
    -- Grant/Revoke system privileges 
    grant alter any index to ZG_GRSDS;  --授权 更改任何参数
    grant alter tablespace to ZG_GRSDS;  --授权 更改表空间
    grant create sequence to ZG_GRSDS; --授权 创建序列
    grant create table to ZG_GRSDS;  --授权 创建表
    grant create tablespace to ZG_GRSDS;  --授权 创建表空间
    grant unlimited tablespace to ZG_GRSDS;--授权 无限制的表空间--以下是一些对表的增删改查的权限赋予,就不再贴出了
      

  12.   

    使用DBA用户登录
    grant connect,resource to ZG_GRSDS;
      

  13.   

    你用什么用户来进行授权的?
    就是用哪个用户在执行grant create sessionto ZG_GRSDS;这条语句?
      

  14.   

    你这个ORA-01031:insufficient privileges错误是在你执行什么语句的时候报的?
    是以用户登录的时候?
    还是对该用户进行授权的时候?
      

  15.   

    那就是你进行授权的用户权限不够吧应该
    你用谁在进行授权conn / as sysdba; 以sys来对ZG_GRSDS授权