时间:2021-07-01 10:21:17 帮助过:90人阅读
1 用户管理
2 权限管理
3 角色管理 ;
4 概要文件管理
5 审计
操作系统: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;
1 授予角色
Grant connect, resource to middle_manager_role;
2 回收角色
Revoke resource ,connect from middle_manager_role;
3 用户的激活或屏蔽
屏蔽
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
Oracle11g用户、权限、角色、概要文件管理及审计
标签: