PLS-00920 parameter plsql_native_library_dir is not set问题解决

Oracle 10.2.0.1 上在创建存储过程,报如下错误:

PLS-00920: parameter plsql_native_library_dir is not set

对于这个问题,可以通过如下两种方法解决:
1、禁用plsql的native模式
2、使用native模式,设置正确的plsql_native_library_dir参数

下面演示解决过程:

[@more@]

1、禁用plsql native模式

1.1、错误提示:

sys@CNHTM> create or replace function scott.p_test(userName in varchar2) return boolean is
2 Result boolean;
3 begin
4 Result:=upper(userName) not in ('SYS','SYSTEM');
5 return(Result);
6 end p_test;
7 /

Warning: Function created with compilation errors.

sys@CNHTM> show error
Errors for FUNCTION SCOTT.P_TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/11 PLS-00920: parameter plsql_native_library_dir is not set

1.2、检查参数

sys@CNHTM> show parameter plsql

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
plsql_ccflags string
plsql_code_type string NATIVE
plsql_compiler_flags string NATIVE, NON_DEBUG
plsql_debug boolean FALSE
plsql_native_library_dir string
plsql_native_library_subdir_count integer 0
plsql_optimize_level integer 2
plsql_v2_compatibility boolean FALSE
plsql_warnings string DISABLE:ALL

1.3、修改plsql_code_type和plsql_compiler_flags参数,禁用native模式

sys@CNHTM> alter system set plsql_code_type=INTERPRETED scope=both;

System altered.

sys@CNHTM> alter system set plsql_compiler_flags=INTERPRETED,NON_DEBUG scope=both;

System altered.

1.4、重新编译失效的存储过程

sys@CNHTM> alter function scott.p_test compile;

Function altered.

2、使用native模式,设置正确的plsql_native_library_dir参数

如果要编译的存储过程必须使用native模式,可以通过这个方式修改,使用native模式的好处见
PL/SQL User's Guide and Reference(B14261-01)第7章

2.1、错误提示:

sys@CNHTM> create or replace function scott.p_test(userName in varchar2) return boolean is
2 Result boolean;
3 begin
4 Result:=upper(userName) not in ('SYS','SYSTEM');
5 return(Result);
6 end p_test;
7 /

Warning: Function created with compilation errors.

sys@CNHTM> show error
Errors for FUNCTION SCOTT.P_TEST:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/11 PLS-00920: parameter plsql_native_library_dir is not set

2.2、检查参数

sys@CNHTM> show parameter plsql

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
plsql_ccflags string
plsql_code_type string NATIVE
plsql_compiler_flags string NATIVE, NON_DEBUG
plsql_debug boolean FALSE
plsql_native_library_dir string
plsql_native_library_subdir_count integer 0
plsql_optimize_level integer 2
plsql_v2_compatibility boolean FALSE
plsql_warnings string DISABLE:ALL

2.3、修改plsql_native_library_dir和plsql_native_library_subdir_count参数

sys@CNHTM> alter system set plsql_native_library_dir='/oracle/app/10.1/plsql/nativelib' scope=both;

System altered.

sys@CNHTM> alter system set plsql_native_library_subdir_count=5 scope=both;

System altered.

plsql_native_library_dir参数的值为$ORACLE_HOME/plsql/nativelib
如果$ORACLE_HOME/plsql中没有nativelib目录,需要手工创建

plsql_native_library_subdir_count参数应为非零的值
并保证$ORACLE_HOME/plsql/nativelib目录中有d0、d1...等目录,如果没有,手工创建,
目录的个数与plsql_native_library_subdir_count相等
如plsql_native_library_subdir_count=5,则在$ORACLE_HOME/plsql/nativelib目录下应该有d0、d1、d2、d3、d4五个目录

2.4、重新编译失效的存储过程

sys@CNHTM> alter function scott.p_test compile;

Function altered.

--end--

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22049049/viewspace-1029912/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22049049/viewspace-1029912/

你可能感兴趣的:(PLS-00920 parameter plsql_native_library_dir is not set问题解决)