以具有SYSDBA权限的用户登录数据库(如 sqlplus / as sysdba),确认目标表空间与数据文件:
查看表空间与数据文件路径、大小:
select tablespace_name, file_id, file_name, round(bytes/1024/1024,0) total_space_mb from dba_data_files order by tablespace_name;
查看表空间使用率与空闲空间:
select a.tablespace_name, a.bytes/1024/1024 total_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_pct from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name,sum(bytes) bytes from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name order by used_pct desc;
检查数据文件是否已启用自动扩展:
select file_name, autoextensible, increment_by, maxbytes from dba_data_files where tablespace_name=‘YOUR_TBS’;