---用戶登陸命令
--管理員登陸
conn sys/oracle as sysdba;
--建立用戶方案必須是管理員權限
--建立用戶命令 create user useranme identifild by password
create user god identified by g123;
--管理員受權 系統 權限 grant ..to...
grant connect,resource,dba to god;
--管理員受權 對象 權限
grant xx on tablename to username;
--取消受權---
revoke xx from username;
revoke xx on tablename from username;
---權限傳遞
--1 with admin option 系統權限傳遞
--管理員給予zhangsan connect,resource 的權限的同時,zhangsna 能夠授予其餘用戶
grant connect,resource to zhangsan with admin option;
--2 with grant option 對象權限傳遞
grant select on scott.emp to zhangsan with grant option;
--god登陸
--建立表
create table student( sid int,sname varchar2(30));
--解鎖---
--scott方案默認是被鎖定
--管理員纔有權限解鎖,鎖定
alter user scott account unlock;
alter user scott account lock;oracle
---舉例
--建立2個用戶方案,A zhangsan/z123 ,B lisi/l123
--給A受權 connect,resouce權限
--在A方案下面建立一張student表
--經過A授予B connect權限
create user zhangsan identified by z123;
create user lisi identified by l123;
grant connect,resource to zhangsan;ide
---刪除用戶
drop user username
drop user lisi;
--級聯刪除
drop user username cascade; 對象
---建立規則
create profile 規則名稱 limit failed_login_attempts 次數 password_lock_time 天數
create profile pwdlock limit failed_login_attempts 3 password_life_time 1000;
--建立用戶
create user zhangsan identified by z123;
--給登陸權限
grant connect to zhangsan;
--給規則
alter user zhangsan profile pwdlock;
---若是輸入3次密碼錯誤就會鎖定 須要解鎖
alter user zhangsan account unlock;it