Purpose
You can use this statement to clear the plan cache based on the specified databases 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 | The tenants. Be sure to specify tenant_list when specifying SQL_identifier and database_list to limit the operation to specified tenants.
NoteYou can specify |
| SQL_identifier | The SQL ID in the format of sql_id = 'xxx'. If you do not specify this parameter, the plan caches of all SQL statements are cleared.
NoteWhen you use the |
| database_list | The databases. If you do not specify this parameter, the plan caches in all databases are cleared.
NoteWhen you use the |
| GLOBAL | Optional. If you do not specify this parameter, the plan caches on the local server are cleared. Otherwise, the plan caches on all servers associated to the tenant are cleared. |
Examples
Clear all plan caches.
obclient> ALTER SYSTEM FLUSH PLAN CACHE; Query OK, 0 rows affectedClear plan caches for
MySQLandOracletenants.obclient> ALTER SYSTEM FLUSH PLAN CACHE TENANT = 'MySQL','Oracle'; Query OK, 0 rows affectedClear the specified plan cache in the sys tenant.
obclient> ALTER SYSTEM FLUSH PLAN CACHE sql_id='B601070DFC14CB85FDA3766A69A9E1B3' databases='myob1' tenant='tenant1' GLOBAL; Query OK, 0 rows affectedClear the plan cache of a user tenant in the tenant itself as the DBA.
obclient> ALTER SYSTEM FLUSH PLAN CACHE sql_id='B601070DFC14CB85FDA3766A69A9E1B3' databases='myob1' GLOBAL; Query OK, 0 rows affected