Oracle tablespace viewing and expansion

  • According to the table space name, check the table space size, etc.
select tablespace_name, file_id, file_name, round(bytes/(1024*1024), 0) total_space from dba_data_files where tablespace_name = 'SYSAUX';
SELECT t.tablespace_name, round(sum(bytes/(1024*1024)), 0) ts_size from dba_tablespaces t, dba_data_files d where t.tablespace_name = d.tablespace_name and t.tablespace_name = 'SYSAUX' group by t.tablespace_name;



Check remaining space

select sum(bytes) / (1024*1024) as free_space,tablespace_name from dba_free_space where tablespace_name ='SYSAUX' group by tablespace_name;

View usage and remaining amount

select a.tablespace_name, a.bytes total, b.bytes used, c.bytes free, round((b.bytes*100)/a.bytes, 2) "% used",
round((c.bytes * 100) / a.bytes, 2) "% 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 and a.tablespace_name = 'SYSAUX';


  • Add data files for SYSAUX tablespace
alter tablespace SYSAUX add datafile 'D:\APP\ZSDORACLE\ORADATA\ORCL\SYSAUX_20180502.DBF' SIZE 1G AUTOEXTEND ON NEXT 200M MAXSIZE UNLIMITED;

Among them: table space name, path address, initial file size and other parameters are defined according to their own conditions.


test result

select tablespace_name,file_name,autoextensible from dba_data_files where tablespace_name = 'SYSAUX';


Reference: https://blog.csdn.net/qq_25391785/article/details/66970349

          https://www.cnblogs.com/iceless/p/7124509.html


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325893713&siteId=291194637