My Oracle Support Banner

Call To External Procedure Fails With Error "The Size Of The Auxiliary Header Is Invalid." (Doc ID 1206453.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version 10.2.0.5 and later
IBM AIX on POWER Systems (64-bit)
***Checked for relevance on 24-Oct-2013***

Symptoms

Executing an External Procedure in Oracle Server 10.2.0.4 on AIX 5.3 OS, which has been compiled using the commands

/usr/vac/bin/cc -G -q64 -c <file.c> ld -b64 -r -s -o <file.so> <file.o>


Fails with:

ORA-06520: PL/SQL: Error loading external library
ORA-06522: Could not load module /var/tmp/oracle/<file.so>
The size of the auxiliary header is invalid.
Examine file headers with the 'dump -ohv' command.

Example

NOTE: the following steps do not include the configuration of the external procedure steps (file listener.ora and tnsnames.ora), however it assumes that

- ENVS="EXTPROC_DLLS=ANY" exists in listener.ora
- PROGRAM=extproc exists in listener.ora (not extproc32)
- the listener containing the extproc setting is running
- the Oracle Server is a 64bit installation

See <Note 302485.1> 'PLSQL External Procedures Guide' for details.



1. Create a file named shell.c in the directory /var/tmp/oracle (or in any directory, in this case please change the path also when referenced) using the following code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void sh(char *command) {
int num;
num = system(command);

}


2. Compile, link and change the permissions

/usr/vac/bin/cc -G -q64 -c shell.c
ld -b64 -r -s -o shell.so shell.o
chmod 755 shell.so



3. Start sqlplus, create the oracle library and the PL/SQL procedure

sqlplus scott/tiger

CREATE OR REPLACE LIBRARY shell_lib is '/var/tmp/oracle/shell.so';
/

CREATE OR REPLACE PROCEDURE shell(command IN char)
AS EXTERNAL
NAME "sh"
LIBRARY shell_lib
LANGUAGE C
PARAMETERS (command string);
/


4. Execute the procedure, the errors raise

exec shell('ls>out.txt');
BEGIN shell('ls>out.txt'); END;

*
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: 0509-022 Cannot load module /var/tmp/oracle/shell.so.
0509-102 The size of the auxiliary header is invalid.
0509-194 Examine file headers with the 'dump -ohv' command.
ORA-06512: at "SCOTT.SHELL", line 1
ORA-06512: at line 1



Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.