Oct 13, 2006

Install Oracle Application Server

I used to read all of documentations and blogs on Oracle Application Server 10g installation.

Out of all I fond best for the installation of Oracle Application Server are follows:

1) Installing Oracle 10g Application Server On Linux

This Includes:

-> Pre-installation Tasks
-> Installing the Oracle Application Server 10g Infrastructure
-> Installing the Oracle Application Server 10g Mid Tier (J2EE and Web Cache)
-> Installing the Oracle BPEL Process Manager 10g
-> Installing the Oracle Application Server Toplink 10g
-> Installing the Oracle Application Server 10g Business Intelligence and Forms
-> Installing the Oracle Application Server 10g Portal and Wireless


2) Installing Oracle 10g Application Server on SLES9

I hope these links will help all my friends who want to install Oracle Application server.

Few Important Oracle Queries

I found the one more excellent query which can help the oracle dba in doing performance tuning.

--> Find the Large Table Scans:

SELECT table_owner,
table_name,
table_type,
size_kb,
statement_count,
reference_count,
executions,
executions * reference_count total_scans
FROM (SELECT a.object_owner table_owner,
a.object_name table_name,
b.segment_type table_type,
b.bytes / 1024 size_kb,
SUM(c.executions ) executions,
COUNT( DISTINCT a.hash_value ) statement_count,
COUNT( * ) reference_count
FROM sys.v_$sql_plan a,
sys.dba_segments b,
sys.v_$sql c
WHERE a.object_owner (+) = b.owner
AND a.object_name (+) = b.segment_name
AND b.segment_type IN ('TABLE', 'TABLE PARTITION')
AND a.operation LIKE '%TABLE%'
AND a.options = 'FULL'
AND a.hash_value = c.hash_value
AND b.bytes / 1024 > 1024
GROUP BY a.object_owner, a.object_name, a.operation, b.bytes /
1024, b.segment_type
ORDER BY 4 DESC, 1, 2 )

--> Full Table Scans:

select ss.username||'('||se.sid||') ' "USER_PROCESS",
sum(decode(name,'table scans (short tables)',value)) "SHORT_SCANS",
sum(decode(name,'table scans (long tables)', value)) "LONG_SCANS",
sum(decode(name,'table scan rows gotten',value)) "ROWS_RETRIEVED"
from v$session ss, v$sesstat se, v$statname sn
where se.statistic# = sn.statistic#
and (name like '%table scans (short tables)%'
OR name like '%table scans (long tables)%'
OR name like '%table scan rows gotten%' )
and se.sid = ss.sid
and ss.username is not null
group by ss.username||'('||se.sid||') ';

--> Top 10 Sessions by Physical Reads:

select distinct c.osuser,c.username,c.sid, b.name, a.value
from v$sesstat a,
v$statname b,
v$session c
where a.statistic# = b.statistic#
and a.sid = c.sid
and nvl(a.value,0) > 0
and c.username not in ('SYS','SYSTEM')
and b.name = 'physical reads'
and c.type <> 'BACKGROUND'
and rownum <= 10
order by a.value desc;

--> Top 10 Sessions by Physical Writes:

select distinct c.osuser,c.username,c.sid, b.name, a.value
from v$sesstat a,
v$statname b,
v$session c
where a.statistic# = b.statistic#
and a.sid = c.sid
and nvl(a.value,0) > 0
and c.username not in ('SYS','SYSTEM')
and b.name = 'physical writes'
and c.type <> 'BACKGROUND'
and rownum <= 10
order by a.value desc;

TABLESPACE USAGE:

select a.TABLESPACE_NAME,
a.BYTES bytes_used,
b.BYTES bytes_free,
b.largest,
round(((a.BYTES-b.BYTES)/a.BYTES)*100,2) percent_used
from
(
select TABLESPACE_NAME,
sum(BYTES) BYTES
from dba_data_files
group by TABLESPACE_NAME
)
a,
(
select TABLESPACE_NAME,
sum(BYTES) BYTES ,
max(BYTES) largest
from dba_free_space
group by TABLESPACE_NAME
)
b
where a.TABLESPACE_NAME=b.TABLESPACE_NAME
order by ((a.BYTES-b.BYTES)/a.BYTES) desc

Based on the few of these queries who can plan according and do the performance tuning.

Oct 11, 2006

Oracle Performance Tuning Tips

---------------------------------
--> Tuning Multi-Threaded Server
=================================

If SERVERS_HIGHWATER exceeds the MTS_SERVERS parameter, increase the number of
MTS_SERVERS in the init&SID.ora file.

set heading off
select 'Current MTS_SERVERS number is ' || value from v$parameter where name = 'mts_servers';

set heading on
select * from v$mts;

-----------------------------
--> Tuning The Library Cache
==============================

Library cache get/hit ratio for SQL AREA should be in high 90's. If not, there
is room to improve the efficiency of your application.

select namespace, gets, gethits, gethitratio from v$librarycache;

---------------------------
--> Reloads-to-pins ratio
===========================

If reloads-to-pins ratio is greater than .01, increase SHARED_POOL_SIZE in the init&SID.ora file.

set heading off
select 'Current SHARED_POOL_SIZE value is ' || value from v$parameter where name = 'shared_pool_size';

set heading on

select sum(pins) "Executions", sum(reloads) "LC Misses",
sum(reloads)/sum(pins) "Ratio" from v$librarycache;

---------------------------
--> Data Dictionary Cache
===========================

If ratio is greater than .15, consider increasing prompt SHARED_POOL_SIZE in the init&SID.ora file.

set heading off

select 'Current SHARED_POOL_SIZE value is ' || value from v$parameter where name = 'shared_pool_size';

set heading on

select sum(gets) "Total Gets", sum(getmisses) "Total Get Misses",
sum(getmisses)/sum(gets) "Ratio" from v$rowcache;

--------------------------------------------------------------------
--> Packages you might want to consider pinning into the shared pool
=====================================================================

column owner format a12
column name format a25
column type format a15
set feedback on

select owner, name, type, loads, executions, sharable_mem
from v$db_object_cache
where kept = 'NO'
and loads > 1 and executions > 50 and sharable_mem > 10000
and type in ('PACKAGE', 'PACKAGE BODY', 'FUNCTION', 'PROCEDURE')
order by loads desc;

--------------------------------
--> Shared Pool Reserved space
================================

The goal is to have zero REQUEST_MISSES and REQUEST_FAILURES, so increase SHARED_POOL_RESERVED_SIZE in the init&SID.ora file.
If either of them are greater than 0.

set heading off

select 'Current SHARED_POOL_RESERVED_SIZE value is ' || value from v$parameter where name = 'shared_pool_reserved_size';

set heading on

select request_misses, request_failures, last_failure_size
from v$shared_pool_reserved;

--------------------------------------
--> Tuning the Data Dictionary Cache
======================================

If the gethitratio is greater than .15 -- increase the SHARED_POOL_SIZE parameter in the init&SID.ora file.

set heading off

select 'Current SHARED_POOL_SIZE value is ' || value from v$parameter where name = 'shared_pool_size';

set heading on

select sum(gets) "total_gets", sum(getmisses) "total_get_misses",
sum(getmisses)/sum(gets) * 100 "gethitratio"
from v$rowcache;

----------------------------------
--> Tuning The Data Buffer Cache
==================================

Goal is to have a Cache Hit Ratio greater than 90% -- if lower, increase value for DB_BLOCK_BUFFERS in the init&SID.ora file.

set heading off

select 'Current DB_BLOCK_BUFFERS value is ' || value from v$parameter where name = 'db_block_buffers';

set heading on

select name, value from v$sysstat where
name in ('db block gets', 'consistent gets', 'physical reads');

select 1 - (phy.value / (cur.value + con.value)) "Cache Hit Ratio"
from v$sysstat cur, v$sysstat con, v$sysstat phy
where cur.name = 'db block gets'
and con.name = 'consistent gets'
and phy.name = 'physical reads';

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

--> If the number of free buffers inspected is high or increasing, consider increasing the DB_BLOCK_BUFFERS parameter in the init&SID.ora file.

set heading off

select 'Current DB_BLOCK_BUFFERS value is ' || value from v$parameter where name = 'db_block_buffers';

set heading on

select name, value from v$sysstat where name = 'free buffer inspected';

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

--> A high or increasing number of waits indicates that the db writer cannot keep up writing dirty buffers. Consider increasing the number of writers using the DB_WRITER_PROCESSES parameter in the init&SID.ora file.

set heading off

select 'Current DB_WRITER_PROCESSES value is ' || value from v$parameter where name = 'db_writer_processes';

set heading on

select event, total_waits from v$system_event where event in
('free buffer waits', 'buffer busy waits');

--------------------------
--> LRU Hit percentage
==========================

If the LRU Hit percentage is less than 99%, consider adding more DB_WRITER_PROCESSES and increasing the DB_BLOCK_LRU_LATCHES parameter in the init&SID.ora file.

set heading off

select 'Current DB_WRITER_PROCESSES value is ' || v1.value || chr(10) ||
'Current DB_BLOCK_LRU_LATCHES value is ' || v2.value
from v$parameter v1,v$parameter v2
where v1.name = 'db_writer_processes' and v2.name = 'db_block_lru_latches';

set heading on

select name, 100 - (sleeps/gets * 100) "LRU Hit%" from v$latch
where name = 'cache buffers lru chain';

---------------------------------
--> Tuning The Redo Log Buffer
=================================

There should never be a wait for log buffer space. Increase LOG_BUFFER in the init&SID.ora file if the selection below doesn't show "no rows selected".

set heading off

select 'Current LOG_BUFFER size is ' || value from v$parameter where name = 'log_buffer';

set heading on
set feedback on

select sid, event, state from v$session_wait
where event = 'log buffer space';

-------------------------------------------------------------------
--> Tables with Chain count greater than 10% of the number of rows
====================================================================

set feedback on

select owner, table_name, num_rows, chain_cnt, chain_cnt/num_rows "Percent"
from dba_tables where (chain_cnt/num_rows) > .1 and num_rows > 0;

-------------------
--> Tuning Sorts
===================

The ratio of disk sorts to memory sorts should be less than 5%. Consider increasing the SORT_AREA_SIZE parameter in the init&SID.ora file. You might also consider setting up separate temp tablespaces for frequent users of disk sorts.

set heading off

select 'Current SORT_AREA_SIZE value is ' || value from v$parameter where name = 'sort_area_size';

set heading on

select disk.value "Disk", mem.value "Mem", (disk.value/mem.value) * 100 "Ratio"
from v$sysstat mem, v$sysstat disk
where mem.name = 'sorts (memory)'
and disk.name = 'sorts (disk)';

-------------------------------
--> Tuning Rollback segments
===============================

If ratio of waits to gets is greater than 1%, you need more rbs segments.

set heading off

select 'Current number of rollback segments is ' || count(*) from dba_rollback_segs
where status = 'ONLINE' and owner = 'PUBLIC';

set heading on

select sum(waits)*100/sum(gets) "Ratio", sum(waits) "Waits", sum(gets) "Gets"
from v$rollstat;

----------------------------
--> Rollback segment waits
============================

Any waits indicates need for more segments.

set heading off

select 'Current number of rollback segments is ' || count(*) from dba_rollback_segs
where status = 'ONLINE' and owner = 'PUBLIC';

set heading on

select * from v$waitstat where class = 'undo header';

--------------------------------------------------
--> Rollback segment waits for transaction slots
==================================================

Any waits indicates need for more segments.

set heading off

select 'Current number of rollback segments is ' || count(*) from dba_rollback_segs
where status = 'ONLINE' and owner = 'PUBLIC';

set heading on
set feedback on

select * from v$system_event where event = 'undo segment tx slot';

--------------------------
--> Rollback contention
==========================

Should be zero for all rbs's.

column name format a10

select n.name,round (100 * s.waits/s.gets) "%contention"
from v$rollname n, v$rollstat s
where n.usn = s.usn;

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

Purpose: List locks on tables and other objects currently held by user sessions, including session information and commands to kill those sessions.

column object_name format a10
column username format a10
column owner format a10

select username,v$session.sid,serial#,owner,object_id,object_name,
object_type,v$lock.type
from dba_objects,v$lock,v$session where object_id = v$lock.id1
and v$lock.sid = v$session.sid and owner != 'SYS';

set heading off pagesize 0

!echo
!echo To kill locking sessions:

select 'alter system kill session ''' || v$session.sid || ',' ||
serial# || ''';'
from dba_objects,v$lock,v$session where object_id = v$lock.id1
and v$lock.sid = v$session.sid and owner != 'SYS';

Sep 28, 2006

How busy your database is?

What a transaction?

A transaction is one logical piece of work in the database, or 'the execution of a program that includes database access operations'. Some transactions are read-only transactions while other transactions update, or write, to the database. All transactions must exhibit the ACID properties. Transactions that make changes to the database are completed when they are committed or rolled back.

SQL> select count(*) from emp;

Count(*)
--------
14

Here Since no data was modified in this transaction, a commit or rollback was unnecessary. It can be considered as read-only transaction.

The following query updates data in the database:

SQL> delete from emp where empno=7934;

1 row deleted.

SQL> commit;

Commit complete.

In the above example, we made a change to the database and committed that change. On successful commit, the transaction is complete and a new one begins.

In some cases, one transaction can consist of multiple SQL statements.

SQL> update emp set ename='JOHNSON' where empno=7876;

1 row updated.

SQL> update emp set ename='JACKSON' where empno=7902;

1 row updated.

ORA9I SQL> rollback;

Rollback complete.

In this example, we issued different SQL statements before rolling back the transaction. All the SQL statements in this example comprised one transaction. The transaction ended with the ROLLBACK statement. These are not separate transactions.

COUNTING TRANSACTIONS

Oracle keeps track of this as a statistic which gets reset when the instance is brought down. So if you want to keep track of your transactions, you’ll have to capture this information before the database is brought down.

The V$SYSSTAT and V$SESSTAT are dynamic performance views where the statistics are stored.

The V$SYSSTAT view gives us 'database-wide' statistics. The V$SESSTAT gives us statistics for each current session. As soon as the current session ends, the statistics are removed from this view. Also, V$SESSTAT does not show the statistic name. You’ll have to join this view with V$STATNAME on the STATISTIC# column to get the statistic name. V$SYSSTAT does have the statistic name.

COUNTING COMMITS AND ROLLBACKS

Oracle has made it very easy for us to count the number of commits in the database.

SQL> select name,value from v$sysstat where name='user commits';

NAME VALUE
-------------------- ----------
user commits 26

SQL> update emp set sal=sal*1.03 where empno=7369;

1 row updated.

SQL> commit;

Commit complete.

SQL> select name,value from v$sysstat where name='user commits';

NAME VALUE
-------------------- ----------
user commits 27

we looked for the ’user commits’ statistic before and after our UPDATE statement. As can be expected, this statistic was increased by one after we committed our work.

Similarly, there is a statistic for measuring rollbacks.

SQL> select name,value from v$sysstat where name='user rollbacks';

NAME VALUE
-------------------- ----------
user rollbacks 12

SQL> update emp set sal=sal*1.05 where empno=7902;

1 row updated.

SQL> rollback;

Rollback complete.

SQL> select name,value from v$sysstat where name='user rollbacks';

NAME VALUE
-------------------- ----------
user rollbacks 13

The ’user rollbacks’ statistic shows how many rollbacks have been issued.

SQL> select name,value from v$sysstat
2 where name in ('user rollbacks','user commits');

NAME VALUE
-------------------- ----------
user commits 27
user rollbacks 13

SQL> select count(*) from emp;

Count(*)
--------
13

SQL> select name,value from v$sysstat
2 where name in ('user rollbacks','user commits');

NAME VALUE
-------------------- ----------
user commits 27
user rollbacks 13


COUNTING SELECTS

So how do we count SELECT statements? There is another statistic, 'user calls', which is as close as we are going to get.

SQL> select name,value from v$sysstat where name='user calls';

NAME VALUE
-------------------- ----------
user calls 49635

SQL> select count(*) from emp;

Count(*)
--------
13

ORA9I SQL> select name,value from v$sysstat where name='user calls';

NAME VALUE
-------------------- ----------
user calls 49641


Average number of commits and rollbacks per day


SQL> select value/up_days as tx_per_day
from (select sum(value) as value from v$sysstat
where name in ('user commits','user rollbacks')),
(select sysdate-startup_time as up_days from v$instance);

TX_PER_DAY
----------
1527355.99

If you database does not have a high number of DML statements, then the above query will not give you a true indicator of how busy the system is.

SQL> select value/up_days as calls_per_day
from (select value from v$sysstat where name='user calls'),
(select sysdate-startup_time as up_days from v$instance);

CALLS_PER_DAY
-------------
15614059.8



Note: This Document/blog is only and only meant to guide/help the newbies.

Sep 20, 2006

Excessive wait events

SQL> select a.event e0, count(*) t0 from sys.v_$session_wait a , sys.v_$event_name n where a.event= n.name group by event;

E0 T0
---------------------------------------------------------------- ----------
SQL*Net message from client 135
SQL*Net message to client 1
db file scattered read 5
db file sequential read 6
enqueue 144
latch free 1
pipe get 1
pmon timer 1
rdbms ipc message 12
smon timer 1

10 rows selected.

Here equeue represents that some session is holding the lock.
To find out which session is holding the lock:

SQL> select /*+ RULE */ a.session_id, s.serial#, s.username, s.status
from dba_locks a, v$session s
where a.blocking_others = 'Blocking'
and a.session_id = s.sid
order by 1;

SESSION_ID SERIAL# USERNAME STATUS
---------- ---------- ------------------------------ --------
436 5032 TEST INACTIVE

SQL> select sql_address, username, SQL_HASH_VALUE,LOGON_TIME,LAST_CALL_ET,status from v$session where sid=436;

SQL_ADDR USERNAME SQL_HASH_VALUE LOGON_TIME LAST_CALL_ET STATUS
-------- ------------------------------ -------------- ------------------- ------------ --------
00 TEST 0 2006-09-20 00:04:39 0 INACTIVE

SQL> select a.sql_text from v$session b,v$sqlarea a where a.address=b.sql_address and b.sid=436;

no rows selected

If SQL_ADDRESS shows some what like '00' it means that particular session not doing any transaction.

To release the Block/LOCK Kill the session based on the sql it is holding/ by knowing the imp. of the sql.

alter system kill session '436,5032';

Sep 6, 2006

How The Oracle Database Processes SQL Statements

The following is a summary of how Oracle processes SQL statements. First the flowchart followed by a brief explanation of each step.




Step 1: Create a Cursor

Cursor creation can either occur implicitly or be explicitly declared.

