Friday, December 9, 2016

Feedback Loop in EBS 12.2

EBS application layer has changed significantly in release EBS 12.2. There are two oracle homes here

1. 10.1.2-Oracle AS  tools or developer tools
2  Oracle AS 10.1.3 is now replaced by fusion middleware home


In the previous release of EBS oacore,oafm, forms and forms-c4ws was deployed in OC4J. Thus one run of autoconfig used to change all the configurations files. But in EBS 12.2 OC4J is replaced by weblogic server, thus EBS components are deployed in the managed servers. 





All properties of managed servers are managed using weblogic tools like admin console. So now to sync the context file and OHS configuration in weblogic, there is a mechanism introduced in EBS12.2 . This mechanism is known as feedback loop and it is invoked by 2 scripts.

adRegisterWLSListeners.pl is used to update the XML file listening to Weblogic parameter changes. This script is invoked automatically on the primary node every time Weblogic administrator server is started in UNIX machines.

adSyncContext.pl is for explicitly pulling the values of Weblogic server and HTTP server parameters to synchronize corresponding context variable values.

We did some changes by using Fusion middleware admin console.



These changes have to be in sync with context file. To do that

You will need to run the following steps on all application nodes:
Go to cd $AD_TOP/bin/
perl <AD_TOP>/bin/adSyncContext.pl contextfile=<CONTEXT_FILE>
This will read the WLS configuration parameter values and synchronize them with the context variables.
Run The Autoconfig on All App Nodes.


These are some of the activities which autoconfig cannot manage by itself completely.














Tuesday, December 6, 2016

Abandoned nodes in EBS 12.2

