標籤:max weight 建立表 log unlock ext nts .com contents
1、資料表空間相關sql
-- 建立資料表空間名為test_tablespace_name,儲存位置為D:\DB\oradata\orcl\test_tablespace_name.dbf,大小為128m,無限制,超出後每次增長10mcreate tablespace test_tablespace_name datafile ‘D:\DB\oradata\orcl\test_tablespace_name.dbf‘ size 128m autoextend on next 10m maxsize unlimited;-- 查看錶空間名為test_tablespace_name資訊SELECT file_name, tablespace_name, bytes, autoextensible FROM dba_data_files WHERE tablespace_name = ‘test_tablespace_name‘;-- 刪除資料表空間 test_tablespace_namealter tablespace test_tablespace_name offline;-- 將磁碟上的資料檔案一同刪除drop tablespace test_tablespace_name including contents and datafiles;
2、使用者相關sql
-- 建立使用者 test_user/test_password,指定資料表空間為test_tablespace_namecreate user test_user identified by test_password default tablespace test_tablespace_name temporary tablespace temp;-- 修改使用者密碼ALTER USER test_user identified by 123456;-- 刪除使用者DROP USER test_user CASCADE;-- 鎖定使用者alter user test_user account lock;-- 解鎖使用者alter user test_user account unlock;-- 查詢使用者資訊select * from all_users;-- 更詳細的使用者資訊select * from dba_users;
3、授權相關sql
-- 授予test_user使用者dba許可權grant resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace to test_user;-- 撤銷test_user使用者dba許可權REVOKE resource, dba, connect, create any table, create any index, create any sequence, unlimited tablespace FROM test_user;--查看目前使用者的系統許可權select * from user_sys_privs;--查看目前使用者的對象許可權select * from user_tab_privs;--查看目前使用者的所有角色select * from user_role_privs;
yexiangyang
[email protected]
Oracle資料庫個人整理常用的資料表空間、使用者、授權操作