Monday, July 31, 2006

ORA-21779 the brain teaser

Amongst my favourite oracle 10G enhancements there is the support for regular expressions.
There is a whole bunch of functions to deal with strings using these powerful pattern matching descriptors so i decided to use them for implementing a procedure that unscrambles search engine URLs in pursuit of the search keywords that led a user to my site.

So, i set out and wrote this wonderful web search URL decoder for the most popular engines like Google and Yahoo and installed it on my development box, just to find out minutes later that, at times, i was getting a strange error called ORA-21779: Duration not active.

The short error description wasn't very helpful, what kind of duration is it talking about?!?
Don't panic, let's see first what the Error Messages manual for version 10.1 says about it.

Cause: User is trying to use a duration that has been terminated
Action: User should avoid performing such operation.

I don't know the rest of you guys, but i'd love to know the "backstage" of the birth of this message. I get this fancy picture in my mind of two tired oracle techies working late in an office where everyone else is at home and sleeping and one screams at the colleague sitting at the other end of a big open space room:

- JOE! What was that error you got this morning?
- ...ion not active! (very weak)
- What?
- ...ion NOT ACTIVE! (somewhat louder)
- HUH?!?
- &$%!!
- (long silence)... and how do you fix it?
- Just don't do it!
- (long silence)

At any rate, back to my problem, it took me a while to figure out that the error was raised by function regexp_replace, for two reasons:

#1 the error was not returned every time i executed the query even against the same inputs.
#2 the function is contained in a so-called "process" inside a page definition of Oracle Apex (Application Express 2.0) , so, at first i thought it was returned by the underlying query of the report being displayed, not by the after submit process.

So, in the end, i commented out the function call and the error stopped occurring.
Said that, i turned up to oracle metalink in search of more descriptive explanations of the problem but i found just one note mentioning regexp functions called inside "pipelined functions".
I also found another note (or was it the same?) suggesting that patch 10.1.0.5 could fix the problem, so i installed the patch too, with little success regarding the point, but introducing the ORA-12640 problem i related in a previous post.
It was not my lucky day, definitely.

After several attempts to isolate the real cause of the problem however, i found out that the error can happen even without nesting regexp_replace inside pipeline functions, but still i cannot reproduce this behaviour sistematically, there is some erraticism in it.
To add more to the picture, this seems to be a Windows only problem.
I could not manage to reproduce it on Solaris, which is good on the other hand because it's my target production environment.
I also left a message in the metalink forum, but nobody has replied up to date.

So, at the end of the day, the function in my development box is still haunted by these infrequent ORA-21779 errors and i don't dare to install the new functionality in a production environment even if, so far, all the tests have returned positive results.

Any suggestions?

PS: UPDATED July 13, 2007
if you are getting this error in an Oracle Application Express page, try out this workaround.

Friday, July 28, 2006

ORA-12640 aka TNS-12640

I recently installed patch 10.1.0.5 on my development box, a windows 2000 box.
When i install oracle software i always log on with the OS administrator account, but when i am developing applications, i normally log on as a power user because i don't need administrator privileges.
For some reason that i still have to investigate, after patching the db, i could no longer log on to the db from the command line using something like:

sqlplus /nolog

connect / as sysdba

because the following error was returned:
ORA-12640: Authentication adapter initialization failed

After a few attempts, it turned out that if i added the os user to the administrators group, the same log on procedure would succeed.
To be more precise i had also to sign off and on again in order to acknowledge the change of permissions.

This behaviour seems to be related to the protocol that oracle uses to communicate with the db when the client and the server are located on the same box.
Indeed it is remarkable to note that if you try to log on in this way:
sqlplus "usr/pwd@dbconn as sysdba"
you'll get the same ORA-12640 error if you do it on the server, while it would succeed on a remote client.

And the same happens when running Golden32.exe or PLEdit.exe , two nifty utilities from Benthic Software.


ORA-12640: Inizializzazione adattatore di autenticazione non riuscita
ORA-12640: Fallo en la inicialización del adaptador de autenticación
ORA-12640: No s'ha pogut inicialitzar l'adaptador d'autenticació
ORA-12640: Initialisation impossible de l'adaptateur d'authentification
ORA-12640: Inititalisierung des Berechtigungsprüfungsadapters misslungen
ORA-12640: Αρχικοποίηση οδηγού προσαρμογής ελέγχου ταυτότητας απέτυχε
ORA-12640: Initialisering af autentificeringsadapter fejlede
ORA-12640: Fel vid initiering av adapter för autentisering
ORA-12640: Initialisering av autentiseringsadapter mislyktes
ORA-12640: Valtuustarkistussovittimen alustus epäonnistui
ORA-12640: Az igazolási szolgáltatás csatolójának inicializálása sikertelen
ORA-12640: Iniţializarea adaptorului pentru autentificare a eşuat
ORA-12640: Initialiseren van verificatieadapter is mislukt.
ORA-12640: Falha ao inicializar o adaptador de autenticação
ORA-12640: Falha na inicialização do adaptador de autenticação
ORA-12640: Сбой при инициализации адаптера аутентификации
ORA-12640: Selhala inicializace ověřovacího adaptéru
ORA-12640: Iniciácia autentifikačného adaptéra zlyhala
ORA-12640: Niepowodzenie inicjalizacji adaptera identyfikacji
ORA-12640: Yetki doğrulama adaptörü başlatılamadı

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles