您好,登錄后才能下訂單哦!
查看 xxx 表空間是否為自動(dòng)擴(kuò)展:
select file_name,autoextensible,increment_by from dba_data_files;
select file_id,file_name,tablespace_name,autoextensible,increment_by from dba_data_files order by file_id desc;
打開表空間自動(dòng)擴(kuò)展功能:
alter database datafile '/u01/app/oracle/oradata/testdb/test01.dbf' autoextend on;
查看數(shù)據(jù)文件大?。?/strong>
select TABLESPACE_NAME,FILE_NAME,BYTES/1024/1024 M from dba_data_files order by TABLESPACE_NAME;
查詢表空間的總?cè)萘浚?/strong>
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
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;
擴(kuò)展表空間:
#首先查看表空間的名字和所屬文件及空間
select tablespace_name, file_id, file_name,round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name;
#三種擴(kuò)展方法
1.alter tablespace test add datafile '/u01/test02.dbf' size 10M(自動(dòng)加一個(gè)datafile)
2.alter database datafile '/u01/test.dbf' resize 20M;
3.alter database datafile '/u01/test.dbf' autoextend on next 10M maxsize 1G;
設(shè)定后查看表空間信息:
select a.tablespace_name,a.bytes total,b.bytes used,c.bytes free,(b.bytes*100)/a.bytes "% used",(c.bytes*100)/a.bytes "% free" from sys.sm$ts_avail a,sys.sm$ts_used b,sys.sm$ts_free c where a.tablespace_name=b.tablespace_name and a.tablespace_name=c.tablespace_name;
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。