Friday 26 November 2010

ORA-29855 error in oracle and solution & Oracle Text

We sometime see the error when insufficient privileges are assigned and CTXSYS is not presented in oracle db 10g.

ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
ORA-20000: Oracle Text error:
DRG-10700: preference does not exist: CTXSYS.DEFAULT_LEXER
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364

This errors comes when lack of privileges/roles when we work with text components (formerly known as Context, or Intermedia Text), this concept provides a powerful search, retrieval, and viewing capabilities for text stored in oracle database.

The solution is as follows:
AS sys DBA:
GRANT EXECUTE ON CTX_DDL TO username ; -- for oracle text package execution i.e. index rebuild and synchronize etc. Ignore if CTX_DDL not going to be used.
grant CTXAPP to username ; 

Solution: 
-----------
Ensure that CTXSYS schema is installed on database instance.

Install:
@? points oracle home directory i.e. ORACLE_HOME variable, ensure ORACLE_HOME and ORACLE_SID is set (window) or with export in UNIX.
The steps to be executed as SYS user 
create tablespace drsys as sysdba
run @?/ctx/admin/catctx.sql ctxsys drsys temp01 nolock
run @?/ctx/admin/defaults/drdefus.sql (as CTXSYS user )-- see below for why and how
grant execute on ctxsys.ctx_ddl to user; 

Uninstall:
@?/ctx/admin/catnoctx.sql as sys

The next step is to install appropriate language-specific default preferences. There is script which creates language-specific default preferences for every language Oracle text supports in ORACLE_HOME/ctx/admin/defaults directory and script should be executed as CTXSYS user.
@?/ctx/admin/defaults/drdefXX.sql -where XX is the language code 


- wish this helps you too..

Wednesday 24 November 2010

ORA-23421: job number <nnn> is not a job in the job queue

You can only change your own jobs by using DBMS_JOB package. Not even SYS is exception to this, meaning that if you connect to the database as SYSDBA you'll be only able to change jobs belonging to SYS, but not those belonging to SCOTT, for example.

Howevere there is undocumented package called DBMS_IJOB that enables you to manipulate other users jobs (provided that you have EXECUTE ANY PROCEDURE privilege). For example, you can remove any job (not only those owned by you) from the job queue by executing procedure SYS.DBMS_IJOB.REMOVE(:job_id)

I'm not sure if DBMS_IJOB has all the procedures that DBMS_JOB has (WHAT, NEXT_DATE, INTERVAL, BROKEN, ...) and if all the parameters are the same, but you can find this out by yourself.

logon as sysdba and use:

SQL>select * from dba_jobs;

To drop perticular job:

SQL>exec SYS.DBMS_IJOB.remove(210);

To drop all user’s job:

SQL>exec SYS.DBMS_IJOB.DROP_USER_JOBS('myuser');

Cheers!

Job Removed!

Dell Service Tag


   
Open CMD
  • Type "wmic bios get serialnumber" (without quotes). Press "Enter." The computer responds with information from the Dell remote computer. The information below "Serial Number" is the Dell system service tag
  • To obtain the make and model number, type "wmic csproduct get vendor,name,identifyingnumber" (without quotes). Press "Enter.

Labels:



Thursday 18 November 2010

Word Count Function


Word Count Function :
create or replace
FUNCTION wordcount (str IN VARCHAR2)
RETURN PLS_INTEGER
AS
words PLS_INTEGER := 0;
len PLS_INTEGER := NVL(LENGTH(str),0);
inside_a_word BOOLEAN;
BEGIN
FOR i IN 1..len + 1
LOOP
IF ASCII(SUBSTR(str, i, 1)) < 33 OR i > len
THEN
IF inside_a_word
THEN
words := words + 1;
inside_a_word := FALSE;
END IF;
ELSE
inside_a_word := TRUE;
END IF;
END LOOP;
RETURN words;
END;