Monday, October 10, 2011

oracle.aurora.vm.IdNotFoundException: -1 is not the number of a user or role

Problem Description
While granting permission to a user using dbms_java PL/SQL package of Oracle it fails with ORA-29532: like below.
SQL> exec dbms_java.grant_permission( 'arju', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' );
BEGIN dbms_java.grant_permission( 'arju', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ); END;

*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.vm.IdNotFoundException: -1 is not the number of a user or role
ORA-06512: at "SYS.DBMS_JAVA", line 313
ORA-06512: at line 1

Cause of the Problem
In the package DBMS_JAVA, the first parameter of grant_permission subprogram is Grantee which is the name of the user, schema, or role to which you want the grant to apply. PUBLIC specifies that the row applies to all users.

The error occurred as the user name does not exist in the database. Whenever we put any name in SQL*plus without quote Sql*plus interprets it into uppercase. Our username also in this case uppercase and so it was needed to put the parameter in uppercase.

Note that here even User ID will not work.

For example:
SQL> select user_id from dba_users where username='ARJU';

   USER_ID
----------
        62

SQL> exec dbms_java.grant_permission( '62', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' );
BEGIN dbms_java.grant_permission( '62', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' ); END;

*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.aurora.vm.IdNotFoundException: -1 is not the number of a user or role
ORA-06512: at "SYS.DBMS_JAVA", line 313
ORA-06512: at line 1

Solution of the Problem
Correct the grantee name. Here I put it into uppercase and it solved the problem.
SQL> exec dbms_java.grant_permission( 'ARJU', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'execute' );

PL/SQL procedure successfully completed.

SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

Problem Description
While connecting to Oracle database using Sql*plus it fails with error SP2-0750 along with Message file sp1<lang>.msb not found.
C:\> sqlplus / as sysdba
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
Cause of the Problem
The problem happened due to incorrect settings of ORACLE_HOME environmental variable.

On Windows you can issue path command to check the environmental variable settings and on Unix issue env command.
C:\Documents and Settings\User>path
PATH=D:\oracle\product\10.2.3\av_agent_1\bin;C:\Program Files\Common Files\NetSarang;D:\oracle\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Ringz Studio\Storm Codec\QTSystem\;C:\Program Files\SSH Communications Security\SSH Secure Shell
Solution of the Problem
Note that, ORACLE_HOME environmental variable is up to before bin directory. So correct it. On windows set it using set comamnd and on Unix set it using export command.
C:\Documents and Settings\User>set ORACLE_HOME=D:\oracle

C:\Documents and Settings\User>set PATH=%ORACLE_HOME%;\%ORACLE_HOME%\bin;%PATH%

C:\Documents and Settings\User>sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Tue Oct 11 11:23:05 2011

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

Sunday, October 9, 2011

ERROR: java.sql.SQLException: ORA-27452: OM while adding REDO collector

Problem Description
Oracle source database version is 11.1.0.6 and we are trying to add a REDO collector. But it fails with following error.
avorcldb add_collector -srcname source5 -agentname agent5 -colltype REDO
-av bddipdc:1523:av -collname myredocoll
source source5 verified for REDO Log Audit Collector collector
Adding collector...
Collector added successfully.
collector successfully added to Audit Vault

remember the following information for use in avctl
Collector name (collname): myredocoll
initializing REDO Collector
setting up APPLY process on Audit Vault server
setting up CAPTURE process on source database
ERROR: java.sql.SQLException: ORA-27452: OM"

Cause of the Problem
The problem happened due to Oracle bug 8201668.
While the REDO collector is configured in the source DB the following statement is executed:
BEGIN
SYS.DBMS_PROPAGATION_ADM.CREATE_PROPAGATION(
propagation_name => 'AV$PROPAGATION_64',
source_queue => 'AV$SRC_QUEUE_64',
destination_queue => 'AVSRCUSR64.AV$DST_QUEUE_64',
destination_dblink => 'AV.REGRESS.RDBMS.DEV.US.ORACLE.COM',
rule_set_name => NULL,
negative_rule_set_name => NULL,
queue_to_queue => TRUE);
Because of a memory overflow the trailing part of string AV.REGRESS.RDBMS.DEV.US.ORACLE.COM is copied over "SYS", resulting in "OM" instead of "SYS.".

Solution of the Problem
Change the global name of the AV database to a smaller string.

SQL> alter database rename global_name to new_name.world;