Step 2: Parse the Statement


What is parsing? Parsing is the process of:
·Translating a SQL statement, verifying it to be a valid statement
·Performing data dictionary lookups to check table and column definitions
·Acquiring parse locks on required objects so that their definitions do not change during the statement’s parsing
·Checking privileges to access referenced schema objects
·Determining the optimal execution plan for the statement
·Loading it into a shared SQL area
·Routing all or part of distributed statements to remote nodes that contain referenced data

If a similar SQL statement exists in the shared pool, Oracle skips the parsing step. A SQL statement is parsed once no matter how many times the statement is run. As you can see, parsing does many things and consumes time and resources. You should always aim at minimizing parsing when writing SQL.

Step 3: Describe Results of a Query

This step is performed in the case of a query (SELECT) processing. The describe step determines the characteristics (datatypes, lengths, and names) of a query’s result.

Step 4: Define Output of a Query

This step is performed in the case of a query (SELECT) processing. In this step, you specify the location, size, and datatype of variables defined to receive each fetched value. These variables are called define variables. Oracle performs datatype conversion if necessary.

Step 5: Bind Any Variables

At this point, Oracle knows the meaning of the SQL statement but still does not have enough information to run the statement. Oracle needs values for any variables listed in the statement. The process of obtaining these values is called binding variables.

Step 6: Parallelize the Statement

Oracle can parallelize DML and some DDL in this step.

Step 7: Run the Statement

At this point, Oracle has all necessary information and resources, so the statement is run. If it is an UPDATE or DELETE statement, however, all rows that the statement affects are locked from use by other users of the database until the next COMMIT, ROLLBACK, or SAVEPOINT for the transaction.

Step 8: Fetch Rows of a Query

This step is performed in the case of a query (SELECT) processing. The rows are selected and ordered (if requested by the query), and each successive fetch retrieves another row of the result until the last row has been fetched.

Step 9: Close the Cursor

The last step of processing a SQL statement is to close the cursor.


Note: This Documentation is been copied from the site/blog, Only and only for helping the Newbies in DBA. (With Courtesy)

Sep 5, 2006

ROLLBACK CONTENTION STATISTICS

To properly configure a system's rollback segments, you must create enough rollback segments, and they must be of a sufficient size. That seems fairly simple, but it is not. You can observe how the rollback segments are being used, and from that determine what needs to be done.

Determining the Number of Rollback Segments

The number of rollback segments should be determined by the number of concurrent transactions in the database. Remember--the fewer transactions per rollback segment, the less contention. A good rule of thumb is to create about one rollback segment for every four concurrent transactions.

Rollback contention occurs when too many transactions try to use the same rollback segment at the same time, and some of them have to wait. You can tell whether you are seeing contention on rollback segments by looking at the dynamic performance table, V$WAITSTAT. Following is the data contained by V$WAITSTAT that is related to rollback segments:

* UNDO HEADER--The number of waits for buffers containing rollback header blocks.
* UNDO BLOCK--The number of waits for buffers containing rollback blocks other than header blocks.
* SYSTEM UNDO HEADER--Same as UNDO HEADER for the SYSTEM rollback segment.
* SYSTEM UNDO BLOCK--Same as UNDO BLOCK for the SYSTEM rollback segment.

The system rollback segment is the original rollback segment that was created when the database was created. This rollback segment is used primarily for special system functions but is sometimes used when no other rollback segment is available. Typically the SYSTEM rollback segment is not used, and you do not need to be concerned about it.

SQL> col name format a15
SQL> col wraps format 99999
SQL> col shrinks format 99999
SQL> col extends format 99999
SQL> set pages 40

SQL> select name, gets, round(waits/gets*100,3) "Pct Waits",writes, wraps, shrinks, extends
from v$rollstat, v$rollname
where v$rollstat.usn = v$rollname.usn
and v$rollname.name != 'SYSTEM';

NAME GETS Pct Waits WRITES WRAPS SHRINKS EXTENDS
--------------- ---------- ---------- ---------- ------ ------- -------
_SYSSMU1$ 2119454 .002 349971066 524 61 177
_SYSSMU2$ 2159979 .003 366184380 560 70 175
_SYSSMU3$ 2166968 .002 372017462 523 58 173
_SYSSMU4$ 2625707 .003 425201464 627 66 211
_SYSSMU5$ 2511741 .002 437697190 635 69 228
_SYSSMU6$ 2064043 .002 344161682 494 53 159
_SYSSMU7$ 2115427 .003 426560784 621 70 245
_SYSSMU8$ 2539862 .003 381893486 548 57 174
_SYSSMU9$ 2559839 .002 419910174 627 71 222
_SYSSMU10$ 2679432 .002 466469086 643 74 240
_SYSSMU11$ 1285735 .002 201921514 3 0 1
_SYSSMU12$ 1367639 .003 255898414 2 0 0

12 rows selected.

SQL> set head off
SQL> select 'The average of waits/gets is '||
round((sum(waits) / sum(gets)) * 100,2)||'%'
from v$rollstat;

The average of waits/gets is 0%

If the ratio of waits to gets is more than 1% or 2%, consider creating more rollback segments.


Another way to gauge rollback contention is:


SQL> set head on
SQL> select class, count
from v$waitstat
where class in ('system undo header', 'system undo block', 'undo header', 'undo block' );

CLASS COUNT
------------------ ----------
system undo header 2
system undo block 0
undo header 1333
undo block 24

SQL> set head off
SQL> select 'Total requests = '||sum(count) xn1, sum(count) xv1
from v$waitstat 2 ;

Total requests = 117316

column xn1 format 9999999
column xv1 new_value xxv1 noprint

SQL> select 'Contention for system undo header = '||
(round(count/(&xxv1+0.00000000001),4)) * 100||'%'
from v$waitstat
where class = 'system undo header' 2 3 4
5 /
old 2: (round(count/(&xxv1+0.00000000001),4)) * 100||'%'
new 2: (round(count/( 117318+0.00000000001),4)) * 100||'%'

'CONTENTION FOR SYSTEM UNDO HEADER = '
--------------------------------------------------------------------------------
Contention for system undo header = 0%

SQL> select 'Contention for system undo block = '||
(round(count/(&xxv1+0.00000000001),4)) * 100||'%'
from v$waitstat
where class = 'system undo block' 2 3 4
5 /
old 2: (round(count/(&xxv1+0.00000000001),4)) * 100||'%'
new 2: (round(count/( 117318+0.00000000001),4)) * 100||'%'

'CONTENTION FOR SYSTEM UNDO BLOCK
--------------------------------------------------------------------------------
Contention for system undo block = 0%

SQL> select 'Contention for undo header = '||
(round(count/(&xxv1+0.00000000001),4)) * 100||'%'
from v$waitstat
where class = 'undo header' 2 3 4 ;
old 2: (round(count/(&xxv1+0.00000000001),4)) * 100||'%'
new 2: (round(count/( 117318+0.00000000001),4)) * 100||'%'

'CONTENTION FOR UNDO HEADER =
--------------------------------------------------------------------------------
Contention for undo header = 1.14%

SQL> select 'Contention for undo block = '||
(round(count/(&xxv1+0.00000000001),4)) * 100||'%'
from v$waitstat
where class = 'undo block' 2 3 4 ;
old 2: (round(count/(&xxv1+0.00000000001),4)) * 100||'%'
new 2: (round(count/( 117318+0.00000000001),4)) * 100||'%'

'CONTENTION FOR UNDO BLOCK='
--------------------------------------------------------------------------------
Contention for undo block = 1.97%

SQL>

If the percentage for an area is more than 1% or 2%, consider creating more rollback segments.

We do have some "undo block" contention since the percent wait is 1.97%. We cannot manually add more rollback segments since ours is System Managed Undo.


Another way to gauge rollback contention is:



Hit Ratio should be >= 99% - if not, consider adding additional rollback segments.


SQL> select b.NAME,
a.USN seg#,
GETS,
WAITS,
round(((GETS-WAITS)*100)/GETS,2) hit_ratio,
XACTS active_transactions,
WRITES
from v$rollstat a,
v$rollname b
where a.USN = b.USN;



Note: Scripts published in this blog are tested, but under any circumstance of failures or bad effect/low performance on database point of view, members of this blog are no were responsible.

Aug 24, 2006

Oracle 10g RAC On Linux or Windows 2003 Using VMware Server

For the newbies sometimes it is diffcult to get the test database/box/server to practice Oracle 10G RAC installation on Linux/Windows 2003.

Here, Now with this it will be reduceing your difficulties to some extent.

Oracle 10g RAC On Linux Using VMware Server


Oracle 10g RAC On Windows 2003 Using VMware Server


Hope you like it...

Aug 23, 2006

What is the COST?

If you use the Cost Based Optimizer (CBO) in your Oracle database, you may be surprised to know that decreasing the ‘COST’ of a query does not necessarily mean increased performance.

The following is a summary of a long thread on AskTom about this topic:

The ‘COST’ of a query is Oracle’s estimate of the completion time for a query. But the estimate for the completion time is based on Oracle’s statistical guesses about your data (which may be wrong), the model that Oracle uses for your hardware resource availability (which may be wrong) and the assumptions that Oracle makes about the actions of the run-time execution (which, surprisingly, may be wrong). Consequently, the predicted cost is not always a good estimate of the execution time of the query. Just to add a little confusion, the unit of measurement used is not seconds (or centi-seconds), but an abstract unit equivalent to the assumed time to perform a single block read on your platform.

