Archive for the 'Oracle 9i' Category

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 [...]

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;

Oracle Passwords: behind the scenes

April 30th, 2008

Up to 30 characters long. All characters will be converted to uppercase before the hashing starts
8-byte hash, encrypted with a DES encryption algorithm without real salt (just the username).
The algorithm can be found in the book “Special Ops Host And Network Security For Microsoft, Unix, And Oracle” on page 727.
Oracle database 11g offers the (optional) [...]

ORA-01401 vs ORA-12899

March 13th, 2008

Watch out for hardcoded ORA-01401 (inserted value too large for column) error handling because from 10g onwards this errorcode has been discarded. His replacer is the error code ORA-12899.
It’s always anoying that codes are changing but the good thing about the change is that the error description changes. It tell you which column causes the [...]