I don't know what you mean by "locked". Locks are released when a commit is issued. So, unless you turned off auto-commit (CLI or other interface), then no locks should be held when the command finishes.
When doing massive inserts, there are some performance considerations:
1. If possible, do not create the indexes on the target table until the data is moved. If you must create the PK index (either explicitly or if DB2 does it automatically when you create the PK) then try to defer creating any other indexes until all the data is moved.
2. If possible, defer creating any foreign keys until after the data is loaded.
3. If possible, turn off DB2 logging. If you create the table with not logged initially, then you can turn off logging temporarily (untill you do a commit). Execute the following script with auto-commit off (+c option on CLI):
alter table2 not logged initially;
insert into table2 select * from table1;
Then create the indexes.
If you want to do massive inserts with logging, then optimize DB2 for massive inserts:
- increase number of asynchronous page cleaners (NUM_IOCLEANERS) to 3 or higher
- decrease changed pages threshold (CHNGPGS_THRESH) to 20
- increase log buffer size (LOGBUFSZ) to 128 or higher
- make sure your buffer pools are sufficiently large
- increase the size and number of log files
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390