1、用户创建/删除
创建
SQL> create user web_hgz identified by admin123;
User created.
SQL> col username format a10; --col为column缩写,format a10指定格式宽度为10个字符
SQL> col account_status format a15;
SQL> select username, account_status, lock_date, expiry_date from dba_users where username = 'web_hgz';
USERNAME ACCOUNT_STATUS LOCK_DATE EXPIRY_DATE
---------- --------------- ------------------- -------------------
web_hgz OPEN
删除
SQL> drop user“name”cascade;
2、修改用户密码
SQL> alter user HR identified by admin123;
修改前:
SQL> select username,account_status,lock_date, expiry_date from dba_users where username ='HR';
USERNAME ACCOUNT_STATUS LOCK_DATE EXPIRY_DA
---------- --------------- --------- ---------
HR EXPIRED 29-NOV-15
修改后:
SQL> select username,account_status,lock_date, expiry_date from dba_users where username ='HR';
USERNAME ACCOUNT_STATUS LOCK_DATE
------------------------------ -------------------------------- ---------
EXPIRY_DA
---------
HR OPEN
3、 解除用户锁定
SQL> alter user hr account unlock;
User altered.
SQL> select a.username, a.account_status, a.lock_date from dba_users a where a.username = 'HR';
USERNAME ACCOUNT_STATUS LOCK_DATE
---------- -------------------------------- -------------------
HR OPEN
4、oracle用户登陆失败次数限制修改
a.查询密码连续输入出错的最大次数,超过该值则锁定该帐号:
SQL> select * from dba_profiles s where s.profile='DEFAULT' and resource_name='FAILED_LOGIN_ATTEMPTS'; //FAILED_LOGIN_ATTEMPTS表示出错最大次数
b.修改登陆失败限制次数
SQL>alter profile default limit failed_login_attempts unlimited; //表示不受限
SQL>alter profile default limit failed_login_attempts 3; //表示限制次数为3次
显示效果:
[oracle@localhost ~]$ sqlplus hr/admin123
ERROR:
ORA-28000: the account is locked
5、赋予用户表空间权限
SQL>alter user ittbank default tablespace ittbank;
6、授予用户管理权限:
grant connect,resource,dba to ittbank ;
7、查看当前用户的角色
select * from user_role_privs;
select * from session_privs;
8、查看当前用户的系统权限和表级权限
select * from user_sys_privs;
select * from user_tab_privs;
9、查询用户表
select name from dba_users;
10、显示当前用户
show user;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。