oracle本地编译问题

时间:2023-12-10 19:10:56

oracle10.2:

--将过程重新编译为本地编译方式,提示有编译错误,经查提示未设置plsql_native_library_dir 参数

SQL> alter procedure p_xxxx compile plsql_code_type=native;
 
Warning: Procedure altered with compilation errors
 
SQL> show error
Errors for PROCEDURE ZZQ2.P_UPDATE_GRAPHCODE:
 
LINE/COL ERROR
-------- -----------------------------------------------
12/53    PLS-00920: 未设置 plsql_native_library_dir 参数

--因此设置plsql_native_library_dir参数,在oracle的home路径下创建nativelib文件夹(有的话就不用了)
 
SQL> alter system set plsql_native_library_dir='D:\oracle\product\10.2.0\db_2\plsql\nativelib' scope=both

2  /
 
System altered
 
SQL> 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      D:\oracle\product\10.2.0\db_2\plsql\nativelib
plsql_native_library_subdir_count    integer     0
plsql_optimize_level                 integer     2
plsql_v2_compatibility               boolean     FALSE
plsql_warnings                       string      DISABLE:ALL

--设置plsql_native_library_subdir_count参数,在nativelib文件下创建5个文件夹d0,d1,d2,d3,d4
SQL> alter system set plsql_native_library_subdir_count=5 scope=both;
 
System altered
 
SQL> 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      D:\oracle\product\10.2.0\db_2\plsql\nativelib
plsql_native_library_subdir_count    integer     5
plsql_optimize_level                 integer     2
plsql_v2_compatibility               boolean     FALSE
plsql_warnings                       string      DISABLE:ALL

--这时再将过程编译为本地编译,结果还是有编译错误
SQL> alter procedure p_xxxxxx compile plsql_code_type=native;
 
Warning: Procedure altered with compilation errors
 
SQL> show error
Errors for PROCEDURE ZZQ2.P_UPDATE_GRAPHCODE:
 
LINE/COL ERROR
-------- -----------------------------------------------------------------------------------------------------------------------------------------------------
0/0      PLS-00923: 本机码编译失败: Visual Studio not found::Could not open registry key HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\VISUALSTUDIO\7.1\SETUP:No error

查了好久还是不知道具体原因,说是需要安装Pro*C/C++环境,但是这个查看已经有了,装oracle的时候已经给装上了。

oracle11.2

本地编译不需向10g那样设置一堆参数,直接执行如下语句就可以将其编译为本地编译方式

alter procedure p_xxxx compile plsql_code_type=native;

plsql_native_library_dir和plsql_native_library_subdir_count参数到11.2g已经没有了。