溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

ORACLE表空間的擴展方法是什么

發(fā)布時間:2021-11-04 16:43:47 來源:億速云 閱讀:262 作者:柒染 欄目:建站服務器

ORACLE表空間的擴展方法是什么,很多新手對此不是很清楚,為了幫助大家解決這個難題,下面小編將為大家詳細講解,有這方面需求的人可以來學習下,希望你能有所收獲。

第一步:查看表空間的名字及文件所在位置:
 
select tablespace_name, file_id, file_name, round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name

第二步:增大所需表空間大?。?br/> 
alter database datafile '表空間位置'resize 新的尺寸

例如: 

alter database datafile '\oracle\oradata\anita_2008.dbf' resize 4000m  

對于oracle數(shù)據庫的表空間,除了用手動增加大小外,還可以增加數(shù)據文件等方式擴展表空間大小。


方法一:增加數(shù)據文件個數(shù)

alter tablespace 表空間名稱add datafile '新的數(shù)據文件地址' size 數(shù)據文件大小

 
例如:

alter tablespace ESPS_2008 add datafile '\oracle\oradata\anita_2010.dbf' size 1000m


方法二:設置表空間自動擴展。
 
alter database datafile '數(shù)據文件位置' autoextend on next 自動擴展大小maxsize 最大擴展大小

例如:
alter database datafile '\oracle\oradata\anita_2008.dbf' autoextend on next 100m maxsize 10000m

方法三:查詢表空間使用情況:

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;

看完上述內容是否對您有幫助呢?如果還想對相關知識有進一步的了解或閱讀更多相關文章,請關注億速云行業(yè)資訊頻道,感謝您對億速云的支持。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI