How to Create a SQL Patch to add Hints to Application SQL Statements (Doc ID 1931944.1)

Last updated on JULY 12, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.3 and later
Information in this document applies to any platform.

Goal

In most applications, application code is static and cannot be modified by users. If there is a performance issue with application SQL, one potential solution is to modify it adding hints to force the desired access path. When the Application SQL statements cannot be modified, we have to look for better alternatives (such as SQL Plan Management Baselines etc.). However, in a time critical situation these solutions may not be applicable and a faster solution may be required.

In a time critical situation, one such alternative is the "SQL Patch". The SQL patch allows a user to "insert hints" into a query whose text cannot be edited due to the application constraints using an undocumented API called DBMS_SQLDIAG_INTERNAL.I_CREATE_PATCH() .

Solution

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