zoukankan      html  css  js  c++  java
  • Oracle11g用户、权限、角色、概要文件管理及审计

    10章 安全管理

    用户管理

    权限管理

    角色管理    ;

    概要文件管理

    审计 

    操作系统:win7    Oracle安装目录:E盘 

    数据库名字:orcl  密码:123456

    先连接

    Set Oracle_sid=orcl

    Sqlplus /nolog

     

    conn sys/123456 as sysdba

    用户管理

    创建用户user3,口令user3,默认表空间USERS,表空间配额为10MB,初始状态为锁定

    Create user user3 identified by user3

    Default  tablespace users quota 10m on users account lock;

    修改用户user3 口令为 newuser3 ,同时将该用户解锁

    Alter user user3 identified by newuser3 account unlock;

    删除用户

    Drop user user3;

    查询用户信息,查看数据库所有用户名及默认表空间

    Select username,default_tablespace from dba_users;

    权限管理

    系统权限的授权

    先创建user1

    Create user user1 identified by user1

    Default  tablespace users quota 10m on users account unlock;

                密码      @数据名字

    Conn system/ 123456   @orcl 

    Grant create  session ,create  table ,create view  to user1; 

        

    系统权限的回收

    Conn system/123456 @orcl

    Revoke  create  table ,create view  from  user1; 

    对象权限的授权

    Conn system /123456 @orcl

    Grant select ,insert ,update  on  Scott.emp to user1;  

    对象权限的回收

    Revoke select  ,update  on  Scott.emp from  user1;  

    查询授权信息

    Select* from user_sys_privs;

    角色管理

    查询当前数据库所有预定义角色

    Select* from dba_roles;

    自定义角色

    Create role high_manager_role; 

    Create role middle_manager_role ;

    利用角色进行权限管理

    Grant connect ,resource ,dba  to high_manager_role ;

    Grant select ,update ,insert ,delete  on scott.emp to high_manager_role; 

    权限回收

    Revoke update ,insert ,delete  on scott.emp from high_manager_role;

    修改角色为 high_manager_role 添加密码 highrole

    Alter role high_manager_role identified by highrole;

    角色失效

    Set role none;

    角色生效

    Set role high_manager_role identified by highrole;

    删除角色

    Drop role high_manager_role;

    授予角色

    Grant connect, resource  to  middle_manager_role;

    回收角色

    Revoke resource ,connect  from  middle_manager_role; 

    用户的激活或屏蔽

    屏蔽 

    alter user user1 default role none ;

    激活 

    alter user user1 default role all ;

    查询角色信息

    Select * from  role_sys_privs where role ='DBA';

    删除 user1

    Drop user user1;

    删除 middle_manager_role 

    drop role middle_manager_role ;

    概要文件管理

    创建概要文件

    用户登陆允许失败次数为4次,登录失败账户锁定时间为10

    Create profile pwd_profile limit failed_login_attempts 4

    Password_lock_time 10; 

    将概要文件分配给用户

    Create user user5 identified by user5 profile pwd_profile;  

    修改概要文件

    Alter profile pwd_profile limit password_life_time 10;

    删除概要文件

    Drop profile pwd_profile cascade;

    查询概要文件

    Select * from user_password_limits;

    审计 

    审计的启动

    Alter system set  audit_trail='DB' scope=spfile;

    conn sys/123456 as sysdba

    Shutdown immediate

    Startup

  • 相关阅读:
    2019-08-01 Ajax实现从数据库读取表
    2019-08-01 JQuery事件
    2019-07-31 Jquery
    2019-07-30 ThinkPHP文件上传
    2019-07-29 ThinkPHP简单的增删改查
    2017-07-26 ThinkPHP简单使用
    python——虚拟环境之virtualenvwrapper-win(windows10,64位)
    python——虚拟环境之virtualenv(windows10,64位)
    python——python3.6环境搭建(Windows10,64位)
    使用poi进行excel下载
  • 原文地址:https://www.cnblogs.com/landiljy/p/4467710.html
Copyright © 2011-2022 走看看