So, The cost number can/will flucuate depending on parameters we can modify directly (e.g. optimizer_index_cost_adj) or the parameters we can modify indirectly (e.g. gather recent statistics). In some cases when the cost decreases the query will run faster (be more efficient), in other cases it may not. So just because I can decrease the cost, doesn’t mean I’m decreasing work (PIO). And just because one query may have a lower cost then another doesn’t mean it works less. But what was true yesterday isn’t true today, and what’s true today won’t be true tomorrow; with each new release the cost becomes a better indicator of work to be done, but today it isn’t perfect enough to rely on exclusively.

Aug 22, 2006

Oracle 1z0-032: Oracle 9i Database Fundamentals-II #5

QUESTION NO: 21

Which two statements are true regarding the use of UTF-16 encoding? (Choose two)

A. Enables easier loading of multinational data.
B. Uses a fixed-width Multibyte encoding sequence.
C. Asian characters are represented in three characters.
D. Used a variable-width Multibyte encoding sequence.
E. European characters are represented on one or two bytes.

Answer: A, B

Explanation:

AL16UTF16 is a 2-byte, fixed-width Unicode character set, which is also referred to as UTF16 or UCS2. The ASCII English character set is assigned the first 128 values from 0 (0X00) through 127 (oX7F) in Unicode, which translates to 1 byte. Even though AL16UTF16 uses one more byte than UTF8 for ASCII character representation, it is still faster because it uses fixed-width encoding as opposed to UTF8, which uses variable-width encoding. UTF-16 encoding enables easier loading of multinational data. It uses a fixed-width multibyte encoding sequence.

Incorrect Answers

C: Asian characters are represented in two characters because UTF16 is a 2-byte, fixed-width Unicode character set.
D: It uses a fixed-width multibyte encoding sequence.
E: European characters are represented in two bytes because UTF16 is a 2-byte, fixed-width Unicode character set.

OCP Oracle9i Database: New Features for Administrators, Daniel Benjamin, p. 266-278
Chapter 5: Language Enhancements
Oracle 9i New Features, Robert Freeman, p. 139-146
Chapter 5: Miscellaneous Oracle9i Features and Enhancements

QUESTION NO: 22

The Oracle Shared Server architecture reduces memory usage by reducing the number of server processes required. To process a request for a server process, the following tasks are performed:
1. A shared server picks up the request from the request queue and processes the request.
2. The dispatcher retrieves the response from the response queue.
3. A user sends a request to its dispatcher.
4. The dispatcher returns the response to the user.
5. The shared sever places the response on the calling dispatcher’s response queue.
6. The dispatcher places the request into the request queue in the SGA.

Put the above task in the order in which they are performed.

A. 3, 1, 6, 2, 5, 4
B. 3, 6, 1, 5, 2, 4
C. 3, 1, 2, 3, 4, 5
D. 6, 1, 3, 5, 2, 4
E. 6, 3, 1, 2, 4, 5
F. 6, 3, 1, 2, 5, 4

Answer: B

Explanation:

When the user process arrives, the listener examines the request and determines whether the user process can use a shared server process. If so, the listener returns the address of the dispatcher process that is currently handling the least number of requests. Then the user process connects to the dispatcher directly. The dispatcher process then directs multiple client requests to a common queue. The idle shared server processes pick up the virtual circuit from the common request queue on a first-in-first-out (FIFO) basis and make all necessary calls to the database to complete that request. When the server process completes the request, it places the response on the calling dispatcher response queue. The dispatcher then returns the completed request to the appropriate user process.

Incorrect Answers

A: The dispatcher places the request into the request queue in the SGA before a shared server picks up the request from the request queue and processes the request..
C: After user sent a request to its dispatcher the dispatcher places the request into the request queue in the SGA.
D: A user sends a request to its dispatcher. This is first step of the procedure.
E: A user sends a request to its dispatcher. This is first step of the procedure.
F: A user sends a request to its dispatcher. This is first step of the procedure.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 100-102
Chapter 5: Usage and Configuration of the Oracle Shared Server

QUESTION NO: 23

You issue this RMAN command:
RMAN> create script Level0Backup {
backup
incremental level 0
format ‘/u01/db01/backup/%d_%_Sp’
fileperset 5
(database include current controlfile);
sql ‘alter database archive log current’;
}

Which three statements are true about the Level0 Backup script you just created?
(Choose three)

A. The script is stored only in the control file.
B. The script is stored only in the recover catalog.
C. The script can be executed only by using the RMAN RUN command.
D. The commands of the script can be displayed with the LIST command.
E. The commands of the script can be displayed with the PRINT command.
F. The commands of the script can be displayed with the REPORT command.

Answer: B, C, E

Explanation:

A stored script is a sequence of RMAN commands stored within the recovery catalog repository. To execute a stored script, you must use the EXECUTE SCRIPT command in a RUN block, as shown in the following code. The commands of the script can be displayed with the PRINT command.

Incorrect Answers

A: The script is stored only in the recover catalog, not in the control file.
D: The LIST command queries the repository and generates a list of all the backup sets and image copies recorded in the RMAN’s metadata that are specific to a database.
F: The REPORT command performs detailed analysis of the information stored in the repository and displays detailed outputs on backup sets or image copies.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 400-407
Chapter 17: Recovery Catalog Creation and Maintenance

QUESTION NO: 24

Which RMAN command do you use to verify that the RMAN repository information is synchronized with the actual files that exist on disk?

A. LIST
B. CHANGE
C. CATALOG
D. CROSSCHECK

Answer: D

Explanation:

RMAN command CROSSCHECK enables you to crosscheck the availability of the backup sets by verifying the information stored in its repository with the backup sets that are physically available in the designated storage medium.

Incorrect Answers

A: The LIST command queries the repository and generates a list of all the backup sets and image copies recorded in the RMAN’s metadata that are specific to a database.
B: The CHANGE command can be used with UNCATALOG clause: it removes the records of the specified backup sets and image copies from the catalog and updates the control file records status as DELETED. Also it can be run with AVAILABLE or UNAVAILABLE clauses: RMAN would then update the repository to reflect the respective backup files as either available or unavailable.
C: The copies of files generated using O/S commands and utilities are similar to RMAN image copies. But these are not recognized by RMAN until you catalog the file copies by executing the RMAN CATALOG command.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 269-270
Chapter 11: RMAN Backups

QUESTION NO: 25

A web browser can connect directly to an Oracle server using which two? (Choose two)

A. HTTP
B. IIOP
C. TCP/IP
D. Named Pipes
E. TCP/IP with SSL

Answer: A, B

Explanation:

The clients forward the requests using HTTP, which provides the language that enables Web browsers and application Web servers to communicate. Also web clients can access the Oracle database directly – for example, by using a Java applet. In addition to regular
connections, the database can be configured to accept HTTP and Internet Inter-ORB Protocol (IIOP) connections.

Incorrect Answers

C: A web browser can connect directly to an Oracle server just using TCP/IP.
D: Names Pipes are not used to connect a web browser directly to an Oracle server.
E: TCP/IP with SSL is not used to connect a web browser directly to an Oracle server.

OCP Oracle9i Database: Fundamentals II Exam Guide, Rama Velpuri, p. 34-36
Chapter 2: Basic Oracle Net Architecture

Prevention, Detection and Repair of Database Corruption Part-2

Types of Corruption

Physical or structural corruption can be defined as damage to internal data structures which do not allow Oracle software to find user data within the database.

Logical corruption involves Oracle being able to find the data, but the data values are incorrect as far as the end user is concerned.

Physical corruption due to hardware or software can occur in two general places -- in memory (including various IO buffers and the Oracle buffer cache) or on disk. Operator error such as overwriting a file can also be defined as a physical corruption.

Logical corruption on the other hand is usually due to end-user error or non-robust(?) application design. A small physical corruption such as a single bit flip may be mistaken for a logical error. In general, for purposes of the paper we will categorize corruption under three general areas and give best practices for prevention, detection and repair for each:

· Memory corruption
· Media corruption
· Logical corruption


In Depth in the forthcoming comments....

Aug 21, 2006

17 tips from Oracle9i Performance Tuning Avoiding Problematic Queries

1. Avoid Cartesian products
2. Avoid full table scans on large tables
3. Use SQL standards and conventions to reduce parsing
4. Lack of indexes on columns contained in the WHERE clause
5. Avoid joining too many tables
6. Monitor V$SESSION_LONGOPS to detect long running operations
7. Use hints as appropriate
8. Use the SHARED_CURSOR parameter
9. Use the Rule-based optimizer if I is better than the Cost-based optimizer
10. Avoid unnecessary sorting
11. Monitor index browning (due to deletions; rebuild as necessary)
12. Use compound indexes with care (Do not repeat columns)
13. Monitor query statistics
14. Use different tablespaces for tables and indexes (as a general rule; but the main point is reduce I/O contention)
15. Use table partitioning (and local indexes) when appropriate (partitioning is an extra cost feature)
16. Use literals in the WHERE clause (use bind variables)
17. Keep statistics up to date

Prevention, Detection and Repair of Database Corruption Part-1

Corruption can be defined as an inconsistency in the data block structures or memory structures as a result of disparate problems. Corruption can be the result of human error (including software, firmware, and hardware bugs) or the environment (component failure).

Lets first define Prevention, Detection, and Repair.

Prevention :

