Oracle Logbook

July 17, 2008

Oracle Bug Status code on metalink

Filed under: Uncategorized — heliodias @ 8:46 pm

10 - Description Phase:
Development is requesting more information.

11 - Code Bug (Response/Resolution):
Bug is being worked by Development.

16 - Support bug screening:
Bug is being reviewed by our Bug Diagnostics group.

30 - Additional Information Requested:
Bug is being worked by Support and/or more information was requested by Development.

37 - To Filer for Review/Merge Required:
Bug has been fixed but the patch will be merged into the next patchset.

80 - Development to Q/A:
Bug is being regression tested for future release.

96 - Closed, Duplicate Bug:
Bug is closed as a duplicate bug.

July 15, 2008

How to finding Maximum SESSION_CACHED_CURSORS in use

Filed under: Uncategorized — heliodias @ 7:57 pm

select max(value)
from v$sesstat natural join v$statname
where name = ’session cursor cache count’ ;
Select amount,SESSION_CACHED_CURSORS*30+30 Cached_Cursors_Rounded from
(select trunc(value/30)  SESSION_CACHED_CURSORS,count(*) Amount
from V$sesstat natural join v$statname
where name = ’session cursor cache count’
group by trunc(value/30) order by 1);

    AMOUNT CACHED_CURSORS_ROUNDED
———- ———————-
       223                     30
        32                     60
        15                     90
         6                    120
         2                    150
         3                    180
         5                    210

7 rows selected.
As we can see 210 will allow every session to cache what they need.

How Adjust Open_cursors on Oracle Database

Filed under: Uncategorized — heliodias @ 7:56 pm

First you need to know how many cursors are you session using at maximum

select max(value) from V$sesstat natural join v$statname
where name = ‘opened cursors current’;
Then you can give some safe e.g. 30% and do an
alter system set open_cursors=&New_value_plus_20pct;
Select amount,Opened_cursos_rounded*10+10 from
(select trunc(value/10) Opened_cursos_rounded,count(*) Amount from V$sesstat natural join v$statname
where name = ‘opened cursors current’
group by trunc(value/10) order by 1);

    AMOUNT OPENED_CURSOS_ROUNDED*10
———- ————————
        35                        0
        59                       10
        10                       20
         3                       30
         2                       40
         1                       60
         1                       70
         1                       80
         1                      130
         1                      180
         1                      190
         1                      200
         1                      220
         2                      230

14 rows selected.
On my example you can see that most of sessions are using just 10 cursors, but my max are at 230.
So put a limit on 300 is sounds good.

July 13, 2008

Killing an Oracle process without OS access

Filed under: Uncategorized — heliodias @ 3:16 am

Sometimes alter system kill session doesn´t work , and you don´t have access to SO.

So use Oradebug instead, but remember to change to correct session:

oradebug event immediate crash;

Killing an Oracle process from inside Oracle

July 11, 2008

Logon Trigger

Filed under: Uncategorized — heliodias @ 8:38 pm

Sometimes you need to something happen just after logon, e.g. an alter session , or an audit DML.

So you may use Logon trigger to do this:

 

GRANT ALTER SESSION TO SYSTEM;

GRANT CREATE SESSION TO SYSTEM;

