The Oracle Application Server 10g Infrastructure - Writing Your Own Infrastructure Repository Log Scripts
(Page 6 of 11 )
As we just noted, the OEM viewer is great for quick online queries, but most administrators write SQL*Plus scripts to directly extract the repository log message, often e-mailing it to the desktop.

Figure 2-3. The OEM infrastructure repository log viewer
To see how this works, here is a sample Korn shell script that will extract the online repository logs for SSO and mail them to the Application Server 10g administrator:
mail_logs.ksh #!/bin/ksh
# First, we must set the environment . . . .
ORACLE_SID=iasdb
export ORACLE_SID
ORACLE_HOME=`cat /etc/oratab|grep $ORACLE_SID:|cut -f2 -
':'`
export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH
export PATH
# Get the server name
host=`uname -a|awk '{ print $2 }'`
${ORACLE_HOME}/bin/sqlplus system/`cat password.txt`<<!
spool log_rpt_mgt.1st
@sso_audit_log.sq l
spool off
exit;
!
#************************************
# Filter only error messages #************************************
grep –i error log_rpt_mgt.lst > errors_log.lst
#************************************
# Mail the Object Statistics Reports #************************************
cat error_rpt_mgt.lst|mailx -s "Oracle AS 10g Repository SSO Messages" \
larry_lizard@us.oracle.com \
raham_cracker@oracle.com \
bob_white@oracle.com
Note the password security in the SQL*Plus invocation line. You can save the SYSTEM password on your server in a file called password.txt and protect it by setting the file permissions such that only the Oracle user may view the password:
oracle> chmod 700 password.txt
oracle> ls -al *.txt
-rwx------ 1 oracle oracle 13 Aug 18 05:35 password.txt
Now that you’ve seen how easy it is to write SQL*Plus scripts against the iasdb instance, let’s take a look at the log tables and see which are the most important to the Application Server 10g administrator.
Viewing the Repository Log Tables Because Oracle has been very careful to use uniform table naming conventions, you can write a simple SQL*Plus query to see the Application Server 10g log tables. In the following listing, we select all iasdb tables that contain the string LOG.
select owner, table_name
from dba_tables
where table_name like '%LOG%';
WIRELESS PTG_LBS_LOG
PTG_DEBUG_LOG
PTG_SERVICE_LOG
PTG_SESSION_LOG
TRANS_REQUEST_LOG
TRANS_HANDLE_LOG
TRANS_PROCESS_LOG
TRANS_ENQUEUE_LOG
TRANS_DEQUEUE_LOG
ASYNC_STATISTICS_LOG
MESSAGING_OUTGOING_LOG
LBEVENT_ENQUEUE_LOG
LBEVENT_DEQUEUE_LOG
LBEVENT_MSG_LOG
LBEVENT_ACTIVATION_LOG
STUDIO_LOG MESSAGES
PROVISIONING_TRANSACTION_LOG
BILLING_SDR_LOG
SYS_LOGGER_TABLE
WWSEC_SSO_LOG$
OWF_MGR ECX_OUTBOUND_LOGS
ECX_DOCLOGS
ECX_EXTERNAL_LOGS
ECX_OXTA_LOGMSG
ECX_INBOUND_LOGS
ECX_MSG_LOGS
IP TIP_ERRORLOGINSTANCE_T_AUD
ERRORLOGRECORDDATA_AUD
TIP_ERRORLOGINSTANCE_RT
TIP_ERRORLOGRECORDDATAINSTA_RT
TIP_RTLOG
B2BERROR_LOG
The output shows each of the iasdb schemas and their associated log tables. Remember, not all of the log tables are populated with meaningful information, so you must carefully examine each log file to see the contents.
Next: Infrastructure Log Reports >>
More Oracle Articles
More By McGraw-Hill/Osborne
|
This article is excerpted from chapter two of Oracle Application Server 10g Administration Handbook by John Garmany and Donald Burleson(McGraw-Hill/Osborne, 2004; ISBN: 0072229586). Check it out at your favorite bookstore. Buy this book now.
|
|