Think of a scenario, where EBS has a multinode environment(Not Shared application tier or Shared APPL TOP), in such case we have to patch all the application nodes. One node will be an admin node and others will fall into secondary node. In a multinode environment, adop command is invoked only in admin node and internally adop uses SSH connectivity to execute required patching activities in other secondary nodes. (Before executing, we should have ssh connectivity in place-https://www.clearos.com/resources/documentation/clearos/content:en_us:kb_o_setting_up_ssh_trust_between_two_servers)



Tip: If you change the password for the relevant operating system account on one or more nodes, you must regenerate the ssh credentials either using the $AD_TOP/patch/115/bin/txkRunSSHSetup.pl script, or your own native solution if you prefer(https://docs.oracle.com/cd/E26401_01/doc.122/e22954/T202991T531065.htm)

The txkRunSSHSetup.pl script has a -help option that shows relevant usage options.

For example, a basic command to enable ssh would be:

$ perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl enablessh -contextfile=<CONTEXT_FILE> -hosts=h1,h2,h3$
To verify ssh operation:

$ perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl verifyssh -contextfile=<CONTEXT_FILE> -hosts=h1,h2,h3 \
-invalidnodefile=<filename to report ssh verification failures>
To disable ssh:

$ perl $AD_TOP/patch/115/bin/txkRunSSHSetup.pl disablessh \
-contextfile=<CONTEXT_FILE> -hosts=h1,h2,h3 \
-invalidnodefile=<filename to report ssh verification failures>


Now the question-what happens if adop fails in one node and complete successfully in another node.

example for this error-
prepare phase failed on node secondary node. if you choose to proceed with cutover, node will be marked as abandoned.
Do you want adop to continue with other completed nodes [y/n]

if we press n, it will exit out of this and then we have to rectify the error first and restart the prepare phase again by

adop phase=prepare allnodes=yes

The same goes for apply phase.

But for cutover phase, the situation is little different. ADOP will just continue by just skipping the problematic node(the problematic node has to be secondary) and this problematic node will be marked as abandoned after cut-over. If the abandoned node is meant for imporant ebs Services such as conc processing then skipping this will impact the availability of concurrent processing. So it is not advisable to skip any errors during patching. And also the admin node cannot have a status abandoned, so if an error occurs in admin node, it cannot be skipped and has to be corrected before proceeding with patching. The abandoned nodes has to be removed and recreated using rapid clone.


Friday, September 16, 2016

EBS 12.2.6 is now available.


 EBS 12.2.6(9/2016)>>>>>12.2.7>>>>>>12.3
  
Oracle recently announced the new version of EBS which is release 12.2.6.

For the upgrade customers: This is a online patch(Patch 21900901) and customers who are in ebs 12.2.x can move to 12.2.6 using online patching cycle.
Those users who are upgrading from 11i ,12.0 or 12.1 or doing a new install of 12.2 can apply this patch using apply_mode=downtime to take their ebs to 12.2.6. Also the minimum version of DB should be atleast 11.2.0.4

11i customers should first upgrade to 12.2 before applying 12.2.6.
12.0 and 12.1 customers should first upgrade to 12.2 before applying 12.2.6.
12.2 customers can directly apply 12.2.6.


In this, they have concentrated mainly upon three key areas.
Functional innovation
Modern user Experience and mobility

Operational Efficiency

Approvals, sign ordering documents becomes easy and can be done anytime, anywhere and at any time. Intelligent interleaving of inbound and outbound tasks were introduced to reduce deadheading. There are many others functional changes which have been done in this new release. More information can be found:

Oracle E-Business Suite System Administration Release Notes for Release 12.2.6 (Doc ID 2174164.1)

Oracle E-Business Suite Release 12.2.6 Readme (Doc ID 2114016.1)

Steven Chan blogs: https://blogs.oracle.com/stevenChan/entry/ebs_1226_now_available


From the system administration point of view, there are many interesting changes done in EBS 12.2.6

Feature Name

3.1 Secure Configuration Console
3.2 Allowed JSPs Restricted Access Enabled by Default
3.3 Allowed Redirects Restricted Access Enabled by Default
3.4 Changes to the Applications SSO Type (APPS_SSO) Profile
3.5 Proxy Auditing
3.6 Audit Trail Search HTML UI
3.7 Oracle E-Business Suite Forms in Read-Only Mode on the Responsibility or User Level
3.8 New Schemes for Storing Concurrent Processing Log and Output Files
3.9 Standard Request Submission Enhancements
3.10 Flexfields Value Set Security Setup Wizard
3.11 Flexfields Registration HTML UI
3.12 Improved Language Determination
3.13 Oracle Applications Manager Licensing for Lightweight MLS
3.14 Translation Synchronization Patches Manifest File for Full Mode Languages Only


Being an APPS DBA, 3.8 and 3.9 was more of a hit to me.

3.8- New Schemes for Storing Concurrent Processing Log and Output Files

This enhancement introduces additional choices of storage schemes for management of large numbers of concurrent processing log and output files. For example, these files can be organized by user name or by date. Customers can specify the scheme that best suits their particular needs.

The schemes are:
•SCHEME = single
 This is the default scheme. Request log files will go into $APPLCSF/log and log files will go into $APPLCSF/out.
•SCHEME = product
 Request log and out files will go to $APPLCSF/<product short name>/log and $APPLCSF/<product short name>/out, respectively.

•SCHEME = user
 Requests log and out files will go to $APPLCSF/<user name>/log and $APPLCSF/<user name>/out, respectively.

•SCHEME = date
 This scheme takes a string as a required parameter, and files will be organized in directories by date.
•SCHEME = reqidexp
 This scheme takes an integer value for a parameter. Directories will be created based on that integer and the request ID number place. For example, using this formula: result = int(request_id / 10^(parameter)) * 10^(parameter)
 If the argument is 1, request 12345 will be put in 12340
 If the argument is 2, request 12345 will be put in 12300
 If the argument is 3, request 12345 will be put in 12000

•SCHEME = reqidmod where reqidmod:<integer> (required)
 This scheme takes an integer value for a parameter. Valid values are all positive integers except for zero. Managers will create specified n number of directories starting with 0 (zero) and continue with other numbers in sequential order. Then, each manager process will perform the following function to determine log and output location: result = request_id mod <parameter>
 Requests log and out files will go to $APPLCSF/<resulting string>/log and $APPLCSF/<resulting string>/out, respectively.
•SCHEME = mgrproc
 Requests log and out files will go into $APPLCSF/<manager's process ID>/log and $APPLECSF/<manager's process ID>/out, respectively. Therefore, each manager's process will have its own directory.

3.9  Standard Request Submission Enhancements

The standard request submission (SRS) View Requests window has the enhancements listed below. These changes simplify the navigation required to perform these steps and/or reduce the number of mouse-clicks needed.
•Auto Refresh check box - When this box is selected, the form will refresh the list of requests after a specified interval measured in seconds. Use the profile option "Concurrent: Auto-refresh View Request Timer (secs)" to set this interval.
•Rerun Request button - This new button will resubmit the selected request with exactly the same parameters, after confirmation. Note that you cannot use this button to rerun non-SRS requests.
•Copy Single Request and Copy Request Set buttons - these buttons allow you to copy a single request or request set, respectively. A list of values is provided to select the request or request set.
•Submit a New Request and Submit New Request Set - These buttons allow you to submit a new request or submit a new request set, respectively. These buttons are also added to the Find Requests window.




Category

Name

Technical Name

Description

Changed Form Standard Request Submission (Forms) FNDRSRUN Updated Find Requests and View Requests windows.



Category

Profile Option Name

Feature Area

Description

New Profile Option Concurrent: Auto-refresh View Request Timer (secs) Concurrent Processing  This profile option sets the interval, in seconds, for refreshing the View Request window based on a timer, if the Auto Refresh box is checked. The default value is 300, if no value is given. The value 0 disables Auto Refresh




Tuesday, September 6, 2016

Beware of crontab - l

You have cron jobs running in Prod server and everyone is happy about it. Also you don't have the backups of cron entries. Now, by mistake, one of the junior dba executed the command crontab - l instead of running crontab -l. The cron did hang at this moment of time. To come out of this, he entered ctrl-d and exited out of the session as well as from putty. The next shift started and the other dba thought of checking the crontab entries and thus executed the command crontab -l...Eureka. He could not see any cron entires. Unix team forwarded the log file /var/log/cron and the term "REPLACE" was logged in when the dba executed ctrl-d. So be careful next time.

Saturday, August 27, 2016

Edit /etc/fstab in maintenance mode


Imagine your server crashes (due to some hardisk I/O error, for instance, or removed the hdd by mistake). Then if you reboot your machine, it’ll spit out something like:

Checking filesystems...
   e2fsck: Cannot continue, aborting
   Type root password for maintenance mode or CTRL+D to continue
Lets suppose the culprit of this is some HDD (for instance, /dev/mapper/Vt31-p1 which should be mounted in /software).

Then if you read the contents of /etc/fstab you will see one line like:

/dev/mapper/Vt31-p1    /t31                    ext3    defaults        1 2
If you try to comment this line, your editor will complain and tell “changes cannot be written” or something like that. Why is this? Well, your /etc files have been mounted on a non writable partition (maintenance mode, you remember?). So you will have to remount this partition in RW mode. Just like this:

mount -o remount,rw /
Then edit fstab, save your changes and reboot.

Sunday, August 21, 2016

Unable to open forms after fresh installation of EBS 12.1

We installed EBS 12.1 and when we tried to open forms in IE11, it threw an message "In order to access this application, you must install the J2SE Plugin version 1.5.0_13. To install this plugin, click here to download the oaj2se.exe executable. Once the download is complete, double-click the oaj2se.exe file to install the plugin. You will be prompted to restart your browser when the installation ".


The steps we performed to resolve the issue are:

1. Go to tools>compatibility settings>and add the domain. My domain was oracle.com so i added it.
2. Tools>internet options>security>internet>custom level>disable xss filter
3. Under internet options>security>Local Intranet>sites>advance option>added the site http://ebs1.oracle.com
4. internet options>security>Local Intranet>custom level>disable xss filter
4. The final step was to apply the RPM-openmotif21-2.1.30-11.EL5.i386.rpm, Shut down ebs services including database and install the RPM. Once installed, start the services and test it.

Thursday, August 18, 2016

Performance tuning in EBS

Oracle Database Performance Tuning

often you will see application users complaining that their concurrent programs are running slow. So being a DBA, how will you validate and work with the situtation.

High performance is common expectation for end user, in fact the database is never slow or fast in most of the case session connected to the database slow down when they receives unexpected hit. Thus to solve this issue you need to find those unexpected hit. To know exactly what the session is doing join your query v$session with v$session_wait.

1. First get the concurrent program request id.
2. Find the sid of it.

SELECT sid
FROM v$session
WHERE paddr LIKE
(SELECT addr
FROM v$process
WHERE spid =
(SELECT oracle_process_id
FROM apps.fnd_concurrent_requests
WHERE request_id = TO_NUMBER(<your request id>)
)
);

3. Also run the sql to find more details about it.
SELECT NVL(s.username,'(oracle)') as username,s.sid,s.serial#,sw.event,sw.wait_time, sw.seconds_in_wait, sw.state FROM v$session_wait sw,v$session s
WHERE s.sid=sw.sid and s.username= '&username'ORDER BY sw.seconds_in_wait DESC;

4.Check the events that are waiting for something.

5.Try to find out the objects locks for that particular session.

select
  blocking_session B_SID,
  blocking_instance B_Inst
from v$session
where sid = ?



Locking is not only the cause to effects the performance. Disk I/O contention is another case. When a session retrieves data from the database datafiles on disk to the buffer cache, it has to wait until the disk sends the data. The wait event shows up for the session as "db file sequential read" (for index scan) or "db file scattered read" (for full table scan).When you see the event, you know that the session is waiting for I/O from the disk to complete. To improve session performance, you have to reduce that waiting period. The exact step depends on specific situation, but the first technique “reducing the number of blocks retrieved by a SQL statement” almost always works.Reduce the number of blocks retrieved by the SQL statement. Examine the SQL statement to see if it is doing a full-table scan when it should be using an index, if it is using a wrong index, or if it can be rewritten to reduce the amount of data it retrieves.
6. Get more details about the objects.


6.Run SQL Tuning Advisor (@$ORACLE_HOME/rdbms/admin/sqltrpt.sql) by providing
SQL_ID as the input for generating the findings and recommendations.
SQL Tuning Advisor seems to be doing logical optimization mainly by checking your SQL structure and statistics.
SQL Tuning Advisor suggests indexes that might be very useful.
SQL Tuning Advisor suggests query rewrites.
SQL Tuning Advisor  suggests SQL profile.

7. Know more about the session what exactly it is doing.

select * from v$session where sid='?';



---Taken from Arup Nanda's blog.

select row_wait_obj#,
       row_wait_file#,
       row_wait_block#,
       row_wait_row#
from v$session
where sid = ?;

ROW_WAIT_OBJ#  ROW_WAIT_FILE#  ROW_WAIT_BLOCK#  ROW_WAIT_ROW#
—————————————  ——————————————  ———————————————— ——————————————
241876         1024            2307623          0



select owner, object_type, object_name, data_object_id
from dba_objects
where object_id = 241876;

OWNER  OBJECT_TYPE  OBJECT_NAME   DATA_OBJECT_ID
—————  ———————————— ————————————  ——————————————
APPS   TABLE        T1                    241877






 Finding the row information


REM Filename: rowinfo.sql
REM This shows the row from the table when the
REM components of ROWID are passed. Pass the
REM following in this exact order
REM  1. owner
REM  2. table name
REM  3. data_object_id
REM  4. relative file ID
REM  5. block ID
REM  6. row Number
REM
select *
from &1..&2
where rowid =
        dbms_rowid.rowid_create (
                rowid_type      =>  1,
                object_number   => &3,
                relative_fno    => &4,
                block_number    => &5,
                row_number      => &6
        )
/

SQL> @rowinfo APPS T1 241877 1024 2307623 0

COL1  C
————— —
  1   x



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

Session waits for a specific machine


col username format a5
col program format a10
col state format a10
col last_call_et head 'Called|secs ago' format 999999
col seconds_in_wait head 'Waiting|for secs' format 999999
col event format a50
select sid, username, program,
        decode(state, 'WAITING', 'Waiting',
                'Working') state,
last_call_et, seconds_in_wait, event
from v$session
where machine = 'appsvr1'
/
                                       Called      Waiting
SID   USERNAME  PROGRAM       STATE    secs ago    for secs   EVENT
————— ———————   ———————————   ———————  —————————   ————————   ——————————————————
2832  APPS      sqlplus.exe   Waiting       152         151   SQL*Net message
                                                              from client
3089  APPS      sqlplus.exe   Waiting       146         146   enq: TX - row lock
                                                              contention
3346  APPS      sqlplus.exe   Working        18          49   SQL*Net message
                                                              from client

=====================


Checking the data access and from which table it is coming

select SID, state, event, p1, p2
from v$session
where username = 'ARUP';

SID  STATE     EVENT                   P1 P2
———— ———————   ——————————————————————— —— ————
2201 WAITING   db file sequential read  5 3011




The P1 column shows the file ID, and the P2 column shows the block ID. From that information in the result in Listing 7, you can get the segment name from the extent information in DBA_EXTENTS, as shown below:


select owner, segment_name
from dba_extents
where file_id = 5
and 3011 between block_id
and block_id + blocks;

OWNER  SEGMENT_NAME
—————— —————————————
APSS   T1


select s.value
from v$sesstat s, v$statname n
where s.sid = 3806
and n.statistic# = s.statistic#
and n.name = 'CPU used by this session';


SELECT a.average_wait "SEQ READ", b.average_wait "SCAT READ"
     FROM sys.v_$system_event a, sys.v_$system_event b
     WHERE a.event = 'db file sequential read'
       AND b.event = 'db file scattered read';
     
     
     
     
       select
s1.h_date,
trunc(s1.v_avg,2) pyh_reads,
trunc(s2.v_avg,2) dir_reads,
trunc(s1.mb_sec,2) pyh_mb_s,
trunc(s2.mb_sec,2) dir_mb_s,
trunc((s2.v_avg/s1.v_avg)*100,2) R_PCT
from
--S1-B-----------
(
select
trunc(b_snap_date,'HH') h_date,
sum(snap_value) svalue,
sum(snap_value/snap_secs) v_avg,
sum(snap_value/snap_secs)*v_db_block_size/1024/1024 mb_sec
from
(select
s.INSTANCE_NUMBER,
cast (s.END_INTERVAL_TIME as date) e_snap_date,
cast (s.BEGIN_INTERVAL_TIME as date) b_snap_date,
(cast(s.END_INTERVAL_TIME as date) - cast(s.BEGIN_INTERVAL_TIME as date))*24*60*60 snap_secs,
t.VALUE,
(t.VALUE-LAG (t.VALUE) OVER (ORDER BY s.INSTANCE_NUMBER, s.BEGIN_INTERVAL_TIME)) snap_value
from
DBA_HIST_SNAPSHOT s,
DBA_HIST_SYSSTAT t
where 1=1
and s.SNAP_ID = t.SNAP_ID
and s.DBID = t.DBID
and s.INSTANCE_NUMBER = t.INSTANCE_NUMBER
and s.DBID = (select DBID from V$DATABASE)
and t.STAT_NAME = 'physical reads'
) pr,
(select VALUE v_db_block_size from v$parameter where name = 'db_block_size')
where snap_value > 0
group by trunc(b_snap_date,'HH'),v_db_block_size
) S1,
--S2-B-----------
(
select
trunc(b_snap_date,'HH') h_date,
sum(snap_value) svalue,
sum(snap_value/snap_secs) v_avg,
sum(snap_value/snap_secs)*v_db_block_size/1024/1024 mb_sec
from
(select
s.INSTANCE_NUMBER,
cast (s.END_INTERVAL_TIME as date) e_snap_date,
cast (s.BEGIN_INTERVAL_TIME as date) b_snap_date,
(cast(s.END_INTERVAL_TIME as date) - cast(s.BEGIN_INTERVAL_TIME as date))*24*60*60 snap_secs,
t.VALUE,
(t.VALUE-LAG (t.VALUE) OVER (ORDER BY s.INSTANCE_NUMBER, s.BEGIN_INTERVAL_TIME)) snap_value
from
DBA_HIST_SNAPSHOT s,
DBA_HIST_SYSSTAT t
where 1=1
and s.SNAP_ID = t.SNAP_ID
and s.DBID = t.DBID
and s.INSTANCE_NUMBER = t.INSTANCE_NUMBER
and s.DBID = (select DBID from V$DATABASE)
and t.STAT_NAME = 'physical reads direct'
) pr,
(select VALUE v_db_block_size from v$parameter where name = 'db_block_size')
where snap_value > 0
==============================

8.Get the sql text.

select sql_fulltext
from v$sql l, v$session s
where s.sid = 3806
and l.sql_id = s.sql_id;

9.

More:

1.Run TOP command in Linux to check CPU usage.
2.Run VMSTAT, SAR, PRSTAT command to get more information on CPU, memory usage and possible blocking.
3.Enable the trace file before running your queries,then check the trace file using tkprof create output file.
According to explain plan check the elapsed time for each query,then tune them respectively.

What is the use of iostat/vmstat/netstat command in Linux?
Iostat – reports on terminal, disk and tape I/O activity.
Vmstat – reports on virtual memory statistics for processes, disk, tape and CPU activity.
Netstat – reports on the contents of network data structures.


What to Look for in AWR Report and STATSPACK Report?
Many DBAs already know how to use STATSPACK but are not always sure what to check regularly.
Remember to separate OLTP and Batch activity when you run STATSPACK, since they usually
generate different types of waits. The SQL script “spauto.sql” can be used to run STATSPACK
every hour on the hour. See the script in $ORACLE_HOME/rdbms/admin/spauto.sql for more
information (note that JOB_QUEUE_PROCESSES must be set > 0). Since every system is different,
this is only a general list of things you should regularly check in your

STATSPACK output:
¦ Top 5 wait events (timed events)
¦ Load profile
¦ Instance efficiency hit ratios
¦ Wait events

¦ Latch waits
¦ Top SQL
¦ Instance activity
¦ File I/O and segment statistics
¦ Memory allocation
¦ Buffer waits

10. Enable trace and find the top sqls to tune them.

Trace can be enabled either from front end or back end. From front end, before strating the program, it can be enabled from program definition screen. And from backend, it can be enabled by:

step 1

select q.concurrent_queue_name || ' - ' || target_node qname
      ,a.request_id "Req Id"
      ,decode(a.parent_request_id,-1,NULL,a.parent_request_id) "Parent"
      ,a.concurrent_program_id "Prg Id"
      ,a.phase_code,a.status_code
      ,b.os_process_id "OS"
      ,vs.sid
      ,vp.spid
      ,(nvl(actual_completion_date,sysdate)-actual_start_date)*1440 "Time"
      ,c.concurrent_program_name||' - '||
       c2.user_concurrent_program_name "program"
from APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
    ,applsys.fnd_concurrent_queues q
    ,APPLSYS.fnd_concurrent_programs_tl c2
    ,APPLSYS.fnd_concurrent_programs c
    ,v$session vs
    ,v$process vp
where a.controlling_manager = b.concurrent_process_id
  and a.concurrent_program_id = c.concurrent_program_id
  and a.program_application_id = c.application_id
  and c2.concurrent_program_id = c.concurrent_program_id
  and a.phase_code in ('I','P','R','T')
  and b.queue_application_id = q.application_id
  and b.concurrent_queue_id = q.concurrent_queue_id
  and c2.language = 'US'
  and vs.process (+) = b.os_process_id
  and vs.paddr = vp.addr (+)
--order by 9,2,1
order by 9



SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
v$process c,
v$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID;

Enter value for request_id: 75696767
old   9: AND a.request_id = &Request_ID
new   9: AND a.request_id = 75696767

REQUEST_ID        SID    SERIAL# OSUSER                         PROCESS                  SPID
---------- ---------- ---------- ------------------------------ ------------------------ ------------------------
  75696767         25      50125 applmgr                        21945                    186

SQL> !ps -ef|grep 186
  oracle  1218 28905 37 03:43:25 pts/2     0:00 grep 186
  oracle   186     1  0 03:39:17 ?         0:00 oracleOICP (LOCAL=NO)

SQL> oradebug setospid 186
Oracle pid: 72, Unix process pid: 186, image: oracle@eprdsc1
SQL> oradebug unlimit
Statement processed.
SQL> oradebug Event 10046 trace name context forever, level 12
Statement processed.
SQL> oradebug tracefile_name
/oracle/app/oracle/*/db/tech_st/11.2.0.3/admin/*_*/diag/rdbms/uat/UAT/trace/UAT_ora_21152.trc
SQL>

SQL>
SQL> oradebug event 10046 trace name context off
Statement processed.
SQL>



tkprof *_ora_12762.trc *_ora_12762.txt explain=apps/k33p1tup sort='(prsela,exeela,fchela)' print=10


 tkprof raw_trace_file.trc output_file sys=no explain=apps/ sort=’(prsela,exeela,fchela)’ print=10


tkprof <filename.trc> <output_filename> sys=no explain=apps/<password> sort='(prsela,exeela,fchela)' print=10


Note:Ensure max_dump_file_size is set to unlimited before enabling the trace.

Wednesday, August 3, 2016

EBS login flow

Before jumping into the flow, lets brush up the role of APPLSYSPUB, GUEST, APPLSYS and APPS user.

When we login to applications,initially oracle applications connect to public schema, APPLSYSPUB. This schema has sufficient privileges to perform the authentication of an Applications User (FND user), which includes running PL/SQL packages to verify the username/password combination and the privilege to record the success or failure of a login attempt.
The public ORACLE username and password that grants access to the Oracle E-Business Suite initial sign-on form. The default is APPLSYSPUB/PUB.
Once we change the APPLSYSPUB password must propagate the change to application tier configuration files. If the instance is Autoconfig enabled, must edit the CONTEXT file on each tier prior to running Autoconfig.
In the CONTEXT file, locate the autoconfig variable “s_gwyuid_pass” and set it to the new password, then run AutoConfig in each applications nodes.
When Autoconfig is not being used:
If you are not using Autoconfig you must manually edit the following configuration files :
1) FND_TOP/resource/appsweb.cfg
2) OA_HTML/bin/appsweb.cfg
3) FND_TOP/secure/HOSTNAME_DBNAME.dbc

