zoukankan      html  css  js  c++  java
  • 用户管理

    1、创建用户:

    conn system/password01;

    create user username01 identified by password001;//新创建的用户,没有登录权限

    grant connect to username01;//connect 实际是角色

    2、修改密码

    password;//修改当前用户的密码

    password username01;//修改指定用户的密码

    3、删除用户(自己不能删自己,具有drop user权限的用户就具有删除用户的功能)

    drop user username01 [cascade]//cascade 添加这个参数,会删除该用户及其创建的表

    4、授予权限

    授予创建表的权限

    grant resource to username01;//授予创建表的权限,resource具有创建表的权限

    create table test(userId varchar2(30), userName varchar2(30));

    desc test;//查表结构

    授予操作表的权限

    conn scott/tiger;

    grant select on emp to hbl1;//授予选择权限,授予所有权限select all on emp to hbl1;

    conn hbl1/hbl1;

    select * from scott.emp;//这里一定要有用户,如scott

    5、收回权限(谁授予谁收回)

    conn scott/tiger;

    revoke select on emp from hbl1;

    6、权限的传递

    conn scott/tiger;

    --如果是对象权限,添加with grant option;如果是系统权限,添加 with admin option,如grant connect to hbl2 with admin option;

    grant select on emp to hbl1 with grant option;//hbl1具有将select权限传递下去的权限

    conn system/Gauss_234;

    create user hbl2 identified by hbl2;

    grant connect to hbl2;

    conn hbl1/hbl1;

    grant select on scott.emp to hbl2;

    conn hbl2/hbl2;

    select * from scott.emp;

    --scott 回收了hbl1的select权限,同时也就回收了hbl2的select权限

    7、用户口令管理(profile配置文件)

    --hbl2 尝试三次登录,失败锁2天

    create profile account_lock1 limit failed_login_attempts 3  password_lock_time 2;

    alter user hbl2 profile account_lock1;

    --解锁

    conn system/Gauss_234;

    alter user hbl2 account unlock;

    --删除profile

    drop profile profileName [cascade]--cascade约束的对象,约束关系也删掉

    附:权限及角色,角色是批量的权限

  • 相关阅读:
    兼容各浏览器,背景透明,内容不透明
    101 个 MySQL 的调节和优化的提示
    二手房买卖砍价最新攻略 帮你花少钱买好房
    “中国互联网100强”(2013)发布
    写入文件,创建xunlei批量任务
    武汉选房
    Java并发编程(十一)线程池的使用
    Retrofit 代理模式
    Java并发编程(十)阻塞队列
    不要在Android的Application对象中缓存数据!
  • 原文地址:https://www.cnblogs.com/hblthink/p/8419577.html
Copyright © 2011-2022 走看看