# LDdarv.ctl: Collects Database Activity Recorder Data # $Id: LDdarv.ctl,v 1.3 2015/08/21 15:34:34 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/LDdarv.ctl,v 1.3 2015/08/21 15:34:34 RDA Exp $ # # Change History # 20150821 MSC Improve time consistency. =head1 NAME OS:LDdarv - Collects DARV Data =head1 DESCRIPTION This module collects a copy of the Database Activity Recorder files. The following report is produced: =head2 dar_box - Database Activity Recorder When available, this module collects a copy of the Database Activity Recorder files. =cut var $pat = undef if isUnix() {loop $key (${COL.TARGET/i}->grep('_SID$','r')) var $sid{field(':',-1,${<'COL.TARGET',$key>})} = 1 var $pat = join('|',map(keys(%sid),code(concat('^',quote(last),'$')))) } if length($pat) {debug ' Inside LOAD module, gathering database activity recorder information' # Get the ps command format var $PS_ARG var $PS_EF var $PS_ELF run &{check(getOsName(),'aix', 'OS:OSaix',\ 'darwin', 'OS:OSdarwin',\ 'dec_osf', 'OS:OSosf',\ 'dynixptx','OS:OSptx',\ 'hpux', 'OS:OShpux',\ 'linux', 'OS:OSlinux',\ 'solaris', 'OS:OSsunos',\ 'OS:OSunix')}('PS') # Initialise the report report dar_box prefix {write '---+ Database Activity Recorder' write ' * Links point to files that have been collected in their original \ format. Use the link to save them and use an adequate viewer.' write '|*Oracle SID*|*Recorder Directory*|*Data*|' } var $alt = '' var $ext = ${OUT.E} # Define macros to collect DAR files macro copy_dar {var ($ext,$bas,$dir,$sid) = @arg if transfer($dir,'dar.box',$ext,concat($bas,'.box'),true) {var @lnk = (concat('[[extern/',$bas,'.box][_blank][dar.box]]')) loop $suf ('err','pch','prm') {var $dst = concat($bas,'_',$suf,'.log') if transfer($dir,concat('dar.',$suf),$ext,$dst,true) call push(@lnk,concat('[[extern/',$dst,'][_blank][dar.',$suf,']]')) } write '|',$sid,' |',encode($dir),' |',join('%BR%',@lnk),' |' } } macro copy_err {var ($dir) = @arg prefix {write '---+ Database Activity Recorder Errors' write ' * Links point to files that have been collected in their original \ format. Use the link to save them and use an adequate viewer.' write '|*File Name*| *Size*|*Last Modified Date*|' } loop $fil (grepDir($dir,'dar.err','dr',1)) {var $lnk = encode($fil) var $siz = getSize($fil) if $siz {output d,concat('L_',basename($fil)) if ${CUR.O_LAST}->write_tail($fil,$TAIL) var $lnk = concat('[[',${CUR.O_LAST}->get_file,'][_blank][',$lnk,']]') call $[OUT]->end_report(${CUR.O_LAST}) } write '|',$lnk,' | ',$siz,'|',getLastModify($fil,''),' |' } } # Search for dar.box once {if loadCommand($PS_ARG) {loop $lin (grepLastFile('\bdar(\s|\z)')) {var ($dir,$sid) = match($lin,'\s(\S+/(\+?\w+))/dar(\s|\z)') if match($sid,$pat,true) call copy_dar($ext,concat('DB_dar',uc($sid)),$dir,$sid) } break isCreated(true) if grepLastFile('\bdar_sys\.sh(\s|\z)') call copy_err(match(last,'\s(\S+)/dar_sys\.sh(\s|\z)')) } else {var $cmd = cond(${OS.linux},$PS_ELF,$PS_EF) loop $lin (grepCommand($cmd,'\bdar(\s|\z)')) {var ($dir,$sid) = match($lin,'\s(\S+/(\+?\w+))/dar(\s|\z)') if match($sid,$pat,true) call copy_dar($ext,concat('DB_dar',uc($sid)),$dir,$sid) } break isCreated(true) if grepCommand($cmd,'\bdar_sys\.sh(\s|\z)') call copy_err(match(last,'\s(\S+)/dar_sys\.sh(\s|\z)')) } } # Insert the report in the table of content if isCreated(true) toc '2:[[',getFile(),'][rda_report][Database Activity Recorder]]' } =head1 SEE ALSO L, L, L, L, L, L, L, L, L, L =begin credits =over 10 =item RDA 4.3: Michel Villette. =item RDA 4.22: Philippe Jennequin, Michel Villette. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut