oracle 查詢表的大小,資料表空間的使用方式,預設資料表空間

來源:互聯網
上載者:User

標籤:

oracle 查詢表的大小,資料表空間的使用方式,預設資料表空間

 

oracle 查詢表的大小,資料表空間的使用方式,預設資料表空間

--查看某張表佔用磁碟空間大小 ( 表名大寫 )
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name having Segment_Name=‘表名‘;
查看使用者預設表空是那個
select username,default_tablespace from dba_users where username=‘SCOTT‘;
--資料表空間空閑
select  tablespace_name, sum(bytes)/(1024*1024)   as   free_space  
from   dba_free_space  
group   by   tablespace_name;

--查看資料庫資料表空間的使用方式 

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


--編輯擴大資料表空間,將資料表空間擴大到2M

alter database datafile ‘/oradata/rszpdb/TEST1.dbf‘ resize 2m;

若不知道 ‘/oradata/rszpdb/TEST1.dbf‘ 這個地址,

可使用一下語句查詢:

select b.file_name 物理檔案名稱 from dba_free_space a, dba_data_files b

 where a.file_id = b.file_id and b.tablespace_name = ‘資料表空間名‘

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



--通過擴大資料檔案來增大資料表空間,將資料表空間  RCMT_TEST 擴大1G (實際用)

 alter tablespace RCMT_TEST add datafile ‘/oradata/rszpdb/RCMT_TEST2.dbf‘ size 1G;

/oradata/rszpdb/RCMT_TEST2.dbf:不能跟原來的資料檔案名稱一樣(原來:/oradata/rszpdb/RCMT_TEST1.dbf)

 RCMT_TEST:資料表空間

1G:擴大1G

在原來資料檔案 RCMT_TEST1.dbf 所擁有的空間使用完之後,會自動使用 RCMT_TEST2.dbf 的空間。

oracle 查詢表的大小,資料表空間的使用方式,預設資料表空間

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.