- 论坛徽章:
- 0
|
This is the way to do it:
1. sp_dboption db_name,'select into/bulkcopy',true
2. sp_dboption db_name,'trunc log on chkpt',true
3. drop indexes,triggers on destination tables
BCP won't fire triggers, but bcp program is optimized for tables without triggers.
4. bcp out data using either of the following methods,
4.1 bcp out the whole data
4.2 bcp ... out data1.txt ... -F1 -L10000000 ..... (use the last row number you want)
bcp ....out data2.txx ... -F10000001 -L20000000..
5. bcp in data
5.1 bcp in the whole data using -b option, say 5000, if you bcp version is higer than 12.0,otherwise
5.1.1 use split -l linecount to split your file
5.1.2 use FIFO pipe
5.2 bcp ... in ...data1.txt ... -b 5000
bcp ... in ...data2.txt ... -b 5000 ......
6. rebuild indexes, recreate triggers
I used bcp to move data from 12.5.2 to 12.0 (bcp 12.0 for solaris doesn't support files greater than 2G), there are 86 million records in one table, and 32 million records in another one, it took me 10 hours in total. |
|