新的Oracle 11g資料是由datapump移轉過來的,在執行Gather Schema Statistics時發生錯誤:
ORA-20005: object statistics are locked (stattype = ALL)
解決方案:
This problem can occur on any platform.
DataPump Import without data (CONTENT=METADATA_ONLY) locks statistics.
Executing the DBMS_STATS.GATHER_TABLE_STATS to collect the statistics on the table imported, it fails with:
The statistics are locked during a DataPump Import if export or import were performed with CONTENT = METADATA_ONLY.
This is because automatic statistics gathering is enabled by default in 10g. Therefore, the imported statistics, if not locked, are lost the next time the auto-stats job runs
To avoid the ORA-20005:
- Unlock the table statistics after the import:
execute DBMS_STATS.UNLOCK_TABLE_STATS('<user name>','<table name>');
OR
- Do not import the table statistics (EXCLUDE=TABLE_STATISTICS impdp parameter)
執行下列的語法來解決問題
指定Table:
exec DBMS_STATS.UNLOCK_TABLE_STATS('OWNER', 'TABLE_NAME');
指定Schmea:
exec dbms_stats.unlock_schema_stats('SCHEMA_NAME');
檢查是否還有其他的Statistics Lock的Table:
SQL> select owner, table_name, stattype_locked from dba_tab_statistics where stattype_locked is not null;
no rows selected
重新執行Gather Schema Statistics就成功了。
-
Windows7 / Windows8 kill process Linux下要刪除某個程序通常會使用 ps 配合 kill 來刪除程序。 例如:ps -ef |grep [PROCESS NAME] kill -9 [PID] 在Windows下,通常是...
-
在電腦版的Line輸入文字時,遇到需要換行的情形時,我都是用記事本先寫好再複製上去,這樣就可以有換行的效果,可是這樣的做法好像失去Line的便利性。 於是查了一下,原來有一個設定可以指定Enter換行,而不是發訊息出去。 完成設定之後,要發送訊息就改用Al...
-
利用Win 10的工作排程器來設定每日自動執行的批次檔,單獨執行批次檔沒問題,但是放在排程上就是無法執行。 後來試了幾種網路上提供的方式,其注意的事項如下: 1、在「安全性選項」選擇「只有使用者登入時才執行」並取消「以最高權限執行」。 2、在「設定」中選擇「Win...