Prevention can be defined as a set of steps that can be taken to anticipate and stop corruption from happening in a production environment. In general, the most common cause of corruption is user error. While we cannot completely prevent corruption, the risk of corrupting the production environments can be greatly reduced by improving the operational infrastructure.

Examples of prevention by improving operational infrastructure include the following:
· Having redundant hardware such as mirrored disks.
· Defining and enforcing strict security procedures.
· Strict change control with proper testing practices.

Detection :

Detection can be defined as a method to determine the existence of a problem. In the context, detection can be defined as the ways to discover the presence of a corruption in the database. In particular, detecting a corruption must encompass detecting anomalies in the hardware, disks, memory, database and application data.

The following are some examples of detecting corruption:
· Monitoring the System logs
· Monitoring the Oracle trace files
· Monitoring any application logs
· Monitor audit trails for any security violations

Repair :

Repair can be defined as a method of restoring the system to a healthy state. In the context, repair can be defined as the steps taken to bring a database back to a consistent state. Interestingly, the way Oracle software defines a consistent state may differ from what the business needs are. For example, in some environments, some data loss is acceptable. The method of repair will vary due to the extent of the corruption and the business needs. For this reason, the scope will focus on quickly repairing damage to Oracle database objects.

More in next comments:

Types of Corruption
Redo log Corruption
Data file Corruption
Lots more....



Note: All the documentations are being gather from different sites/blogs/groups/etc. for helping the newbies in Database field. This blog is only and only meant to help the newbies. Suggestion/Advices are highly appreciated.

Interview Questions for Oracle, DBA, Developer Candidates

PL/SQL Questions:

1. Describe the difference between a procedure, function and anonymous pl/sql block.

Level: Low

Expected answer : Candidate should mention use of DECLARE statement, a function must return a value while a procedure doesn?t have to.

2. What is a mutating table error and how can you get around it?

Level: Intermediate

Expected answer: This happens with triggers. It occurs because the trigger is trying to update a row it is currently using. The usual fix involves either use of views or temporary tables so the database is selecting from one while updating the other.

3. Describe the use of %ROWTYPE and %TYPE in PL/SQL

Level: Low

Expected answer: %ROWTYPE allows you to associate a variable with an entire table row. The %TYPE associates a variable with a single column type.

4. What packages (if any) has Oracle provided for use by developers?

Level: Intermediate to high

Expected answer: Oracle provides the DBMS_ series of packages. There are many which developers should be aware of such as DBMS_SQL, DBMS_PIPE, DBMS_TRANSACTION, DBMS_LOCK, DBMS_ALERT, DBMS_OUTPUT, DBMS_JOB, DBMS_UTILITY, DBMS_DDL, UTL_FILE. If they can mention a few of these and describe how they used them, even better. If they include the SQL routines provided by Oracle, great, but not really what was asked.

5. Describe the use of PL/SQL tables

Level: Intermediate

Expected answer: PL/SQL tables are scalar arrays that can be referenced by a binary integer. They can be used to hold values for use in later queries or calculations. In Oracle 8 they will be able to be of the %ROWTYPE designation, or RECORD.

6. When is a declare statement needed ?

Level: Low

The DECLARE statement is used in PL/SQL anonymous blocks such as with stand alone, non-stored PL/SQL procedures. It must come first in a PL/SQL stand alone file if it is used.

7. In what order should a open/fetch/loop set of commands in a PL/SQL block be implemented if you use the %NOTFOUND cursor variable in the exit when statement? Why?

Level: Intermediate

Expected answer: OPEN then FETCH then LOOP followed by the exit when. If not specified in this order will result in the final return being done twice because of the way the %NOTFOUND is handled by PL/SQL.

8. What are SQLCODE and SQLERRM and why are they important for PL/SQL developers?

Level: Intermediate

Expected answer: SQLCODE returns the value of the error number for the last error encountered. The SQLERRM returns the actual error message for the last error encountered. They can be used in exception handling to report, or, store in an error log table, the error that occurred in the code. These are especially useful for the WHEN OTHERS exception.

9. How can you find within a PL/SQL block, if a cursor is open?

Level: Low

Expected answer: Use the %ISOPEN cursor status variable.

10. How can you generate debugging output from PL/SQL?

Level:Intermediate to high

Expected answer: Use the DBMS_OUTPUT package. Another possible method is to just use the SHOW ERROR command, but this only shows errors. The DBMS_OUTPUT package can be used to show intermediate results from loops and the status of variables as the procedure is executed. The new package UTL_FILE can also be used.

11. What are the types of triggers?

Level:Intermediate to high

Expected Answer: There are 12 types of triggers in PL/SQL that consist of combinations of the BEFORE, AFTER, ROW, TABLE, INSERT, UPDATE, DELETE and ALL key words:

BEFORE ALL ROW INSERT

AFTER ALL ROW INSERT

BEFORE INSERT

AFTER INSERT etc.

DBA:

1. Give one method for transferring a table from one schema to another:

Level:Intermediate

Expected Answer: There are several possible methods, export-import, CREATE TABLE... AS SELECT, or COPY.

2. What is the purpose of the IMPORT option IGNORE? What is it?s default setting?

Level: Low

Expected Answer: The IMPORT IGNORE option tells import to ignore "already exists" errors. If it is not specified the tables that already exist will be skipped. If it is specified, the error is ignored and the tables data will be inserted. The default value is N.

3. You have a rollback segment in a version 7.2 database that has expanded beyond optimal, how can it be restored to optimal?

Level: Low

Expected answer: Use the ALTER TABLESPACE ..... SHRINK command.

4. If the DEFAULT and TEMPORARY tablespace clauses are left out of a CREATE USER command what happens? Is this bad or good? Why?

Level: Low

Expected answer: The user is assigned the SYSTEM tablespace as a default and temporary tablespace. This is bad because it causes user objects and temporary segments to be placed into the SYSTEM tablespace resulting in fragmentation and improper table placement (only data dictionary objects and the system rollback segment should be in SYSTEM).

5. What are some of the Oracle provided packages that DBAs should be aware of?

Level: Intermediate to High

Expected answer: Oracle provides a number of packages in the form of the DBMS_ packages owned by the SYS user. The packages used by DBAs may include: DBMS_SHARED_POOL, DBMS_UTILITY, DBMS_SQL, DBMS_DDL, DBMS_SESSION, DBMS_OUTPUT and DBMS_SNAPSHOT. They may also try to answer with the UTL*.SQL or CAT*.SQL series of SQL procedures. These can be viewed as extra credit but aren?t part of the answer.

6. What happens if the constraint name is left out of a constraint clause?

Level: Low

Expected answer: The Oracle system will use the default name of SYS_Cxxxx where xxxx is a system generated number. This is bad since it makes tracking which table the constraint belongs to or what the constraint does harder.

7. What happens if a tablespace clause is left off of a primary key constraint clause?

Level: Low

Expected answer: This results in the index that is automatically generated being placed in then users default tablespace. Since this will usually be the same tablespace as the table is being created in, this can cause serious performance problems.

8. What is the proper method for disabling and re-enabling a primary key constraint?

Level: Intermediate

Expected answer: You use the ALTER TABLE command for both. However, for the enable clause you must specify the USING INDEX and TABLESPACE clause for primary keys.

9. What happens if a primary key constraint is disabled and then enabled without fully specifying the index clause?

Level: Intermediate

Expected answer: The index is created in the user?s default tablespace and all sizing information is lost. Oracle doesn?t store this information as a part of the constraint definition, but only as part of the index definition, when the constraint was disabled the index was dropped and the information is gone.

10. (On UNIX) When should more than one DB writer process be used? How many should be used?

Level: High

Expected answer: If the UNIX system being used is capable of asynchronous IO then only one is required, if the system is not capable of asynchronous IO then up to twice the number of disks used by Oracle number of DB writers should be specified by use of the db_writers initialization parameter.

11. You are using hot backup without being in archivelog mode, can you recover in the event of a failure? Why or why not?

Level: High

Expected answer: You can?t use hot backup without being in archivelog mode. So no, you couldn?t recover.

12. What causes the "snapshot too old" error? How can this be prevented or mitigated?

Level: Intermediate

Expected answer: This is caused by large or long running transactions that have either wrapped onto their own rollback space or have had another transaction write on part of their rollback space. This can be prevented or mitigated by breaking the transaction into a set of smaller transactions or increasing the size of the rollback segments and their extents.

13. How can you tell if a database object is invalid?

Level: Low

Expected answer: By checking the status column of the DBA_, ALL_ or USER_OBJECTS views, depending upon whether you own or only have permission on the view or are using a DBA account.

14. A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check?

Level: Low

Expected answer: You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that points to the object (create synonym emp for scott.emp;)

15. A developer is trying to create a view and the database won?t let him. He has the "DEVELOPER" role which has the "CREATE VIEW" system privilege and SELECT grants on the tables he is using, what is the problem?

Level: Intermediate

Expected answer: You need to verify the developer has direct grants on all tables used in the view. You can?t create a stored object with grants given through views.

16. If you have an example table, what is the best way to get sizing data for the production table implementation?

Level: Intermediate

Expected answer: The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows.

17. How can you find out how many users are currently logged into the database? How can you find their operating system id?

Level: high

Expected answer: There are several ways. One is to look at the v$session or v$process views. Another way is to check the current_logins parameter in the v$sysstat view. Another if you are on UNIX is to do a "ps -ef|grep oracle|wc -l? command, but this only works against a single instance installation.

18. A user selects from a sequence and gets back two values, his select is:

