3-用户管理

来源:互联网 发布:窗帘培训软件 编辑:程序博客网 时间:2024/05/12 07:04

oracle 有dba权限才能创建用户:

create user username identified by user_password; //user_password 不能以数字开头

删除user

drop user user_name cascade;//用户如果有创建表加cascade,级联删除。

修改密码:如果修改别人的密码,需要dba或有alter user系统权限

password username;//自己修改不需要写username;

赋权限:

1.系统权限 user 对数据库的相关权限

2.对象权限 user 对其他 user的数据对象操作的权限。

(1)预定义角色(2)自定义角色

grant connect/resource/dba to username;

grant all on userOther.table to username;//all(insert update delete select) //create index

权限传递:

grant XXX to username with admin option;//系统权限

grant all on userOther.table to username with grant option;//对象权限

a to b ,b to c, b如果被回收权限,c也被回收。

收回权限:

revoke XXX from username;

revoke all on userOther.table from username;

限制 profile 命令:

create profile lock_accountlimit filed_login_attempts 3 password_lock_time 2;

alter user usernameprofile lock_account;

锁定用户xxx3,次尝试失败的话锁定2天

create profile my_profile limit password_life_time 10 password_grace_time 2 password_resue_time 10;

定期修改口令 每隔10天,宽限期2天,如果修改的密码和原来的一样,10天之后才能用

解锁:

alter user username accountunlock;

删除:

drop profile profileName;// cascade 






原创粉丝点击