一:
--查看表空間的名字及文件所在位置
select tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space from sys.dba_data_files order by tablespace_name
--查詢表空間信息
select username,default_tablespace,t.* from dba_users t
二:
--查詢當前表空間下使用情況
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;
從查詢結果看出,sgshare這個表空間已經滿了,存不下任何東西,這樣我們需要進行擴展表空間;
三:
--根據要求,我們需要將這個sgshare的表空間擴展到4G
alter database datafile '表空間位置' resize 新的尺寸
alter database datafile 'D:\APP\ADMINISTRATOR\ORADATA\XYSHARE\SGSHARE.DBF' resize 4096m
當然還有其余別的方法增加表空間大小。暫時 只接觸這一種,以后會補上。
四:
--增加后在查詢表空間的大小,看看sgshare是不是增加了表空間大小。
sgshare已經增加到了4G的大小。可以正常傳輸數據。