1、創建用戶create user KD identified by 123456;2、授予連接資料庫的許可權grant connect to KD;3、將Scott用戶的emp表授權給KD可以查詢grant select on scott.emp to KD;grant create table t ...
1、創建用戶
create user KD identified by 123456;
2、授予連接資料庫的許可權
grant connect to KD;
3、將Scott用戶的emp表授權給KD可以查詢
grant select on scott.emp to KD;
grant create table to KD;
4、回收許可權
revoke select on scott.emp from KD;
5、表的增刪改許可權授權
grant select,inset,delete,update on scott.emp to KD;
revoke select,inset,delete,update on scott.emp from KD;
6、刪除用戶
SQL 錯誤: ORA-01940: 無法刪除當前連接的用戶
退出已經連接得KD用戶後再執行
drop user KD;
會提示:錯誤: ORA-01922: 必須指定 CASCADE 以刪除 'KD'
drop user KD cascade;
7、查看當前用戶所擁有的許可權
select * from session_privs;
8、查看當前用戶所擁有的角色
select * from user_role_privs;
9、查看角色所有的許可權
select * from dba_sys_privs;
select * from dba_sys_privs where grantee='CONNECT';
--create session
select * from dba_sys_privs where grantee='RESOURCE';
/*
create trigger
create sequence
create type
create procedure
create cluster
create operator
create indextype
create table
*/
select * from dba_sys_privs where grantee='DBA';
--有最高許可權 所有的許可權都有
創建一個開發人員並授權:
create user CURRY identified by 123456;
create connet,resource to CURRY;
10、用戶解鎖
alter user HR account unlock;
11、修改用戶密碼
alter user HR identified by 123456;