Need to remove OS files based on SQL
Posted on 2011-05-10
This is needed when restoring a new database and I need to remove select files obtained from output of a SQL script (file path/name) pertaining to the database that will be removed.
For example, need to create a batch file that will remove the filenames obtained by the following SQL (existing DB is up at this point).
select substr(name,1,50) as filepathname, bytes/1000000 as MB from v$datafile order by bytes desc;
select t.name, t.bytes/1000000 as MBs from v$tempfile t;
select f.member as thename, l.bytes/1000000 as thesize from v$logfile f join v$log l on f.group# = l.group#;
select name, (blocks * block_size)/1000000 as MSIZE from v$archived_log where deleted = 'NO';
select NAME, sum((blocks * block_size)/1000000) total_MB from v$datafile_copy group by NAME;
show parameter dump;
show parameter spfile;
show parameter control;