The UNLOCK_TABLE_STATS procedure is used to unlock table-level statistics.
Syntax
DBMS_STATS.UNLOCK_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
stattype VARCHAR2 DEFAULT 'ALL');
Parameters
Parameter |
Explanation |
|---|---|
| ownname | Username. If the username is set to NULL, the current login username will be used by default. |
| tabname | Table name. |
| stattype | The type of lock. Generally, there are the following three types:
|
Usage instructions
To call this procedure, you must be the owner of the table. For objects owned by
SYS, you must be the table owner or have theSYSDBAprivilege to call this procedure.When the statistics of a table are locked, all statistics that depend on it are locked, including table-level statistics, column-level statistics, histogram statistics, and all index-dependent statistics.
If the statistics of an object are locked, executing the
SET_*, DELETE_*, IMPORT_*, or GATHER_*procedure to modify the statistics of a single table, index, or column will cause an error.Neither the
UNLOCK_SCHEMA_STATSnor theUNLOCK_TABLE_STATSprocedure can unlock statistics for the corresponding partition. When you call theLOCK_TABLE_STATSprocedure, it sets a lock at the table level. In this case, you cannot collect statistics on dependent objects such as partitions and indexes. Furthermore, if table statistics are locked, their dependencies are also locked, so there is no need to explicitly call theLOCK_PARTITION_STATSstored procedure to lock partition statistics.
Examples
Unlock the table-level statistics for table t1 under user test.
obclient> CALL DBMS_STATS.UNLOCK_TABLE_STATS('test', 't1');
Query OK, 0 rows affected