Oracle數據庫創建、刪除用戶及用戶授權

--創建用戶指定表空間並授權:
create user testuser identified by testuser
default tablespace tests_data;
alter user testuseraccount unlock;
grant connect,resource to testuser;--給用戶所有權限
--查詢所有用戶
select * from dba_users;  
select * from all_users;
select * from user_users;
--刪除用戶
drop user [username] cascade;
--一個用戶的默認表空間只能有一個,但是你可以試下用下面的語句爲其授權在別的表空間中創建對像:
alter user username quota 0||unlimited on tablespace_name;
alter user username quota unlimited on tablespaceA;
alter user username quota unlimited on tablespaceB;
--或者放開所有表空間
grant unlimited tablespace to username;
--或者索性給所有權限
grant resource,connect,dba to username;
--關於用戶具體權限授權
grant create session to username;--授予username用戶創建session的權限,即登陸權限
grant unlimited tablespace to username;--授予username用戶使用表空間的權限
grant create table to username;--授予創建表的權限
grante drop table to username;--授予刪除表的權限
grant insert table to username;--插入表的權限
grant update table to username;--修改表的權限
grant all to public;--這條比較重要,授予所有權限(all)給所有用戶(public)
--oralce對權限管理比較嚴謹,普通用戶之間也是默認不能互相訪問的,需要互相授權
grant select on tablename to username;--授予username用戶查看指定表的權限
grant drop on tablename to username;--授予刪除表的權限
grant insert on tablename to username;--授予插入的權限
grant update on tablename to username;--授予修改表的權限
grant insert(id) on tablename to username;
grant update(id) on tablename to username;--授予對指定表特定字段的插入和修改權限,注意,只能是insert和update
grant alert all table to username;--授予username用戶alert任意表的權限

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章