Oracle擴充套件表空間

2021-08-06 07:59:39 字數 1065 閱讀 4281

平時在工作中,客戶那邊的伺服器--放置erp的,很容易表空間不足造成業務流程走不通,導致一些不必要的麻煩,作為乙個運維,必須時刻檢視表空間,通過指令碼監控來進行報警;

怎麼檢視表空間

select tablespace_name, sum(bytes) / 1024 / 1024 as mb from dba_data_files group by tablespace_name;

--查詢表空間使用率

select total.tablespace_name,

round(total.mb, 2)           as total_mb,

round(total.mb - free.mb, 2) as used_mb,

round(( 1 - free.mb / total.mb ) * 100, 2)

|| '%'                       as used_pct,

round(free.mb, 2) as free_mb

from   (select tablespace_name,

sum(bytes) / 1024 / 1024 as mb

from   dba_free_space

group  by tablespace_name) free,

(select tablespace_name,

sum(bytes) / 1024 / 1024 as mb

from   dba_data_files

group  by tablespace_name) total

where  free.tablespace_name = total.tablespace_name;

如果不足,則必須加長表空間,或者加多乙個user表

alter tablespace users add datafile '/ora/oracle/oradata/dbserver/users03.dbf' size 20000m;

alter database datafile '/ora/oracle/oradata/dbserver/users04.dbf' resize 20000m;

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擴充套件表空間

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

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 ...