MobileFirst SQL adapter raising an error - oracle

Sometimes we are receiving following error while calling sql adapter
ORA-06508: PL/SQL: could not find program unit being called.
All objects are valid /compiled and available in oracle DB.
If we change any package or procedure on oracle database we receive that error. So the question is: Do we need to re-deploy that SQL adapter which calls that database object again?

It happens because your connection is holding on to a pointer to a procedure that no longer exists in RAM because it was recompiled.
I have seen this for many years and you can recreate this on the fly.
Call an Oracle Procedure
Recompile that procedure
Call it again you will get "could not find program unit being called."
Call it again and it will work.
If you closed the connection after #2 and then opened the connection and called the procedure you would never get that error.
After you make the call to that proc and you are done, close out your connection before calling it again.

Related

BizTalk send port using WCF-OracleDB to perform procedure call gives no-clue error messages

Trying to debug database updates using a stored procedure in package in Oracle database. Gives following error in event log:
Microsoft.ServiceModel.Channels.Common.TargetSystemException: ORA-06550: line %s, column %s:
%s ---> Oracle.DataAccess.Client.OracleException: ORA-06550: line %s, column %s:
%s
Googling for a while leads you to the fact that this is usually a compilation error. However, procedure compiles OK, and the adapter is well tested and is probably not the cause of this problem. I was able to run the procedure using direct call, but that is not the same to running from Send Port and the WCF-OracleDB adapter.
I was troubleshooting by disabling functionality part-by-part, but I still got the same error message back from Oracle.
I then stumbled across some article discussing Ambient transactions and Oracle...
I disabled Ambient transaction in binding properties, and then I got a readable error message pointing me in the right direction.
Seems like Oracle uses other code when the transaction handling is handled from outside...?

Updating Oracle PL SQL Package Causes ORA 04021 Error

I am trying to update a package previously creating by running the following code in SQL Developer (Oracle 11g)
CREATE OR REPLACE PACKAGE package_name AUTHID CURRENT_USER AS
PROCEDURE timesecond(proc_name IN VARCHAR2,
starttime IN TIMESTAMP, endtime in TIMESTAMP);
PROCEDURE drop_tables;
PROCEDURE create_tables;
...
END package_name;
I am getting the following error:
ORA-04021: timeout occurred while waiting to lock object
04021. 00000 - "timeout occurred while waiting to lock object %s%s%s%s%s"
*Cause: While waiting to lock a library object, a timeout is occurred.
*Action: Retry the operation later.
I used to be able to update my package when I ran it on SQL developer, but I also ran it on SQLPLUS a few days ago (although that session ended when I disconnected from the server I'm using to do all of this work).
I tried to run this process but it takes too long. Any idea what could be the issue?
SELECT SID, OWNER, OBJECT, TYPE
FROM V$ACCESS
WHERE OBJECT LIKE '%OBJECT%';
Thanks

How to convert Sybase error message offset to a Stored Procedure line number

I am trying to debug a long stored procedure in Sybase and I get an error message like:
Number (257) Severity (16) State (1) Server (DZUCRINSI225) Procedure (Calculate_FX_Haircut) Implicit conversion from datatype 'CHAR' to 'NUMERIC' is not allowed. Use the CONVERT function to run this query. (4068EE10)
I don't know where the error is occurring in the SP. How can I locate it? I guess that the '4068EE10' in the message may be an offset, but I don't know how to make use of it to find the line number. Can anyone help?
I should add that I am using Embarcadero Rapid SQL as an interface to the Sybase server. I'm not certain whether the '4068EE10' is added by Sybase or Embarcadero.
I haven't used Rapid Sql for a long while, but Open Client, the Sybase client interface, definitely has messages to the client that contain the line number when the SQL failing is an SP. Perhaps Rapid SQL is unsing an ODBC connection and the middleware discards Sybase specific things in server message handling?
Can you change your datasource to use a native Sybase connection - I'd expect Rapid Sql to be able to manage?
Why don't you try running this SP in the Sybase sql client isql?
You'll find you get a message that includes the SP name and line number.

First call to a stored procedure, after successful compilation, fails. Oracle 10g

I have an Oracle 10G installation (Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod), and a java web app that calls stored procedures and functions in oracle via a JDBC connection. The SP's and functions are part of a package. The first time a SP or a function is called, after the package is successfully compiled, I get these errors:
(I replaced our schema name and package name with "#schema-name#.#package-name#")
ORA-04068: existing state of packages has been discarded
ORA-04061: existing state of package body "#schema-name#.#package-name#" has been invalidated
ORA-04065: not executed, altered or dropped package body "#schema-name#.#package-name#"
ORA-06508: PL/SQL: could not find program unit being called: "#schema-name#.#package-name#"
ORA-06512: at "#schema-name#.#package-name#", line 5393
ORA-06512: at line 1
The very next time it is called, everything runs the way that it should. Any ideas on why and how to keep this from happening?
This is normal behavior for packages that have state, i.e. they have body variables. When the package is compiled, the existing state has to be discared and all session that have used the package before receive the ORA-04068 error (except the one that compiled the package).
As you have a web application, I assume it uses a connection pool that keeps the session alive. So they will all be affected if they have used the package before.
One workaround is to call DBMS_SESSION.RESET_PACKAGE, which discards the state of all packages of the current session. Another one is to check whether you can get rid of the session state, which is somewhat problematic in combination with a connection pool.
I don't think there's any way around this without dropping and recreating your session..
Have a look at this

How to detect SQL Server stored procedure failure from JDBC client?

I have some Java code that uses JDBC to execute a "CREATE PROCEDURE" statement on a SQL Server 2008 instance. The create proc is failing due to an error ("Implicit conversion from data type xml to varchar(max) is not allowed. Use the CONVERT function to run this query.").
This error is not being raised to the JDBC client and so I have no indication that the sproc creation failed. As far as the JDBC statement and connection are concerned, after executing the CREATE PROC statement, there were no problems.
So does anyone know how to detect this problem from the JDBC client?
TIA!
I discovered that using PreparedStatement rather than Statement gets sproc compilation warnings raised as SQLExceptions.

Resources