DBA Tips Archive for Oracle

  


[an error occurred while processing this directive]

No Title

[an error occurred while processing this directive]

by Michael New, MichaelNew@earthlink.net, Gradation LLC


Listener.ora


SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (PROGRAM = extproc) (ENVS="EXTPROC_DLLS=ONLY:/u01/app/oracle/custom/libraries/UnloadToFile/lob2file.so") ) ) INBOUND_CONNECT_TIMEOUT_LISTENER = 0 LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = packmule.idevelopment.info)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) )

Compile and Build Shared Library


[oracle@packmule ~]$ cd /u01/app/oracle/custom/libraries/UnloadToFile [oracle@packmule UnloadToFile]$ ./compile_lob2file.sh lob2file.c: In function ‚lob2file‚: lob2file.c:64: warning: incompatible implicit declaration of built-in function ‚strcpy‚ lob2file.c:66: warning: incompatible implicit declaration of built-in function ‚strncpy‚ lob2file.c:114: warning: incompatible implicit declaration of built-in function ‚strlen‚ lob2file.c:120: warning: incompatible implicit declaration of built-in function ‚strncpy‚ lob2file.c:141: warning: incompatible implicit declaration of built-in function ‚strlen‚ lob2file.c:209: warning: passing argument 9 of ‚OCILobRead‚ from incompatible pointer type lob2file.c:238: warning: incompatible implicit declaration of built-in function ‚strlen‚ lob2file.c:276: warning: incompatible implicit declaration of built-in function ‚strlen‚ lob2file.c: In function ‚checkerr‚: lob2file.c:293: warning: incompatible implicit declaration of built-in function ‚strcpy‚ lob2file.c:333: warning: incompatible implicit declaration of built-in function ‚strlen‚

Create Oracle Library Object (UTL_LOB_LIB) / PL/SQL support package (UTL_LOB) / Specification Function (LOBTOFILE)


[oracle@packmule UnloadToFile]$ sqlplus -s scott/tiger@catdb @lob2file.sql +-------------------------------------------------+ | Creating Oracle Library Object (UTL_LOB_LIB) | +-------------------------------------------------+ Library created. +-------------------------------------------------+ | Creating PL/SQL Package (UTL_LOB) | +-------------------------------------------------+ Package created. No errors. +-------------------------------------------------+ | Creating PL/SQL Package Body (UTL_LOB) | +-------------------------------------------------+ Package body created. No errors.

Run Demo


[oracle@packmule UnloadToFile]$ sqlplus -s scott/tiger@catdb @lob2file_test.sql Enter full path to input binary file : /u03/app/oracle/app_ext_files Enter input binary filename : app-api-tools.zip Enter output binary file (including full path) : /u03/app/oracle/app_ext_files/app-api-tools-NEW.zip Enter output log log file (including full path): /u03/app/oracle/app_ext_files/lob2file.log +-------------------------------------------------+ | Creating a temporary Oracle Directory that will | | be used to load the binary file using a | | BFILENAME. | +-------------------------------------------------+ Directory created. Directory Name Directory Path --------------- ------------------------------------------------------- UTL_LOB_DIR /u03/app/oracle/app_ext_files +-------------------------------------------------+ | Creating BLOB demo table (UTL_LOB_TEST). | +-------------------------------------------------+ Table dropped. Table created. +-------------------------------------------------+ | Use a simple anonymous PL/SQL block to load the | | specified binary image to the demo table. | +-------------------------------------------------+ PL/SQL procedure successfully completed. +-------------------------------------------------+ | Finally, test the Lob2File external C function | | using the PL/SQL support package. The function | | Unload_To_File will call the external C | | function to unload the specified BLOB to the | | file system. | +-------------------------------------------------+ Exit status = 0 PL/SQL procedure successfully completed. +-------------------------------------------------+ | Dropping the temporary Oracle Directory. | +-------------------------------------------------+ Directory dropped.

Verify results:


[oracle@packmule UnloadToFile]$ ls -l /u03/app/oracle/app_ext_files/app-api-tools* -rw-r--r-- 1 oracle oinstall 11961027 Mar 11 14:50 /u03/app/oracle/app_ext_files/app-api-tools-NEW.zip -rw-r--r-- 1 oracle oinstall 11961027 Mar 11 14:12 /u03/app/oracle/app_ext_files/app-api-tools.zip

  lob2file.log



Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Sunday, 11-Mar-2012 15:24:45 EDT
Page Count: 7991