Oracle用户、权限、角色管理

发表于:2013-5-17 12:45

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:未知    来源:51Testing软件测试网采编

  Oracle 用户管理

  一、创建用户的Profile文件

  SQL> create profile student limit  // student为资源文件名

  FAILED_LOGIN_ATTEMPTS  3  //指定锁定用户的登录失败次数

  PASSWORD_LOCK_TIME 5  //指定用户被锁定天数

  PASSWORD_LIFE_TIME 30  //指定口令可用天数

  二、创建用户

  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、修改口令字:

  SQL>Alter user acc01 identified by “12345”;

  2、修改用户缺省表空间:

  SQL> Alter user acc01 default tablespace users;

  3、修改用户临时表空间

  SQL> Alter user acc01 temporary tablespace temp_data;

  4、强制用户修改口令字:

  SQL> Alter user acc01 password expire;

  5、将用户加锁

  SQL> Alter user acc01 account lock;  // 加锁

  SQL> Alter user acc01 account unlock;  // 解锁

  四、删除用户

  SQL>drop user 用户名;  //用户没有建任何实体

  SQL> drop user 用户名 CASCADE;  // 将用户及其所建实体全部删除

  *1. 当前正连接的用户不得删除。

  五、监视用户:

  1、查询用户会话信息:

  SQL> select username, sid, serial#, machine from v$session;

  2、删除用户会话信息:

  SQL> Alter system kill session 'sid, serial#';

  3、查询用户SQL语句:

  SQL> select user_name, sql_text from v$open_cursor;

43/4<1234>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号