欢迎阅读!

潇湘夜雨

当前位置: 主页 > 数据库 >

ORACLE Profile 及权限

时间:2018-10-31 21:56来源:ChinaZ 作者:网络 点击:
用户管理 一、创建用户 :创建的新用户是没有任何权限的,甚至连登陆的数据库的权限都没有,需要为其指定相应的权限。 SQL Create User username Identified by password Default Tablespace tablespa

用户管理

一、创建用户:创建的新用户是没有任何权限的,甚至连登陆的数据库的权限都没有,需要为其指定相应的权限。

 SQL> Create User username
   Identified by password
   Default Tablespace tablespace
   Temporary Tablespace tablespace
   Profile profile
   Quota integer/unlimited on tablespace;

 例:
 SQL> Create user acc01
  identified by acc01  // 如果密码是数字,请用双引号括起来
  default tablespace account
  temporary tablespace temp
  profile default
  quota 50m on account;

 SQL> grant connect, resource to acc01;

 [*] 查询用户缺省表空间、临时表空间
 SQL> select username, default_tablespace, temporary_tablespace from dba_users;

 [*] 查询系统资源文件名:
 SQL> select * from dba_profiles;

 资源文件类似表,一旦创建就会保存在数据库中。
 SQL> select username, profile, default_tablespace, temporary_tablespace from dba_users;
 SQL> create profile common limit
   failed_login_attempts 5
   idle_time 5;
  SQL> Alter user acc01 profile common;

二、修改用户:

 SQL> Alter User 用户名
   Identified 口令
   Default Tablespace tablespace
   Temporary Tablespace tablespace
   Profile profile
   Quota integer/unlimited on tablespace;
 
 1、修改口令字:Alter user acc01 identified by "12345";
 2、修改用户缺省表空间:Alter user acc01 default tablespace users;
 3、修改用户临时表空间:Alter user acc01 temporary tablespace temp_data;
 4、强制用户修改口令字:Alter user acc01 password expire;
 5、将用户加锁:Alter user acc01 account lock; // 加锁
         Alter user acc01 account unlock; // 解锁

三、删除用户
 SQL>drop user 用户名; //用户没有建任何实体
 SQL>drop user 用户名 CASCADE; // 将用户及其所建实体全部删除
 *1. 当前正连接的用户不得删除。

四、监视用户:
 1、查询用户会话信息:select username, sid, serial#, machine from v$session;
 2、删除用户会话信息:Alter system kill session 'sid, serial#';

 3、查询用户SQL语句: select user_name, sql_text from v$open_cursor;

 

用户Profile

一、Profile目的:


  Oracle系统中的profile可以用来对用户所能使用的数据库资源进行限制,使用Create Profile命令创建一个Profile,用它来实现对数据库资源的限制使用,如果把该profile分配给用户,则该用户所能使用的数据库资源都在该profile的限制之内。具体管理内容有:CPU的时间、I/O的使用、IDLE TIME(空闲时间)、CONNECT TIME(连接时间)、并发会话数量、口令机制等。

二、条件:

  创建profile必须要有CREATE PROFILE的系统权限。为用户指定资源限制,必须:

  1.动态地使用alter system或使用初始化参数resource_limit使资源限制生效。该改变对密码资源无效,密码资源总是可用。 
    SQL> show parameter resource_limit (责任编辑:liangzh)

织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
推荐内容