The UNLOCK_SCHEMA_STATS procedure unlocks statistics for all tables in a user schema.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_STATS.UNLOCK_SCHEMA_STATS (
ownname VARCHAR2,
stattype VARCHAR2 DEFAULT 'ALL');
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If NULL is specified, the username of the current user is used. |
| stattype | The type of lock. Valid values:
'ALL' is supported. |
Considerations
You must be the owner of the table to call this procedure. For objects owned by
SYS, you must be the owner or have theSYSDBAprivilege.When statistics for a table are locked, statistics for all dependent objects, including table-level statistics, column-level statistics, histogram statistics, and statistics for all dependent indexes, are also locked.
If statistics for an object are locked, an error will be returned when you execute the
SET_*,DELETE_*,IMPORT_*, orGATHER_*procedure to modify statistics for a single table, index, or column.The
UNLOCK_SCHEMA_STATSandUNLOCK_TABLE_STATSprocedures cannot unlock statistics for partitions. When you call theLOCK_TABLE_STATSprocedure, it sets the lock at the table level. At this point, you cannot collect statistics for dependent objects such as partitions and indexes. Additionally, if table statistics are locked, dependent statistics are also locked, so you do not need to explicitly call theLOCK_PARTITION_STATSprocedure to lock partition statistics.
Examples
Unlock statistics for all tables in the hr schema.
obclient [SYS]> CREATE USER hr IDENTIFIED BY 123456;
Query OK, 0 rows affected
obclient [SYS]> CALL DBMS_STATS.UNLOCK_SCHEMA_STATS ('hr', stattype=>'ALL');
Query OK, 0 rows affected
