oracle關于表空間的一些操作

查看 xxx 表空間是否為自動擴展:

創(chuàng)新互聯(lián)公司是一家以網(wǎng)站設計建設,微信小程序開發(fā)、網(wǎng)站開發(fā)設計,網(wǎng)絡軟件產(chǎn)品開發(fā),企業(yè)互聯(lián)網(wǎng)推廣服務為主的民營科技公司。主要業(yè)務涵蓋:為客戶提供網(wǎng)站策劃、網(wǎng)站設計、網(wǎng)站開發(fā)、國際域名空間、網(wǎng)站優(yōu)化排名、買友情鏈接等服務領域。憑借建站老客戶口碑做市場,建設網(wǎng)站時,根據(jù)市場搜索規(guī)律和搜索引擎的排名收錄規(guī)律編程,全力為建站客戶設計制作排名好的網(wǎng)站,深受老客戶認可和贊譽。

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; 

打開表空間自動擴展功能:

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;

查詢表空間的總容量: 

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; 

擴展表空間:

#首先查看表空間的名字和所屬文件及空間 

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

#三種擴展方法 

1.alter tablespace test add datafile '/u01/test02.dbf' size 10M(自動加一個datafile) 

2.alter database datafile '/u01/test.dbf' resize 20M; 

3.alter database datafile '/u01/test.dbf' autoextend on next 10M maxsize 1G; 

設定后查看表空間信息:

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; 

當前名稱:oracle關于表空間的一些操作
瀏覽路徑:http://bm7419.com/article2/goioic.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供用戶體驗、網(wǎng)站制作云服務器、、ChatGPT、網(wǎng)站設計公司

廣告

聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)