Oracle 用户管理小实例

    技术2022-06-25  50

    --用system用户登录

    --此用户有created user的权限

    SQL> conn system/manager as sysdba;

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

    Connected as SYS

     

    SQL> create user yeeXun identified by 12082119;

    create user yeeXun identified by 12082119

     

    ORA-00988: 口令缺失或无效

    --这里为什么会无效呢?

    --命名规则的问题,密码不能以数字开头,其他的变量命名也是一样的,必须以字母--(A~Z,a~z)开头。

    SQL> create user yeeXun identified by m123;

    User created

     

    --yeeXun用户授权

    SQL> grant create session,create table to yeeXun;

    Grant succeeded

     

    --试着用yeeXun登录

    SQL> conn yeeXun/m123;

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

    Connected as yeeXun

     

    --删除yeeXun用户

    --删除用户需要有system的系统权限,用户sys或者system具有此权限

    SQL> conn system/manager as sysdba;

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

    Connected as SYS

     

    --删除用户前,最好先将其权限收回

    SQL> revoke create session,create table from yeeXun;

    Revoke succeeded

     

    --验证以下是否将其权限回收了

    SQL> conn yeeXun/m123;

    Not logged on

     

    SQL> conn system/manager as sysdba;

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0

    Connected as SYS

    --删除用户

    SQL> drop user yeeXun;

    User dropped

    --检测是否删除成功

    SQL> conn yeeXun/m123;

    Not logged on


    最新回复(0)