To change password of APPLSYSPUB with FNDCPASS:
$FNDCPASS APPS/[apps_pass] 0 Y SYSTEM/[system_pass] ORACLE APPLSYSPUB [new_passs].

0 & Y are flags for FNDCPASS
0 is request id (request ID 0 is assigned to request ID's which are not submitted via Submit Concurrent Request Form)
'Y' indicates that this method is directly invoked from the command-line and not from the Submit Request Form.
All application tier processes (Apaches) must be restarted following the password change.

Role of GUEST user/schema in Oracle Applications:
GUEST is a dummy schema.
By default it has ORACLE as password.
GUEST/ORACLE password is present in DBC file at $FND_TOP/secure directory as well as at $FND_TOP/secure/SID_hostname directory.
If a user logs in without any role mappings, the user will get the Guest role, which has a default permission of "R".
GUEST user is used by JDBC Drivers and Oracle Self Service Web Applications like istore, irecruitment, iprocurement, ipayables, ireceivables etc to make initial Connection.

Role of APPLSYS & apps user/schema in Oracle Applications:
APPLSYS user is same as other oracle users like AP, AR, GL etc which hold their set of tables, views etc. In the same manner APPLSYS Account holds its set of tables like FND_USER and FND_APPLICATION, AD_APPLIED_PATCHES etc.
Applsys schema has applications technology layer products like FND and AD etc.
Apps is a universal schema, it has synonyms to all base product tables and sequences. This also has code objects for all products (triggers, views, packages, synonyms etc).
APPS is central Schema which holds synonyms for all other Users Database Objects.

Note: APPLSYS and APPS should have same password.

Reason why these contains same password.

Both apps & applsys need to have same password because when you sign on to apps, initially it connects to a public schema called APPLSYSPUB. This validates AOL name and password that we enter (operations/welcome). Once this is verified we select responsibility, this is validated by APPLSYS schema and then it connects to apps schema.
During signon process it uses both applsys and apps, hence this expects both the password to be identical. If the password for applsys & apps are not identical (Different) Try changing apps password to something else and try to login, the validation at the last stage would fail. This would result in failure of application login.

Difference B/W APPLSYSPUB & GUEST:
APPLSYSPUB/PUB - is DB user which is used by any utility to retrieve APPS schema password for further logins.
GUEST/ORACLE - is EBS user with no or max limited privileges to execute authorization function.That is why Guest user cannot be end dated.

Now lets jump into the login flow:


1.Webserver receives the user request for the particular port number. Web server Binds the request with the port number.

2.Based on the cookie webserver serves the request by sending login page

3.The application user name and password is entered by the user(operations/welcome)

4.DB connection is established using APPLSYSPUB user. This user “APPLSYSPUB” is having access to fnd_user view and a small set of other public tables needed to establish the initial connection.

5.Once DB connection is established FND_USER table is used to get ENCRYPTED_FOUNDATION_PASSWORD.

6.Using GUEST/ORACLE password combination and ENCRYPTED_FOUNDATION_PASSWORD  string obtained from 2 above, we get Apps schema password.

7.Internally it tries to connect to Apps schema with the password retrieved in step 3 above. If the connection fails, then

   a)The GUEST username password is incorrect

   b)The FNDNAM (APPS) environment variable is set incorrectly.

   c)Some other problem prevented a connection


