Wednesday, September 15, 2010

Adding timestamp to spool file


set colsep ','
set term off
set lines 130
set pages 50000
col objecT_name format a40
col object_type format a40
col owner format a20
col status format a15



column filename noprint new_value filename

select 'one_time_cufnd_invalid_objects_'||to_char(sysdate, 'mmddyy_hh24mi')||'.csv' filename
from dual;

spool $HOME/script_output/&&filename

select owner, object_type, objecT_name, status from dba_objects
where status <> 'VALID'
order by owner, object_type, object_name
/
spool off
quit

No comments:

Post a Comment