ORA-39213: Metadata processing is not available

The Problem

While using data pump in an Oracle 10g database, I got the following error:

ORA-39006: internal error
ORA-39213: Metadata processing is not available

I read through the following forum post and did what they said:
http://forums.oracle.com/forums/thread.jspa?threadID=614753

I kicked off the job again and this time got a different error:

ORA-39006: internal error
ORA-39065: unexpected master process exception in DISPATCH
ORA-04063: package body "SYS.KUPW$WORKER" has errors
ORA-06508: PL/SQL: could not find program unit being called: "SYS.KUPW$WORKER"
ORA-39097: Data Pump job encountered unexpected error -6508

If you read through Metalink note 402242.1, this will answer your questions. For those of you who don’t have a Metalink account, here is what I did:

execute sys.dbms_metadata_util.load_stylesheets
spool java_xml_install

@?\javavm\install\initjvm.sql
@?\xdk\admin\initxml.sql

spool off

You may think, and hope, that this is the end of it and you will now be able to re-run your job but you would be wrong…The SYS.KUPW$WORKER package was not valid in my case, so I had to run the following to get it working:

@?\rdbms\admin\catdpb.sql

The details for this part can be seen in Metalink note: 394569.1