8.Using Apps password obtained in Step 3 and ENCRYPTED_USER_PASSWORD string from FND_USER table, password for Application user (e.g. SYSADMIN) is obtained.

9. The Application user password obtained in Step 5 is compared to the application user password entered by user in login screen. If both passwords match then user is   allowed to get into self-service.

10. A list of responsibilities assigned to that user is shown.  The user picks one of the responsibilities listed.

11. The responsibility and application name is validated by connecting to Applsys schema(fnd_Responsibility, fnd_application…….)
Note: Here we should remember the difference between applsys and apps schema. Applsys schema contains ad,fnd objects whereas apps schema is a global schema contains all application objects.

12. Once the application is validated , Connecting to apps schema to get access application tables. This is the reason why we should have apps and applsys passwords should be same

13. Once a particular form is selected the .dbc file is accessed to get the information about the GUEST username/pwd

============
Note: Oracle doesn't store the hash value of the passwords. It just store the whole password in the encrypted format and get stored in FND_USER table(encrypted_user_password). Thus during authentication of a front end user, it is done on the stored password. Decryption of the stored password takes place FND_WEB_SEC package which is found under apps schema. The decryption key for the user password is the decrypted “ENCRYPTED_FOUNDATION_PASSWORD” of the guest user. Meaning that the first step to decrypt the user password is to decrypt the foundation password of the guest user.

