oracle 由于impdp 引起的表统计信息被锁 ORA-20005: object statistics are locked
2014-04-01 10:35
363 查看
以下转自:http://blog.itpub.net/15747463/viewspace-741040 作者:renjixinchina
oracle 由于impdp 引起的表统计信息被锁 ORA-20005: object statistics are locked
分类: Linux
发现一个用户下统计信息没有生成,
查询user_tab_modifications 发现变动信息也超过10%
没有警告日志
执行
exec dbms_stats.gather_schema_stats(ownname => 'test',granularity => 'ALL',cascade => true);
还是没有生成
然后执行报
begin dbms_stats.gather_table_stats(ownname => 'test',tabname => 'TCCLICOMH',granularity => 'ALL',cascade => true); end;
ORA-20005: object statistics are locked (stattype = ALL)
ORA-06512: 在 "SYS.DBMS_STATS", line 13056
ORA-06512: 在 "SYS.DBMS_STATS", line 13076
ORA-06512: 在 line 2
执行以下脚本后正常
SQL> exec dbms_stats.unlock_schema_stats(ownname => 'test');
PL/SQL procedure successfully completed
SQL>exec dbms_stats.gather_schema_stats(ownname => 'test',granularity => 'ALL',cascade => true);
PL/SQL procedure successfully completed
原因是因为使用impdp 只导入metadata_only 或(expdp的时候使用了contend=metadata_only)时 没有使用use exclude=(table_statistics,index_statistics)
引起的
参考文档
Symptoms
---------
Either of the following two error messages are signaled:
1. ORA-38029: object statistics are locked
2. ORA-20005: object statistics are locked (stattype = ALL)
Cause
---------
Possible Cause 1:
DBMS_STATS.LOCK_[SCHEMA|TABLE]_STATS has been used to lock statistics on the table.
Possible Cause 2:
Using import (imp) or data pump import (impdp) to import a table without data results in the table's statistics being locked in 10gR2.
Possible Cause 3:
After an IMPORT is finished for which ROWS=N, the statistics for all tables imported will be locked.
Part Number B14233-04 Database Readme 10g Release 2 (10.2) (39.5 Original Export/Import)
Possible Cause 4: If the table is a queue table then the statistics are intended to be empty and locked so that dynamic sampling will be used due to the table's volatility. During an upgrade to 10gR2 statistics on queue tables are deleted and then locked. In 10gR2 when a queue table is created statistics are locked while still empty.
Solution
---------
If the table is a queue table then the statistics should remain empty and locked so that dynamic sampling is used due to the volatility of queue tables. If the table is not a queue table, unlock the statistics using DBMS_STATS.UNLOCK_[SCHEMA|TABLE]_STATS or gather statistics on the table using DBMS_STATS.GATHER_[SCHEMA|TABLE|INDEX]_STATS and the force=>true parameter.
To prevent import (imp) from locking the table's statistics when importing a table without therows (rows=n), use statistics=none. To prevent data pump import (impdp) from locking the table's statistics when importing a table without the rows (content=metadata_only), use exclude=(table_statistics,index_statistics).
oracle 由于impdp 引起的表统计信息被锁 ORA-20005: object statistics are locked
分类: Linux
发现一个用户下统计信息没有生成,
查询user_tab_modifications 发现变动信息也超过10%
没有警告日志
执行
exec dbms_stats.gather_schema_stats(ownname => 'test',granularity => 'ALL',cascade => true);
还是没有生成
然后执行报
begin dbms_stats.gather_table_stats(ownname => 'test',tabname => 'TCCLICOMH',granularity => 'ALL',cascade => true); end;
ORA-20005: object statistics are locked (stattype = ALL)
ORA-06512: 在 "SYS.DBMS_STATS", line 13056
ORA-06512: 在 "SYS.DBMS_STATS", line 13076
ORA-06512: 在 line 2
执行以下脚本后正常
SQL> exec dbms_stats.unlock_schema_stats(ownname => 'test');
PL/SQL procedure successfully completed
SQL>exec dbms_stats.gather_schema_stats(ownname => 'test',granularity => 'ALL',cascade => true);
PL/SQL procedure successfully completed
原因是因为使用impdp 只导入metadata_only 或(expdp的时候使用了contend=metadata_only)时 没有使用use exclude=(table_statistics,index_statistics)
引起的
参考文档
Symptoms
---------
Either of the following two error messages are signaled:
1. ORA-38029: object statistics are locked
2. ORA-20005: object statistics are locked (stattype = ALL)
Cause
---------
Possible Cause 1:
DBMS_STATS.LOCK_[SCHEMA|TABLE]_STATS has been used to lock statistics on the table.
Possible Cause 2:
Using import (imp) or data pump import (impdp) to import a table without data results in the table's statistics being locked in 10gR2.
Possible Cause 3:
After an IMPORT is finished for which ROWS=N, the statistics for all tables imported will be locked.
Part Number B14233-04 Database Readme 10g Release 2 (10.2) (39.5 Original Export/Import)
Possible Cause 4: If the table is a queue table then the statistics are intended to be empty and locked so that dynamic sampling will be used due to the table's volatility. During an upgrade to 10gR2 statistics on queue tables are deleted and then locked. In 10gR2 when a queue table is created statistics are locked while still empty.
Solution
---------
If the table is a queue table then the statistics should remain empty and locked so that dynamic sampling is used due to the volatility of queue tables. If the table is not a queue table, unlock the statistics using DBMS_STATS.UNLOCK_[SCHEMA|TABLE]_STATS or gather statistics on the table using DBMS_STATS.GATHER_[SCHEMA|TABLE|INDEX]_STATS and the force=>true parameter.
To prevent import (imp) from locking the table's statistics when importing a table without therows (rows=n), use statistics=none. To prevent data pump import (impdp) from locking the table's statistics when importing a table without the rows (content=metadata_only), use exclude=(table_statistics,index_statistics).
相关文章推荐
- oracle 由于impdp 引起的表统计信息被锁 ORA-20005: object statistics are locked
- 对象统计信息锁定的解决办法(ORA-20005/ORA-38029) object statistics are locked
- 错误处理 ORA-20005: object statistics are locked (stattype = ALL)
- ORA-20005: object statistics are locked (stattype = ALL)-转
- SAP之ORA-20005: object statistics are locked
- ORA-20005: object statistics are locked (stattype = ALL)
- ORA-38029:object statistics are locked
- Oracle 10g 统计信息自动收集功能(automatic statistics gathering)学习总结 .
- 由于修改Linux系统主机名,引起的Oracle故障ORA-00600
- Oracle 10g 统计信息自动收集功能(automatic statistics gathering)学习总结
- DataPump Import (IMPDP) Fails With Error ORA-39083 Object Type INDEX_STATISTICS (文档 ID 1454880.1)
- SQL优化一例,由于动态性能视图统计信息不准确引起的查询缓慢
- Oracle 10g 统计信息自动收集功能(automatic statistics gathering)
- 由于统计信息引起的性能灾难
- 对象统计信息锁定的解决办法(ORA-20005/ORA-38029)
- 对象统计信息锁定的解决办法(ORA-20005/ORA-38029)
- Oracle中出现Ora-00054该怎么处理,V$locked_object和V$session的用法
- [zt] Oracle 10g 统计信息自动收集功能(automatic statistics gathering)
- Oracle 12c数据库优化器统计信息收集的最佳实践(二)
- Oracle性能-查询统计信息的SQL语句