Pls-00923: Native Compilation Failed With 10.2 Database (Doc ID 370517.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version 10.2.0.1 to 10.2.0.5 [Release 10.2]
Information in this document applies to any platform.
Checked for relevance on 24-OCT-2012


Symptoms

Attempting to implement Native Compilation on a 10g Database fails with an error:

Error:
PLS-00923: native compilation failed: C compilation or linking failed


Based on the 10.2 Docs, these need to be set:
PLSQL_NATIVE_LIBRARY_DIR - directory where the shared libraries will be created

PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT - This is an optional system-level only parameter that
specifies the number of subdirectories in the directory that is specified by the parameter
PLSQL_NATIVE_LIBRARY_DIR (ALTER SYSTEM SET PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT=10;)

PLSQL_CODE_TYPE - determines whether PL/SQL code is natively compiled or interpreted (ALTER
SESSION SET PLSQL_CODE_TYPE='NATIVE';)

Before setting up the Database, the Native directory was created under the Oracle Home and the
following permissions were set 'chmod 777 Native'


AS SYS
(Note:

If Server Parameter file (SPFILE) is used , then the ALTER SYSTEM permanently records the changes.
However when the normal initialization file (PFILE) is used ,these values set with the ALTER SYSTEM command,  will be lost when the Database is restarted and will result in the original values being set unless these changes are made permanently by setting them within the database initialization file.)


SQL> ALTER SYSTEM SET PLSQL_NATIVE_LIBRARY_DIR='$ORACLE_HOME/Native';

System altered.

SQL> ALTER SYSTEM SET PLSQL_NATIVE_LIBRARY_SUBDIR_COUNT=0;

System altered.

SQL> ALTER SYSTEM SET PLSQL_CODE_TYPE='NATIVE';

Session altered.


As SCOTT
CREATE OR REPLACE PROCEDURE hello_native AS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello world. Today is ' || TO_CHAR(SYSDATE) || '.');
END hello_native;

Recompile the test procedure as 'Native' (recreated the error)
---------------------------------------------------------------------------------
SQL> ALTER PROCEDURE hello_native COMPILE PLSQL_CODE_TYPE=NATIVE REUSE SETTINGS;

Warning: Procedure altered with compilation errors.

SQL> show error
Errors for PROCEDURE HELLO_NATIVE:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0 PLS-00923: native compilation failed: C compilation or linking
failed:spdzj.c:Could not invoke program
/opt/SunProd/SUNWspro8/bin/cc:No such file or directory

Cause

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms