1. 程式人生 > 其它 >oracle定時備份失效,手動執行報錯ORA-31634ORA-31664

oracle定時備份失效,手動執行報錯ORA-31634ORA-31664

自動備份失效,手動執行指令碼報錯 ORA-31634 ORA-31664

1、問題發現:
每天定時資料泵匯出作業未正常匯入,檢視import.log,居然為空。
2、問題追蹤:
手工呼叫back.sh指令碼匯出,執行幾秒後報錯:
ORA-31634: job already exists
ORA-31664: unable to construct unique job name when defaulted
3、查詢解決
1)分析錯誤及如何解決:
ORA-31634: job already exists
Cause: Job creation or restart failed because a job having the selected name is currently executing. This also generally indicates that a Master Table with that job name exists in the user schema. Refer to any following error messages for clarification.
Action: Select a different job name, or stop the currently executing job and re-try the operation (may require a DROP on the Master Table).
ORA-31664: unable to construct unique job name when defaulted
Cause: The job name was defaulted, and the name creation algorithm was unable to find a unique job name for this schema where the table name (for the master table) didn"t already exist.
Action: Specify a job name to use or delete some of the existing tables causing the name conflicts.
經分析是expdp執行時呼叫job的唯一名不存在,查詢dba_datapump_jobs,正常情況下job_name欄位只有SYS_IMPORT_SCHEMA_01和SYS_IMPORT_SCHEMA_02兩行,而此表有135行,解決方法刪除表中欄位state是NOT RUNNING狀態的表。
2)解決
生成清除master table的SQL語句為:
select 'drop table ' || owner_name || '.' || job_name || ';' from dba_datapump_jobs where state = 'NOT RUNNING'
手工執行生成的SQL語句後,再次查詢dba_datapump_jobs確認是否有state是NOT RUNNING的master table,重複生成SQL語句執行即可。
再次手工呼叫匯入指令碼,正常匯入。