Here I'll show an example of using Oracle Data Pump Import (impdp) utility. It allows importing Oracle data dumps. Specifically, below is the list of steps I used on an existing Oracle schema to reload the data from a dump.
Steps to reload the data from an Oracle dump- We start with logging into SQL Plus as sysdba to be able to manage users.
sqlplus sys/password@test as sysdba
- Dropping the existing user. CASCADE clause will ensure that all schema objects are removed before the user.
SQL> DROP USER test CASCADE;
- Creating a fresh user will automatically create an empty schema with the same name.
SQL> CREATE USER test IDENTIFIED BY "testpassword";
- Granting DBA role to the user to load the dump later. Actually, it's an overkill and loading the dump can be permitted using a more granular role IMP_FULL_DATABASE.
SQL> GRANT DBA TO test;
- Registering the directory where the dump is located.
SQL> CREATE DIRECTORY dump_dir AS '/home/test/dumpdir';
- Running import utility using the created user. REMAP_TABLESPACE may be needed if you want to remap the tablespace name from OLDUSERSPACE that was used in the original schema to the default USERS.
impdp test/testpassword@localhost/test DIRECTORY=dump_dir DUMPFILE=test.dmp LOGFILE=imp.log REMAP_TABLESPACE=OLDUSERSPACE:USERS
Once the process is completed, the log file will contain the list of operations including all created schema objects.
Comments
Post a Comment