Saturday, June 23, 2012

BOUNCING THE MOBILE APPLICATION SERVER IN E-BUSINESS SUITE


Mobile Application Server - Version: 11.5.9 to 12.0.5

BOUNCING THE MOBILE APPLICATION SERVER FOR INDUSTRIAL APPLICATIONS


It is advisable to bounce the Mobile Application Server(s) at predefined intervals, so that active database sessions can be refreshed, and possible defects that might occur due to caching can be avoided.
Solution

Mobile Application Server for Industrial Applications can be used in conjunction with a software/hardware dispatcher for load balancing purposes. In this case, multiple servers are active and bouncing should take care of maintaining continuity of active user sessions; users who are logged in should not loose their connection. Steps required in bouncing can be summarized as follows:

. Start new servers on ports different than currently running servers using the mwactl utility, i.e. "mwactl.sh start port"

. Register new servers with the dispatcher

· Notify the dispatcher to stop accepting new connections for servers that are to be stopped

· Send graceful stop command to each of the servers that are to be stopped using the mwactl utility, i.e. "mwactl.sh -login mfg/welcome -stop port". (Refer to the Installation Guide for more information about shutting down servers gracefully)

When the Mobile Application Server is stopped gracefully, server process does not terminate until current users logout (or zombie sessions timeout). Hence, on a system that has to be up 24x7, Mobile Application Server should be stopped gracefully to provide a transparent transition for active users. As explained in the steps above, dispatcher should be aware of this process, and it should not send new sessions to servers that are being shutdown.

The Mobile Application Server Dispatcher has features to provide smooth transitioning for bouncing. First of all, every Mobile Application Server process that is brought up knows how to find the dispatcher (using mwa.cfg) and registers itself with the dispatcher after a successful start. Likewise, each server notifies the dispatcher as they get a graceful stop signal, which prevents the dispatcher from sending new sessions to these servers. Therefore, bouncing steps can be accomplished by a script, which would start the new servers first, and then stop the old ones gracefully. Since servers that are started should have different port numbers than servers that are in the process of shutting down, this script should also take care of alternating between two sets of port numbers. Please note that the Mobile Applications Server reserves two ports in case of a successful start; specified port (n), and n+1, i.e. if the server is started on port 10252, Mobile Application Server also reserves 10253 for administration purposes (Server Manager Listener is using this extra port), so you can not start another server on 10253. Running this script as a cron job (at specified intervals by the crontab file) would achieve the task of bouncing Mobile Application Servers on a regular basis.

In case of using a hardware dispatcher, each of these steps has to be executed manually. As explained above, after starting the new server, you should add these servers to the dispatcher routing table (Please consult your Dispatcher manual for instructions on how to modify your routing table). Dispatcher routing table should also be modified not to send new sessions to servers that are to be stopped. Finally, you should send graceful stop signals to servers that should be stopped. Once again, these steps can be accomplished by a script, which will run as a cron job.

To give an example, say your business runs 3 concurrent Mobile Application Servers, and you want to bounce these servers everyday at 6:00 a.m. (GMT). In this case you will have to allocate 12 ports ( 2 sets of 6 ports) for the Mobile Application Server. At least 6 of these ports will be active at any time 3 for Mobile Application Servers, 3 for Server Manager Listeners), and all of them will be used at bounce time. Assume the following sets are used: (10252, 10253, 10254, 10255, 10256, 10257) and (10258, 10259, 10260, 10261, 10262, 10263). The first time servers are started, bouncing script can use the first set, so you should be executing mwactl.sh 3 times with the following syntax:

mwactl.sh start 10252
mwactl.sh start 10254
mwactl.sh start 10256

Once again, please note that, 10253, 10255, 10257 will be allocated by these servers! The next morning, you should complete the following steps:

· Start new servers on the inactive set (which is the second set) using the following:
o mwactl.sh start 10258
o mwactl.sh start 10260
o mwactl.sh start 10262
· If you are using the hardware dispatcher, modify the routing tables to register these servers (running on ports 10258, 10260, 10262) with the dispatcher. Remember that, this step is not required if you are using
the the Mobile Application Server Dispatcher.
· If you are using the hardware dispatcher, modify the routing table so that the dispatcher won't accept new connections on the set that is to be stopped (running on ports 10252, 10254, 10256). Remember that, this step is not required if you are using the the Mobile Application Server Dispatcher.
· Stop the servers that need to be stopped gracefully (running on ports 10252,10254, 10256) using the following:
o mwactl.sh -login appsuser/appspassword stop 10252
o mwactl.sh -login appsuser/appspassword stop 10254
o mwactl.sh -login appsuser/appspassword stop 10256

If you want to implement this in a shell script, you can cycle between the port sets by creating a dummy file as follows:

· Check if foo.1 exists, if so remove foo.1, create foo.2 and use port set 2.
· Check if foo.2 exists, if so remove foo.2, create foo.1 and use port set 1
· If both of them do not exist, default to use port set 1

The following sample script illustrates how this can be done.

Note : This script does not check for all possible failures and is forcefully stopping the MWA Servers so logged in users would be disconnected. This should normally be scheduled to run during inactive hours like midnight or on holidays when there wouldn't be active users on the system. TMPDIR can be set to any temporary writable directory location

#!/bin/ksh
export TMPDIR=/usr/tmp
ulimit -n 1024

if [ -f $TMPDIR/foo.1 ]
then

rm -f $TMPDIR/foo.1
touch $TMPDIR/foo.2

#activate servers with port set 2
nohup $MWA_TOP/bin/mwactl.sh start 10258 >> /dev/null 2>&1 &
echo "Starting 10258 server"
nohup $MWA_TOP/bin/mwactl.sh start 10260 >> /dev/null 2>&1 &
echo "Starting 10260 server"
nohup $MWA_TOP/bin/mwactl.sh start 10262 >> /dev/null 2>&1 &
echo "Starting 10262 server"

#stop existing servers
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10252 >> /dev/null 2>&1 &
echo "Stopping 10252 server"
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10254 >> /dev/null 2>&1 &
echo "Stopping 10254 server"
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10256 >> /dev/null 2>&1 &
echo "Stopping 10256 server"

else
if [ -f $TMPDIR/foo.2 ]
then

rm -f $TMPDIR/foo.2
touch $TMPDIR/foo.1

#activate servers with port set 1
nohup $MWA_TOP/bin/mwactl.sh start 10252 >> /dev/null 2>&1 &
echo "Starting 10252 server"
nohup $MWA_TOP/bin/mwactl.sh start 10254 >> /dev/null 2>&1 &
echo "Starting 10254 server"
nohup $MWA_TOP/bin/mwactl.sh start 10256 >> /dev/null 2>&1 &
echo "Starting 10256 server"

#stop existing servers
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10258 >> /dev/null 2>&1 &
echo "Stopping 10258 server"
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10260 >> /dev/null 2>&1 &
echo "Stopping 10260 server"
nohup $MWA_TOP/bin/mwactl.sh -login mfg/welcome stop_force 10262 >> /dev/null 2>&1 &
echo "Stopping 10262 server"
fi

fi

exit

Regards
Manoj

Source: NOTE:198543.1    



Title:              How To Rebounce the Mobile Application Server for
                    Industrial Applications v1.0.8



1. Responsibilities Listing
2. Menus Listing
3. Submenu and Function Listing
4. User and Assigned Responsibility Listing
5. Responsibility and assigned request group listing
6. Profile option with modification date and user
7. Forms personalization Listing
8. Patch Level Listing
9. Request attached to responsibility listing
10. Request listing application wise
11. Count Module Wise Reports
12. Request Status Listing
13. User and responsibility listing
14. Applied Patch Listing




//*
1. Responsibilities Listing
Purpose/Description:
Retrieve a list of all responsibilities.
Parameters
None
*//