SELECT pk_seq.nextval FROM dual;

What is the problem?

Level: Intermediate

Expected answer: Somehow two values have been inserted into the dual table. This table is a single row, single column table that should only have one value in it.

19. How can you determine if an index needs to be dropped and rebuilt?

Level: Intermediate

Expected answer: Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio

BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.

SQL/ SQLPlus

1. How can variables be passed to a SQL routine?

Level: Low

Expected answer: By use of the & symbol. For passing in variables the numbers 1-8 can be used (&1, &2,...,&8) to pass the values after the command into the SQLPLUS session. To be prompted for a specific variable, place the ampersanded variable in the code itself:

"select * from dba_tables where owner=&owner_name;" . Use of double ampersands tells SQLPLUS to resubstitute the value for each subsequent use of the variable, a single ampersand will cause a reprompt for the value unless an ACCEPT statement is used to get the value from the user.

2. You want to include a carriage return/linefeed in your output from a SQL script, how can you do this?

Level: Intermediate to high

Expected answer: The best method is to use the CHR() function (CHR(10) is a return/linefeed) and the concatenation function "||". Another method, although it is hard to document and isn?t always portable is to use the return/linefeed as a part of a quoted string.

3. How can you call a PL/SQL procedure from SQL?

Level: Intermediate

Expected answer: By use of the EXECUTE (short form EXEC) command.

4. How do you execute a host operating system command from within SQL?

Level: Low

Expected answer: By use of the exclamation point "!" (in UNIX and some other OS) or the HOST (HO) command.

5. You want to use SQL to build SQL, what is this called and give an example

Level: Intermediate to high

Expected answer: This is called dynamic SQL. An example would be:

set lines 90 pages 0 termout off feedback off verify off

spool drop_all.sql

select ?drop user ?||username||? cascade;? from dba_users

where username not in ("SYS?,?SYSTEM?);

spool off

Essentially you are looking to see that they know to include a command (in this case DROP USER...CASCADE;) and that you need to concatenate using the ?||? the values selected from the database.

6. What SQLPlus command is used to format output from a select?

Level: low

Expected answer: This is best done with the COLUMN command.

7. You want to group the following set of select returns, what can you group on?

Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no

Level: Intermediate

Expected answer: The only column that can be grouped on is the "item_no" column, the rest have aggregate functions associated with them.

8. What special Oracle feature allows you to specify how the cost based system treats a SQL statement?

Level: Intermediate to high

Expected answer: The COST based system allows the use of HINTs to control the optimizer path selection. If they can give some example hints such as FIRST ROWS, ALL ROWS, USING INDEX, STAR, even better.

9. You want to determine the location of identical rows in a table before attempting to place a unique index on the table, how can this be done?

Level: High

Expected answer: Oracle tables always have one guaranteed unique column, the rowid column. If you use a min/max function against your rowid and then select against the proposed primary key you can squeeze out the rowids of the duplicate rows pretty quick. For example:

select rowid from emp e

where e.rowid > (select min(x.rowid)

from emp x

where x.emp_no = e.emp_no);

In the situation where multiple columns make up the proposed key, they must all be used in the where clause.

10. What is a Cartesian product?

Level: Low

Expected answer: A Cartesian product is the result of an unrestricted join of two or more tables. The result set of a three table Cartesian product will have x * y * z number of rows where x, y, z correspond to the number of rows in each table involved in the join.

11. You are joining a local and a remote table, the network manager complains about the traffic involved, how can you reduce the network traffic?

Level: High

Expected answer: Push the processing of the remote data to the remote instance by using a view to pre-select the information for the join. This will result in only the data required for the join being sent across.

12. What is the default ordering of an ORDER BY clause in a SELECT statement?

Level: Low

Expected answer: Ascending

13. What is tkprof and how is it used?

Level: Intermediate to high

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

14. What is explain plan and how is it used?

Level: Intermediate to high

Expected answer: The EXPLAIN PLAN command is a tool to tune SQL statements. To use it you must have an explain_table generated in the user you are running the explain plan for. This is created using the utlxplan.sql script. Once the explain plan table exists you run the explain plan command giving as its argument the SQL statement to be explained. The explain_plan table is then queried to see the execution plan of the statement. Explain plans can also be run using tkprof.

15. How do you set the number of lines on a page of output? The width?

Level: Low

Expected answer: The SET command in SQLPLUS is used to control the number of lines generated per page and the width of those lines, for example SET PAGESIZE 60 LINESIZE 80 will generate reports that are 60 lines long with a line width of 80 characters. The PAGESIZE and LINESIZE options can be shortened to PAGES and LINES.

16. How do you prevent output from coming to the screen?

Level: Low

Expected answer: The SET option TERMOUT controls output to the screen. Setting TERMOUT OFF turns off screen output. This option can be shortened to TERM.

17. How do you prevent Oracle from giving you informational messages during and after a SQL statement execution?

Level: Low

Expected answer: The SET options FEEDBACK and VERIFY can be set to OFF.

18. How do you generate file output from SQL?

Level: Low

Expected answer: By use of the SPOOL command

Tuning Questions:

1. A tablespace has a table with 30 extents in it. Is this bad? Why or why not.

Level: Intermediate

Expected answer: Multiple extents in and of themselves aren?t bad. However if you also have chained rows this can hurt performance.

2. How do you set up tablespaces during an Oracle installation?

Level: Low

Expected answer: You should always attempt to use the Oracle Flexible Architecture standard or another partitioning scheme to ensure proper separation of SYSTEM, ROLLBACK, REDO LOG, DATA, TEMPORARY and INDEX segments.

3. You see multiple fragments in the SYSTEM tablespace, what should you check first?

Level: Low

Expected answer: Ensure that users don?t have the SYSTEM tablespace as their TEMPORARY or DEFAULT tablespace assignment by checking the DBA_USERS view.

4. What are some indications that you need to increase the SHARED_POOL_SIZE parameter?

Level: Intermediate

Expected answer: Poor data dictionary or library cache hit ratios, getting error ORA-04031. Another indication is steadily decreasing performance with all other tuning parameters the same.

5. What is the general guideline for sizing db_block_size and db_multi_block_read for an application that does many full table scans?

Level: High

Expected answer: Oracle almost always reads in 64k chunks. The two should have a product equal to 64 or a multiple of 64.

6. What is the fastest query method for a table?

Level: Intermediate

Expected answer: Fetch by rowid

7. Explain the use of TKPROF? What initialization parameter should be turned on to get full TKPROF output?

Level: High

Expected answer: The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. This can also be used to generate explain plan output.

8. When looking at v$sysstat you see that sorts (disk) is high. Is this bad or good? If bad -How do you correct it?

Level: Intermediate

Expected answer: If you get excessive disk sorts this is bad. This indicates you need to tune the sort area parameters in the initialization files. The major sort are parameter is the SORT_AREA_SIZe parameter.

9. When should you increase copy latches? What parameters control copy latches?

Level: high

Expected answer: When you get excessive contention for the copy latches as shown by the "redo copy" latch hit ratio. You can increase copy latches via the initialization parameter LOG_SIMULTANEOUS_COPIES to twice the number of CPUs on your system.

10. Where can you get a list of all initialization parameters for your instance? How about an indication if they are default settings or have been changed?

Level: Low

Expected answer: You can look in the init.ora file for an indication of manually set parameters. For all parameters, their value and whether or not the current value is the default value, look in the v$parameter view.

11. Describe hit ratio as it pertains to the database buffers. What is the difference between instantaneous and cumulative hit ratio and which should be used for tuning?

Level: Intermediate

Expected answer: The hit ratio is a measure of how many times the database was able to read a value from the buffers verses how many times it had to re-read a data value from the disks. A value greater than 80-90% is good, less could indicate problems. If you simply take the ratio of existing parameters this will be a cumulative value since the database started. If you do a comparison between pairs of readings based on some arbitrary time span, this is the instantaneous ratio for that time span. Generally speaking an instantaneous reading gives more valuable data since it will tell you what your instance is doing for the time it was generated over.

12. Discuss row chaining, how does it happen? How can you reduce it? How do you correct it?

Level: high

Expected answer: Row chaining occurs when a VARCHAR2 value is updated and the length of the new value is longer than the old value and won?t fit in the remaining block space. This results in the row chaining to another block. It can be reduced by setting the storage parameters on the table to appropriate values. It can be corrected by export and import of the effected table.

13. When looking at the estat events report you see that you are getting busy buffer waits. Is this bad? How can you find what is causing it?

Level: high

Expected answer: Buffer busy waits could indicate contention in redo, rollback or data blocks. You need to check the v$waitstat view to see what areas are causing the problem. The value of the "count" column tells where the problem is, the "class" column tells you with what. UNDO is rollback segments, DATA is data base buffers.

14. If you see contention for library caches how can you fix it?

Level: Intermediate

Expected answer: Increase the size of the shared pool.

15. If you see statistics that deal with "undo" what are they really talking about?

Level: Intermediate

Expected answer: Rollback segments and associated structures.

16. If a tablespace has a default pctincrease of zero what will this cause (in relationship to the smon process)?

Level: High

Expected answer: The SMON process won?t automatically coalesce its free space fragments.

17. If a tablespace shows excessive fragmentation what are some methods to defragment the tablespace? (7.1,7.2 and 7.3 only)

Level: High

Expected answer: In Oracle 7.0 to 7.2 The use of the 'alter session set events 'immediate trace name coalesce level ts#';? command is the easiest way to defragment contiguous free space fragmentation. The ts# parameter corresponds to the ts# value found in the ts$ SYS table. In version 7.3 the ?alter tablespace coalesce;? is best. If the free space isn?t contiguous then export, drop and import of the tablespace contents may be the only way to reclaim non-contiguous free space.

18. How can you tell if a tablespace has excessive fragmentation?

Level: Intermediate

If a select against the dba_free_space table shows that the count of a tablespaces extents is greater than the count of its data files, then it is fragmented.

19. You see the following on a status report:

redo log space requests 23

redo log space wait time 0

Is this something to worry about? What if redo log space wait time is high? How can you fix this?

Level: Intermediate

Expected answer: Since the wait time is zero, no. If the wait time was high it might indicate a need for more or larger redo logs.

20. What can cause a high value for recursive calls? How can this be fixed?

Level: High

Expected answer: A high value for recursive calls is cause by improper cursor usage, excessive dynamic space management actions, and or excessive statement re-parses. You need to determine the cause and correct it By either relinking applications to hold cursors, use proper space management techniques (proper storage and sizing) or ensure repeat queries are placed in packages for proper reuse.

21. If you see a pin hit ratio of less than 0.8 in the estat library cache report is this a problem? If so, how do you fix it?

Level: Intermediate

Expected answer: This indicate that the shared pool may be too small. Increase the shared pool size.

22. If you see the value for reloads is high in the estat library cache report is this a matter for concern?

Level: Intermediate

Expected answer: Yes, you should strive for zero reloads if possible. If you see excessive reloads then increase the size of the shared pool.

23. You look at the dba_rollback_segs view and see that there is a large number of shrinks and they are of relatively small size, is this a problem? How can it be fixed if it is a problem?

Level: High

Expected answer: A large number of small shrinks indicates a need to increase the size of the rollback segment extents. Ideally you should have no shrinks or a small number of large shrinks. To fix this just increase the size of the extents and adjust optimal accordingly.

24. You look at the dba_rollback_segs view and see that you have a large number of wraps is this a problem?

Level: High

Expected answer: A large number of wraps indicates that your extent size for your rollback segments are probably too small. Increase the size of your extents to reduce the number of wraps. You can look at the average transaction size in the same view to get the information on transaction size.

25. In a system with an average of 40 concurrent users you get the following from a query on rollback extents:

ROLLBACK CUR EXTENTS

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

R01 11

R02 8

R03 12

R04 9

SYSTEM 4

You have room for each to grow by 20 more extents each. Is there a problem? Should you take any action?

Level: Intermediate

Expected answer: No there is not a problem. You have 40 extents showing and an average of 40 concurrent users. Since there is plenty of room to grow no action is needed.

26. You see multiple extents in the temporary tablespace. Is this a problem?

Level: Intermediate

Expected answer: As long as they are all the same size this isn?t a problem. In fact, it can even improve performance since Oracle won?t have to create a new extent when a user needs one.

Installation/Configuration

1. Define OFA.

Level: Low

Expected answer: OFA stands for Optimal Flexible Architecture. It is a method of placing directories and files in an Oracle system so that you get the maximum flexibility for future tuning and file placement.

2. How do you set up your tablespace on installation?

Level: Low

Expected answer: The answer here should show an understanding of separation of redo and rollback, data and indexes and isolation os SYSTEM tables from other tables. An example would be to specify that at least 7 disks should be used for an Oracle installation so that you can place SYSTEM tablespace on one, redo logs on two (mirrored redo logs) the TEMPORARY tablespace on another, ROLLBACK tablespace on another and still have two for DATA and INDEXES. They should indicate how they will handle archive logs and exports as well. As long as they have a logical plan for combining or further separation more or less disks can be specified.

3. What should be done prior to installing Oracle (for the OS and the disks)?

Level: Low

Expected Answer: adjust kernel parameters or OS tuning parameters in accordance with installation guide. Be sure enough contiguous disk space is available.

4. You have installed Oracle and you are now setting up the actual instance. You have been waiting an hour for the initialization script to finish, what should you check first to determine if there is a problem?

Level: Intermediate to high

Expected Answer: Check to make sure that the archiver isn?t stuck. If archive logging is turned on during install a large number of logs will be created. This can fill up your archive log destination causing Oracle to stop to wait for more space.

5. When configuring SQLNET on the server what files must be set up?

Level: Intermediate

Expected answer: INITIALIZATION file, TNSNAMES.ORA file, SQLNET.ORA file

6. When configuring SQLNET on the client what files need to be set up?

Level: Intermediate

Expected answer: SQLNET.ORA, TNSNAMES.ORA

7. What must be installed with ODBC on the client in order for it to work with Oracle?

Level: Intermediate

Expected answer: SQLNET and PROTOCOL (for example: TCPIP adapter) layers of the transport programs.

8. You have just started a new instance with a large SGA on a busy existing server. Performance is terrible, what should you check for?

Level: Intermediate

Expected answer: The first thing to check with a large SGA is that it isn?t being swapped out.

9. What OS user should be used for the first part of an Oracle installation (on UNIX)?

Level: low

Expected answer: You must use root first.

10. When should the default values for Oracle initialization parameters be used as is?

Level: Low

Expected answer: Never

11. How many control files should you have? Where should they be located?

Level: Low

Expected answer: At least 2 on separate disk spindles. Be sure they say on separate disks, not just file systems.

12. How many redo logs should you have and how should they be configured for maximum recoverability?

Level: Intermediate

Expected answer: You should have at least three groups of two redo logs with the two logs each on a separate disk spindle (mirrored by Oracle). The redo logs should not be on raw devices on UNIX if it can be avoided.

13. You have a simple application with no "hot" tables (i.e. uniform IO and access requirements). How many disks should you have assuming standard layout for SYSTEM, USER, TEMP and ROLLBACK tablespaces?

Expected answer: At least 7, see disk configuration answer above.

Data Modeler:

1. Describe third normal form?

Level: Low

Expected answer: Something like: In third normal form all attributes in an entity are related to the primary key and only to the primary key

2. Is the following statement true or false:

"All relational databases must be in third normal form"

Why or why not?

Level: Intermediate

Expected answer: False. While 3NF is good for logical design most databases, if they have more than just a few tables, will not perform well using full 3NF. Usually some entities will be denormalized in the logical to physical transfer process.

3. What is an ERD?

Level: Low

Expected answer: An ERD is an Entity-Relationship-Diagram. It is used to show the entities and relationships for a database logical model.

4. Why are recursive relationships bad? How do you resolve them?

Level: Intermediate

A recursive relationship (one where a table relates to itself) is bad when it is a hard relationship (i.e. neither side is a "may" both are "must") as this can result in it not being possible to put in a top or perhaps a bottom of the table (for example in the EMPLOYEE table you couldn?t put in the PRESIDENT of the company because he has no boss, or the junior janitor because he has no subordinates). These type of relationships are usually resolved by adding a small intersection entity.

5. What does a hard one-to-one relationship mean (one where the relationship on both ends is "must")?

Level: Low to intermediate

Expected answer: This means the two entities should probably be made into one entity.

6. How should a many-to-many relationship be handled?

Level: Intermediate

Expected answer: By adding an intersection entity table

7. What is an artificial (derived) primary key? When should an artificial (or derived) primary key be used?

Level: Intermediate

Expected answer: A derived key comes from a sequence. Usually it is used when a concatenated key becomes too cumbersome to use as a foreign key.

8. When should you consider denormalization?

Level: Intermediate

Expected answer: Whenever performance analysis indicates it would be beneficial to do so without compromising data integrity.

UNIX:

1. How can you determine the space left in a file system?

Level: Low

Expected answer: There are several commands to do this: du, df, or bdf

2. How can you determine the number of SQLNET users logged in to the UNIX system?

Level: Intermediate

Expected answer: SQLNET users will show up with a process unique name that begins with oracle, if you do a ps -ef|grep oracle|wc -l you can get a count of the number of users.

3. What command is used to type files to the screen?

Level: Low

Expected answer: cat, more, pg

4. What command is used to remove a file?

Level: Low

Expected answer: rm

5. Can you remove an open file under UNIX?

Level: Low

Expected answer: yes

6. How do you create a decision tree in a shell script?

Level: intermediate

Expected answer: depending on shell, usually a case-esac or an if-endif or fi structure

7. What is the purpose of the grep command?

Level: Low

Expected answer: grep is a string search command that parses the specified string from the specified file or files

8. The system has a program that always includes the word nocomp in its name, how can you determine the number of processes that are using this program?

Level: intermediate

Expected answer: ps -ef|grep *nocomp*|wc -l

9. What is an inode?

Level: Intermediate

Expected answer: an inode is a file status indicator. It is stored in both disk and memory and tracts file status. There is one inode for each file on the system.

10. The system administrator tells you that the system hasn?t been rebooted in 6 months, should he be proud of this?

Level: High

Expected answer: Maybe. Some UNIX systems don?t clean up well after themselves. Inode problems and dead user processes can accumulate causing possible performance and corruption problems. Most UNIX systems should have a scheduled periodic reboot so file systems can be checked and cleaned and dead or zombie processes cleared out.

11. What is redirection and how is it used?

Level: Intermediate

Expected answer: redirection is the process by which input or output to or from a process is redirected to another process. This can be done using the pipe symbol "|", the greater than symbol ">" or the "tee" command. This is one of the strengths of UNIX allowing the output from one command to be redirected directly into the input of another command.

12. How can you find dead processes?

Level: Intermediate

Expected answer: ps -ef|grep zombie -- or -- who -d depending on the system.

13. How can you find all the processes on your system?

Level: Low

Expected answer: Use the ps command

14. How can you find your id on a system?

Level: Low

Expected answer: Use the "who am i" command.

15. What is the finger command?

Level: Low

Expected answer: The finger command uses data in the passwd file to give information on system users.

16. What is the easiest method to create a file on UNIX?

Level: Low

Expected answer: Use the touch command

17. What does >> do?

Level: Intermediate

Expected answer: The ">>" redirection symbol appends the output from the command specified into the file specified. The file must already have been created.

18. If you aren?t sure what command does a particular UNIX function what is the best way to determine the command?

Expected answer: The UNIX man -k command will search the man pages for the value specified. Review the results from the command to find the command of interest.

Oracle Troubleshooting:

1. How can you determine if an Oracle instance is up from the operating system level?

Level: Low

Expected answer: There are several base Oracle processes that will be running on multi-user operating systems, these will be smon, pmon, dbwr and lgwr. Any answer that has them using their operating system process showing feature to check for these is acceptable. For example, on UNIX a ps -ef|grep dbwr will show what instances are up.

2. Users from the PC clients are getting messages indicating :

Level: Low

ORA-06114: (Cnct err, can't get err txt. See Servr Msgs & Codes Manual)

What could the problem be?

Expected answer: The instance name is probably incorrect in their connection string.

3. Users from the PC clients are getting the following error stack:

Level: Low

ERROR: ORA-01034: ORACLE not available

ORA-07318: smsget: open error when opening sgadef.dbf file.

HP-UX Error: 2: No such file or directory

What is the probable cause?

Expected answer: The Oracle instance is shutdown that they are trying to access, restart the instance.

4. How can you determine if the SQLNET process is running for SQLNET V1? How about V2?

Level: Low

Expected answer: For SQLNET V1 check for the existence of the orasrv process. You can use the command "tcpctl status" to get a full status of the V1 TCPIP server, other protocols have similar command formats. For SQLNET V2 check for the presence of the LISTENER process(s) or you can issue the command "lsnrctl status".

5. What file will give you Oracle instance status information? Where is it located?

Level: Low

Expected answer: The alert.ora log. It is located in the directory specified by the background_dump_dest parameter in the v$parameter table.

6. Users aren?t being allowed on the system. The following message is received:

Level: Intermediate

ORA-00257 archiver is stuck. Connect internal only, until freed

What is the problem?

Expected answer: The archive destination is probably full, backup the archive logs and remove them and the archiver will re-start.

7. Where would you look to find out if a redo log was corrupted assuming you are using Oracle mirrored redo logs?

Level: Intermediate

Expected answer: There is no message that comes to the SQLDBA or SRVMGR programs during startup in this situation, you must check the alert.log file for this information.

8. You attempt to add a datafile and get:

Level: Intermediate

ORA-01118: cannot add anymore datafiles: limit of 40 exceeded

What is the problem and how can you fix it?

Expected answer: When the database was created the db_files parameter in the initialization file was set to 40. You can shutdown and reset this to a higher value, up to the value of MAX_DATAFILES as specified at database creation. If the MAX_DATAFILES is set to low, you will have to rebuild the control file to increase it before proceeding.

9. You look at your fragmentation report and see that smon hasn?t coalesced any of you tablespaces, even though you know several have large chunks of contiguous free extents. What is the problem?

Level: High

Expected answer: Check the dba_tablespaces view for the value of pct_increase for the tablespaces. If pct_increase is zero, smon will not coalesce their free space.

10. Your users get the following error:

Level: Intermediate

ORA-00055 maximum number of DML locks exceeded

What is the problem and how do you fix it?

Expected answer: The number of DML Locks is set by the initialization parameter DML_LOCKS. If this value is set to low (which it is by default) you will get this error. Increase the value of DML_LOCKS. If you are sure that this is just a temporary problem, you can have them wait and then try again later and the error should clear.

11. You get a call from you backup DBA while you are on vacation. He has corrupted all of the control files while playing with the ALTER DATABASE BACKUP CONTROLFILE command. What do you do?

Level: High

Expected answer: As long as all datafiles are safe and he was successful with the BACKUP controlfile command you can do the following:

CONNECT INTERNAL

STARTUP MOUNT

(Take any read-only tablespaces offline before next step ALTER DATABASE DATAFILE .... OFFLINE;)

RECOVER DATABASE USING BACKUP CONTROLFILE

ALTER DATABASE OPEN RESETLOGS;

(bring read-only tablespaces back online)

Shutdown and backup the system, then restart

If they have a recent output file from the ALTER DATABASE BACKUP CONTROL FILE TO TRACE; command, they can use that to recover as well.

If no backup of the control file is available then the following will be required:

CONNECT INTERNAL

STARTUP NOMOUNT

CREATE CONTROL FILE .....;

However, they will need to know all of the datafiles, logfiles, and settings for MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES for the database to use the command.

Free Online books or Tutorials on Database(Oracle/Mysql/SqlServer/Postgre)

List of Books available for free download:

1) Oracle 9i Database Administrators Guide
2) Oracle 9i Database Concept
3) Oracle 9i Database Getting Started
4) Oracle 9i Security Network Integration
5) Oracle 8 How to.zip
6) O'Reilly - Oracle Application
7) Oreilly Mastering Oracle SQL
8) Teach Yourself Oracle 8 In 21 Days
9) Oracle Unleashed (SAMS)
10)Oracle PL/SQL Bookshelf
11)Using Oracle8

