Oracle資料庫個人整理常用的資料表空間、使用者、授權操作

來源:互聯網
上載者:User

標籤: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資料庫個人整理常用的資料表空間、使用者、授權操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.