SELECT
    (SELECT application_short_name
        FROM fnd_application fa
        WHERE fa.application_id = frt.application_id)
    application
,   frt.responsibility_id
,   frt.responsibility_name
FROM apps.fnd_responsibility_tl frt;



//*
2. Menus Listing
Purpose/Description:
To see the Menus associated with a given responsibility
Parameters
responsibility_id that you can retrieve from query nr 1 (Responsibilities Listing)
*//

SELECT DISTINCT
    a.responsibility_name
,   c.user_menu_name
FROM
    apps.fnd_responsibility_tl a
,   apps.fnd_responsibility b
,   apps.fnd_menus_tl c
,   apps.fnd_menus d
,   apps.fnd_application_tl e
,   apps.fnd_application f
WHERE
    a.responsibility_id(+) = b.responsibility_id
AND a.responsibility_id = 50103
AND b.menu_id = c.menu_id
AND b.menu_id = d.menu_id
AND e.application_id = f.application_id
AND f.application_id = b.application_id
AND a.LANGUAGE = ‘US’;



//*
3. Submenu And Function Listing
Purpose/Description:
By using this query you can check function and submenus attached to a specific menu
Parameters
User_menu_name that you can get by running query 2 (Menu Listing)
*//

SELECT
    c.prompt
,   c.description
FROM
    apps.fnd_menus_tl a
,   fnd_menu_entries_tl c
WHERE
    a.menu_id = c.menu_id
AND a.user_menu_name = ‘Navigator Menu - System Administrator GUI’;



//*
4.User and Assigned Responsibility Listing
Purpose/Description:
You can use this query to check responsibilities assigned to users.
Parameters
None
*//
   
SELECT UNIQUE
    u.user_id
,   SUBSTR (u.user_name, 1, 30) user_name
,   SUBSTR (r.responsibility_name, 1, 60) responsiblity
,   SUBSTR (a.application_name, 1, 50) application
FROM
    fnd_user u
,   fnd_user_resp_groups g
,   fnd_application_tl a
,   fnd_responsibility_tl r
WHERE
    g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY
    SUBSTR (user_name, 1, 30)
,   SUBSTR (a.application_name, 1, 50)
,   SUBSTR (r.responsibility_name, 1, 60);



//*
5. Responsibility and assigned request group listing
Purpose/Description:
To find responsibility and assigned request groups.
Every responsibility contains a request group (The request group is basis of submitting requests)
Parameters
None
*//

SELECT
    responsibility_name responsibility
,   request_group_name
,   frg.description
FROM
    fnd_request_groups frg
,   fnd_responsibility_vl frv
WHERE
    frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name



//*
6. Profile option with modification date and user
Purpose/Description:
Query that can be used to audit profile options.
Parameters
None
*//

SELECT
    t.user_profile_option_name
,   profile_option_value
,   v.creation_date
,   v.last_update_date
,   v.creation_date - v.last_update_date "Change Date"
,   (SELECT UNIQUE user_name
        FROM fnd_user
        WHERE user_id = v.created_by) "Created By"
,   (SELECT user_name
        FROM fnd_user
        WHERE user_id = v.last_updated_by) "Last Update By"
FROM
    fnd_profile_options o
,  fnd_profile_option_values v
,   fnd_profile_options_tl t
    WHERE
        o.profile_option_id = v.profile_option_id
    AND o.application_id = v.application_id
    AND start_date_active <= SYSDATE
    AND NVL (end_date_active, SYSDATE) >= SYSDATE
    AND o.profile_option_name = t.profile_option_name
    AND level_id = 10001
    AND t.LANGUAGE IN (SELECT language_code
    FROM fnd_languages
WHERE installed_flag = ‘B’
UNION
    SELECT nls_language
    FROM fnd_languages
    WHERE installed_flag = ‘B’)
ORDER BY user_profile_option_name;



//*
7. Forms personalization Listing
Purpose/Description:
To get modified profile options.
Personalization is a feature available in 11.5.10.X.
Parameters
None
*//

SELECT
    ffft.user_function_name "User Form Name"
,   ffcr.SEQUENCE
,   ffcr.description
,   ffcr.rule_type
,   ffcr.enabled
,   ffcr.trigger_event
,   ffcr.trigger_object
,   ffcr.condition
,   ffcr.fire_in_enter_query
,   (SELECT user_name
        FROM fnd_user fu
        WHERE fu.user_id = ffcr.created_by) "Created By”
FROM
    fnd_form_custom_rules ffcr
,   fnd_form_functions_vl ffft
WHERE ffcr.ID = ffft.function_id
ORDER BY 1;



//*
8. Patch Level Listing
Purpose/Description:
Query that can be used to view the patch level status of all modules
Parameters
None
*//

SELECT
    a.application_name
,   DECODE (b.status, ‘I’, ‘Installed’, ‘S’, ‘Shared’, ‘N/A’) status
,   patch_level
FROM
    apps.fnd_application_vl a
,   apps.fnd_product_installations b
WHERE
    a.application_id = b.application_id;
 



//*
9. Request attached to responsibility listing
Purpose/Description:
To see all requests attached to a responsibility
Parameters
None
*//

SELECT
    responsibility_name
,   frg.request_group_name
,   fcpv.user_concurrent_program_name
,  fcpv.description
FROM
    fnd_request_groups frg
,   fnd_request_group_units frgu
,   fnd_concurrent_programs_vl fcpv
,   fnd_responsibility_vl frv
WHERE
    frgu.request_unit_type = ‘P’
AND frgu.request_group_id = frg.request_group_id
AND frgu.request_unit_id = fcpv.concurrent_program_id
AND frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name;



//*
10. Request listing application wise
Purpose/Description:
View all request types application wise
Parameters
None
*//

SELECT
    fa.application_short_name
,   fcpv.user_concurrent_program_name
,   description
,   DECODE (fcpv.execution_method_code
            ,’B', ‘Request Set Stage Function’
            ,’Q', ‘SQL*Plus’
            ,’H', ‘Host’
            ,’L', ‘SQL*Loader’
            ,’A', ‘Spawned’
            ,’I', ‘PL/SQL Stored Procedure’
            ,’P', ‘Oracle Reports’
            ,’S', ‘Immediate’
            ,fcpv.execution_method_code) exe_method
,   output_file_type
,   program_type
,   printer_name
,   minimum_width
,   minimum_length
,   concurrent_program_name
,   concurrent_program_id
FROM
    fnd_concurrent_programs_vl fcpv
,   fnd_application fa
WHERE
    fcpv.application_id = fa.application_id
ORDER BY description



//*
11. Count Reports per module
Purpose/Description:
To Count Reports
Parameters
None
*//

SELECT
    fa.application_short_name
,   DECODE (fcpv.execution_method_code
    ,’B', ‘Request Set Stage Function’
    ,’Q', ‘SQL*Plus’
    ,’H', ‘Host’
    ,’L', ‘SQL*Loader’
    ,’A', ‘Spawned’
    ,’I', ‘PL/SQL Stored Procedure’
    ,’P', ‘Oracle Reports’
    ,’S', ‘Immediate’
    ,fcpv.execution_method_code) exe_method
,   COUNT (concurrent_program_id) COUNT
FROM
    fnd_concurrent_programs_vl fcpv
,   fnd_application fa
WHERE
    fcpv.application_id = fa.application_id
GROUP BY
    fa.application_short_name
,   fcpv.execution_method_code
ORDER BY 1;



//*
12. Request Status Listing
Purpose/Description:
This query returns report/request processing time
Parameters
None
*//

SELECT
    f.request_id
