# DCsp.ctl:213:Collects SQL*Plus/iSQL*Plus Information # $Id: DCsp.ctl,v 1.5 2013/12/18 14:13:37 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/DCsp.ctl,v 1.5 2013/12/18 14:13:37 RDA Exp $ # # Change History # 20131218 KRA Fix spell. =for stopwords iSQL =head1 NAME DB:DCsp - 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 if !${I_DBC/E} return echo tput('bold'),'Processing DB.SP module ...',tput('off') # Initialization var $ORACLE_HOME = ${D_ORACLE_HOME/P:''} var $SP_PORT = ${N_PORT:5560} var $SP_HOST = ${T_HOST} var $TAIL = ${DFT.N_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 OFM:IAS() run RDA:library() =head2 glogin - Global Start File Collects the global start 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 Start File' write '---## From: ',$fil } call writeFile($fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Global Start File]]' } =head2 sqlperms - SQL*Plus Permissions Gets SQL*Plus permissions. =cut debug ' Inside SP module, getting SQL*Plus permissions' if ?testFile('f',$fil = catFile($ORACLE_HOME,'bin',${AS.EXE:'sqlplus'})) {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 !?nvl(testDir('d',catDir($ORACLE_HOME,'oc4j','j2ee','isqlplus')),\ testFile('f',catFile($ORACLE_HOME,'bin',${AS.EXE:'isqlplus'}))) {# Disable the group title in next index if isTocCreated(true) toc '-:RDBMS' return } =head2 isqlstart - Start Script Gets the iSQL*Plus start script. =cut pretoc '2:iSQL*Plus' if ?testDir('d',$dir = catDir($ORACLE_HOME,'oc4j','j2ee','isqlplus')) {debug ' Inside SP module, getting iSQL*Plus start script' report isqlstart var $fil = catFile($ORACLE_HOME,'bin',${AS.BATCH:'isqlplusctl'}) prefix {write '---+ Start Script' write 'From: ',$fil } call writeFile($fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Start 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, 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