We are able to use plsql_optimize_level parameter for getting better execution performance on plsql codes. On the other way, plsql_code_type parameter is using to change compilation mode.
Check current parameter:
SQL> show parameter plsql
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
plsql_ccflags string
plsql_code_type string INTERPRETED
plsql_debug boolean FALSE
plsql_optimize_level integer 2
plsql_v2_compatibility boolean FALSE
plsql_warnings string DISABLE:ALL
Apply the setting:
init.ora file:
*.plsql_optimize_level=3
*.plsql_code_type='NATIVE'
SQL> shutdown immediate;
SQL> startup upgrade;
SQL> @$ORACLE_HOME/rdbms/admin/dbmsupgnv.sql;
SQL> shutdown;
SQL> startup;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql;
SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION;
Check lastly:
SQL> show parameter plsql
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
plsql_ccflags string
plsql_code_type string NATIVE
plsql_debug boolean FALSE
plsql_optimize_level integer 3
plsql_v2_compatibility boolean FALSE
plsql_warnings string DISABLE:ALL
To see current status of objects;
SQL>
SELECT TYPE, PLSQL_CODE_TYPE, COUNT(*) FROM DBA_PLSQL_OBJECT_SETTINGS
WHERE PLSQL_CODE_TYPE IS NOT NULL
GROUP BY TYPE, PLSQL_CODE_TYPE
ORDER BY TYPE, PLSQL_CODE_TYPE;
Deep notes
INTERPRETED -> PL/SQL library units compile as bytecode format
NATIVE -> PL/SQL library units compile as native (machine) code format
Ref: https://becomeadba.com/?pages-list