oracle擴充套件表空間

2021-10-02 05:42:41 字數 1496 閱讀 8085

一:檢視表空間的名字及檔案所在位置

select tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space from sys.dba_data_files order by tablespace_name

二:查詢表空間資訊

select username,default_tablespace,t.* from dba_users t

三:查詢當前表空間下使用情況

select a.tablespace_name, a.bytes / 1024 / 1024 "sum mb", (a.bytes - b.bytes) / 1024 / 1024 "used mb", b.bytes / 1024 / 1024 "free mb", round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "used%" from (select tablespace_name, sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name, sum(bytes) bytes, max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name = b.tablespace_name order by ((a.bytes - b.bytes) / a.bytes) desc;

從查詢結果看出,這個表空間已經滿了,存不下任何東西,這樣我們需要進行擴充套件表空間;

四:根據要求,我們需要將這個表空間擴充套件到4g

alter database datafile '表空間位置' resize 新的尺寸

當然還有其餘別的方法增加表空間大小。暫時 只接觸這一種,以後會補上。

五:增加後在查詢表空間的大小,看看是不是增加了表空間大小。

六:根據相同的表空間名比較是否擴容過,比較下

select  b.file_name 物理檔名, 

b.tablespace_name 表空間, 

b.bytes/1024/1024 大小m, 

(b.bytes-sum(nvl(a.bytes,0)))/1024/1024 已使用m, 

substr((b.bytes-sum(nvl(a.bytes,0)))/(b.bytes)*100,1,5) 利用率 

from dba_free_space a,dba_data_files b 

where a.file_id=b.file_id 

group by b.tablespace_name,b.file_name,b.bytes 

order by b.tablespace_name;

Oracle表空間擴充套件

1.檢視所有表空間使用情況 select b.file id 檔案id號,b.tablespace name 表空間名,b.bytes 1024 1024 m 位元組數,b.bytes sum nvl a.bytes,0 1024 1024 m 已使用,sum nvl a.bytes,0 1024 ...

Oracle擴充套件表空間

平時在工作中,客戶那邊的伺服器 放置erp的,很容易表空間不足造成業務流程走不通,導致一些不必要的麻煩,作為乙個運維,必須時刻檢視表空間,通過指令碼監控來進行報警 怎麼檢視表空間 select tablespace name,sum bytes 1024 1024 as mb from dba da...

oracle擴充套件表空間

oracle擴充套件表空間 1.首先找出該錶空間對應的資料檔案及路徑 查詢對應的表空間中的資料檔案的全路徑,該路徑對應file name欄位。select from dba data files t where t.tablespace name 輸入要查詢的表空間 解決方法1 增大資料檔案 增加對...