There are certain changes for EBS 12.2 as 10.1.3 application server is replaced by Weblogic server. Thus the login flow will be slight different

When a HTTP request is made for EBS, the request is received by the Oracle HTTP Server (OHS).
When the configuration of OHS is for a resource that needs to be processed by Java, such as logging into EBS, the OHS configuration will redirect the request to the Web Logic Server (WLS) Java process (OACore in this case).
WLS determines the J2EE application that should deal with the request, which is called “oacore”.
This J2EE application needs to be deployed and available for processing requests in order for the request to succeed.   The J2EE application needs to access a database and does this via a datasource which is configured within WLS.
Here is the processing in terms of URL(Login HTTP headers)
When the EBS login works OK, the browser will be redirected to various different URLs in order for the login page to be displayed.  The page flow below shows the URLs that will be called to display the login page:

/OA_HTML/AppsLogin
EBS Login URL
/OA_HTML/AppsLocalLogin.jsp
Redirects to local login page
/OA_HTML/RF.jsp?function_id=1032925&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&oas=3TQG_dtTW1oYy7P5_6r9ag..&params=5LEnOA6Dde-bxji7iwlQUg
Renders the login page
The URLs after the user enters username and password, then clicks the “login” button are shown below/OA_HTML/OA.jsp?page=/oracle/apps/fnd/sso/login/webui/MainLoginPG&_ri=0&_ti=640290175&language_code=US&requestUrl=&oapc=2&oas=4hoZpUbqVSrv9IE0iJdY1g..
/OA_HTML/OA.jsp?OAFunc=OANEWHOMEPAGE
/OA_HTML/RF.jsp?function_id=MAINMENUREST&security_group_id=0
Renders user home page
Once the users home page is displayed, the logout flow also redirects to several different URL before returning to the login page:
/OA_HTML/OALogout.jsp?menu=Y
Logout icon has been clicked
/OA_HTML/AppsLogout
/OA_HTML/AppsLocalLogin.jsp?langCode=US&_logoutRedirect=y
Redirects to the login page
/OA_HTML/RF.jsp?function_id=1032925&resp_id=-1&resp_appl_id=-1&security_group_id=0&lang_code=US&oas=r6JPtR7-a4n5U2H3–ytEg..&params=1JU-PCsoyAO7NMAeJQ.9N6auZoBnO8UYYXjUgSPLHdpzU3015KGHA668whNgEIQ4


