首頁  >  文章  >  資料庫  >  oracle怎麼查看使用者對應的表空間

oracle怎麼查看使用者對應的表空間

hzc
hzc原創
2020-06-16 14:51:2210350瀏覽

oracle怎麼查看使用者對應的表空間

oracle怎麼查看使用者對應的表空間?

查詢用戶

查看資料庫裡面所有用戶,前提是你是有dba權限的帳號,如sys,system:

select * from dba_users;

查看你能管理的所有使用者:

select * from all_users;

查看目前使用者資訊:

select * from user_users;

查詢使用者所對應的表空間:

select username,default_tablespace from dba_users;

#為使用者指定表空間:

alter user 使用者名稱default tablespace 資料表空間名稱;

為使用者指定暫存表空間:

alter user 使用者名稱temporary tablespace 資料表空間名字;

刪除使用者:

drop user 使用者名稱 cascade;

#刪除表格空間:

drop tablespace 表格空間名稱including contents and datafiles cascade constraint;

##找出工作空間的路徑:

#select * from dba_data_files;

Oracle 查看表格空間的大小及使用情況sql語句

查詢表空間的名稱及大小(原樣複製,不要改變)

SELECT t.tablespace_name, round(SUM(bytes / (1024 * 1024)), 0) ts_size
FROM dba_tablespaces t, dba_data_files d
WHERE t.tablespace_name = d.tablespace_name
GROUP BY t.tablespace_name;

查看表空間實體檔案的名稱及大小(原樣複製,不要改)

SELECT tablespace_name,file_id,file_name,
round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files ORDER BY tablespace_name;

推薦教學:《

Oracle教學

以上是oracle怎麼查看使用者對應的表空間的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn