Oracle EBS Patch Tips

What We Mean By Patch ?

Is Program designed to fix some Bugs Or Particular problem .

types of file in patch

cxxxx.drv         the ‘c’ or copy driver
dxxxx.drv         the ‘d’ or ‘database’ driver
gxxxx.drv         the ‘g’ or ‘generate’ driver  -form rep chart         jar file

Applying Patch On EBS ?

-Go to Patch Directory , Unzip .
-inside patch Directory , you find Patch.DRV
-After Run Apps-.evn run adpatch
-answer on the question .
-On Some where in the question , you will be asked to apply patch name which is .DRV

Note : You Need to Enable Maintenance Mode using adadmin .

You will find Topics in Details on my blog talking about how to use adadmin and Adpatch .

Thank you
Osama Mustafa

Oracle Default Users

When you are creating Database , By Default there’s Users Created In Installation Phase , Check Them :

The SYS user owns all base tables and user-accessable view of the data dictionary (Oracle configuration information). No Oracle user should ever alter (update, delete, or insert) any rows or schema objects conatained in the SYS schema, because such activity can compromise data integrety. The security administrator must keep strict control of this central account. 
The SYSTEM user is used to create additional tables and views that display administrative information, and internal tables and views used by various Oracle options and tools. 
The SYSMAN user represents the Enterprise Manager super admin account. This EM admin can create and modify other EM admin accounts as well as admin the database instance itself.
The DBSNMP user is used by EM to monitor the database. EM uses this account to access performance stats about the database. The DBSNMP credentials sometimes referred to as the monitoring credentials. 
In addition to these users, a user can connect with diffrent levels of privileges, namely SYSDBA and SYSOPER. When you connect using “connect sys/passwd as sysdba” your connecting as the SYS user and requesting SYSDBA privs. Because the SYS user is the Oracle equivilent to the UNIX root user Oracle makes you specify the amount of control you have, which is why you’ll get an error if you try to connect without specifying the privs.
The big diffrence between SYSDBA and SYSOPER privs is that SYSDBA can do anything (just like root). The SYSOPER privs allow you just about the same amount of control but won’t allow you to look at user data. Both privs allow you to ALTER DATABASE, CREATE SPFILE, STARTUP or SHUTDOWN, ALTER DATABASE ARCHIVELOG, and includes RESTRICTED SESSION privs. However, only SYSDBA can CREATE or DROP DATABASE, and the ALTER DATABASE RECOVER options for SYSOPER are limited to complete recovery only. 
There’s Another Users you can find Them On This Link 
Thank you 
Osama mustafa

Find blocking sessions In Oracle

  You can query the gv$lock and gv$session views to locate a blocking session in RAC.

Miladin Modrakovic offers this script to detect and kill RAC blocking sessions, using  GV$Session and GV$Lock.

   sqlstmt   VARCHAR2 (1000);
   FOR x IN (SELECT gvh.SID sessid, gvs.serial# serial,
                    gvh.inst_id instance_id
               FROM gv$lock gvh, gv$lock gvw, gv$session gvs
              WHERE (gvh.id1, gvh.id2) IN (SELECT id1, id2
                                             FROM gv$lock
                                            WHERE request = 0
                                           SELECT id1, id2
                                             FROM gv$lock
                                            WHERE lmode = 0)
                AND gvh.id1 = gvw.id1
                AND gvh.id2 = gvw.id2
                AND gvh.request = 0
                AND gvw.lmode = 0
                AND gvh.SID = gvs.SID
                AND gvh.inst_id = gvs.inst_id)
      sqlstmt :=
         || x.sessid
         || ‘,’
         || x.serial
         || ‘,@’
         || x.instance_id
         || ””;
      DBMS_OUTPUT.put_line (sqlstmt);

      EXECUTE IMMEDIATE sqlstmt;
   END kill_blovk;

when the script  will generate it will execute Alter session to kill This Session .

Some Useful Link
1-Erik Wramner

Thank you
Osama mustafa


Redhat virtualization (KVM)

I am So Proud Today to write this topic , after 14 Hours Of continuous working . I Enabled Virtualization On Redhat , Its was challenging to me ,  I feel for moment its impossible to enable it .

But After finishing KVM installation and see everything is working fine i knew its deserve every moments . I believe in what they say now ” Never Give Up ” . I posting this article today for the people who wants to learn something new. And if you face any problem you can contact me here, I Wrote this because there’s no much information about the package that you should install while you are working on Virtualization But Hope you will find this useful.

you can install the package from Redhat Media , some Package will Generate what called Package Dependency , You will start searching for missing Package on media with same name as appear to you . its waste of time , i will post under this topic the most important package that you need to install to avoid this error. 
Some Other Information you need to know To Check If KVM Support : 

Solution One Using :

/proc/cpuinfo , the output :

The flags to look out for are:

  • vmx — Intel VT-x, basic virtualization
  • svm — AMD SVM, basic virtualization
  • ept — Extended Page Tables, an Intel feature to make emulation of guest page tables faster.
  • vpid — VPID, an Intel feature to make expensive TLB flushes unnecessary when context switching between guests.
  • npt — AMD Nested Page Tables, similar to EPT.
  • tpr_shadow and flexpriority — Intel feature that reduces calls into the hypervisor when accessing the Task Priority Register, which helps when running certain types of SMP guests.
  • vnmi — Intel Virtual NMI feature which helps with certain sorts of interrupt events in guests.

Solution Two :

dmesg | less

The two messages to look out for are:

kvm: no hardware support and
kvm: disabled by bios

To load KVM:


modprobe kvm_intel 

 AMD :

modprobe kvm_amd

Package that you need to install (Sorted) :


Some Other package you need to install for avoiding dependency error : 



If you need to Run  convirt install the below package also (Sorted) :


 Thank you
Osama Mustafa

ORA-01502: index ‘%’ or partition of such index is in unusable state

To Solve this error you could use more than one solution :

Solution One :

   for index_rec in (select owner, index_name
                     from dba_INDEXES
                     where status = ‘UNUSABLE’)
      execute immediate ‘alter index ‘ || index_rec.owner || ‘.’ ||
          index_rec.index_name || ‘ rebuild’;
   end loop;

Solution two:

10g and above :

alter system set skip_unusable_indexes=true;

 thank you
Osama mustafa 

Find which User are Running SQL Query

I will post this script here , and you can download it also :

AR.MODULE || ' @ ' || SS.machine CLIENT,
v$timer T
AND SS.SID = w.SID (+)
AND W.EVENT != 'client message'

To Download the Script Press Here

Thank you
Osama Mustafa

check character set in Oracle

Simple Topic just to people who asked before why NLS_CHARACTER SET Not appearing in my V$PARAMETER View :

Just Use two Below Query Depend on your version 

SQL> select value from nls_database_parameters where 
parameter = 'NLS_CHARACTERSET' ;
Check the National Character set :
SQL> select value from nls_database_parameters where 

 Or you can Use :

SELECT value$ FROM sys.props$ WHERE name = ‘NLS_CHARACTERSET’ ;

Thank you
Osama Mustafa

Oracle Performance – Statspack

I mention before in my blog how to Generate AWR Reports But now How to Generate Statpack and how to use it !!!!

enable Statpack :

By default Statpack is disable to enable it do the following

1- Create tablespace with size at least 200MB

Disable it 

Statpack works on snapshot you can do the following with oracle snap shot :
Generate Snapshot : 

exec statspack.snap;
exec statspack.snap(i_snap_level => 10, i_modify_parameter => 'true'); 

Levels Description :

Level 0 - This level captures general statistics, 
including rollback segment, row cache, SGA, system events, background
events, session events, system statistics, wait statistics, lock
statistics, and Latch information.

Level 5 - This level includes capturing high resource usage SQL Statements, along with all data captured by lower levels.

Level 6 - This level includes capturing SQL plan and SQL plan usage
information for high resource usage SQL Statements, along with all data
captured by lower levels.

Level 7 - This level captures segment level statistics, including
logical and physical reads, row lock, itl and buffer busy waits, along
with all data captured by lower levels.
Level 10 - This level includes capturing Child Latch statistics, along with all data captured by lower levels. 
Delete SnapShot 

Check SnapShot on Database Level : 

col "Date/Time" format a30
select snap_id
, snap_level
, to_char(snap_time,'HH24:MI:SS DD-MM-YYYY') "Date/Time"
from stats$snapshot
, v$database
order by snap_id

 To Scheducle One Hour Generate Snapshot :

This script use DBMS_JOB to create new job . you can check them from view dba_jobs
 and to delete job "exec dbms_job.remove();"

Finally Generate statpack Reports :


AWR Reports Vs ASH Reports

Sometimes when you face performance issue On your database, Usually first thing you are doing is Generate One of the above reports . But What is the benefits of these reports ? What is the difference ? When Can i use them ?

Let Start

I share in my blog earlier how to generate AWR reports . But Today we are talking About another topic .

Automatic Workload Repository Reports/(AWR):

this report appear in 10g Database, I heard that some people said “AWR used Instead Of Statpack” !! NO AWR is higher Version of statpack , statpack still exists but you have to enable it.

The AWR takes a snap shot of the database in specified intervals (default is one hour) and stores in Sysaux tablespace. and you can change this interval using the following :

retention => 43200, -- Minutes (= 30 Days). Current value retained if NULL.
interval => 30); -- Minutes. Current value retained if NULL.

The snap shots are taken automatically if the statistics_level parameter is set to typical/all. If it set to basic then statistics details are not gathered,The AWR contains the performance statistics and workload information on the database.

and you can take extra snapshot by :


DBMS_WORKLOAD_REPOSITORY.drop_snapshot_range (
low_snap_id => 22,
high_snap_id => 32);

As i mention above you can enable it , disable by the following command :

Enable AWR :

alter system set  statistic_level = {typical | all} scope=spfile ;

Disable AWR :

alter system set   set statistic_level = {basic} scope=spfile

 Check Statistic if its been Gathered By Fire :

Select * from V$statistics_level;

The statistics are collected and stored in memory in SGA. The in memory statistics collection area is a circular buffer, where the old data is overwritten after flushing to disk.

he AWR statistics snap shot are owned by Sys schema. ,The AWR is used to collect performance statistics including:

  • Wait events used to identify performance problems.
  • Time model statistics indicating the amount of DB time associated with a process from the V$SESS_TIME_MODEL and V$SYS_TIME_MODEL views.
  • Active Session History (ASH) statistics from the V$ACTIVE_SESSION_HISTORY view.
  • Some system and session statistics from the V$SYSSTAT and V$SESSTAT views.
  • Object usage statistics.
  • Resource intensive SQL statements.


     Active Session History (ASH) :

     The Name of this reports describe what is the major difference between it and AWR , The ASH contains recent information on active sessions sampled every second. The AWR are taken every one hour and its one hour old will not help in diagnosing issues that are current on the database. Typically to resolve issues urgenly on the database, details information pertaining o last 5 to 10 mins is critical. Because recording session activity is expensive, ASH samples V$SESSION every second and records the event for which he session are waiting.

    ASH information through V$active_session_history , you can can check this table from Oracle Documentation .

    As appear in the Documentation the View contain :
    It include

    * sql identifier of sql statement.
    * object no., file no., and block no.
    * wait event identifier & parameters.
    * user identifier, Session identifier and Serial number.
    * client identifier and name of the operating system program.

    Conclusion :

    ASH can help you when there’s a sudden performance degradation of the database felt.
    AWR – historic past snapshot intervals.

    AWR, stores the session performance statistics for analysis later.
    ASH – the storage is not persistent and as time progresses, the old entries are removed to accommodate new ones. They can be viewed using V$ACTIVE_SESSION_HISTORY.

    For More Information also about Baseline in AWR.
    Thank You
    Osama Mustafa 

    Linux Command For DBA

    Enable SSH in Linux: –
    #chkconfig –list sshd
    #chkconfig –levels 2345 sshd on

    to find a file in a directory:-
    $ find (directory_path) -name (file_name)

    to find a value in a vi editor:-
    in vi editor [esc] & :/(find_value)

    to delete a value in a vi editor:-
    in vi editor [esc] & :%s /delete_value

    to delete contents in a file:-
    in vi editor [esc] & :/%d

    to replace a value in a vi editor:-
    in vi editor [esc] & :%s /search_value/replace_value

    to see the size of a file (or) directory:-
    $du -csh (file or directory name)

    to count the files & directories in a directory:-
    $ls -l |wc -l

    to count the files in a directory:-
    $find . -type f |wc -l

    to count the directries in a directory:-
    $find . -type d |wc -l

    to see the file-system in linux:-
    $file /sbin/init
    $getconf LONG_BIT

    How to mount Windows shared folder in Linux: –
    $mount.cifs //IPAddrss/share_folder_name/ /mnt -o user=username

    Thank you 
    Osama Mustafa