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_account limit filed_login_attempts 3 password_lock_time 2;
alter user username profile 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 account unlock;
删除:
drop profile profileName;// cascade