Zip trace file dynamically

----------------------------------------------------------------------------
--                                                                         -
-- Purpose:     Dynamically zip a process's trace file                     -
--                                                                                                      -
--                                                                         -
-- Description: This script creates a named pipe in place of the process's -
--              trace file and spawns a gzip process to compress it.       -
--                                                                         -
----------------------------------------------------------------------------

column trc_file new_value trc_file noprint
column zip_file new_value zip_file noprint

select p.value || '/ora_' || u.spid || '.trc' trc_file,
       p.value || '/ora_' || u.spid || '.trc.gz' zip_file
from   sys.v_$session s,
       sys.v_$process u,
       sys.v_$parameter p
where  s.audsid = userenv('SESSIONID')
  and  u.addr = s.paddr
  and  p.name = 'user_dump_dest'
/

set define :
host mknod :trc_file p && nohup gzip < :trc_file > :zip_file &
set define &

alter session set max_dump_file_size = unlimited
/

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.