,   pt.user_concurrent_program_name user_concurrent_program_name
,   f.actual_start_date actual_start_date
,   f.actual_completion_date actual_completion_date
,   floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)
    || ‘ HOURS ‘ ||
    floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
    floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)
    || ‘ MINUTES ‘ ||
    round((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
    floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 -
    (floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -
    floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))
    || ‘ SECS ‘ time_difference
,   DECODE(p.concurrent_program_name
    ,’ALECDC’
    ,p.concurrent_program_name||’['||
     f.description||']‘
    ,p.concurrent_program_name) concurrent_program_name
,   decode(f.phase_code
    ,’R',’Running’
    ,’C',’Complete’
    ,f.phase_code) Phase
, f.status_code
FROM
    apps.fnd_concurrent_programs p
,   apps.fnd_concurrent_programs_tl pt
,   apps.fnd_concurrent_requests f
WHERE
    f.concurrent_program_id = p.concurrent_program_id
AND f.program_application_id = p.application_id
AND f.concurrent_program_id = pt.concurrent_program_id
AND f.program_application_id = pt.application_id
AND pt.language = USERENV(’Lang’)
AND f.actual_start_date is not null
ORDER by f.actual_completion_date-f.actual_start_date desc;



//*
13. User and responsibility listing
Purpose/Description:
Check responsibilities assigned to users
Parameters
None
*//

SELECT UNIQUE
    u.user_id
,   SUBSTR (u.user_name, 1, 30) user_name
,   SUBSTR (r.responsibility_name, 1, 60) responsiblity
,   SUBSTR (a.application_name, 1, 50) application
FROM
    fnd_user u
,   fnd_user_resp_groups g
,   fnd_application_tl a
,   fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
–AND a.application_name like ‘%Order Man%’
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60)



//*
14. Applied Patch Listing
Purpose/Description:
Check Current Applied Patches
Parameters
None
*//

SELECT
    patch_name
,   patch_type
,   maint_pack_level
,   creation_date
FROM applsys.ad_applied_patches
ORDER BY creation_date DESC



=================================
CM: jvm size of concurrent queues
=================================
select DEVELOPER_PARAMETERS from FND_CP_SERVICES
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
============
to increase
============
update FND_CP_SERVICES
set DEVELOPER_PARAMETERS =
'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx1024m'
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');



===========================================
Workflow: To see failed, open notifications
===========================================
SELECT message_type, COUNT(1)
FROM apps.wf_notifications
WHERE 1 = 1 AND mail_status = 'FAILED' AND status = 'OPEN'
GROUP BY message_type;


================
SQL: patch level
================
set linesize 155;
set pagesize 200;
set verify off;
select b.bug_number bug, b.creation_date credate, b.last_update_date ldate,
decode(bug_number,
2728236, 'OWF.G',
3031977, 'POST OWF.G ROLLUP 1 - 11.5.9.1',
3061871, 'POST OWF.G ROLLUP 2 - 11.5.9.2',
3124460, 'POST OWF.G ROLLUP 3 - 11.5.9.3',
3316333, 'POST OWF.G ROLLUP 4 - 11.5.9.4.1',
3314376, 'POST OWF.G ROLLUP 5 - 11.5.9.5',
3409889, 'POST OWF.G ROLLUP 5 Consolidated Fixes',
3492743, 'POST OWF.G ROLLUP 6 - 11.5.9.6',
3672076, 'POST OWF.G ROLLUP 6.1',
3868138, 'POST OWF.G ROLLUP 7',
3258819, 'OWF.H',
3262159, 'FND.H',
3140000, '11.5.10',
3240000, '11.5.10 CU1',
4017300, '11.5.10 Consolidated Update (CU1) for ATG Product Family',
3460000, '11.5.10 CU2',
4125550, '11.5.10 Consolidated Update (CU2) for ATG Product Family',
4605136, 'WFDS 4.5 rollup FOR 11.5.10, 11.5.10.1, 11.5.10.2',
4645579, 'WFDS 4.5 v2 (replaces 4605136) FOR FND.H',
4684377, 'ONE OFF MISSING RESPONSIBILITIES PATCH',
4334965, '11.5.10 Consolidated Update (CU3) for ATG Product Family') Patch
from APPS.AD_BUGS b
where b.BUG_NUMBER in
('2728236','3031977','3061871','3124460','3316333',
'3314376','3409889','3492743','3672076','3868138',
'3258819','3262159','3140000','3240000','4017300',
'3460000','4125550','4605136','4645579','4684377',
'4334965')
order by bug_number desc;

=================
Workflow: version
=================
$FND_TOP/sql/wfver.sql


========================
Enable low level logging
========================
How to turn on the debugging:
Set the following profiles:
 FND: Debug Log Enabled = YES
 FND: Debug Log Filename = NULL
 FND: Debug Log Level = STATEMENT (most detailed log)
 FND: Debug Log Module = % or ar% or even ar.arp_auto_rule%

If you have applied Patch 3140000 - 11.5.10 MAINTENANCE PACK, the profile names have changed:
'FND: Debug Log Enabled' been replaced by 'FND: Log Enabled'
and 'FND: Debug Log Level' has been replaced by 'FND: Log Level

If FND: Debug Log Enabled profile is not set, then rest of the others won't matter.


============================================
To check the what is installed on what nodes
===========================================
select node_name, status,  support_cp "cp", support_web "web", support_forms "frm", support_db "db" from apps.fnd_nodes;

============================================
Summary of how many users -- 10g As oacore
============================================

REM
    REM        START OF SQL
    REM
    set feedback on
    set timing on
    set echo on
    set feedback on
    set pagesize 132
    set linesize 80
    col user_name format a15
    col first_connect format a18
    col last_connect format a18
    col How_many_user_sessions format 9999999999
    col How_many_sessions format 9999999999
    REM
    REM SQL 1
    REM Summary of how many users
    REM
    select 'Number of user sessions : ' || count( distinct session_id) How_many_user_sessions
    from icx_sessions icx
    where last_connect > sysdate - 1
    and disabled_flag != 'Y'
    and PSEUDO_FLAG = 'N'


===========================================
check JOC patch's
===========================================
select bug_number, last_update_date from ad_bugs where bug_number in ('5726582','5639951','5455628','5468797','5215394');


=====================
Check current sysdate
=====================
SELECT TO_CHAR(SYSDATE,'MM/DD/YYYY HH:MM:SS AM')
       "Today's Date and Time" from DUAL;

===============================
Enable Apache and Jserv logging
===============================


Jserv
 Modify $ORACLE_HOME/Apache/Jserv/etc/jserv.properties
 Make sure the log switch is set to true. Can also specify the location
 of the jserv log file if so desired:

      log=true
      log.timestamp=true
      log.file=<path to jserv log file>/jserv.log
      log.channel.servletException=true
      log.channel.jservException=true
      log.channel.warning=true
      log.channel.servletLog=true
      log.channel.critical=true

Apache
# LogLevel: Control the number of messages logged to the error_log.
   # Possible values: debug,info,notice,warn,error,crit,alert,emerg
     Loglevel warn


=================================================================
Session info: high cpu consumption spid session info
=================================================================
set verify off
set echo off
set head off
set pages 1000
PROMPT Enter SPID :
ACCEPT 1
  select 'SID............ : ' || a.sid
|| chr(10) ||
         'SERIAL#........ : ' || a.serial#
|| chr(10) ||
         'USERNAME....... : ' || a.username
|| chr(10) ||
         'COMMAND........ : ' || a.command
|| chr(10) ||
         'STATUS......... : ' || a.status
|| chr(10) ||
         'Machine........ : ' || a.machine
|| chr(10) ||
         'Terminal....... : ' || a.terminal
|| chr(10) ||
         'Program........ : ' || a.program
|| chr(10) ||
         'Module........ : ' || a.module
|| chr(10) ||
         'SQL Hash Value. : ' || a.sql_hash_value
|| chr(10) ||
         'Logon Time..... : ' || to_char(a.logon_time,'DD-Mon-YYYY HH:MI:SS')
|| chr(10) ||
         'Last Call Et... : ' || a.last_call_et
|| chr(10) ||
         'Process ID..... : ' || a.process
|| chr(10) ||
         'SPID........... : ' || b.spid
  from   v$session a, v$process b
  where  a.paddr=b.addr     and b.spid='&1';
  PROMPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  PROMPT  Process ID is  process col. in v$session table.
  PROMPT  SPID       is  spid    col. in v$process table.
  PROMPT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  select 'Session Waiting for event...: ' || event
  from    v$session_wait
  where   sid=(select sid from v$session a, v$process b where  a.paddr=b.addr
  and b.spid='&1');
  PROMPT  SQL STATEMENT :
  PROMPT  ===============
  select sql_text
  from   v$sqltext
  where  hash_value=(select sql_hash_value from v$session a, v$process b where
a.paddr=b.addr  and b.spid='&1')
  order  by piece;
==============================================


Solaris Command Reference
HD info(vendor, RPM, capacity)

iostat -E

sd0     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: SEAGATE  Product: ST34371W SUN4.2G Revision: 7462 Serial No: 9742K71685
RPM: 7200 Heads: 16 Size: 4.29GB <4292075520 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

sd1     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: SEAGATE  Product: ST32171W SUN2.1G Revision: 7462 Serial No: 9736T74649
RPM: 5400 Heads: 19 Size: 2.13GB <2127708160 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 3 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

sd6     Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
Vendor: TOSHIBA  Product: XM5701TASUN12XCD Revision: 0997 Serial No: 04/09/97
RPM: 0 Heads: 0 Size: 18446744073.71GB <-8589934591 bytes>
Media Error: 0 Device Not Ready: 3 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

Display the number of used and free i-nodes

df -F ufs -o i

Filesystem             iused   ifree  %iused  Mounted on
/dev/dsk/c0t3d0s0      38555  403045     9%   /
/dev/dsk/c0t1d0s0     160761  345607    32%   /export/home
/dev/md/dsk/d20       149826 1905214     7%   /usr/local
impulse:/home/dxy[4:07pm] /usr/ucb/df -i
Filesystem             iused   ifree  %iused  Mounted on
/dev/dsk/c0t3d0s0      38555  403045     9%   /
/dev/dsk/c0t1d0s0     160761  345607    32%   /export/home
/dev/md/dsk/d20       149826 1905214     7%   /usr/local
impulse:/home/dxy[4:07pm]

Display processes with the highest CPU utilization

ps -eo pid,pcpu,args | sort +1n

Display processes with the highest memory usage

ps -eo pid,vsz,args | sort +1n

Printing disk geometry and partition info

 prtvtoc /dev/rdsk/c0t0d0s0

* /dev/rdsk/c0t0d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*     135 sectors/track
*      16 tracks/cylinder
*    2160 sectors/cylinder
*    3882 cylinders
*    3880 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0   7855920   7855919   /usr/local
       1      3    01    7855920    524880   8380799
       2      5    00          0   8380800   8380799

Checking whether it's running in 32-bit mode or 64-bit mode

64-bit mode


% isalist -v 
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

% isainfo -v
64-bit sparcv9 applications
32-bit sparc applications

32-bit mode

% isalist -v
sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc

% isainfo -v
32-bit sparc applications

Verifying a route to a specified network

# route -n get xxx.yyy.zzz.0
   route to: xxx.yyy.zzz.0
destination: default
       mask: default
    gateway: xxx.yyy.aaa.254
  interface: hme0
      flags:
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0
#

print the version of OBP

% prtconf -V
OBP 3.3.2 1996/06/28 08:43

% /usr/platform/`uname -i`/sbin/prtdiag -v | grep OBP
  OBP 3.11.1 1997/12/03 15:53   POST 3.11.4 1997/05/27 02:26
%

{2} ok .version
Release 3.23 Version 1 created 1999/07/16 12:08
OBP 3.23.1 1999/07/16 12:08
POST 2.0.2 1998/10/19 10:46
{2} ok

print the version of Open Windows

% showrev -w

OpenWindows version:
OpenWindows Version 3.6.1 25 January 1999

%


To determine which monitor resolution is available



% /usr/sbin/ffbconfig -res \?
Valid values for -res option are:
        1024x768x60 [1]
        1024x768x70 [1]
        1024x768x75 [1] [2]
        1024x768x77
        1024x800x84
        1152x900x66
        1152x900x76
        1280x800x76 [1] [2]
        1280x1024x60 [1] [2]
        1280x1024x67
        1280x1024x76
        1280x1024x85 [1] [2]
        960x680x112s
        960x680x108s
        640x480x60 [1] [2]
        640x480x60i [1]
        768x575x50i [1]
        1440x900x76 [1] [2]
        1600x1000x66 [1] [2]
        1600x1000x76 [1] [2]
        1600x1280x76 [1] [2]
        1920x1080x72 [1] [2]
        1920x1080x76 [1] [2]
        1920x1200x70 [1] [2]
        1920x1200x75 [1] [2]
        svga [1]
        1152
        1280
        stereo
        vga [1] [2]
        ntsc [1]
        pal [1]
        none
Notes:
[1] monitor does not support this resolution.
[2] this version of FFB (FFB1) does not support this resolution.
%

system configuration

% sysdef
Display the device list (and drivers attached to devices)

% prtconf -D
System Configuration:  Sun Microsystems  sun4u
Memory size: 256 Megabytes
System Peripherals (Software Nodes):

SUNW,Ultra-1
    packages
        terminal-emulator
        deblocker
        obp-tftp
        disk-label
        ufs-file-system
    chosen
    openprom
        client-services
    options, instance #0 (driver name: options)
    aliases
    memory
    virtual-memory
    counter-timer
    sbus, instance #0 (driver name: sbus)
        SUNW,CS4231 (driver name: audiocs)
        auxio
        flashprom
        SUNW,fdtwo, instance #0 (driver name: fd)
        eeprom (driver name: eeprom)
        zs, instance #0 (driver name: zs)
        zs, instance #1 (driver name: zs)
        sc
        SUNW,pll
        SUNW,fas, instance #0 (driver name: fas)
            sd (driver name: sd)
            st (driver name: st)
            sd, instance #0 (driver name: sd)
            sd, instance #1 (driver name: sd)
            sd, instance #2 (driver name: sd)
            sd, instance #3 (driver name: sd)
            sd, instance #4 (driver name: sd)
            sd, instance #5 (driver name: sd)
            sd, instance #6 (driver name: sd)
            sd, instance #7 (driver name: sd)
            sd, instance #8 (driver name: sd)
            sd, instance #9 (driver name: sd)
            sd, instance #10 (driver name: sd)
            sd, instance #11 (driver name: sd)
            sd, instance #12 (driver name: sd)
            sd, instance #13 (driver name: sd)
            sd, instance #14 (driver name: sd)
        SUNW,hme, instance #0 (driver name: hme)
        SUNW,bpp (driver name: bpp)
    SUNW,UltraSPARC
    SUNW,ffb, instance #0 (driver name: ffb)
    pseudo, instance #0 (driver name: pseudo)

processor type, speed

% psrinfo -v
Status of processor 0 as of: 06/16/99 12:38:51
  Processor has been on-line since 02/07/99 01:47:11.
  The sparcv9 processor operates at 200 MHz,
        and has a sparcv9 floating point processor.

patch applied on the system
% showrev -p

exported file system on NFS server
% showmount -e NFS_SERVER

display current run level
% who -r

Find out a package which a file belongs to
% pkgchk -l -p /usr/lib/sendmail
Pathname: /usr/lib/sendmail
Type: regular file
Expected mode: 4555
Expected owner: root
Expected group: bin
Expected file size (bytes): 650720
Expected sum(1) of contents: 22626
Expected last modification: Apr 07 04:13:53 1999
Referenced by the following packages:
        SUNWsndmu
Current status: installed

%

Examining gcc behavior
% gcc -v -x c /dev/null

Display the version of CDE
% /usr/ccs/bin/what /usr/dt/bin/dtmail
/usr/dt/bin/dtmail:
        CDE Version 1.3.4
        CDEVersion1.3.4

Display the version of BIND
% nslookup -class=chaos -q=txt version.bind ns0.optix.org
Server:  impulse.optix.org
Address:  210.164.85.210
Aliases:  210.85.164.210.in-addr.arpa

VERSION.BIND    text = "8.2.2-P5"
% dig @ns-tk021.ocn.ad.jp version.bind chaos txt
; <<>> DiG 8.2 <<>> @ns-tk021.ocn.ad.jp version.bind chaos txt
; (1 server found)
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;;      version.bind, type = TXT, class = CHAOS

;; ANSWER SECTION:
VERSION.BIND.           0S CHAOS TXT    "4.9.7-REL"

;; Total query time: 81 msec
;; FROM: velocity to SERVER: ns-tk021.ocn.ad.jp  203.139.160.103
;; WHEN: Tue May  9 17:26:23 2000
;; MSG SIZE  sent: 30  rcvd: 64

%

system configuration


% /usr/platform/`uname -i`/sbin/prtdiag
System Configuration:  Sun Microsystems  sun4u 8-slot Sun Enterprise 4000/5000
System clock frequency: 82 MHz
Memory size:  512Mb

========================= CPUs =========================

                    Run   Ecache   CPU    CPU
Brd  CPU   Module   MHz     MB    Impl.   Mask
---  ---  -------  -----  ------  ------  ----
 0     0     0      248     2.0   US-II    1.1
 0     1     1      248     2.0   US-II    1.1
 2     4     0      248     2.0   US-II    1.1
 2     5     1      248     2.0   US-II    1.1


========================= Memory =========================

                                              Intrlv.  Intrlv.
Brd   Bank   MB    Status   Condition  Speed   Factor   With
---  -----  ----  -------  ----------  -----  -------  -------
 0     0     256   Active      OK       60ns    2-way     A
 2     0     256   Active      OK       60ns    2-way     A

========================= IO Cards =========================

     Bus   Freq
Brd  Type  MHz   Slot  Name                              Model
---  ----  ----  ----  --------------------------------  ----------------------
 1   SBus   25     3   SUNW,hme                                              
 1   SBus   25     3   SUNW,fas/sd (block)                                    
 1   SBus   25    13   SUNW,soc/SUNW,pln                 501-2069            
 5   SBus   25     3   SUNW,hme                                              
 5   SBus   25     3   SUNW,fas/sd (block)                                    
 5   SBus   25    13   SUNW,soc/SUNW,pln                 501-2069            

Detached Boards
===============
  Slot  State       Type           Info
  ----  ---------   ------         -----------------------------------------
    3    disabled   disk           Disk 0: Target: 10   Disk 1: Target: 11  
    7    disabled   disk           Disk 0: Target: 14   Disk 1: Target: 15  

No failures found in System
===========================

No System Faults found
======================

Regards
Manoj


AIX Vs Linux Basic Commands



        LINUX                   AIX
===================================================
Text:
        cat                       "
        more                    "
        pg                        "
        cut                       "
        sort                      "
        grep                     "
        head                     "
        tail                        "
        join                       "
        paste                     "
        split                      "
        csplit                    "
        *awk                    "
        *sed                    "

Files:
        ls                      "
        cd                      "
        cp                      "
        mv                      "
        find                    "
        tr                      "
        df                      "
        du                      "
        cpio                    "
        file                    "
        diff                    "
        which                   "
        whatis                  "
        tar                     "
        gzip                    "
        bzip2                   "
        compress                "

Processes:
        ps                      "
        kill                    "
        nice                    "
        renice                  "
        nohup                   "
        &                       "
        ctrl+z                  "
        fg                      "
        bg                      "

Administrative stuff:
        su                          "
        passwd                  "
        chown                    "
        chmod                   "
        last                        "
        who (am i)              "
        whoami                  "
        useradd                 mkuser (better use smit)
        groupadd                mkgroup (better use smit)
        id                          "
        at                          "
        crontab                 "
        mount                   "
        -                       oslevel
        uname                   "
        ulimit                     "
        free                    bootinfo -r
        host                    "
        ifconfig                "
        netstat                 "
        ipcs                    "
        ipcrm                   "
        mail                    "
        dmesg                   alog -f /var/adm/ras/bootlog -o
        /var/log/messages       errpt -a | more
        -                             lsattr
        -                            chdev
        lsmod                   -
        modprobe                -
        insmod                  -

Printers:
        lpstat                  lpstat
        lp                      lp; enq



Performance/Monitoring:
        vmstat                  "
        sar                     "
        iostat                  "
        top; ntop               topas; monitor; nmon
        ethereal                (has to be compiled maybe)
        tcpdump                 "
        -                       filemon
        -                       svmon

LVM:
        pvdisplay               lspv
        vgdisplay               lsvg
        lvdisplay                lslv
        -                            lsfs
        pvcreate                "
        vgcreate                mkvg
        lvcreate                 mklv

Paket management:
        rpm                     installp
        rpm -qa               lslpp
        dpkg                    -
        apt-cache             -
        apt-get                 -
        -                          instfix

Shell:
        env                     "
        set                     "
        if; fi                  "
        else                    "
        elif                    "
        case; esac              "
        while; do; done         "
        for; do; done           "
        let                     "
        (())                    "
        eval                    "

Miscellaneous:
        ftp                     "
        rsh                     "
        rcp                     "
        ssh                     "
        scp                     "
        rsync                   "
        wget                    -
        yast                    smit(ty)

Regards
Manoj

  • Windows RUN Command Shotcuts


  • Accessibility Controls  :  access.cpl   
  • Add Hardware Wizard : hdwwiz.cpl 
  • Add/Remove Programs : appwiz.cpl 
  • Administrative Tools : control admintools 
  • Automatic Updates :  wuaucpl.cpl 
  • Bluetooth Transfer Wizard : fsquirt 
  • Calculator : calc 
  • Certificate Manager : certmgr.msc 
  • Character Map : charmap 
  • Check Disk Utility : chkdsk 
  • Clipboard Viewer : clipbrd 
  • Command Prompt : cmd 
  • Component Services : dcomcnfg 
  • Computer Management : compmgmt.msc 
  • Date and Time Properties : timedate.cpl 
  • DDE Shares : ddeshare 
  • Device Manager : devmgmt.msc 
  • Direct X Control Panel (If Installed)* : directx.cpl 
  • Direct X Troubleshooter : dxdiag 
  • Disk Cleanup Utility : cleanmgr 
  • Disk Defragment : dfrg.msc 
  • Disk Management : diskmgmt.msc 
  • Disk Partition Manager : diskpart 
  • Display Properties : control desktop 
  • Display Properties : desk.cpl 
  • Display Properties (w/Appearance Tab Preselected) : control color 
  • Dr. Watson System Troubleshooting Utility : drwtsn32 
  • Driver Verifier Utility : verifier 
  • Event Viewer : eventvwr.msc 
  • File Signature Verification Tool : sigverif 
  • Findfast : findfast.cpl 
  • Folders Properties : control folders 
  • Fonts : control fonts 
  • Fonts Folder : fonts 
  • Free Cell Card Game : freecell 
  • Game Controllers : joy.cpl 
  • Group Policy Editor (XP Prof) : gpedit.msc 
  • Hearts Card Game : mshearts 
  • Iexpress Wizard : iexpress 
  • Indexing Service : ciadv.msc 
  • Internet Properties : inetcpl.cpl 
  • IP Configuration (Display Connection Configuration) : ipconfig /all 
  • IP Configuration (Display DNS Cache Contents) : ipconfig /displaydns 
  • IP Configuration (Delete DNS Cache Contents) : ipconfig /flushdns 
  • IP Configuration (Release All Connections) : ipconfig /release 
  • IP Configuration (Renew All Connections) : ipconfig /renew  
  • IP Configuration (Refreshes DHCP & Re-Registers DNS) : ipconfig /registerdns 
  • IP Configuration (Display DHCP Class ID) : ipconfig /showclassid 
  • IP Configuration (Modifies DHCP Class ID) : ipconfig /setclassid 
  • Java Control Panel (If Installed) : jpicpl32.cpl 
  • Java Control Panel (If Installed) : javaws 
  • Keyboard Properties : control keyboard 
  • Local Security Settings : secpol.msc 
  • Local Users and Groups : lusrmgr.msc 
  • Logs You Out Of Windows : logoff 
  • Microsoft Chat : winchat 
  • Minesweeper Game : winmine 
  • Mouse Properties : control mouse  
  • Mouse Properties : main.cpl 
  • Network Connections : control netconnections 
  • Network Connections : ncpa.cpl 
  • Network Setup Wizard : netsetup.cpl 
  • Notepad : notepad 
  • Nview Desktop Manager (If Installed) : nvtuicpl.cpl 
  • Object Packager : packager 
  • ODBC Data Source Administrator : odbccp32.cpl 
  • On Screen Keyboard : osk 
  • Opens AC3 Filter (If Installed) : ac3filter.cpl 
  • Password Properties : password.cpl 
  • Performance Monitor : perfmon.msc 
  • Performance Monitor : perfmon 
  • Phone and Modem Options : telephon.cpl 
  • Power Configuration : powercfg.cpl 
  • Printers and Faxes : control printers 
  • Printers Folder : printers 
  • Private Character Editor : eudcedit 
  • Quicktime (If Installed) : QuickTime.cpl 
  • Regional Settings : intl.cpl 
  • Registry Editor : regedit 
  • Registry Editor : regedit32 
  • Remote Desktop : mstsc 
  • Removable Storage : ntmsmgr.msc 
  • Removable Storage Operator Requests : ntmsoprq.msc 
  • Resultant Set of Policy (XP Prof) : rsop.msc 
  • Scanners and Cameras : sticpl.cpl 
  • Scheduled Tasks : control schedtasks 
  • Security Center : wscui.cpl 
  • Services : services.msc 
  • Shared Folders : fsmgmt.msc 
  • Shuts Down Windows : shutdown 
  • Sounds and Audio : mmsys.cpl 
  • Spider Solitare Card Game : spider 
  • SQL Client Configuration : cliconfg 
  • System Configuration Editor : sysedit 
  • System Configuration Utility : msconfig 
  • System File Checker Utility (Scan Immediately) : sfc /scannow 
  • System File Checker Utility (Scan Once At Next Boot) : sfc /scanonce 
  • System File Checker Utility (Scan On Every Boot) : sfc /scanboot 
  • System File Checker Utility (Return to Default Setting) : sfc /revert 
  • System File Checker Utility (Purge File Cache) : sfc /purgecache  
  • System File Checker Utility (Set Cache Size to size x) : sfc /cachesize=x 
  • System Properties : sysdm.cpl 
  • Task Manager : taskmgr 
  • Telnet Client : telnet 
  • User Account Management : nusrmgr.cpl 
  • Utility Manager : utilman 
  • Windows Firewall : firewall.cpl 
  • Windows Magnifier : magnify 
  • Windows Management Infrastructure : wmimgmt.msc 
  • Windows System Security Tool : syskey 
  • Windows Update Launches : wupdmgr 
  • Windows XP Tour Wizard : tourstart 
  • Wordpad : write
    Regards 
    Manoj


Direct NFS Client – Performance, Scalability, and High Availability


Direct NFS Client – Performance, Scalability, and High Availability


Direct NFS Client includes two fundamental I/O optimizations to increase throughput and overall performance. First, Direct NFS Client is capable of performing concurrent direct I/O, which bypasses any operating system level caches and eliminates any operating system write-ordering locks. This decreases memory consumption by eliminating scenarios where Oracle data is cached both in the SGA and in the operating system cache and eliminates the kernel mode CPU cost of copying data from the operating system cache into the SGA. Second, Direct NFS Client performs asynchronous I/O, which allows processing to continue while the I/O request is submitted and processed. Direct NFS Client, therefore, leverages the tight integration with the Oracle Database software to provide unparalleled performance when compared to the operating system kernel NFS clients. Not only does Direct NFS Client outperform traditional NFS, it does so while consuming fewer system resources. The results of a detailed performance analysis are discussed later in this paper.

Oracle Direct NFS Client currently supports up to 4 parallel network paths to provide scalability and high availability. Direct NFS Client delivers optimized performance by automatically load balancing requests across all specified paths. If one network path fails, then Direct NFS Client will reissue commands over any remaining paths – ensuring fault tolerance and high availability.

Regards
Manoj

Understanding AWR (Automatic Workload Repository)


Understanding AWR


Viewing AWR Reports awrrpt.sql and awrrpti.sql displays statistics ,  awrinfo.sql displays general information.

Notes:

565812.1
274496.1
396940.1 -- Troubleshooting and Diagnosing ORA-4031 Erro

The following list includes the meanings of particular hit ratios:

Buffer Hit Ratio: Measures how many times a required block was found in memory rather than having to execute an expensive read operation on disk to get the block.

Buffer Nowait %: Shows the percentage of times when data buffers were accessed directly without any wait time.

Library Hit %: Shows the percentage of times when SQL statements and PL/SQL packages were found in the shared pool.

Execute to Parse %: Shows how often parsed SQL statements are reused without reparsing.

Parse CPU to Parse Elapsd %: Gives the ratio of CPU time spent to parse SQL statements.

Redo NoWait %: Shows whether the redo log buffer has sufficient size.

In-memory Sort %: Shows the percentage of times when sorts are performed in memory instead of using temporary tablespaces.

Soft Parse %: Shows how often sessions issued a SQL statement that is already in the shared pool and how it can use an existing version of that statement.

Latch Hit %: Shows how often latches were acquired without having to wait.

% Non-Parse CPU: Shows the percentage of how much CPU resources were spent on the actual SQL execution.

In the above list of statistics, special attention should be paid to parse-related statistics. The Instance Efficiency Percentage report provided previously shows that about 95 percent of the parses are soft as indicated by the Soft Parse %. This is good enough, indicating that the SQL statements are actively reused by Oracle.

The next interesting item to review is the Parse CPU to Parse Elapsd % statistic. In this case, it is about three percent, which is very low. This fact reveals that Oracle waits for some resources during parsing of SQL statements. This should be investigated further to find the cause.

In this case, % Non-Parse CPU statistic is about 97 percent, which is quite high.  This indicates Oracle utilizes the CPU mostly for statement execution but not for parsing.

As a rule of thumb, one should always minimize the number of hard parses in your production database. This reduction yields the benefit of minimizing CPU overhead spent performing costly parse work.

This following sample report section shows shared pool related statistics:

Shared Pool Statistics        Begin    End

                              ------  ------

             Memory Usage %:   92.70   92.49

    % SQL with executions>1:   86.73   84.20

  % Memory for SQL w/exec>1:   84.12   71.86

In this example, the Memory Usage % statistic shows that almost all, approximately 92 percent, of the shared pool memory is consumed. This could indicate that the system experiences some overhead while aging out old shared memory structures like cursors, PL/SQL programs, and so on. This places additional overhead on the CPU to perform reparsing aging-out. The size of the shared pool should be increased appropriately to eliminate such overhead. In general, this statistic should be near 70 percent after the database has been running a long time. If it is quite low, memory is being wasted.

The % SQL with executions>1 statistic indicates how many SQL statements are executed more than one time. This measures how well production applications are tuned and how well they make use of bind variables.

Regards
Manoj

Oracle Database Granules


The DB_CACHE_SIZE parameter, rather than DB_BLOCK_BUFFERS, is used to define the size of the buffer cache for the standard block size. This can be set to any size, but it will be rounded to the nearest whole granule. If the total SGA is less then 128M the granule size is 4M, greater than 128M and it becomes 16M. The DB_CACHE_SIZE must be at least 1 granule in size and defaults to 48M.

Regards
Manoj

Diagnose performance problems, using the wait interface in Oracle 10g.


Source: http://www.oracle.com/technology/oramag/oracle/04-jul/o44tech_perf.html

=======================
Perform Without Waiting
By Arup Nanda
========================

Diagnose performance problems, using the wait interface in Oracle 10g.
----------------------------------------------------------------------


John, the DBA at Acme Bank, is on the phone with an irate user, Bill, who complains that his database session is hanging, a complaint not unfamiliar to most DBAs. What can John do to address Bill's complaint?

Acme Bank's database is Oracle Database 10g, so John has many options. Automatic Database Diagnostic Manager (ADDM), new in Oracle Database 10g, can tell John about the current overall status and performance of the database, so John starts with ADDM to determine whether what Bill's session is experiencing is the result of a databasewide issue. The ADDM report identifies no databasewide issues that could have this impact on Bill's session, so John moves on to the next option.

One way to diagnose session-level events such as Bill's is to determine whether the session is waiting for anything, such as the reading of a block of a file, a lock on a table row, or a latch. Oracle has provided mechanisms to display the waits happening inside the database since Oracle7, and during the last several years, the model has been steadily perfected, with more and more diagnostic information added to it. In Oracle Database 10g, which makes significantly improved wait event information available, diagnosing a session slowdown has become even easier. This article shows you how to use the wait events in Oracle Database 10g to identify bottlenecks.

Session Waits

How can John the DBA determine what's causing Bill's session to hang? Actually, the session is not hanging; it's waiting for an event to happen, and that's exactly what John checks for.

To continue his investigation, John could use Oracle Enterprise Manager or he could directly access V$ views from the command line. John has a set of scripts he uses to diagnose these types of problems, so he uses the command line.

============================================================================================================
John queries the V$SESSION view to see what Bill's session is waiting for. (Note that John filters out all idle events.)

select sid, username, event, blocking_session,
   seconds_in_wait, wait_time
from v$session where state in ('WAITING')
and wait_class != 'Idle';

The output follows, in vertical format.

SID              : 270
USERNAME         : BILL
EVENT            : enq: TX - row lock
                 contention
BLOCKING_SESSION : 254
SECONDS_IN_WAIT  : 83
WAIT_TIME        : 0

============================================================================================================
Looking at this information, John immediately concludes that Bill's session with SID 270 is waiting for a lock on a table and that that lock is held by session 254 (BLOCKING_SESSION).

=====================================================================================================================
But John wants to know which SQL statement is causing this lock. He can find out easily, by issuing the following query joining the V$SESSION and V$SQL views:

select sid, sql_text
from v$session s, v$sql q
where sid in (254,270)
and (
   q.sql_id = s.sql_id or
   q.sql_id = s.prev_sql_id);

=====================================================================================================================
Listing 1 shows the result of the query. And there (in Listing 1) John sees it—both sessions are trying to update the same row. Unless session 254 commits or rolls back, session 270 will continue to wait for the lock. He explains this to Bill, who, considerably less irate now, decides that something in the application has gone awry and asks John to kill session 254 and release the locks.

Wait Classes

After John kills the blocking session, Bill's session continues but is very slow. John decides to check for other problems in the session. Again, he checks for any other wait events, but this time he specifically checks Bill's session.

=====================================================================================================================
In Oracle Database 10g, wait events are divided into various wait classes, based on their type. The grouping of events lets you focus on specific classes and exclude nonessential ones such as idle events. John issues the following against the V$SESSION_WAIT_CLASS view:

select wait_class_id, wait_class,
   total_waits, time_waited
from v$session_wait_class
where sid = 270;
=====================================================================================================================
The output, shown in Listing 2, shows the wait classes and how many times the session has waited for events in each class. It tells John that application-related waits such as those due to row locks have occurred 17,760 times, for a total of 281,654 centiseconds (cs)—hundredths of a second—since the instance started. John thinks that this TIME_WAITED value is high for this session. He decides to explore the cause of these waits in the application wait class. The times for individual waits are available in the V$SYSTEM_EVENT view. He issues the following query to identify individual waits in the application wait class (class id 4217450380):
=====================================================================================================================
select event, total_waits, time_waited
from v$system_event e, v$event_name n
where n.event_id = e.event_id
and wait_class_id = 4217450380;
=====================================================================================================================
Listing 3 shows the output of this query. It shows that lock contentions (indicated by the event enq: TX - row lock contention) constitute the major part of the waiting time in the application wait class. This concerns John. Is it possible that a badly written application made its way through to the production database, causing these lock contention problems?

Being the experienced DBA that he is, however, John does not immediately draw that conclusion. The data in Listing 3 merely indicates that the users have experienced lock-contention-related waits a total of 2,275 times, for 280,856 cs. It is possible that mostly 1- or 2-cs waits and only one large wait account for the total wait time, and in that case, the application isn't faulty. A single large wait may be some freak occurrence skewing the data and not representative of the workload on the system. How can John determine whether a single wait is skewing the data?
=====================================================================================================================
Oracle 10g provides a new view, V$EVENT_HISTOGRAM, that shows the wait time periods and how often sessions have waited for a specific time period. He issues the following against V$EVENT_HISTOGRAM:

select wait_time_milli bucket, wait_count
 from v$event_histogram
 where event =
    'enq: TX - row lock contention';

The output looks like this:

    BUCKET     WAIT_COUNT
-----------    ----------
         1          252
         2             0
         4             0
         8             0
        16             1
        32             0
        64            4
       128            52
       256          706
       512           392
      1024           18
      2048            7
      4096           843
=====================================================================================================================
The V$EVENT_HISTOGRAM view shows the buckets of wait times and how many times the sessions waited for a particular event—in this case, a row lock contention—for that duration. For example, sessions waited 252 times for less than 1 millisecond (ms), once less than 16 ms but more than 1 ms, and so on. The sum of the values of the WAIT_COUNT column is 2,275, the same as the value shown in the event enq: TX - row lock contention, shown in Listing 3. The V$EVENT_HISTOGRAM view shows that the most waits occurred in the ranges of 256 ms, 512 ms, and 4,096 ms, which is sufficient evidence that the applications are experiencing locking issues and that this locking is the cause of the slowness in Bill's session. Had the view showed numerous waits in the 1-ms range, John wouldn't have been as concerned, because the waits would have seemed normal.

Time Models

Just after John explains his preliminary findings to Bill, Lora walks in with a similar complaint: Her session SID 355 is very slow. Once again, John looks for the events the session is waiting for, by issuing the following query against the V$SESSION_WAIT view:
=====================================================================================================================
select event, seconds_in_wait,
   wait_time
from v$session_wait
where sid = 355;
=====================================================================================================================
The output, shown in Listing 4, shows a variety of wait events in Lora's session, including latch contention, which may be indicative of an application design problem. But before he sends Lora off with a prescription for an application change, John must support his theory that bad application design is the cause of the poor performance in Lora's session. To test this theory, he decides to determine whether the resource utilization of Lora's session is extraordinarily high and whether it slows not only itself but other sessions too.

In the Time Model interface of Oracle Database 10g, John can easily view details of time spent by a session in various activities. He issues the following against the V$SESS_TIME_MODEL view:
=====================================================================================================================
select stat_name, value
from v$sess_time_model
where sid = 355;
 =====================================================================================================================

ADDM Advises

Oracle Diagnostics Pack 10g includes the Automatic Database Diagnostic Monitor (ADDM)—a self-diagnostic engine built right into the Oracle Database 10g kernel. This is a revolutionary performance self-diagnostic solution that enables Oracle Database 10g to automatically diagnose its performance problems.

ADDM periodically examines the state of the database, automatically identifies potential database performance bottlenecks, and recommends corrective actions. Each ADDM finding has an associated impact and benefit measure to enable prioritized handling of the most critical issues. In addition to reporting potential performance issues, ADDM also documents the nonproblem areas of the system.
The output, shown in Listing 5, displays the time (in microseconds) spent by the session in various places. From this output, John sees that the session spent 503,996,336 microseconds parsing (parse time elapsed), out of a total of 878,088,366 microseconds on all SQL execution (sql execute elapsed time), or 57 percent of the SQL execution time, which indicates that a cause of this slowness is high parsing. John gives Lora this information, and she follows up with the application design team.

OS Statistics

While going over users' performance problems, John also wants to rule out the possibility of the host system's being a bottleneck. Before Oracle 10g, he could use operating system (OS) utilities such as sar and vmstat and extrapolate the metrics to determine contention. In Oracle 10g, the metrics at the OS level are collected automatically in the database. To see potential host contention, John issues the following query against the V$OSSTAT view:

select * from v$osstat;

The output in Listing 6 shows the various elements of the OS-level metrics collected. All time elements are in cs. From the results in Listing 6, John sees that the single CPU of the system has been idle for 51,025,805 cs (IDLE_TICKS) and busy for 2,389,857 cs (BUSY_TICKS), indicating a CPU that is about 4 percent busy. From this he concludes that the CPU is not a bottleneck on this host. Note that if the host system had more than one CPU, the columns whose headings had the prefix AVG_, such as AVG_IDLE_TICKS, would show the average of these metrics over all the CPUs.

Active Session History

So far the users have consulted John exactly when each problem occurred, enabling him to peek into the performance views in real time. This good fortune doesn't last long—Janice comes to John complaining about a recent performance problem. When John queries the V$SESSION view, the session is idle, with no events being waited for. How can John check which events Janice's session was waiting for when the problem occurred?

Oracle 10g collects the information on active sessions in a memory buffer every second. This buffer, called Active Session History (ASH), which can be viewed in the V$ACTIVE_SESSION_HISTORY dynamic performance view, holds data for about 30 minutes before being overwritten with new data in a circular fashion. John gets the SID and SERIAL# of Janice's session and issues this query against the V$ACTIVE_SESSION_HISTORY view to find out the wait events for which this session waited in the past.
=====================================================================================================================
select sample_time, event, wait_time
from v$active_session_history
where session_id = 271
and session_serial# = 5;
=====================================================================================================================
Next Steps

READ more about wait events
Oracle Database Reference Guide

Oracle Database Performance Tuning Guide

about AWR

about ADDM
Oracle Database Performance Tuning Guide
The output, excerpted in Listing 7, shows several important pieces of information. First it shows SAMPLE_TIME—the time stamp showing when the statistics were collected—which lets John tie the occurrence of the performance problems to the wait events. Using the data in the V$ACTIVE_SESSION_HISTORY view, John sees that at around 3:17 p.m., the session waited several times for the log buffer space event, indicating that there was some problem with redo log buffers. To further aid the diagnosis, John identifies the exact SQL statement executed by the session at that time, using the following query of the V$SQL view:
=====================================================================================================================
select sql_text, application_wait_time
from v$sql
where sql_id in (
  select sql_id
  from v$active_session_history
  where sample_time =
   '22-FEB-04 03.17.31.188 PM'
  and session_id = 271
  and session_serial# = 5
);
=====================================================================================================================
The output is shown in Listing 8.

The column APPLICATION_WAIT_TIME shows how long the sessions executing that SQL waited for the application wait class. In addition to the SQL_ID, the V$ACTIVE_SESSION_HISTORY view also lets John see specific rows being waited for (in case of lock contentions), client identifiers, and much more.

What if a user comes to John a little late, after the data is overwritten in this view? When purged from this dynamic performance view, the data is flushed to the Active Workload Repository (AWR), a disk-based repository. The purged ASH data can be seen in the DBA_HIST_ACTIVE_SESSION_HIST view, enabling John to see the wait events of a past session. The data in the AWR is purged by default after seven days.

Conclusion

Oracle Database 10g introduces a number of enhancements designed to automate and simplify the performance diagnostic process. Wait event information is more elaborate in Oracle Database 10g and provides deeper insight into the cause of problems, making the diagnosis of performance problems a breeze in most cases, especially in proactive performance tuning.

Regards
Manoj

SQL Queries for Database Locks


SQL to check lock held by sessions


select substr(to_char(l.session_id)||','||to_char(s.serial#),1,12) sid_ser,
substr(l.os_user_name||'/'||l.oracle_username,1,12) username,
l.process,
p.spid,
substr(o.owner||'.'||o.object_name,1,35) owner_object,
decode(l.locked_mode,
1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Excl',
6,'Exclusive',null) locked_mode,
substr(s.status,1,8) status
from
v$locked_object l,
all_objects o,
v$session s,
v$process p
where
l.object_id = o.object_id
and l.session_id  = s.sid
and s.paddr = p.addr
and s.status != 'KILLED';


SQL to check lock held by particular session 

select substr(to_char(l.session_id)||','||to_char(s.serial#),1,12) sid_ser,
    substr(l.os_user_name||'/'||l.oracle_username,1,12) username,
    l.process,
  p.spid,
    substr(o.owner||'.'||o.object_name,1,35) owner_object,
    decode(l.locked_mode,
    1,'No Lock',
    2,'Row Share',
    3,'Row Exclusive',
    4,'Share',
    5,'Share Row Excl',
    6,'Exclusive',null) locked_mode,
    substr(s.status,1,8) status
    from
  v$locked_object l,
    all_objects o,
    v$session s,
    v$process p
        where
    l.object_id = o.object_id
    and l.session_id = s.sid
    and s.paddr = p.addr
    and s.sid=978;

-------------
sample output
-------------

SID_SER      USERNAME    PROCESS      SPID        OWNER_OBJECT                      LOCKED_MODE    STATUS
------------ ------------ ------------ ------------ ----------------------------------- -------------- --------
978,60077    appmyfai/APP 6275        15225        ONT.OE_HEADERS_IFACE_ALL            Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        ONT.OE_ACTIONS_IFACE_ALL            Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        ONT.OE_PRICE_ADJS_IFACE_ALL        Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        ONT.OE_LINES_IFACE_ALL            Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225      BOLINF.XXMF_TX_IN_ORDER_HEADERS    Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        BOLINF.XXMF_TX_IN_COUPONS          Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        BOLINF.XXMF_TX_IN_ORDER_LINES      Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        BOLINF.XXMF_ORDER_HEADERS          Row Exclusive  KILLED
978,60077    appmyfai/APP 6275        15225        BOLINF.XXMF_ORDER_LINES            Row Exclusive  KILLED

Regards
Manoj

Oracle E-business suite logs clean up

 Oracle E-business suite logs clean up #!/bin/bash cd $EBS_DOMAIN_HOME find $EBS_DOMAIN_HOME -type f -path "*/logs/*.log?*" -mtime...