View table space usage
SELECT a.tablespace_name, a.bytes/(1024*1024*1024) total, b.bytes/(1024*1024*1024) used, c.bytes/(1024*1024*1024) 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;
View the data files corresponding to the tablespace
select t1.name, t2.name from v$tablespace t1, v$datafile t2 where t1.ts# = t2.ts# and t1.name = 'SYSTEM'
- If it is a temporary tablespace, use the following sql
select tablespace_name,file_name,bytes/1024/1024 file_size,autoextensible from dba_temp_files;
expand tablespace
ALTER TABLESPACE ITSP_DCDATA ADD DATAFILE '/data1/zytmp3pr/itsp_dcdata104.dbf' SIZE 31g AUTOEXTEND ON NEXT 1024M MAXSIZE 31g;
If you are expanding the temporary tablespace (temp), use the following statement:
ALTER TABLESPACE TEMP ADD TEMPFILE '/data1/zytmp4pr/temp03.dbf' SIZE 31g AUTOEXTEND ON NEXT 1024M MAXSIZE 31g;
- The maximum file size is set to 31G
drop tablespace
ALTER TABLESPACE ITSP_DCDATA drop DATAFILE '/data1/zytmp3pr/itsp_dcdata114.dbf';
- When deleting, the corresponding file of the table needs to have no data