把生产数据库得到一个用户数据导出到另一个数据库里,想收集统计信息的时候提示:
- ORA-20005:object statistics are locked (stattype = ALL)
既然有锁,就肯定可以解锁:
有两个办法,一个是对整个用户下所有的表解锁:
- DBMS_STATS.UNLOCK_schema_STATS('用户名');
另一个是对单个表解锁:
a.先查一下当前用户下那些表的统计信息被锁了
- select table_name from user_tab_statistics where stattype_locked is not null;
- dbms_stats.unlock_table_stats('用户名','表名');
c.也可以编辑一个解锁脚本
- select 'exec dbms_stats.unlock_table_stats('''||user||''','''||table_name||''');' from user_tab_statistics where stattype_locked is not null;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20893244/viewspace-2155354/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20893244/viewspace-2155354/