Archive for the 'Oracle 10g' Category

Reset SYSTEM password

August 1st, 2010

For the ones who wants to reset the SYSTEM pwd:
operfcfg.exe -U SYSTEM -P password -D tns_entry_name

Select ‘X’ faster then Select 1

January 23rd, 2009

What somebody at Oracle Belgium told me once 10 years ago, I retested it on Oracle 10R2.
A Select ‘X’ is faster then a Select 1.
Stop dreaming because it’s only slightly faster.
see here the tests I did

SET time ON
SET timing ON
 
declare
v_n number;
v_c varchar2(1);
begin
FOR i IN 1..1000000 loop
SELECT ‘X’ INTO v_c FROM dual;
end loop;
end;
/
 
declare
[...]

direct path write temp

December 23rd, 2008

Had a query which took ages. After checking the session browser I noticed the query was doing a lot of “direct path write temp”. So I checked directly the sort_area_size. Big surprise it had a value of 64K!!!
After sending a mail to the DBA’s of my current project to ask to increase to 1GB, everything [...]

How to list the installed patches on Oracle?

October 21st, 2008

Use Opatch.
Look in the Opatch directory in Oracle Home.
‘opatch query -all’ will allow you to query detailed information about a patch.
‘opatch lsinventory’ will list all patches with the applied date chronologically.
‘opatch lsinventory -detail’ will list all patches and which files were modified.

To block sample or to auto sample? That’s the question !

July 23rd, 2008

Because of some problems with the Oracle statistics I did a small research.
I have a custom procedure of gathering stats that i call p_x_stats_table. It will gather stats with and estimation of X% of the records. With X corresponding a percentage witch reflect 100.000 records (or all records of table if amount of records inferiuor then [...]

Interesting system views concerning statistics history

July 23rd, 2008

WRI$_OPTSTAT_HISTGRM_HISTORY
WRI$_OPTSTAT_HISTHEAD_HISTORY
WRI$_OPSTAT_TAB_HISTORY

Faster, commit!

July 9th, 2008

In Oracle 10gR2 there is a way to make a commit even faster in your PL/SQL code. Hey every microsecond counts.

COMMIT WRITE IMMEDIATE NOWAIT;

How to execute long dynamic statements

July 7th, 2008

PROCEDURE exec_clob_sql_statement(vv_clob_sql_statement IN clob) IS
v_cur       INTEGER     := DBMS_SQL.open_cursor;
v_offset    PLS_INTEGER :=1;
v_nb        PLS_INTEGER :=0;
v_sql_table DBMS_SQL.varchar2a;
v_len       PLS_INTEGER;
v_retval    INTEGER;
BEGIN
  v_len := DBMS_LOB.getlength(vv_clob_sql_statement);
 
LOOP
    v_nb:=v_nb+1;
    v_sql_table(v_nb):=DBMS_LOB.SUBSTR(vv_clob_sql_statement
                                        ,LEAST(4000,v_len - v_offset + 1)
                                        ,v_offset
                                        );
    v_offset:=v_offset + 4000;
    EXIT WHEN v_offset > v_len;
  END LOOP;
 
DBMS_SQL.parse(v_cur, v_sql_table, 1, v_nb, FALSE, DBMS_SQL.native);
  v_retval:=DBMS_SQL.EXECUTE(v_cur);
  DBMS_SQL.close_cursor(v_cur);
EXCEPTION WHEN OTHERS THEN
  IF DBMS_SQL.is_open(v_cur) THEN DBMS_SQL.close_cursor(v_cur); END IF;
  RAISE;
END exec_clob_sql_statement;