I am working on this single table which needs to be exported from prod and import into test.
As I understand I need to follow below steps:
1. Test - export table abc dump as backup
2. Prod - Export single table abc
3. Test - Drop table abc cascade constraints
4. Test - Import abc into test
Export par file:
Import par file:
1. Is my process flow correct?
2. Export & Import file correct? or missing parameters?
3. What happens to all objects connected to the table, will that also imported?
4. Do I need to lock user during this process?
5. Any script to check whether all objects connected to table does exist in test after import?
I wouldn't do it that way but you can if you wish.
When you drop a table you drop permissions, constraints, indexes, triggers, invalidate views, etc. Maybe that doesn't matter in your case and maybe it does.
What I would do is:
1. CREATE TABLE data_hold AS SELECT * FROM target table in test.
2. TRUNCATE the target table in test.
3. Do an import using APPEND.
4. If all looks good drop the data_hold table.
Process for table export & import.
+1. Create database directory in test as well as production:-+
--> create or replace directory directory_name as 'physical_path';
--> grant acsess on that directory to user.
+2. Backp table in test environment (in case if you need old data in your test env):-+
--> Create table BKP_table_name as select * from table_name; (table_name u want to import)
+3. Take Export backup in Production database:-+
--> expdp dumpfile=file_name.dmp logfile=file_name.log directory=directory_name tables=Owner.table_name
+4. On test server do the following actvity:-+
a. Just check for dependencies on that table using DBA_DEPENDENCIES.
b. Truncate table which u want to import
c. import table-
impdp dumpfile=file_name.dmp tables=owner.table_name logfile=file_name_imp.log directory=directory_name table_exists_action=APPEND
d. Just check for dependencies on that table using DBA_DEPENDENCIES. And also you can use table_exists_action=replace This will also import all depedent objects to the table..
Edited by: XBOX on Dec 14, 2012 10:15 PM