Oracle資料庫查詢使用者表空間查詢 建立

2021-09-29 17:54:53 字數 1314 閱讀 9083

檢視資料庫裡面所有使用者,前提是你是有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;

---建立資料表空間

/*---------------------------------表空間---------------------*/

create bigfile tablespace ds

logging

datafile '***/ds.dbf'

size 1g autoextend on next 512m maxsize unlimited;

***代表你表空的存放的位置,根據你oracle伺服器實際環境決定

Oracle匯出空表資料庫

經常我們在匯出資料庫進行備份的時候,會發現有些空表沒有匯出,如何匯出包含空表的完整資料庫呢?那麼請按照下面的方法進行即可。1.使用plsql工具,連線oracle資料庫 2.開啟乙個sql視窗,用以下這句查詢空表並生成執行命令 1select alter table table name alloc...

oracle 查詢資料庫表空間大小和剩餘空間

dba data files 資料庫資料檔案資訊表。可以統計表空間大小 總空間大小 dba free space 可以統計剩餘表空間大小。增加表空間即向表空間增加資料檔案,表空間大小就是資料檔案總大小。檢查oracle各個表空間的增長情況 各表空間使用率 select a.tablespace na...

oracle資料庫匯出空表問題

11g中有個新特性,當表無資料時,不分配segment,以節省空間 解決方法 1 insert一行,再rollback就產生segment了。該方法是在在空表中插入資料,再刪除,則產生segment。匯出時則可匯出空表。2 設定deferred segment creation 引數 該引數值預設是...