# S213SP.def: Collects SQL*Plus/iSQL*Plus Information # $Id: S213SP.def,v 2.5 2012/01/03 13:34:44 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/S213SP.def,v 2.5 2012/01/03 13:34:44 mschenke Exp $ # # Change History # 20120103 MSC Change the copyright notice. =head1 NAME S213SP - Collects SQL*Plus/iSQL*Plus Information =head1 DESCRIPTION This module collects the SQL*Plus/iSQL*Plus diagnostic information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing SP module ...',tput('off') if !getSetting('DATABASE_INSTALLED') return # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $SP_PORT = getSetting('SP_PORT',5560) var $SP_HOST = getSetting('SP_HOST') var $TAIL = getSetting('RDA_TAIL',1000) var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var @TXT pretoc '^1:RDBMS' pretoc '1+:SQL*Plus/iSQL*Plus' var %HTTPDCONF # Load the common library run IAS() run library() =head2 glogin - Global Startup File Collects the global startup file F. =cut pretoc '2:SQL*Plus' debug ' Inside SP module, getting glogin' report glogin var $fil = catFile($ORACLE_HOME,'sqlplus','admin','glogin.sql') prefix {write '---+ Global Startup File' write '---## From: ',$fil } call writeFile($fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Global Startup File]]' } =head2 sqlperms - SQL*Plus Permissions Gets SQL*Plus permissions. =cut debug ' Inside SP module, getting SQL*Plus permissions' if or(testFile('f',catFile($ORACLE_HOME,'bin','sqlplus.exe')),\ testFile('f',catFile($ORACLE_HOME,'bin','sqlplus'))) {var $fil = lastFile() report sqlperms write '---+ SQL*Plus Permissions' call statFile('p',$fil) var @sta = getStat($fil) if !expr('&',$sta[2],1) {write '%BR%' write ' * Users other than owner and group do not have permissions to \ execute SQL*Plus.' write ' * If other users should be able to execute SQL*Plus, the \ following steps should be performed ONLY after considering all \ security ramifications and if you need to share this \ installation.' write ' * Execute ``changePerm.sh`` script available in Oracle \ Database 10.2.0.2 and later.' write ' * If you are in 10.2.0.1 release, the permissions \ should be modified manually.' write ' * If it is 9.0.2.7 or later, Patch 4533592 should \ be applied.' } write $TOP toc '3:[[',getFile(),'][rda_report][SQL*Plus Permissions]]' } unpretoc # Check iSQL*Plus presence if !or(testDir('d',catDir($ORACLE_HOME,'oc4j','j2ee','isqlplus')),\ testFile('f',catFile($ORACLE_HOME,'bin','isqlplus')),\ testFile('f',catFile($ORACLE_HOME,'bin','isqlplus.exe'))) {# Disable the group title in next index if isTocCreated(true) toc '-:RDBMS' return } =head2 isqlstart - Startup Script Gets the iSQL*Plus startup script. =cut pretoc '2:iSQL*Plus' var $dir = catDir($ORACLE_HOME,'oc4j','j2ee','isqlplus') if testDir('d',$dir) {debug ' Inside SP module, getting iSQL*Plus start script' report isqlstart var $fil = catFile($ORACLE_HOME,'bin',cond(isWindows(),'isqlplusctl.bat',\ isCygwin(), 'isqlplusctl.bat',\ 'isqlplusctl')) prefix {write '---+ Startup Script' write 'From: ',$fil } call writeFile($fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Startup Script]]' } =head2 isqlproc - Running iSQL*Plus Processes Lists running iSQL*Plus processes. For Windows, RDA gets the processes only if the F command is available. =cut debug ' Inside SP module, getting running iSQL*Plus processes' report isqlproc prefix {write '---+ Running iSQL*Plus Processes' write '' write getLines(0,0) } if isUnix() {var $cmd = testCommand('ps -ef','/bin/ps -ef','/usr/bin/ps -ef') if loadCommand($cmd) {loop $lin (grepLastFile('isqlplus','i')) write $lin } } elsif or(isWindows(),isCygwin()) {if findCommand('tasklist') {var $cmd = last loop $lin (grepCommand(concat($cmd,' /V'),'isqlplus','i')) write $lin } } if isCreated(true) write '' else {write '---+ Running iSQL*Plus Processes' write 'No iSQL*Plus process found' } toc '3:[[',getFile(),'][rda_report][Running iSQL*Plus Process]]' } =head2 isqlstat - iSQL*Plus Status Lists iSQL*Plus status. =cut debug ' Inside SP module, getting iSQL*Plus status' if and(match($SP_HOST,'^[\w\-\.]+$'),match($SP_PORT,'^\d+$')) {report isqlstat write '---+ iSQL*Plus Status' var $url = concat('http://',$SP_HOST,':',$SP_PORT,'/') var $req = createRequest('GET',$url) var $rsp = submitRequest($req) if isSuccess($rsp) write '|',$url,' |Pass|' else write '|',$url,' |Failed ',join(',',getRspCode($rsp)),\ ' - ',getRspMessage($rsp),' |' var $url = concat('http://',$SP_HOST,':',$SP_PORT,'/isqlplus') var $req = createRequest('GET',$url) var $rsp = submitRequest($req) if isSuccess($rsp) write '|',$url,' |Pass|' else write '|',$url,' |Failed ',join(',',getRspCode($rsp)),\ ' - ',getRspMessage($rsp),' |' toc '3:[[',getFile(),'][rda_report][iSQL*Plus Status]]' } =head2 Configuration Files Collects iSQL*Plus configuration files. =cut pretoc '3:Configuration Files' if testDir('d',$dir) call sort_files(4,0,grepDir(catDir($dir,'config'),'^\.+$','pv')) else {var %HTTPDCONF = () keep %HTTPDCONF var $APACHE_TOP = catDir($ORACLE_HOME,'Apache','Apache') call httpServer_getListenerConf(true) call sort_files(4,0,keys(%HTTPDCONF)) } unpretoc =head2 Log Files Collects iSQL*Plus log files. =cut pretoc '3:Log Files' call sort_files(4,$TAIL,\ catFile($dir,'application-deployments','isqlplus','application.log'),\ grepDir(catDir($dir,'log'),'^\.+$','pv'),\ grepDir(catDir($ORACLE_HOME,'sqlplus','log','isqlplus'),'^\.+$','pv')) unpretoc 2 # Disable the group title in next index if isTocCreated(true) toc '-:RDBMS' =head1 SEE ALSO L, L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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