UNLOCK_SCHEMA_STATS

2024-03-05 01:54:27  Updated

The UNLOCK_SCHEMA_STATS procedure unlocks the statistics on all tables of the specified user.

Applicability

This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.

Syntax

DBMS_STATS.UNLOCK_SCHEMA_STATS (
  ownname        VARCHAR2,
  stattype       VARCHAR2 DEFAULT 'ALL');

Parameters

Parameter Description
ownname The name of the user. If the username is set to NULL, the current logon username is used by default.
stattype The type of the statistics to be locked. Three types are supported:
  • 'ALL'
  • 'DATA'
  • 'CACHE'
Note: OceanBase Database in Oracle mode supports only the 'ALL' type.

Considerations

  • To call this procedure, you must be the owner of the table. If the object is in the sys tenant, you must be the owner of the table or have the SYSDBA privilege.

  • When statistics on a table are locked, all statistics dependent on the table are locked, including table-level statistics, column-level statistics, histogram statistics, and statistics on all dependent indexes.

  • If the statistics on an object are locked, an error occurs when you execute a SET_*, DELETE_*, IMPORT_*, or GATHER_* procedure to modify the statistics on a single table, index, or column.

  • The UNLOCK_SCHEMA_STATS and UNLOCK_TABLE_STATS procedures cannot unlock the statistics on corresponding partitions. When you call the LOCK_TABLE_STATS procedure, it sets a table-level lock position. In this case, you cannot collect statistics on dependent objects such as partitions and indexes. In addition, if table statistics are locked, the dependent objects are also locked. In this case, you do not need to explicitly call the LOCK_PARTITION_STATS procedure to lock partition statistics.

Examples

Unlock the statistics on all tables of the hr user.

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

Contact Us