环境:AIX 6.1 + Oracle 10.2.0.4
现象:在XTTS迁移测试阶段,遇到执行几个expdp的导出任务,迟迟没有返回任何信息,对应日志无任何输出,查看任务状态:
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导出任务的STATE都停留在DEFINING状态。
•1.牛刀小试清异常
•2.追本溯源查MOS
1.牛刀小试清异常
先强制杀掉后台执行的所有expdp任务:
ps -ef|grep expdp|grep -v grep|awk '{print $2}'|xargs kill -9
然后尝试删除这些表(其实应该在not running状态下删除)
select 'drop table '||OWNER_NAME||'.'||JOB_NAME||' purge;' from dba_datapump_jobs where STATE='NOT RUNNING';
drop table sys.SYS_EXPORT_TRANSPORTABLE_01 purge;
..
可这样是没有作用的,查询结果不变。
甚至尝试正常shutdown immediate停止数据库,也无法成功,告警日志看到有活动调用:
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.
发现这些进程的id都对应了ora_dm的进程:
$ 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
实际上,这就是expdp任务的相关进程,强制杀掉这些进程:
ps -ef|grep ora_dm|grep -v grep|awk '{print $2}'|xargs kill -9
之后数据库关闭成功:
Thu Nov 1 15:24:37 2018
All dispatchers and shared servers shutdown
Thu Nov 1 15:24:37 2018
ALTER DATABASE CLOSE NORMAL