# S371ESB.def: Collects Enterprise Service Bus Information # $Id: S371ESB.def,v 1.4 2008/02/25 17:32:55 mschenke Exp $ # ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/modules/S371ESB.def,v 1.4 2008/02/25 17:32:55 mschenke Exp $ # # Change History # 20080225 MSC Change the copyright notice. =head1 NAME S371ESB - Collects Enterprise Service Bus Information =head1 DESCRIPTION This module collects the Enterprise Service Bus-related information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing ESB module ...',tput('off') # Initialization var $ORACLE_HOME = getSetting('ORACLE_HOME','') var $ESB_AUTO = getSetting('ESB_DB_AUTO',1) var $ESB_LOCAL = getSetting('ESB_LOCAL') var $TAIL = getSetting('RDA_TAIL',1000) var $ESB_HOME = catDir($ORACLE_HOME,'integration','esb') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Enterprise Service Bus' # Load the common macros run library() run DBinfo() =head2 rep_info - Repository Information Collects the repository information from the Enterprise Service Bus database. =cut # Define a database connection macro macro set_db {var ($sid) = @arg var $usr = uc(getSetting('ESB_LOGIN','ORAESB')) # Determine the user password if compare('eq',$usr,'/') var ($usr,$pwd) = ('','') elsif hasSqlPassword($usr,$sid) var $pwd = undef else var $pwd = askPassword(concat('Enter ',$usr,'@',$sid,' user password:')) # Change the database context var $old = setSqlLogin($usr,$pwd,$sid,getSetting('ESB_SYSDBA')) var $env = cond(getSetting('ESB_SWITCH'),setSqlSid($sid)) var $try = setSqlFailure(0) # Test the database connection call testSql() # Return the previous context return (true,$old,$env,$try) } # Get the SID from config file if $ESB_AUTO {var @tbl = () var $J2EE_TOP = getSetting('J2EE_TOP',catDir($ORACLE_HOME,'j2ee')) # Get the container list if testFile('r',catFile($ORACLE_HOME,'opmn','conf','opmn.xml')) {var $top = xmlLoadFile(lastFile()) loop $xml (xmlFind($top,\ 'opmn/process-manager/ias-instance/ias-component/process-type \ module-id="OC4J"')) var @tbl = (@tbl,xmlValue($xml,'id')) } elsif testDir('d',catDir($J2EE_TOP,'home')) var @tbl = ('home') # Get the database connection details var $sid = undef loop $itm (@tbl) {next !testFile('r',catFile($J2EE_TOP,$itm,'config','data-sources.xml')) var $top = xmlLoadFile(lastFile()) if xmlFind($top,'data-sources/managed-data-source jndi-name="jdbc/esb$"') {var $con = xmlValue(last,'connection-pool-name') if xmlFind($top,concat('data-sources/connection-pool name="',$con,\ '"/connection-factory')) {var $sid = replace(xmlValue(last,'url'),'^.*@') if match($sid,'^//([\w\-\.]+:{1}\d+/{1}.*)$') {# Pattern for service name, eg: //hostname:port/service var $sid = replace(last,'/','::') } elsif match($sid,'ldap',true) {echo tput('reverse'),'Warning:' echo "RDA does not support database connection using LDAP. Run the setup \ again in\012advanced mode to provide the connection details. You \ can use the\012following command:" echo ' -SCRP -p advanced ESB',tput('off') var ($ESB_LOCAL,$flg) = (true) break } var ($flg,$old,$env,$try) = set_db($sid) break } } } } elsif $ESB_LOCAL var $flg = true elsif getSetting('ESB_SID') var ($flg,$old,$env,$try) = set_db(last) else var ($ESB_LOCAL,$flg) = (true) # Collect the repository information if $flg {debug ' Inside ESB module, gathering the repository information' report rep_info var $TTL = '---+!! Enterprise Service Bus Repository Information' var @DBG = ('',\ ' - Getting tablespace information',\ ' - Getting free space in default tablespaces for ORAESB',\ ' - Getting extents of default tablespaces for ORAESB',\ ' - Getting total number of invalid objects',\ ' - Getting list of invalid objects',\ ' - Getting total number of rows in ESB_Control table',\ ' - Getting total number of rows in ESB_Error table',\ ' - Getting total number of rows in ESB_Monitor table',\ ' - Getting ESB_Parameter table information') var @TTL = ('',\ '---+ Tablespace Information',\ '---+ Free Space in Default Tablespaces for ORAESB',\ '---+ Extents of Default Tablespaces for ORAESB',\ '---+ Total Number of Invalid Objects',\ '---+ List of Invalid Objects',\ '---+ Number of Rows in ESB_Control Table',\ '---+ Number of Rows in ESB_Error Table',\ '---+ Number of Rows in ESB_Monitor Table',\ '---+ ESB_Parameter Table Information') var @HDR = ('',\ '|*Username*|*Created*|*Default Tablespace*|*Temp Tablespace*|',\ '|*Default Tablespace*|*Free Tablespace (MiB)*|',\ '|*Tablespace Name*|*Initial Extent*|*Next Extent*|*Pct Increase*|\ *Allocation Type*|*Segment Space Management*|\ *Extent Management*|',\ '| *Count*|',\ '|*Owner*|*Object Name*|*Object Type*|*Status*|',\ '| *Count*|',\ '| *Count*|',\ '| *Count*|',\ '|*Parameter Name*|*Parameter Value*|') set $sql {SELECT '|' || " username || ' |' || " TO_CHAR(created,'DD-Mon-YYYY HH24:MI:SS') || ' |' || " default_tablespace || ' |' || " temporary_tablespace || ' |' " FROM dba_users " WHERE username = 'ORAESB'; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " tablespace_name || ' | ' || " SUM(bytes) / 1048576 || '|' " FROM dba_free_space " WHERE tablespace_name IN ( " SELECT default_tablespace " FROM dba_users " WHERE username = 'ORAESB') " GROUP BY tablespace_name " ORDER BY tablespace_name; "PROMPT ___Macro_separator(3)___ "SELECT '|' || " tablespace_name || ' | ' || " initial_extent || '| ' || " next_extent || '| ' || " pct_increase || '|' || " allocation_type || ' |' || " segment_space_management || ' |' || " extent_management || ' |' " FROM dba_tablespaces " WHERE tablespace_name IN ( " SELECT default_tablespace " FROM dba_users " WHERE username = 'ORAESB') " ORDER BY tablespace_name; "PROMPT ___Macro_separator(4)___ "SELECT '| ' || " COUNT(*) || '|' " FROM all_objects " WHERE status = 'INVALID'; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " owner || ' |' || " object_name || ' |' || " object_type || ' |' || " status || ' |' " FROM all_objects " WHERE status = 'INVALID'; "PROMPT ___Macro_separator(6)___ "SELECT '| ' || " COUNT(*) || '|' " FROM esb_control; "PROMPT ___Macro_separator(7)___ "SELECT '| ' || " COUNT(*) || '|' " FROM esb_error; "PROMPT ___Macro_separator(8)___ "SELECT '| ' || " COUNT(*) || '|' " FROM esb_monitor; "PROMPT ___Macro_separator(9)___ "SELECT '|' || " param_name || ' |' || " param_value || ' |' " FROM esb_parameter; } call separator(1) call writeSql($sql) call separator(0,'Repository Information') } # Restore the previous context if !$ESB_LOCAL {if defined($env) call setSqlSid($env) call setSqlLogin($old) call setSqlFailure($try) } =head2 Configuration Files Gathers Enterprise Service Bus-related configuration files. =cut debug ' Inside ESB module, collecting the configuration files' pretoc '2:Configuration Files' call sort_files(3,$TAIL,\ grepDir(catDir($ESB_HOME,'config'),'\.(ini|xml|esb)','p')) unpretoc 2 =head1 SEE ALSO See also L, L. =begin credits =over 10 =item RDA 4.10: Sunil Hingorani, Selva Parthasarathy. =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