(Re)create user/schema using DataPump
Remember, one thing Datapump doesn't do (by design) is recreate grants to objects owned by SYS.
If the user does not yet exist on the destination database, just import it using the procedure outlined here.
Or if you are asked to create a user 'like' another user, use this:
$ expdp schemas=CURRENTUSER content=metadata_only $ impdp remap_schema=CURRENTUSER:NEWUSER
If however, the user(schema) already exists, it will have to be dropped and re-created before the data can be imported.
Run this script to generate the recreation DDL
After this has been run, the following command can be executed:
drop user <schema name> cascade;
Now, recreate the schema with the above-mentioned DDL
The dumpfile (or a part thereof) can now be imported to fill up the currently empty schema:
impdp <usr>/<pwd> parfile=schema.par
where schema.par would look like this:
directory=DATA_PUMP_DIR dumpfile=<schema_name>.DMP schemas=(<schema_name>)
and/or maybe one or more of the following:
exclude=grants tables=(<schema_name>.<table_name>) remap_tablespace=old:new
Finally, recompile all invalid objects:
exec utl_recomp.recomp_serial(); or exec utl_recomp.recomp_parallel(4); or @?\rdbms\admin\utlrp.sql or @?\rdbms\admin\utlprp.sql(4)