# S400RAC.def: Collects Cluster Information # $Id: S400RAC.def,v 1.39 2008/02/25 17:32:56 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/S400RAC.def,v 1.39 2008/02/25 17:32:56 mschenke Exp $ # # Change History # 20080225 MSC Change the copyright notice. =head1 NAME S400RAC - Collects Cluster Information =head1 DESCRIPTION This module collects data that is related to the operation of the Oracle Cluster and its configuration. The following reports can be generated and are regrouped under C in C: =cut echo tput('bold'),'Processing Cluster module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $MACHINE_NAME = getSetting('MACHINE_NAME','localhost') var $DATABASE_LOCAL = getSetting('DATABASE_LOCAL') var $CLUSTER_OCRDUMP = getSetting('CLUSTER_OCRDUMP') var $CLUSTER_TAIL = getSetting('CLUSTER_TAIL',200) var $AGE = getSetting('CLUSTER_FILE_AGE',15) var $CORE = '(^core\.\d+$|core$)' var $OSN = getOsName() var $PAT1 = concat('itm',$AGE) var $PAT2 = concat('dirm',$AGE) var $PAT3 = concat('drm',$AGE) var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' toc '^1:Cluster' toc '1+:Cluster Information' # Load the common macros run library() run INSTinfo() =pod Reports the details of the operating system-specific aspects (platform-specific code) =cut var $ORA_CRS_HOME = getEnv('ORA_CRS_HOME','') var @FILES = () var @INITD = () if match($OSN,'solaris') {run OSsunos('RAC',\@INITD,\@FILES) } elsif match($OSN,'hpux') {run OShpux('RAC',\@INITD,\@FILES) } elsif match($OSN,'aix') {run OSaix('RAC',\@INITD,\@FILES) } elsif match($OSN,'dec_osf') {run OSosf('RAC',\@INITD,\@FILES) } elsif match($OSN,'linux') {run OSlinux('RAC',\@INITD,\@FILES) } else {echo 'Platform ',$OSN,' not supported' } =head2 racOnOff - RAC on/off Linked Verifies that the RAC option is currently linked into the F executable. This check is performed only in supported platforms. =cut if match($OSN,'aix|dec_osf|hpux|linux|solaris') {debug ' Inside RAC module, checking ORACLE binaries to see if RAC is linked' report racOnOff write '---+ Verify RAC Linked' var $cmd = concat('nm -r ',\ catCommand($ORACLE_HOME,'rdbms','lib','libknlopt.a'),\ ' | grep -c "kcsm.o" 2>/dev/null') write '---## Checking ORACLE binaries to see if RAC is linked' write '---### Using command: ',$cmd if command($cmd) write 'RAC option IS installed and linked into the Oracle binary.' else write 'RAC NOT correctly linked or installed into the Oracle binary' toc '2:[[',getFile(),'][rda_report][RAC on/off Linked]]' } =head2 init - Init Files Collects the F and the init files. Additional platform-specific files can be present. =cut debug ' Inside RAC module, gathering init files' report init prefix {write '---+!! Init Files' write $TOC } loop $fil (@INITD) {if testFile('f',$fil) {var $nam = basename($fil) write '---+ Display of ',$nam,' File' write '---## Information Taken from ',$fil if !writeFile($fil) {write '**',$nam,' not readable.**%BR%\ May be file permission problems.%BR%\ Permissions are:%BR%' call statFile('b',$fil) write 'User: ',id(),'%BR%' } write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Init Files]]' =head2 core - Core Dumps When a debugger is found on UNIX, RDA tries to extract the stack trace from the core dumps present in the cluster directories. =cut if isUnix() {debug ' Inside RAC module, detecting core dumps' var $log = catDir($ORA_CRS_HOME,'log',getSetting('MACHINE_NAME')) var @dmp = (grepDir(catDir($ORA_CRS_HOME,'crs','init'),$CORE,$PAT3),\ grepDir(catDir($ORA_CRS_HOME,'css','init'),$CORE,$PAT3),\ grepDir(catDir($ORA_CRS_HOME,'evm','init'),$CORE,$PAT3),\ grepDir(catDir($log,'csrd'),$CORE,$PAT3),\ grepDir(catDir($log,'cssd'),$CORE,$PAT3),\ grepDir(catDir($log,'evmd'),$CORE,$PAT3)) if @dmp {# Include the core analyzer run COREinfo() # When a debugger is found, analyze the core dumps if can_analyze_core() {var $dbg = last report core write '---+!! Core Dump Stack Trace Extraction' write '---## Using: ',$dbg write $TOC call analyze_core(@dmp) toc '2:[[',getFile(),'][rda_report][Core Dumps]]' } } } =head2 crs_status - CRS Status Sets up and populates CRS_status if Cluster Ready Services is installed. =cut debug ' Inside RAC module, checking Cluster Ready Services status' report crs_status write '---+!! Cluster Ready Services Status' write $TOC prefix write 'Cluster Ready Services detected.' if $ORA_CRS_HOME {if testFile('f',catFile($ORA_CRS_HOME,'bin','olsnodes')) {write '---+ Nodes Found' call writeCommand(concat(lastCommand(),' 2>&1')) write $TOP write '---+ CSS Daemon Status' call writeCommand(concat(catCommand($ORA_CRS_HOME,'bin','crsctl'),\ ' check css')) write $TOP } } if !hasOutput(true) {write write '**Cluster Ready Services NOT detected.**%BR%' } # Get ocr.loc write '---+ OCR Configuration File contents' if testFile('f','/var/opt/oracle/ocr.loc') call writeFile('/var/opt/oracle/ocr.loc') elsif testFile('f','/etc/oracle/ocr.loc') call writeFile('/etc/oracle/ocr.loc') else write '**ocr.loc file not found.**%BR%' write $TOP toc '2:[[',getFile(),'][rda_report][CRS Status]]' =head2 crs_inventory - CRS Inventory Provides the inventory of the Cluster Ready Services home if inventory information is still available. =head2 crs_stat - CRS Stat Details If Cluster Ready Services is installed, provides the C detailed output. =cut if $ORA_CRS_HOME {debug ' Inside RAC module, providing the crs inventory (can take time)' var $fil = catFile($ORA_CRS_HOME,'inventory','ContentsXML','comps.xml') if testFile('fr',$fil) {report crs_inventory prefix {write '---+!! Cluster Ready Services Inventory' write $TOC } call inventory_details($fil,getSetting('CLUSTER_INTERIM')) if isCreated(true) toc '2:[[',getFile(),'][rda_report][CRS Inventory]]' } debug ' Inside RAC module, providing the crs_stat detailed output' report crs_stat prefix {write '---+!! Cluster Ready Services crs_stat' write $TOC write '---+ Using: ',$cmd } var $cmd = concat(catCommand($ORA_CRS_HOME,'bin','crs_stat'),' -u') call writeCommand($cmd) if hasOutput() {prefix write '---+ Using: ',$cmd } var $cmd = concat(catCommand($ORA_CRS_HOME,'bin','crs_stat'),' -p') call writeCommand($cmd) if isCreated(true) toc '2:[[',getFile(),'][rda_report][CRS Stat Details]]' } =head2 alert_log - Alert Log Collects last lines of F<$ORA_CRS_HOME/log/EnodeE/alertEnodeE.log> (Oracle Database 10g R2). =head2 crs_log - CRS Log Handles the log files in F<$ORA_CRS_HOME/crs/log> (Oracle Database 10g R1) or in F<$ORA_CRS_HOME/log/EnodeE/crsd> (Oracle Database 10g R2). =head2 css_log - CSS Log Handles the log files in F<$ORA_CRS_HOME/css/log> (Oracle Database 10g R1) or in F<$ORA_CRS_HOME/log/EnodeE/cssd> (Oracle Database 10g R2). =head2 racg_dump - RACG Dump Gets dump files from F<$CRS_HOME/racg/dump> (Oracle Database 10g R1) or from F<$ORA_CRS_HOME/log/EnodeE/racg> (Oracle Database 10g R2). =head2 evm_log - CRS EVM Log Handles the log files in F<$ORA_CRS_HOME/evm/log> (Oracle Database 10g R1) or in F<$ORA_CRS_HOME/log/EnodeE/evmd> (Oracle Database 10g R2). =head2 client_log - Client Log Handles the log files in F<$ORA_CRS_HOME/log/EnodeE/client> (Oracle Database 10g R2). =head2 admin_log - Admin Log Handles the log files in F<$ORA_CRS_HOME/log/EnodeE/admin> (Oracle Database 10g R2). =cut if $ORA_CRS_HOME {toc '2:CRS Log Files' var $nod = getSetting('MACHINE_NAME') var $log = catDir($ORA_CRS_HOME,'log',$nod) debug ' Inside RAC module, gathering alert log file' report alert_log call tail_file($log,concat('alert',$nod,'.log'),$CLUSTER_TAIL) if isCreated() toc '3:[[',getFile(),'][rda_report][Alert Log]]' debug ' Inside RAC module, gathering CRS log files' report crs_log var $dir = catDir($ORA_CRS_HOME,'crs','log') loop $nam (grepDir($dir,'\.log$',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) loop $fil (grepDir(catDir($log,'csrd'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated() toc '3:[[',getFile(),'][rda_report][CRS Log]]' debug ' Inside RAC module, gathering CSS log files' report css_log var $dir = catDir($ORA_CRS_HOME,'css','log') loop $nam (grepDir($dir,'\.log$',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) var $dir = catDir($ORA_CRS_HOME,'css','init') loop $nam (grepDir($dir,'\.log$',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) loop $fil (grepDir(catDir($log,'cssd'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated() toc '3:[[',getFile(),'][rda_report][CSS Log]]' debug ' Inside RAC module, gathering RACG dump files' report racg_dump var $dir = catDir($ORA_CRS_HOME,'racg','dump') loop $nam (grepDir($dir,'.*',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) if compare('ne',$ORA_CRS_HOME,$ORACLE_HOME) {var $dir = catDir($ORACLE_HOME,'racg','dump') loop $nam (grepDir($dir,'.*',$PAT1)) {next match($nam,$CORE) call tail_file($dir,$nam,$CLUSTER_TAIL) } } loop $fil (grepDir(catDir($log,'racg'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated() toc '3:[[',getFile(),'][rda_report][RACG Dump]]' debug ' Inside RAC module, gathering CRS EVM Log' report evm_log var $dir = catDir($ORA_CRS_HOME,'evm','log') loop $nam (grepDir($dir,'\.log$',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) var $dir = catDir($ORA_CRS_HOME,'evm','init') loop $nam (grepDir($dir,'\.log$',$PAT1)) call tail_file($dir,$nam,$CLUSTER_TAIL) loop $fil (grepDir(catDir($log,'evmd'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated(true) toc '3:[[',getFile(),'][rda_report][CRS EVM Log]]' debug ' Inside RAC module, gathering Client Log' report client_log loop $fil (grepDir(catDir($log,'client'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated(true) toc '3:[[',getFile(),'][rda_report][Client Log]]' debug ' Inside RAC module, gathering Admin Log' report admin_log loop $fil (grepDir(catDir($log,'admin'),'.',$PAT2)) {if testFile('f',$fil) {var $nam = basename($fil) next match($nam,$CORE) call tail_file(dirname($fil),$nam,$CLUSTER_TAIL) } } if isCreated(true) toc '3:[[',getFile(),'][rda_report][Admin Log]]' =head2 ocrdump - ocrdump An OCR dump can be requested by C setting to a true (non zero) value. =cut if $CLUSTER_OCRDUMP {debug ' Inside RAC module, requesting an OCR dump' report ocrdump var $pgm = catCommand($ORA_CRS_HOME,'bin','ocrdump') var $tmp = getTemp('ocrdump') prefix {write '---+ OCR Dump' write '---## Using: ',$pgm } if loadCommand(concat($pgm,' ',quote($tmp,'x'),' 2<&1')) call writeFile($tmp) else call writeLastFile() call unlinkTemp('ocrdump') if isCreated(true) toc '3:[[',getFile(),'][rda_report][ocrdump]]' } =head2 ocrcheck - ocrcheck Executes C. (Oracle Database 10g R2) =cut debug ' Inside RAC module, requesting an OCR check' report ocrcheck var $pgm = catCommand($ORA_CRS_HOME,'bin','ocrcheck') prefix {write '---+ OCR Check' write '---## Using: ',$pgm } call writeCommand($pgm) if isCreated(true) toc '3:[[',getFile(),'][rda_report][ocrcheck]]' =head2 ocrconfig - ocrconfig -showbackup Executes C. (Oracle Database 10g R2) =cut debug ' Inside RAC module, requesting an OCR config' report ocrconfig var $pgm = concat(catCommand($ORA_CRS_HOME,'bin','ocrconfig'),' -showbackup') prefix {write '---+ OCR Config' write '---## Using: ',$pgm } call writeCommand($pgm) if isCreated(true) toc '3:[[',getFile(),'][rda_report][ocrconfig -showbackup]]' } =head2 srvctl - SRVM Runs F commands and reports the configuration information. =cut debug ' Inside RAC module, running srvctl commands' report srvctl write '---+!! SRVCTRL Information' write $TOC write '---++ Location and Contents of svrConfig.loc' if testFile('f','/var/opt/oracle/srvConfig.loc') var $loc = '/var/opt/oracle/srvConfig.loc' elsif testFile('f','/etc/srvConfig.loc') var $loc = '/etc/srvConfig.loc' else {var $loc = undef write '**srvConfig.loc not found.**%BR%\ Either file does not exist or \ this Oracle version does not use this file.' } if $loc {write '---++ Location' call statFile('p',$loc) write $TOP write '---++ Contents of ',$loc call writeFile($loc) write $TOP write '---++ srvConfig File Permissions' loop $fil (grepFile($loc,'srvconfig_loc')) {var @fld = split('=',trim($fil)) call statFile('p',$fld[-1]) } write $TOP write '---+ srvctl config output' call writeCommand(concat(catCommand($ORACLE_HOME,'bin','srvctl'),' config')) write $TOP write '---+ srvctl status database -d dbname output' loop $db (command('srvctl config')) {write '---++ ',$db,' has been registred as a database' call writeCommand(concat(catCommand($ORACLE_HOME,'bin','srvctl'),\ ' status database -d ',$db)) write $TOP } } toc '2:[[',getFile(),'][rda_report][SRVM]]' =head2 ipc - IPC Runs C commands to generate a trace file, and then displays the IPC trace file. It is performed only for databases associated with the current Oracle home. =cut debug ' Inside RAC module, gathering IPC trace file' report ipc prefix write '---+ IPC Trace File' if $DATABASE_LOCAL {set $sql {oradebug setmypid "oradebug ipc "oradebug tracefile_name } call loadSql($sql) var ($fil) = grepLastSql('\.trc') if $fil call writeFile($fil) else {write '' call writeLastSql() if getSqlMessage() write last write '' } } else write 'Database was not chosen as an option for this execution.%BR%\ oradebug ipc information not gathered.' if isCreated(true) toc '2:[[',getFile(),'][rda_report][IPC]]' =head2 logs - Cluster Configuration/Logs Looks for the cluster configuration and log files on the operating system. The file list is platform-specific. =cut debug ' Inside RAC module, looking for cluster configuration and logs' report logs prefix {write '---+!! Cluster Configuration and Logs' write $TOC } loop $fil (@FILES) {if testFile('f',$fil) call tail_file(dirname($fil),basename($fil),100) else write '---## ',$fil,' not present on this server' write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Cluster Configuration/Logs]]' # Disable the group title in next index toc '-:Cluster' =head1 SEE ALSO See also L, L, L, L, L, L, L, L. =begin credits =over 10 =item RDA 4.0: Bernhard Cock Buning. =item RDA 4.2: Roger Snowden. =item RDA 4.6: Bob Caldwell. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2008, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut