Updating Oracle PL SQL Package Causes ORA 04021 Error - oracle

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

Related

MobileFirst SQL adapter raising an error

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.

ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalThreadStateException: process hasn't exited

I am executing a stored procedure in order to perform some nightly maintenance on the database.
Which is Oracle 11.2.0.3.0.
The procedure uses RMAN to perform a daily backup, the backup finishes but I get the error:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalThreadStateException: process hasn't exited
This causes the backup to be restarted and the stored procedure enters a loop state.
This procedure runs a several other machines without any issues.
I've checked Oracle trace logs but no error where recorded there.
What can be the cause of this?
Please assist.

How in Oracle kill user session silent or reproduce error 17410?

I need to test robustness of my application for problem with network. But I don't have access to network physically. I have only access to Oracle as SYS. Does it possible may be silent kill user session so when application try to get data from connection jdbc driver will generate error 17410 ?
oracle: No more data to read from socket
When I try to kill session by sid - oracle send alert about killed session and this is not 17410 error.
You can raise any error code with PRAGMA EXCEPTION_INIT.
DECLARE
e_no_more_data EXCEPTION
pragma exception_init( e_no_more_data , -17410 );
BEGIN
RAISE e_no_more_data;
END;
/
Don't know if it really simulates the error.
If you have access to only the database and you know the SID and Serial of the session you are trying to kill, you can issue
ALTER SYSTEM KILL SESSION 'sid,serial#';
Check this link for more options.
http://www.oracle-base.com/articles/misc/killing-oracle-sessions.php

DBMS LOB.SUBSTR Throwing ORA-00904: Invalid Identifier Error

One of our cutomer is running the scripts in oracle sql developer to upgrade his database table structure, procudere & triggers etc. But while running the script, he is getting ORA-00904: Invalid Identifier Error for DBMS_LOB.SUBSTR() and DBMS_LOB.GETLENGTH() in one procedure.
Can somebody tell why is happening so?
There are using Oracle Sql developer Version 3.1.07 Build MAIN-07.42 with Oracle 11g.
I imagine 3 possible reasons:
the user lacks execute privilege on sys.dbms_lob (although the
privilege is granted to PUBLIC by default)
there is no synonym dbms_lob for sys.dbms_lob in the database (although such public synonym should exist)
the schema, on which the customer works, contains some other package with the same name DBMS_LOB
Run this sql with sys to check whether your schema has privilege to execute DBMS_LOB.
select * from dba_tab_privs where table_name='DBMS_LOB';
By default, you should see PUBLIC in the grantees.
If not, you can run sql with sys.
grant execute on sys.DBMS_LOB to public;
or
grant execute on sys.DBMS_LOB to <your_schema_name>

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