create or replace trigger set_trace after logon on database
begin
if user not in (’SYS’,'SYSTEM’) then
if user=’GERAL’ THEN
execute immediate ‘alter session set TRACEFILE_IDENTIFIER= ”CLIENT_TRACE10046”’;
execute immediate ‘alter session set timed_statistics=true’;
execute immediate ‘alter session set max_dump_file_size=unlimited’;
execute immediate ‘alter session set events ”10046 trace name context forever, level 12”’;
end if;
end if;
exception
when others then
null;
end;
/

 

GRANT ALTER SESSION TO SYSTEM;

GRANT CREATE SESSION TO SYSTEM;

create or replace trigger GC_set_session after logon on database
begin
if user not in (’SYS’,'SYSTEM’) then
  execute immediate ‘alter session set session_cached_cursors=250′;
end if;
exception
when others then
null;
end;
/

July 4, 2008

Adjusting Oracle memory

Filed under: Uncategorized — heliodias @ 12:20 pm

To do a fine tuning on memory area, you should first look the shared pool, then go to PGA and at the end adjust the db_cache

SELECT SHARED_POOL_SIZE_FOR_ESTIMATE MB_ESTIMATE,SHARED_POOL_SIZE_FACTOR
FACTOR_PERCENT,
ESTD_LC_TIME_SAVED_FACTOR TIME_PERCENT FROM V$SHARED_POOL_ADVICE;

SELECT PGA_TARGET_FOR_ESTIMATE MB_ESTIMADO,PGA_TARGET_FACTOR
FATOR_PERCENT,
ESTD_PGA_CACHE_HIT_PERCENTAGE ACERTO_PERCENT FROM V$PGA_TARGET_ADVICE;

SELECT SIZE_FOR_ESTIMATE MB_ESTIMADO, SIZE_FACTOR
FATOR_PERCENT,
ESTD_PHYSICAL_READ_FACTOR TEMPO_PERCENT FROM V$DB_CACHE_ADVICE;

Below are good notes from metalink
Metalink Note: 223730.1 Automatic PGA Memory Management in 9i and 10g

Metalink Note: 62172.1 Understanding and Tuning Buffer Cache and DBWR

Metalink Note: 255409.1 Size Shared Pool using V$shared_pool_advice.

June 25, 2008

Using DBMS_SHARED_POOL.KEEP TO PINNING

Filed under: Uncategorized — heliodias @ 6:03 pm

CREATE TABLE GC_PINNING
(OBJ_OWNER VARCHAR2(50), OBJ_NAME VARCHAR2(50),OBJ_TYPE VARCHAR2(50),
OBJ_SIZE NUMBER,PINNING_DATE DATE DEFAULT SYSDATE,obj_LOADS NUMBER);

insert into GC_PINNING
(OBJ_OWNER , OBJ_NAME,OBJ_TYPE,
OBJ_SIZE,PINNING_DATE ,obj_LOADS)
(select
OWNER , NAME,TYPE,
sharable_mem,
sysdate
,LOADS
from v$db_object_cache where
type in (’PACKAGE’,'PACKAGE BODY’,'TRIGGER’,'SEQUENCE’,'PROCEDURE’)
and nvl(sharable_mem,0)>0 and kept=’NO’);

CREATE OR REPLACE PROCEDURE GC_PINNER AS
/*
gc_Pinner by Helio Dias.com
Subject : pinning object that had been saved on GC_PINNING table
June 24, 2008,
*/
cursor c_pinning is
select OBJ_OWNER||’.'||OBJ_NAME OBJ_NAME,OBJ_TYPE from GC_PINNING;
V_NAME VARCHAR2(50);
V_TYPE VARCHAR(50);
begin
open c_pinning;
loop
fetch c_pinning into v_name,v_type;
exit when c_pinning%notfound;
IF V_TYPE=’FUNCTION’
THEN V_TYPE:=’P';
END IF;
IF V_TYPE=’SEQUENCE’
THEN V_TYPE:=’Q';
END IF;
IF V_TYPE=’TRIGGER’
THEN V_TYPE:=’R';
END IF;
V_TYPE:=SUBSTR(V_TYPE,1,1);
dbms_shared_pool.keep(V_NAME,V_TYPE);
end loop;
END;
/

June 23, 2008

Oracle interview questions

Filed under: Uncategorized — heliodias @ 3:53 pm

Every time a saw this type of ask on forums, so i decide to put some basics questions:

What is the difference between cold backup and hot backup?

What is the difference between and constraints and triggers?

What is normalization? what is the advantage of normalization (briefly)

What is structure of Database?

What is the difference between primary key, unique key, sorrougate key?

What is the different between Stand Alone Procedure and Package?

How create database statistics?

What is Mutating Trigger?

What is Full Table Scan?

What is Tablespace Quota? what is usefull views?

You are going to out of tablespace space , what are you gonna do?

Describe a dead lock

Is lock a bad thing?

What is ORA-1555?

What is ORA-0600?

What is ORA-04031?

Difference of Physical and Logical Backup?

CBO Means?

What is difference between SQLNET.ORA AND TNSNAMES.ORA AND LISTENER.ORA?

Most of this questions had been extracted from :
http://www.geekinterview.com/Interview-Questions/Oracle

June 13, 2008

Oracle Architecture and Tuning on AIX

Filed under: Uncategorized — heliodias @ 2:51 pm

Finding ORA-04031 When not appear on alert

Filed under: Uncategorized — heliodias @ 1:52 pm

Sometimes just the user session receive the message, but it not logged on alert.
On this X$ Table you can see this.

select sum(kghlunfu) Total_4031 ,kghlunfs Size_miss from x$kghlu group by kghlunfs;

Next Page »

Blog at WordPress.com.