User Tools

Site Tools


recreate_user_schema_using_datapump

Remember, one thing Datapump doesn't do (by design) is recreate grants to objects owned by SYS.\\<br /> 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)
recreate_user_schema_using_datapump.txt · Last modified: 2019/01/30 11:32 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki