Some time ago i had a need to create identical user on a test database every hour. To solve that i used impdp ability to use transfer over database link.
I have two databases . Production "db_prod" and test database "db_test". User that i am transferring has to preserve its name for easier testing.
1. Create public database link on db_test as SYSTEM:
create a public database link DB_PROD connect to system identified by xxxxx using ‘DB_PROD_ALIAS’;
2. Insert data (create users and all) from db_prod to db_test with impdp:
impdp system/xxxxxx@db_test schemas=user_prod network_link=db_prod_alias
This way there is no need to use remap_schema since both user names are the same. There is no need to use data_pump_dir because all transfer is done by database link.
There is some more job to be done. I ran script by hand at first to see what objects are giving me warning (Roles, references to another user) and to create a script to prepare test database for fresh injection of a test user. That means usually to drop existing user from db_test, create roles if needed (impdp will fill them with appropriate grants).
Nema komentara:
Objavi komentar