Purpose
This statement is used to clear the plan cache for a specified database and SQL ID.
Syntax
ALTER SYSTEM FLUSH PLAN CACHE
[
[SQL_identifier] [database_list] tenant_list
] [GLOBAL]
database_list:
databases ='database_name, database_name...'
tenant_list:
TENANT = 'tenant_name, tenant_name....'
Parameters
| Parameter | Description |
|---|---|
| tenant_list | Specifies the tenant scope. When you specify the SQL_identifier and database_list parameters, you must also specify the tenant_list parameter to limit the operation to the specified tenant.
NoteOnly the system tenant |
| SQL_identifier | Specifies the SQL statement. The format is sql_id = 'xxx'. If this parameter is not specified, the plan cache for all SQL statements will be cleared.
NoteWhen using the |
| database_list | Specifies the database. If this parameter is not specified, the plan cache for all databases will be cleared.
NoteWhen using the |
| GLOBAL | Optional. If this parameter is not specified, the plan cache for the local server will be cleared. If specified, the plan cache for all servers in the tenant will be cleared. |
Examples
Clear the plan cache for all databases.
obclient> ALTER SYSTEM FLUSH PLAN CACHE; Query OK, 0 rows affectedClear the plan cache for MySQL and Oracle tenants.
obclient> ALTER SYSTEM FLUSH PLAN CACHE TENANT = 'MySQL','Oracle'; Query OK, 0 rows affectedClear the plan cache for a specified SQL statement in the sys tenant.
obclient> ALTER SYSTEM FLUSH PLAN CACHE sql_id='B601070DFC14CB85FDA3766A69A9E1B3' databases='myob1' tenant='tenant1' GLOBAL; Query OK, 0 rows affectedA regular tenant logs in as a DBA to clear its own plan cache.
obclient> ALTER SYSTEM FLUSH PLAN CACHE sql_id='B601070DFC14CB85FDA3766A69A9E1B3' databases='myob1' GLOBAL; Query OK, 0 rows affected
