当前位置:首页 > 技能相关 > ORACLE > 正文内容

Oracle 用户管理

admin3年前 (2022-04-13)ORACLE3090 修订时间:2022-04-13 09:06:40

一、创建用户的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;


 您阅读本篇文章共花了: 

免责声明
本站内容均为博客主本人日常使用记录的存档,如侵犯你的权益请联系:lifei@zaiheze.com 546262132@qq.com 沟通删除事宜。本站仅带访问端口形式使用,已杜绝搜索引擎爬取。

扫描二维码推送至手机访问。

版权声明:本文由LIFEI - blog发布,如需转载请注明出处。

本文链接:http://www.lifeiai.com/?id=163

分享给朋友:

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。