這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)?lái)有關(guān)如何處理expdp任務(wù)異常,文章內(nèi)容豐富且以專(zhuān)業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
成都創(chuàng)新互聯(lián)是一家專(zhuān)業(yè)的成都網(wǎng)站建設(shè)公司,我們專(zhuān)注網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、網(wǎng)絡(luò)營(yíng)銷(xiāo)、企業(yè)網(wǎng)站建設(shè),外鏈,廣告投放為企業(yè)客戶提供一站式建站解決方案,能帶給客戶新的互聯(lián)網(wǎng)理念。從網(wǎng)站結(jié)構(gòu)的規(guī)劃UI設(shè)計(jì)到用戶體驗(yàn)提高,創(chuàng)新互聯(lián)力求做到盡善盡美。環(huán)境:AIX 6.1 + Oracle 10.2.0.4
現(xiàn)象:在XTTS遷移測(cè)試階段,遇到執(zhí)行幾個(gè)expdp的導(dǎo)出任務(wù),遲遲沒(méi)有返回任何信息,對(duì)應(yīng)日志無(wú)任何輸出,查看任務(wù)狀態(tài):
SQL> set lines 300 col OWNER_NAME for a10 col OPERATION for a15 col JOB_MODE for a20 col STATE for a15 select * from dba_datapump_jobs; OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ---------- ------------------------------ --------------- -------------------- --------------- ---------- ----------------- ----------------- SYS SYS_EXPORT_TRANSPORTABLE_01 EXPORT TRANSPORTABLE DEFINING 1 0 1 SYS SYS_EXPORT_TRANSPORTABLE_02 EXPORT TRANSPORTABLE DEFINING 1 1 2 SYS SYS_EXPORT_TRANSPORTABLE_03 EXPORT TRANSPORTABLE DEFINING 1 1 2 SYS SYS_EXPORT_SCHEMA_01 EXPORT SCHEMA DEFINING 1 1 2 SYS SYS_EXPORT_TRANSPORTABLE_04 EXPORT TRANSPORTABLE DEFINING 1 1 2 SYS SYS_EXPORT_SCHEMA_02 EXPORT SCHEMA DEFINING 1 1 2 6 rows selected.
可以看到所有的expdp導(dǎo)出任務(wù)的STATE都停留在DEFINING狀態(tài)。
1.牛刀小試清異常
先強(qiáng)制殺掉后臺(tái)執(zhí)行的所有expdp任務(wù):
ps -ef|grep expdp|grep -v grep|awk '{print $2}'|xargs kill -9
然后嘗試刪除這些表(其實(shí)應(yīng)該在not running狀態(tài)下刪除)
select 'drop table '||OWNER_NAME||'.'||JOB_NAME||' purge;' from dba_datapump_jobs where STATE='NOT RUNNING'; drop table sys.SYS_EXPORT_TRANSPORTABLE_01 purge; ..
可這樣是沒(méi)有作用的,查詢結(jié)果不變。
甚至嘗試正常shutdown immediate停止數(shù)據(jù)庫(kù),也無(wú)法成功,告警日志看到有活動(dòng)調(diào)用:
Thu Nov 1 15:14:24 2018 Active call for process 4522064 user 'oracle' program 'oracle@localhost (DM00)' Active call for process 4456536 user 'oracle' program 'oracle@localhost (DM01)' Active call for process 10027180 user 'oracle' program 'oracle@localhost (DM02)' Active call for process 7340140 user 'oracle' program 'oracle@localhost (DM03)' Active call for process 6291888 user 'oracle' program 'oracle@localhost (DM04)' Active call for process 8126596 user 'oracle' program 'oracle@localhost (DM05)' SHUTDOWN: waiting for active calls to complete.
發(fā)現(xiàn)這些進(jìn)程的id都對(duì)應(yīng)了ora_dm的進(jìn)程:
$ ps -ef|grep ora_dm oracle 4456536 1 0 17:00:09 - 0:00 ora_dm01_xxxxdb oracle 4522064 1 0 16:50:57 - 0:00 ora_dm00_xxxxdb oracle 7340140 1 0 14:06:07 - 0:00 ora_dm03_xxxxdb oracle 8126596 1 0 14:35:03 - 0:00 ora_dm05_xxxxdb oracle 10027180 1 0 13:55:08 - 0:00 ora_dm02_xxxxdb oracle 6291888 1 0 14:31:17 - 0:00 ora_dm04_xxxxdb oracle 7340432 8388786 0 15:22:59 pts/4 0:00 grep ora_dm
實(shí)際上,這就是expdp任務(wù)的相關(guān)進(jìn)程,強(qiáng)制殺掉這些進(jìn)程:
ps -ef|grep ora_dm|grep -v grep|awk '{print $2}'|xargs kill -9
之后數(shù)據(jù)庫(kù)關(guān)閉成功:
Thu Nov 1 15:24:37 2018 All dispatchers and shared servers shutdown Thu Nov 1 15:24:37 2018 ALTER DATABASE CLOSE NORMAL
啟動(dòng)數(shù)據(jù)庫(kù)后,再次查詢發(fā)現(xiàn)已經(jīng)成功清理:
SQL> set lines 300 col OWNER_NAME for a10 col OPERATION for a15 col JOB_MODE for a20 col STATE for a15 select * from dba_datapump_jobs; no rows selected
小結(jié):數(shù)據(jù)泵任務(wù)與ora_dm進(jìn)程相關(guān);如果數(shù)據(jù)泵任務(wù)發(fā)生異常,但任務(wù)并沒(méi)有退出的情況,需要同時(shí)殺掉這類(lèi)進(jìn)程(殺掉后狀態(tài)就會(huì)變?yōu)镹OT RUNNING)。關(guān)庫(kù)不是必須的,只是演示此時(shí)正常關(guān)閉被阻塞的場(chǎng)景。這也能說(shuō)明為什么要保證在NOT RUNNING狀態(tài)下才可以清理。
2.追本溯源查MOS
上面的步驟只是清理了異常的數(shù)據(jù)泵任務(wù),但沒(méi)有解決問(wèn)題,再次后臺(tái)執(zhí)行備份任務(wù)依然會(huì)重現(xiàn)故障:
nohup sh expdp_xtts.sh &
$ ps -ef|grep expdp oracle 6684914 8061208 0 15:30:07 pts/2 0:00 grep expdp oracle 7143482 8061208 0 15:30:03 pts/2 0:00 sh expdp_xtts.sh oracle 6685096 7143482 0 15:30:03 pts/2 0:00 expdp '/ as sysdba' parfile=expdp_xtts.par $ ps -ef|grep ora_dm oracle 7602308 8061208 0 15:30:10 pts/2 0:00 grep ora_dm oracle 3997964 1 1 15:30:05 - 0:00 ora_dm00_xxxxdb $
此時(shí)查詢dba_datapump_jobs,state依然一直是defining狀態(tài):
OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ---------- ------------------------------ --------------- ------------------------------ ------------------------------ ---------- ----------------- ----------------- SYS SYS_EXPORT_TRANSPORTABLE_01 EXPORT TRANSPORTABLE DEFINING 1 1 2
其他的導(dǎo)出任務(wù)都一樣,不再贅述。
為了方便測(cè)試,寫(xiě)一個(gè)簡(jiǎn)單的單表expdp導(dǎo)出,現(xiàn)象也一樣。
expdp \'/ as sysdba\' directory=XTTS tables=query.test dumpfile=query_test.dmp logfile=query_test.log
根據(jù)故障現(xiàn)象,用如下關(guān)鍵字在MOS中搜索: expdp state DEFINING,匹配到文檔:
DataPump Export/Import Hangs With "DEFINING" Status When Using A Directory On NFS Filesystem (文檔 ID 2262196.1)
正好這次測(cè)試是在NFS文件系統(tǒng)上,MOS建議移動(dòng)到本地文件系統(tǒng)導(dǎo)出。
這次再將expdp進(jìn)程全部殺掉:
ps -ef|grep ora_dm|grep -v grep|awk '{print $2}'|xargs kill -9 ps -ef|grep expdp|grep -v grep|awk '{print $2}'|xargs kill -9
此時(shí)查詢dba_datapump_jobs:
OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ---------- ------------------------------ --------------- ------------------------------ --------------- ---------- ----------------- ----------------- SYS SYS_EXPORT_TABLE_04 EXPORT TABLE NOT RUNNING 0 0 0 SYS SYS_EXPORT_SCHEMA_01 EXPORT SCHEMA NOT RUNNING 0 0 0 SYS SYS_EXPORT_TABLE_02 EXPORT TABLE NOT RUNNING 0 0 0 SYS SYS_EXPORT_TABLE_05 EXPORT TABLE NOT RUNNING 0 0 0 SYS SYS_EXPORT_TABLE_03 EXPORT TABLE NOT RUNNING 0 0 0 SYS SYS_EXPORT_TABLE_01 EXPORT TABLE NOT RUNNING 0 0 0 SYS SYS_EXPORT_TRANSPORTABLE_01 EXPORT TRANSPORTABLE NOT RUNNING 0 0 0 7 rows selected.
清理NOT RUNNING的master表:
select 'drop table '||OWNER_NAME||'.'||JOB_NAME||' purge;' from dba_datapump_jobs where STATE='NOT RUNNING'; --執(zhí)行結(jié)果用來(lái)執(zhí)行,再次查看結(jié)果為空: SQL> select * from dba_datapump_jobs; no rows selected
按MOS建議,將導(dǎo)出任務(wù)移動(dòng)到本地文件系統(tǒng):
AIX源端導(dǎo)出XTTS源數(shù)據(jù)至源端/hxbak/xtts_exp目錄中,而后copy至nfs共享存儲(chǔ)/xtts/dmp中:
mkdir /hxbak/xtts_exp chown oracle:dba /hxbak/xtts_exp ls -ld /hxbak/xtts_exp select * from dba_directories; create or replace directory XTTS as '/hxbak/xtts_exp';
此時(shí)測(cè)試expdp任務(wù)可正常運(yùn)行:
$ expdp \'/ as sysdba\' directory=XTTS tables=query.test dumpfile=query_test.dmp logfile=query_test.log Export: Release 10.2.0.4.0 - 64bit Production on Thursday, 01 November, 2018 16:03:21 Copyright (c) 2003, 2007, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYS"."SYS_EXPORT_TABLE_01": '/******** AS SYSDBA' directory=XTTS tables=query.test dumpfile=query_test.dmp logfile=query_test.log Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 8 MB Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS . . exported "QUERY"."TEST" 6.743 MB 72593 rows Master table "SYS"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded ****************************************************************************** Dump file set for SYS.SYS_EXPORT_TABLE_01 is: /hxbak/xtts_exp/query_test.dmp Job "SYS"."SYS_EXPORT_TABLE_01" successfully completed at 16:03:57 SQL> select * from dba_datapump_jobs; OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ---------- ------------------------------ --------------- ------------------------------ --------------- ---------- ----------------- ----------------- SYS SYS_EXPORT_TABLE_01 EXPORT TABLE EXECUTING 1 1 3
再次導(dǎo)出其他元數(shù)據(jù):
#expdp_xtts.sh (about 5min) nohup sh expdp_xtts.sh & #expdp_xtts_other.sh(about 5min) nohup sh expdp_xtts_other.sh & #expdp_tmp_table nohup sh expdp_tmp_table01.sh & nohup sh expdp_tmp_table02.sh & nohup sh expdp_tmp_table03.sh & nohup sh expdp_tmp_table04.sh &
最后將這些導(dǎo)出文件再移動(dòng)到/xtts/dmp/下,供后續(xù)xtts測(cè)試目標(biāo)端導(dǎo)入使用:
$ pwd /hxbak/xtts_exp $ cp -rp * /xtts/dmp/
上述就是小編為大家分享的如何處理expdp任務(wù)異常了,如果剛好有類(lèi)似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
新聞標(biāo)題:如何處理expdp任務(wù)異常-創(chuàng)新互聯(lián)
URL標(biāo)題:http://muchs.cn/article10/iohdo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站內(nèi)鏈、關(guān)鍵詞優(yōu)化、微信公眾號(hào)、品牌網(wǎng)站制作、軟件開(kāi)發(fā)、企業(yè)網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容