by-nc-sa     개발자, DBA가 함께 만들어가는 구루비 지식창고!

PLSQL 기타




PL/SQL Native Compilation 9i, 10g 데모#1

PL/SQL Real Native Compilation 11g 데모#2




데모

데모#1 - PL/SQL Native Compilation (9i) 사전작업
vi $ORACLE_HOME/plsql/spnc_makefile.mk

■ BEFORE
	OPTIMIZE=-xO1 -Xa  -xstrconst -dalign -xF -mr -xildoff -errtags=yes -v -xarch=v9 
                 -xchip=ultra3 -W2,-AKNR_S -Wd,-xsafe=unboundsym -Wc,-Qiselect-funcalign=32
                 -xcode=abs44 -Wc,-Qgsched-trace_late=1 -Wc,-Qgsched-T5 -xalias_level=weak
                 -D_REENTRANT -DBIT64 -DMACHINE64
	PIC=-Kpic

■ AFTER
	OPTIMIZE=-O1 -m64
	PIC=-fpic

SQL> show parameter plsql;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
plsql_compiler_flags                 string      INTERPRETED
plsql_native_c_compiler              string
plsql_native_library_dir             string
plsql_native_library_subdir_count    integer     0
plsql_native_linker                  string
plsql_native_make_file_name          string
plsql_native_make_utility            string
plsql_v2_compatibility               boolean     FALSE

SQL> alter system set plsql_compiler_flags = 'NATIVE';

시스템이 변경되었습니다.

SQL> alter system set plsql_native_make_utility = '/usr/local/bin/make';

시스템이 변경되었습니다.

SQL> alter system set plsql_native_c_compiler = '/usr/local/bin/gcc';

시스템이 변경되었습니다.

SQL> alter system set plsql_native_make_file_name = '/data01/oracle9/9.2.0.1/plsql/spnc_makefile.mk';

시스템이 변경되었습니다.

SQL> !mkdir /data01/oracle9/work/plsql

SQL> alter system set plsql_native_library_dir = '/data01/oracle9/work/plsql';

시스템이 변경되었습니다.

SQL> show parameter plsql;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
plsql_compiler_flags                 string      NATIVE
plsql_native_c_compiler              string      /usr/local/bin/gcc
plsql_native_library_dir             string      /data01/oracle9/work/plsql
plsql_native_library_subdir_count    integer     0
plsql_native_linker                  string
plsql_native_make_file_name          string      /data01/oracle9/9.2.0.1/plsql/
                                                 spnc_makefile.mk
plsql_native_make_utility            string      /usr/local/bin/make
plsql_v2_compatibility               boolean     FALSE



데모#1 - PL/SQL Native Compilation (9i)
SQL> alter session set plsql_compiler_flags = 'INTERPRETED', 'NON_DEBUG';

SQL> create or replace procedure oracleclub as
  2    v_number number;
  3  begin
  4    for i in 1 .. 5000000 loop
  5      v_number := i * 10000 ;
  6    end loop;
  7  end;
  8  /

프로시저가 생성되었습니다.

경   과: 00:00:00.07
SQL> select object_name, param_value from user_stored_settings where object_name = 'ORACLECLUB';

OBJECT_NAME          PARAM_VALUE
-------------------- ------------------------------
ORACLECLUB           INTERPRETED,NON_DEBUG
ORACLECLUB           BYTE

경   과: 00:00:00.01
SQL> exec oracleclub;

PL/SQL 처리가 정상적으로 완료되었습니다.

경   과: 00:00:15.11
SQL> alter session set plsql_compiler_flags = 'NATIVE', 'NON_DEBUG';

세션이 변경되었습니다.

경   과: 00:00:00.01
SQL> !ls /data01/oracle9/work/plsql

SQL> alter procedure oracleclub compile;

프로시저가 변경되었습니다.

경   과: 00:00:00.73
SQL> !ls /data01/oracle9/work/plsql
ORACLECLUB__DEVDBA__0.so        ORACLECLUB__DEVDBA__0.so.17929

SQL> select object_name, param_value from user_stored_settings where object_name = 'ORACLECLUB';

OBJECT_NAME          PARAM_VALUE
-------------------- ------------------------------
ORACLECLUB           NATIVE,NON_DEBUG
ORACLECLUB           BYTE

경   과: 00:00:00.00
SQL> exec oracleclub;

PL/SQL 처리가 정상적으로 완료되었습니다.

경   과: 00:00:11.71



데모#1 - PL/SQL Native Compilation (10g) 사전작업
SQL> show parameter plsql;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
plsql_ccflags                        string
plsql_code_type                      string      INTERPRETED
plsql_compiler_flags                 string      INTERPRETED, 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
SQL> alter system set plsql_native_library_dir = '/home/oracle/plsql';

시스템이 변경되었습니다.

SQL> show parameter plsql;

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



데모#1 - PL/SQL Native Compilation (10g)
SQL> alter session set plsql_compiler_flags = 'INTERPRETED', 'NON_DEBUG';

세션이 변경되었습니다.

경   과: 00:00:00.00
SQL> create or replace procedure oracleclub as
  v_number number;
begin
  for i in 1 .. 5000000 loop
    v_number := i / 10000 ;
  end loop;
end;
/  2    3    4    5    6    7    8

프로시저가 생성되었습니다.

경   과: 00:00:00.03
SQL> column object_name format a20
column param_value format a30
select object_name, param_value from user_stored_settings where object_name = 'ORACLECLUB';SQL> SQL>

OBJECT_NAME          PARAM_VALUE
-------------------- ------------------------------
ORACLECLUB           2
ORACLECLUB           INTERPRETED
ORACLECLUB           FALSE
ORACLECLUB           BYTE
ORACLECLUB           DISABLE:ALL
ORACLECLUB
ORACLECLUB           INTERPRETED,NON_DEBUG

7 개의 행이 선택되었습니다.

경   과: 00:00:00.00
SQL> exec oracleclub;

PL/SQL 처리가 정상적으로 완료되었습니다.

경   과: 00:00:01.40
SQL> alter session set plsql_compiler_flags = 'NATIVE', 'NON_DEBUG';

세션이 변경되었습니다.

경   과: 00:00:00.00
SQL> alter procedure oracleclub compile;

프로시저가 변경되었습니다.

경   과: 00:00:00.08
SQL> select object_name, param_value from user_stored_settings where object_name = 'ORACLECLUB';

OBJECT_NAME          PARAM_VALUE
-------------------- ------------------------------
ORACLECLUB           2
ORACLECLUB           NATIVE
ORACLECLUB           FALSE
ORACLECLUB           BYTE
ORACLECLUB           DISABLE:ALL
ORACLECLUB
ORACLECLUB           NATIVE,NON_DEBUG

7 개의 행이 선택되었습니다.

경   과: 00:00:00.01
SQL> exec oracleclub;
BEGIN oracleclub; END;

*
1행에 오류:
ORA-06549: PL/SQL: 공유 객체(DLL)
/home/oracle/plsql/ORACLECLUB__OCSTUDY__P__71593.so: undefined symbol:
__stack_chk_fail_local을(를) 동적으로 여는 데 실패


경   과: 00:00:00.00



데모#2 - PL/SQL Real Native Compilation (11g)
alter session set plsql_code_type = native;

문서정보

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.