For example, if you import data_only for partitioned table, the impdp does serial import (see MOS ID 1327029.1).
Also, when you have a schema with many indexes, it can take a while because impdp process creates one index at a time. The index is created using parallelism you specify in the par file or at the command line. But it does not create multiple indexes at the same time.
Here are the general steps I use to speed up the import process using impdp.
data_only import
- Put database in NO ARCHIVELOG Mode.
- Disable constraints (FK and PK)
- Change all indexes in the schema(s) to unusable
- Generate grants statements for sequences
- Disable all triggers
- Drop sequences
- Import data using following options
- content=data_only
- TABLE_EXISTS_ACTION=TRUNCATE
- parallel=4 (if your machine can handle more then increase this number)
- Import sequences
- content=metadata_only
- INCLUDE=SEQUENCE
- parallel=4
- Apply the grants generated in step 2.
- Rebuild indexes using parallel 20 in multiple sessions.
- generate ALTER INDEX owner.index_name REBUILD PARALLEL 20; into a file
- use Unix utility called split to split the file into 10 different files.
- use nohup and & to background the sqlplus session to create index and start all 10 sessions.
- Enable foreign and primary constraints
- Change indexes back to NO PARALLEL or change it to whatever they were before.
- Enable triggers
- Update Stats
- Put database back in ARCHIVELOG mode
Using the method mentioned above I was able to import about 511GB in 28 minuets for a database running in NO ARCHIVELOG mode. Rebuilt 2,089 indexes in 40mins. I created a korn shell script for the entire import process and it took about 1 hours and 20 minuets to complete.
Import everything
- Put database in NO ARCHIVELOG Mode
- Set the db_block_checksum parameter to false to improve import speed: ALTER SYSTEM SET db_block_checksum=FALSE SCOPE=BOTH;
- Generate scripts or save info for following:
- grants
- parallelism for indexes
- password
- synonyms
- DDL for foreign and primary constraints
- Set index parallel to 20 and generate DDL for indexes into 10 files
- Drop the schema if already exist
- Import using following parameters
- content=ALL
- exclude=constraint
- exclude=INDEX
- Create indexes using nohup and & to background and start all 10 sessions.
- Create constraints
- Put indexes back to their original parallelism
- Apply grants
- Create synonyms
- Set the passwords
- Recompile all invalid objects
- Update stats
- Set the db_block_checksum parameter back to typical: ALTER SYSTEM SET db_block_checksum=TYPICAL SCOPE=BOTH;
- Put database back in ARCHIVELOG Mod.
I hope these steps help anyone who is looking to speed up import process. I didn't put exact SQL and korn shell commands I use in my scripts. Please contact me if you would like exact SQL and/or korn shell script commands.
If anyone does it any differently please let me know. I am interested to see how other DBAs import large amount of data when Trasnportable Tablespace (TTS) is not an option.
No comments:
Post a Comment