Reference:http://johanlouwers.blogspot.in/2006/12/oracle-applications-passwords.html
               12.2 E-Business Suite Technology Stack Summary Of The iAS / HTTP Server Login Process And What To Expect When One Of The Login Components Fails (Doc ID 1984710.1)

Friday, July 22, 2016

Abort a patch applied to run file system via Hotpatch in EBS 12.2.x

In EBS 12.2.x, we may get this error sometimes while applying the patch using adop.

APPL_TOP is set to /ERPAPP/TEST/fs1/EBSapps/appl
[STATEMENT] [START 2016/07/04 12:36:16] Determining admin node
[STATEMENT] [END 2016/07/04 12:36:18] Determining admin node
[STATEMENT] Recommended Worker Count: 2 Max Allowed Workers: 9
[STATEMENT] [START 2016/07/04 12:36:22] Acquiring lock on sessions table
[STATEMENT] [END 2016/07/04 12:36:23] Acquiring lock on sessions table
[STATEMENT] [START 2016/07/04 12:36:23] Checking for any pending sessions
[STATEMENT] There is already a session which is incomplete. Details are:
[STATEMENT] Session Id: 2
[STATEMENT] Prepare phase status: Y
[STATEMENT] Apply phase status: P
[STATEMENT] Cutover phase status: N
[STATEMENT] Abort phase status: N
[STATEMENT] Session status: F
[STATEMENT] [Note: Y denotes that the phase is done
[STATEMENT] N denotes that the phase has not been completed
[STATEMENT] X denotes that the phase is not applicable
[STATEMENT] R denotes that the phase is running (in progress) or ran
[STATEMENT] F denotes that the phase has failed
[STATEMENT] P (is applicable only to APPLY phase) denotes atleast
[STATEMENT] one patch is already applied for the session id
[ERROR] Cannot apply hotpatch as another online patching cycle is going on
[ERROR] Unrecoverable error occured. Exiting the current session.


The reason for this error is because another patching session is active.
[applmgr@cvm-928 ~]$ adop -status
Enter the APPS username: apps
Enter the APPS password:

Current Patching Session ID: 2


Node Name       Node Type       Phase       Status          Started                        Finished                       Elapsed
--------------- --------------- ----------- --------------- ------------------------------ ------------------------------ ------------
cvm-928         master          APPLY       FAILED          30-JUN-16 01:44:53 +05:30      30-JUN-16 01:48:01 +05:30      0:03:08
                                PREPARE     COMPLETED       30-JUN-16 12:07:26 +05:30      30-JUN-16 12:37:40 +05:30      0:30:14
                                CUTOVER     NOT STARTED
                                CLEANUP     NOT STARTED

File System Synchronization Used in this Patching Cycle: None

Solution: Abort the patching cycle and run full cleanup.

adop phase=abort
adop phase=cleanup cleanup_mode=full




Patch can be rolled back till we reached the cutover phase. Once we reach the cutover phase, we cannot abort a phase. Thus the question comes, what will we do, if some problem occur which eventually lead to failure of cutover phase.Taking a backup is always recommended before applying a patch but it is too costly. We cannot take a cold back up of EBS application filesystema and Database everytime just to apply a single patch. There is a time constraint, downtime and cost involved to keep the backup.

Thus we have to go for flashback option for database where we can roll back the database just before the cutover stage. To enable the flashback option, execute the below statements


Connect to the oracle database

1. sqlplus / as sysdba

alter system set db_recovery_file_dest='/oracle/stage/backups' scope=BOTH SID='*';

alter system set db_recovery_file_dest_size=200GB scope=BOTH SID='*';

alter system set db_flashback_retention_target=300;(this is in minutes, set it according to the environment)

alter database flashback on;


2. Stop the ebs services, conc processing and other outgoing interface just to ensure that there won't be any loss of data.

3.start the patching cycle

adop phase=prepare,apply,finalize

4. Create a restore point

alter system switch logfile;
create restore point ABc guarantee flashback database;
alter system switch logfile;

5. execute adop phase=cutover.

if we face any issue, we can flashback the database to the restore point.

shutdown immediate;
startup mount;
flashback database to restore point ABC;
alter database open read only;

shutdown immediate;
startup mount;
alter database open resetlogs;

6.
Disable flashback
alter database flashback off;
drop restore point ABC;
Restore point dropped.
alter system set db_recovery_file_dest='';
System altered.
select FLASHBACK_ON from v$database;


now we also have to revert back the appliction file system. By checking the cutover logs, we can check that if the cutover has failed before the cutover happened or after the cutover. If the cutover has not happened, then just clean shutdown and startup the ebs services.

if the cutover has happened and file system has switched, then we have to switch the filesystem again.

shutdown the ebs services
perl $AD_TOP/patch/115/bin/txkADOPCutOverPhaseCtrlScript.pl -action=ctxupdate -contextfile=<full path to new run context file> \
-patchcontextfile=<full path to new patch file system context file> \
-outdir=<full path to out directory>

and start the services from the old file system

In a multi-node environment, repeat the preceding two steps on all nodes, starting with the admin node and then proceeding to the slave nodes.

Options and Next Steps
After the restore is complete, you have two basic options for proceeding:
Abort the current patching cycle, if the issue that required you to restore was caused by the patches you were attempting to apply.

Identify and fix any other issues in the current patching cycle, and proceed with patching.


Reference-Document 1584097.1, Oracle E-Business Suite Release 12.2: Backup and Recovery Guidelines For Online Patching Cutover.

https://docs.oracle.com/cd/E26401_01/doc.122/e22954/T202991T531065.htm





Wednesday, July 20, 2016

Autoconfig bits and pieces and how EBS services are started


I will not go through what autoconfig is. There are  number of docs available in the net.
Just wanted to brush what internally autoconfig does which helps during the troubleshooting times.

1. Report version conflict
2. Backup of the context file
3. Synchronization of file system Context file and its templates with those in the database (Establish DB Connection)
4. Check for customizations to Context template
5. Check the context file for possible updates from database
6. compare the context file stored in database with the context file sored in Database and update it accordingly
   Result                  : The two Context files are in sync

===========================================================================
Starting Updates of Context file Fri May 27 04:28:13 EDT 2016

      found context version     : 120.271.12010000.36
      available update version  : 120.271.12010000.36


7. Start Config Tool CVMHelper
  Updating local context file variables for Middle Tier

Checking file $AD_TOP/12.0.0/admin/template/adgendbc_ux.sh
FND_SECURE: $FND_SECURE
DBC FILE NAME: Instance name
File exists, getting the version
Version: 120.8.12010000.6
No updates to s_fnd_secure needed

Writing Context File back to File System
Context file updated

8. Making database connection using DBUtil
9. Check for new context variables
   No new variables found in the context file

Updated  s_dbGlnam to "instance name"

Processing existing variables with updated defaults
Updated  s_defterr to AMERICA
Updated  s_apps_version to 12.1.3

Writing Context File back to File System
Context file updated
Closing connection

10.Start synchronisation of context file

11. Start location of IANA character set
    [s_iana_cset]
    IANA Charset obtained from Database    : UTF-8
    IANA Charset present in Context file   : UTF-8
    IANA Charset based on APPL_TOP char set: UTF-8
    IANA Charset decided for Context file  : UTF-8
    Action taken : None, since the correct value exists in the Context file

12. Start context value management system
    Performs the task of validating the APPL_TOP
    Start $FND_TOP/patch/115/bin/txkSetConfig.pl (TXK Script to update the Applications configuration
    Start $AD_TOP/adgentns.pl (seeds the entries in to the data model and generates the tnsnames.ora)

13. Upload file system Context file and its templates to the database
14. Upload the Context information template to the DataBase
15. Configure templates from all of the product tops
16. AutoConfig Profile Phase--This prepares all the application TOPS
17. Start Restore Profile utility  

************************************************************************

We might have observed that in multi node install few services are started
in one server and some in another server.
During the Rapid Install, you select the above configuration via the
“Edit Services” button as follows :
•APPS1 : enable “Root Service Group”, “Batch Processing Services”
•APPS2 : enable “Root Service Group”, “Web Entry Point Services”, “Web Application Services”,
“Other Service Group”



Configuring Applications Node Services in Oracle E-Business Suite Release 12
(Doc ID 406558.1)



The logic behind these service classification is as follows :
1.Root Service Group (Runs services on AS, 10.1.3 OH) 1.Oracle Process Manager (OPM)
: adopmnctl.sh

2.Web Entry Point Services (Runs services on AS, 10.1.3 OH) 1.HTTP Server
: adapcctl.sh

3.Web Application Services (Runs services on AS, 10.1.3 OH) 1.OACORE OC4J
: adoacorectl.sh
2.FORMS OC4J : adformsctl.sh
3.OAFM OC4J : adoafmctl.sh

4.Batch Processing Services (Concurrent Managers and Apps Listener) 1.APPS TNS Listener
: adalnctl.sh
2.Concurrent Managers : adcmctl.sh, adsvcm.sh, ieoicsm.sh, ieosvicsm.sh
3.Fulfillment Server : jtffmctl.sh, jtfsvfm.sh

5.Other Service Group: (Runs services for Forms on 10.1.2) 1.Oracle Forms Server :
adformsrvctl.sh
2.Oracle MWA Service : mwactlwrpr.sh


After the installation you see that the Autoconfig XML file is generated with the following
entries for APPS1 and APPS2 :
•s_isDB=NO
•s_isAdmin=YES
•s_isForms=YES
•s_isConc=YES
•s_isWeb=YES

Why are all services enabled on the two application tier nodes instead of the configuration
that was selected via the “Edit Services” feature ?

In R12, the concept for Applications Nodes has changed.  When installing R12 with multiple nodes all the nodes are now set as ‘Y’ in FND_NODES.

This occurs because in R12, concept of unified APPL_TOP is introduced which means everything is laid down on all servers.

From the APPL_TOP perspective, all the Servers on a Multi-Node Environment will have the same files and can now potentially start any Service if needed.  In some cases, additional configuration will be required before this can be done since there can be profiles, etc associated with each Server.

For R12, the only difference between the Servers, are the Services that have been activated on each Node.
 The Services are identified by the variables on the /service_group/ section in the APPS Context File:
•Root Service Group : s_root_status
•Web Entry Point Services : s_web_entry_status
•Web Application Services : s_web_applications_status
•Batch Processing Services : s_batch_status
•Other Service Group : s_other_service_group_status

Depending on the value of these variables (enabled or disabled), adstrtal.sh / adstpall.sh will only start/stop the Services associated with them, ignoring the rest.

For example, if a node has only /s_batch_status/ “enabled” and the rest of the services are disabled, when you run adstrtall.sh on that Server and it will only start the Concurrent Managers and the TNS Listener for Apps.


With a Unified APPL_TOP, all Applications tier nodes have their corresponding context variables set to ‘Y’.
As the difference between nodes is in the services that are activated rather than the files that are present, and since there is no one-to-one match between service groups and nodes, services can easily be switched to run on a different node if desired. This provides a failover capability, whereby a service can be enabled on a node so it can take over the role of a failed node. Equally, it is possible to start a service on a node that was not specified to run that service when Rapid Install was executed.

******************************************************************

                                                      Few Important notes:

Sometimes we can face an issue where the serial number of the context file is less than the serial number present in FND_OAM_CONTEXT_FILES. In this case, autoconfig repalces the values stored in our context file with the values present in FND_OAM_CONTEXT_FILES table. This scenario can also happen when during cloning only DB is refreshed and apps tier is not.
In this case, value present in table will come from source and thus there can be anomaly.

This scenario can also happen in EBS 12.2 where due to adop phase=abort the there is a serial mismatch between file system context file and DB table values. Metalink note:adop phase=abort causes "Serial number in context file contains lower value than that of database copy." (Doc ID 1916658.1)

adpatch generally does not update the "values" of a context file directly. Patches usually update templates. After the file is updated by adpatch, the autoconfig portion automatically launched from the patch session will replicate the templates into configuration files. The same applies for the context file. Having said that, if for some reason, a patch changes the setting of a context variable (which I really don't recall any particular case) then the autoconfig portion will update it in the database first and second it will also update the context file on the node where autoconfig was executed. If that is the case for a patch, autoconfig should be executed separately on all the nodes to make sure the configuration is transported. If such a patch exists, the README should include this clarification.
Regardless of this particular use case, it is always recommended to run autoconfig on all the nodes to assure consistency.

Additionally, the template of the context file is treated as any other file in EBS. If it has a lower version than the patch, then adpatch will replace the file and run AC. If the version in the file system is higher, then all the actions are skipped including the AC phase.
Adpatch has a smart criteria to run AC. In the same way, the AC phase will not be launched from adpatch if the files included in the patch don't belong to the "autoconfig template" category. In other words if a patch includes another file type not related with AC (ie .o file for binaries) then it will not run AC because is not necessary.

For more information refer to metalink note:-Using AutoConfig to Manage System Configurations in Oracle E-Business Suite Release 12 (Doc ID 387859.1)













Tuesday, July 12, 2016

Hourly/Daily Archive generation

The below query comes handy to understand the archivelog generation of an Oracle database on
 an hourly /daily basis, per thread – in case of RAC databases. Archivelog generation on a daily 
basis:

set pages 1000select trunc(COMPLETION_TIME,'DD') Day, thread#, round(sum(BLOCKS*BLOCK_SIZE)/1024/1024/1024) GB,count(*) Archives_
Generated from v$archived_loggroup by trunc(COMPLETION_TIME,'DD'),thread# order
 by 1;

Archive log generation on an hourly basis:

set pages 1000select trunc(COMPLETION_TIME,'HH') Hour,thread# , round(sum(BLOCKS*BLOCK_SIZE)/1024/1024/1024) GB,count(*) Archives from 
v$archived_loggroup by trunc(COMPLETION_TIME,'HH'),thread#  order by 1 ;

Sample output:

HOUR                   THREAD#         MB   ARCHIVES
------------------- ---------- ---------- ----------
2013 08 20 12:00:00          1      31268        339
2013 08 20 13:00:00          1       4994         55
2013 08 20 14:00:00          1       4412         48
2013 08 20 15:00:00          1       4805         52
2013 08 20 16:00:00          1       3364         37
2013 08 20 17:00:00          1         22          1
2013 08 20 21:00:00          1          9          1

Also, the following script is useful to find the archivelog switches on an hourly basis that happened in the past 
one week, I got this from http://kubilaykara.blogspot.com/2008/02/redo-log-generation.html and is quite an 
useful one.

SELECT to_date(first_time) DAY,to_char(sum(decode(to_char(first_time,'HH24'),'00',
1,0)),'99') "00",to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'99') "01",to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'99') "02",to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'99') "03",to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'99') "04",to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'99') "05",to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'99') "06",to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'99') "07",to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'99') "08",to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'99') "09",to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'99') "10",to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'99') "11",to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'99') "12",to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'99') "13",to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'99') "14",to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'99') "15",to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'99') "16",to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'99') "17",to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'99') "18",to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'99') "19",to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'99') "20",to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'99') "21",to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'99') "22",to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'99') 
"23"fromv$log_historywhere to_date(first_time) > sysdate - 8 -- or else change 
it you want for more days to viewGROUP byto_char(first_time,'YYYY-MON-DD'), 
to_date(first_time)order by to_date(first_time)
/

Sample output:

DAY 00 01 02 03 04 05 06 09 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
--------- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -
01-NOV-13 0 1 1 0 1 0 1 0 1 4 1 1 0 1 0 1 1 0 1 1 1 1 1 1
02-NOV-13 0 1 1 1 1 0 1 1 1 1 0 1 1 7 1 1 1 1 1 2 1 1 1 1
03-NOV-13 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 2 1 1 2
04-NOV-13 1 1 8 1 7 2 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 2
05-NOV-13 2 1 2 1 2 2 1 2 1 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2
06-NOV-13 2 1 2 2 2 2 1 2 2 2 2 2 1 2 2 1 0 2 0 0 0 0 1 0
09-NOV-13 0 0 1 7 0 0 1 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 0 0