http://programmerworld.net/books/oracle.htm


Available for MySql/SqlServer/Postgre Database Documentation for free download.

http://programmerworld.net/books/database.htm

How do you tune your Oracle database?

This article provides technical insight into Oracle database Wait-Event performance issues. Wait-Event Analysis for Oracle Databases is the industry best practice today for database tuning and performance optimization. Understanding the importance of each Oracle Wait-Event or “Resource” is essential for DBAs in keeping their database performing at its optimal level. Each month, Confio Software brings you this update to provide insight into a specific Oracle Resource, its significance in your Oracle system, and how to identify and address related problems. Oracle Resource is: index block split Definition: As applications, users, or sessions request rows from a table, Oracle may determine through the cost-based optimizer, which index access path is best for finding rows in a table. During this index lookup process, if another session is inserting or updating data, which in turn causes updates to that index and requires an index block split, the first session must wait on that index block split until finished. After which the first session must retry the index lookup request again to get the appropriate index keys for the rows required. Indexes are made up of a root block, branch blocks, and leaf blocks. Each of which can go through a block split. As index entries are created, and because index structures are inherently ordered, if the block required holding the new index key is full, room must be made by performing a block split. These block splits can occur in two different flavors. The first case splitting the block 50/50 where a new block is created and half the entries are contained in each of the blocks after the split. The second case is a 99/1 split that accommodates indexes where there are ever increasing values and the new key value is the highest key. In this case the original block is left intact and the new block contains only the new entry. Finding the splitting index When an index block split causes a session to wait, an event will be seen in the V$SESSION_WAIT view. The wait time associated with the event that holds up the session from selecting a row is important, but often just determining the splitting index object is key. The block splitting can then be limited by modifying the structure of the index. There are essentially three steps to this process of finding the offending index: 1. Find the data block addresses (dba) of the splitting index from the V$SESSION_WAIT view. Two different dbas are given plus the level of the index block:
P1 : rootdba: The root of the index
P2 : level: The level of the index where the block is being split
P3 : childdba: The actual block of the index being split

SELECT sid, event, p1, p2, p3 FROM v$session_wait

1. Find the physical location of the splitting index by using the DBMS_UTILITY package. Two functions will help zero in on the physical location of the index block using the rootdba value from step

1: DATA_BLOCK_ADDRESS_FILE: Returns the file number of the dba

DATA_BLOCK_ADDRESS_BLOCK: Returns the block number the dba

SELECT DBMS_UTILITY.DATA_BLOCK _ADDRESS_FILE() FILE_ID, DBMS_UTILITY.DATA_BLOCK_ADDRESS_BLOCK() BLOCK_ID
FROM dual;

Find the offending index object from DBA_EXTENTS using the FILE_ID and BLOCK_ID values determined from step

2: SELECT owner, segment_name FROM dba_extents WHERE file_id = AND BETWEEN block_id AND block_id + blocks -1;

How to combat index block splits

1. Re-evaluate the setting of PCTFREE for problematic indexes. Giving a higher PCTFREE will allow more index entries to be inserted into existing index blocks and thus prolong the need for an index block split.

2. Check the indexed columns to make sure they are valid. An improperly formed index key can cause excessive splitting by the nature and order of the columns it contains.

3. Check application logic. Many ill-formed applications have been known to perform excessive updates to indexes when not required. Review application code to verify all data manipulations are required, especially if some tables are treated as temporary objects when in fact they are permanent tables.

Conclusion

Through the normal processing of insertions and updates to data, Oracle must maintain indexes so future queries to the underlying data can be accessed quickly through the use of indexes. Maintaining these indexes requires Oracle to keep index entries in order and thus may need to split and move keys between blocks at times. Splitting, allocating a new block, and moving keys are very expensive operations. If done too often the performance of queries against those indexes must wait and could slow down processing. Proper detection of the offending index and taking corrective action through changing the index structure or application processing must be done.