Thursday, October 19, 2017

Oracle export unwrapped object's DDL

i had to mass extract source code for all unwrapped objects from the db, and here is what I used

select   u.name,  u.type,   dbms_metadata.get_ddl(replace(u.type,' BODY'),u.name) ddl_source
from    user_source u
where   line = 1
and     instr(text, 'wrapped') = 0
and type  in ( 'PACKAGE BODY'   ,   'PROCEDURE','FUNCTION')
order by u.type,    u.name

I ran above sql to extract Package, Procedure and Function and ran it in Toad/SQL Developer and then export the output

Here is an example to extract table definition from scott schema

Select t.table_name ,dbms_metadata.get_ddl('TABLE',t.table_name) ddl_source
from user_tables t


Monday, October 2, 2017

ORA-04043 object XXXXXX does not exist

When I tried to drop my user, I got the error

drop user mrrame cascade;

ORA-00604: error occurred at recursive SQL level 1
ORA-04043: object SYS_PLSQL_816EF5E1_361_1 does not exist

Not sure what is causing it, but quick workaround is to drop the TYPE and replace the numeric value with Dummy as shown

drop type SYS_PLSQL_816EF5E1_DUMMY_1;

drop user mrrame cascade;
user dropped;

Friday, September 1, 2017

ODP.NET: ORA-03111: Break received on communication channel

I am using Oracle Managed dlls (Oracle.ManagedDataAccess.dll) in program to export a data set into XML and lately I've been getting  "ORA-03111: Break received on communication channel" errors.

I was obviously looking into network and TNS to figure out where the issue is, but it seems ODP.Net is masking the exception thrown from my program.

Actual issue was due to dirty characters in a string, and escaping them to XML was failing.

so, If you get this error, start from your SQL. Its probably a SQL error, but masked to something totally different.


Tuesday, August 29, 2017

Oracle Patch: OCI.DLL is active



I had to patch Oracle 12c to latest patch set today and it took couple of attempts to me it work.
In our setup, Oracle is running on Windows server.

1) Downloaded patch 26161726 from MetaLink.
2) Go to Windows Services and stop all Oracle services
3) first attempt on "opatch apply" resulted in following error

Following files are active :
                             D:\app\oracle\product\121~1.0\dbhome_1\bin\oci.dll

A quick search in ProcessExplorer.exe for oci.dll, resulted in 4 processess.



I had to stop "VMware Tools" and "COM+ System Application" services to kill above processes.




Once the OCI.dll reference was cleared, opatch finished successfully.


Wednesday, March 15, 2017

C# System.TypeInitialization error

I was working on a project and it failed to run at client site. When client launches the program, they get an error like below







Obviously, I have an issue with some class initialization, and neither event viewer nor the crash report had anything useful.


Quick fix is to add an Exception clause and InnerException exactly tells you the nature of the problem