====== Completely drop a tablespace and all the associated data files ======
===== Check data files location =====
First, note all the datafiles associated with your tablespace:
SELECT DECODE(r, 1, tablespace_name, null) tablespace_name, file_name
FROM (select tablespace_name, file_name, rank() over (partition by tablespace_name
order by tablespace_name, file_name) r
from dba_data_files
order by tablespace_name, file_name
)
Result:
{{:database:oracle:pasted:20230309-153743.png}}
The ST_SERVERLOG tablespace has 2 data files:
* /opt/oracle/oradata/ORACLE19C/datafile/o1_mf_st_serve_js7jhf9y_.dbf
* /opt/oracle/oradata/ORACLE19C/datafile/o1_mf_st_serve_js7jqjb3_.dbf
===== Remove tablespace =====
DROP TABLESPACE ST_SERVERLOG including contents;
This will not remove the data files from the disk, so the space will remain occupied.
===== Drop data files =====
Manually go on the disk and remove the associated data files.
If those files are not in use by any tablespace, the Oracle will let you remove them.