# OIDinfo.def: Collects Generic Oracle Internet Directory Information # $Id: OIDinfo.def,v 1.10 2009/08/05 12:41:58 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/OIDinfo.def,v 1.10 2009/08/05 12:41:58 mschenke Exp $ # # Change History # 20090804 MSC Improve the documentation. =head1 NAME OIDinfo - Collects Generic Oracle Internet Directory Information =head1 DESCRIPTION This module collects generic Oracle Internet Directory information. =cut # Initialization var ($AS11) = @arg import $LDAP_HOME,$ORACLE_HOME,$TOC,$TOP var $OID_LOCAL = getSetting('OID_LOCAL') var $OID_USER = 'ODS' # Load the common macros run DBinfo() # Change the database context if $OID_LOCAL var $sid = getSetting('ORACLE_SID') elsif getSetting('OID_SID') var $sid = trim(last,'-') if $sid {# Determine the user password if hasSqlPassword($OID_USER,$sid) var $pwd = undef else var $pwd = askPassword(concat('Enter ',$OID_USER,'@',$sid,' user password:')) # Switch the context var $log = setSqlLogin($OID_USER,$pwd,$sid) var $try = setSqlFailure(0) } else {# Disable the database access var $log = setSqlLogin('','') var $try = setSqlFailure(-1) } # Test the database connection if testSql() {echo '' echo tput('bold'),'The schema containing the OID repository is not \ accessible.',tput('off') echo tput('bold'),'Therefore RDA cannot collect repository information.',\ tput('off') if getSqlMessage() echo last echo '' } else var $DB_ACCESS = true =head2 oid_diag - OIDDIAG Output Displays the output of the F command. =cut if getSetting('OID_DIAG') {var $cmd = undef if findCommand('oiddiag') var $cmd = last elsif grepDir(catDir($LDAP_HOME,'bin'),'oiddiag','fip') var $cmd = catCommand(last) if $cmd {var $tmp = getTemp('oid','.txt') var $txt = getTemp('oiddiag','.txt') var $out = quote($txt,'x') debug ' Inside OID module, executing the OIDDIAG command' if compare('eq',$out,$txt) output P,concat($cmd,' collect_all=true outfile=',$out,' >',quote($tmp,'x')) else output P,concat($cmd,' collect_all=true >',quote($tmp,'x')) write getSetting('OID_DB_HOST') write getSetting('OID_DB_PORT') write getSetting('OID_SERVICE_NAME') write $pwd if $AS11 {write 'N' write 'N' } close report oid_diag prefix {write '---+!! OIDDIAG Command Output' write '---## Using: ',encode($cmd),' collect_all=true' } if grepFile($tmp,'^Done\! the output file is\s+(.*)\s*$') {var ($lin) = chomp(last) if match($lin,'^Done\! the output file is\s+(.*?)\s*$') call writeFile(last) } else call writeFile($tmp) call unlinkTemp('oid') call unlinkTemp('oiddiag') if isCreated(true) toc '2:[[',getFile(),'][rda_report][OIDDIAG Output]]' } } =head2 oidctl - OIDCTL Status Displays the C status. =cut var $chk = true if findCommand('oidctl') {var $cmd = concat(last,' connect=',$sid,' status 2>&1') debug ' Inside OID module, getting the OIDCTL status' report oidctl prefix {write '---+!! OIDCTL Status' write '---## Using: ',encode($cmd) } if loadCommand($cmd) {call writeLastFile() var $chk = false } if isCreated(true) toc '2:[[',getFile(),'][rda_report][OIDCTL Status]]' } =head2 ldapcheck - ldapcheck Displays the output of the command C<$ORACLE_HOME/ldap/bin/ldapcheck> when it encounters a problem for getting the C status. =cut if $chk {if isWindows() var $fil = catFile($ORACLE_HOME,'ldap','bin','ldapcheck.exe') else var $fil = catFile($ORACLE_HOME,'ldap','bin','ldapcheck') if testFile('x',$fil) {debug ' Inside OID module, getting the ldapcheck command output' report ldapcheck prefix {write '---+!! ldapcheck command output' write '---## Using: ',encode($fil) } if loadCommand($fil) call writeLastFile() if isCreated(true) toc '2:[[',getFile(),'][rda_report][ldapcheck]]' } } =head2 process - Processes Displays the information about processes. On Windows, RDA gets the processes only if the tasklist command is available. =cut debug ' Inside OID module, gathering information about processes' report process var $TTL = '---+!! Processes' if isUnix() {var $OSP = testCommand('ps -ef','/bin/ps -ef','/usr/bin/ps -ef') prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ OID Processes' write '' } loop $lin (grepCommand($OSP,'\boid\w')) write $lin if hasOutput(true) {write '' write $TOP } prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ DIP Processes' write '' } loop $lin (grepCommand($OSP,'\bodi\w')) write $lin if hasOutput(true) {write '' write $TOP } } elsif isWindows() {if findCommand('tasklist') {var $cmd = last prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ OID Processes' write '' } loop $lin (grepCommand(concat($cmd,' /V'),'^oid','i')) write $lin if hasOutput(true) {write '' write $TOP } prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ DIP Processes' write '' } loop $lin (grepCommand(concat($cmd,' /V'),'^odi','i')) write $lin if hasOutput(true) {write '' write $TOP } } } if !$AS11 {if isWindows() var $fil = catFile($ORACLE_HOME,'opmn','bin','opmnctl.exe') else var $fil = catFile($ORACLE_HOME,'opmn','bin','opmnctl') if testFile('x',$fil) {var $cmd = concat($fil,' status') prefix {if $TTL {write $TTL write $TOC var $TTL = undef } write '---+ ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Processes]]' var $TTL = undef =head2 ods_process - ODS Process Information Lists details from the C table on OID 11g, or from the C table in earlier versions. =cut if $DB_ACCESS {debug ' Inside OID module, gathering ODS process information' report ods_process prefix {write '---+!! ',uc($tbl) write $hdr } if $AS11 var ($tbl,$flg) = ('ods_process_status',true) else {var ($tbl,$flg) = ('ods_process',\ getSqlColumns('RDA','','ODS_PROCESS','failedhost')) call clearSqlColumns('RDA') } if $flg {var $hdr = '| *Instance*| *Process ID*| *Server ID*|*Flags*|*Hostname*| \ *ConfigSet*| *State*|*Last Wake Time*| *Retry Count*|\ *Failed Host*|' set $sql {SELECT '| ' || " instance || '| ' || " pid || '| ' || " serverid || '|' || " flags || ' |' || " hostname || ' | ' || " configset || '| ' || " state || '|' || " TO_CHAR(lastwaketime,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " retrycount || '|' || " NVL(failedhost,'%NULL%') || ' |' " FROM :1; } } else {var $hdr = '| *Instance*| *Process ID*| *Server ID*|*Flags*|*Hostname*| \ *ConfigSet*| *State*|*Last Wake Time*| *Retry Count*|' set $sql {SELECT '| ' || " instance || '| ' || " pid || '| ' || " serverid || '|' || " flags || ' |' || " hostname || ' | ' || " configset || '| ' || " state || '|' || " TO_CHAR(lastwaketime,'DD-Mon-YYYY HH24:MI:SS') || ' | ' || " retrycount || '|' " FROM :1; } } call writeSql(bindSql($sql,$tbl)) if getSqlMessage() write last if isCreated(true) toc '2:[[',getFile(),'][rda_report][ODS Process Information]]' =head2 attrstore - DS_ATTRSTORE table Information Lists details from C table. =cut debug ' Inside OID module, gathering details from ds_attrstore table' report attrstore var $TTL = '---+!! DS_ATTRSTORE Table Information' var @TTL = ('',\ '---+ Default LDAP Settings',\ '---+ Other LDAP Settings',\ '---+ Default Replication Settings',\ '---+ Other Replication Settings',\ '---+ DIP Information - Profile Information',\ '---+ DIP Information - Default Profiles',\ '---+ DIP Information - DIP Configuration') var @HDR = ('',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|',\ '|*Entry ID*|*Name*|*Value*|*Kind*|*Version*|*Type*|') set $sql {SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=configset0,' || " '%cn=osdldapd,' || " '%cn=subconfigsubentry%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(2)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=osdldapd,%cn=subconfigsubentry%' " AND attrval NOT LIKE '%cn=configset0,%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(3)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=configset0,' || " '%cn=osdrepld,' || " '%cn=subconfigsubentry%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(4)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=osdrepld,%cn=subconfigsubentry%' " AND attrval NOT LIKE '%cn=configset0,%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(5)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=metadird,' || " '%cn=configsets,' || " '%cn=oracle internet directory%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(6)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=provisioning profiles,' || " '%cn=changelog subscriber,' || " '%cn=oracle internet directory%') " ORDER BY entryid,attrname; "PROMPT ___Macro_separator(7)___ "SELECT '[[[' || CHR(10) || '|' || " entryid || '|' || " attrname || ' |' || " REPLACE(REPLACE(attrval,'%','%'),CHR(10),'%BR%') || ' |' || " attrkind || ' |' || " NVL(attrver,'%NULL%') || ' |' || " NVL(attrstype,'%NULL%') || ' |' || " CHR(10) || ']]]' " FROM ds_attrstore " WHERE entryid IN ( " SELECT entryid " FROM ds_attrstore " WHERE attrname IN ('orclentrydn','orclnormdn') " AND attrval LIKE '%cn=odi,%cn=oracle internet directory%') " ORDER BY entryid,attrname; } call separator(1) call writeSql($sql) call separator(0,'DS_ATTRSTORE Table Information') } # Restore the previous context call setSqlLogin($log) call setSqlFailure($try) pretoc '2:Configuration and Log Files' =head2 odiprop - $OH/ldap/odi/conf/odi.properties Displays the contents of the F<$ORACLE_HOME/ldap/odi/conf/odi.properties> file. =cut debug ' Inside OID module, displaying the file \ $OH/ldap/odi/conf/odi.properties' var $dir = catDir($ORACLE_HOME,'ldap','odi','conf') var $fil = catFile($dir,'odi.properties') if testFile('r',$fil) {report odiprop write '---+!! Contents of ',encode($fil) if !writeFile($fil) {write '**',encode($fil),' not readable.**%BR%\ May be file permission problems.%BR%\ Permissions are:%BR%' call statFile('b',$fil) write 'User: ',id(),'%BR%' } toc '3:[[',getFile(),'][rda_report][$OH/ldap/odi/conf/odi.properties]]' } =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.4: Wes Root. =item RDA 4.9: Irina Donaldson, Anita Hegde, Satheesan Vettahil. =item RDA 4.12: Raju Channabasappa, Wes Root, Jerry Smith, Satheesan Vettahil. =item RDA 4.15: Greg Cook, Wes Root, Andrew Salt, Ram Sathyanarayan, Hector Viveros. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2009, 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