Link to home
Start Free TrialLog in
Avatar of tablaFreak
tablaFreakFlag for United States of America

asked on

SQL Server Hanging on Bulk Inserts

Hello Experts,

When trying to run a script from Generate Scripts copying data from one database to another, using the 'Check for object existence = True', 'Script Drop and Create', and 'Copy Schema and Data', the query is just hanging indefinitely. Any idea what might be causing that?

Thanks,
Steve
Avatar of David Favor
David Favor
Flag of United States of America image

Take a look at  your server logs + see if you've hit some resource limit.

There should be some indication of what's occurring.

Also, check CPU time accumulating on the script you're running. So long at CPU continues to accumulate, some processing is still occurring.

If CPU time is still accumulating on your script, then just let it run.

One trick you can use with large database loads is to create your target table(s) with no indexes. Then after load finishes, create indexes. Sometimes this dramatically speeds up data loads.
Another thing would be to start with a higher initial data file size. Because I/O is the slowest component, every time the SQL Server goes to expand the data file and the log files, it will take a considerably long time.
Avatar of tablaFreak

ASKER

Thanks guys, I appreciate the input. Turns out when I used the command line with "SQLCMD -d <database-name> -i filename.sql" the script ran with no problemo. Cheers.
ASKER CERTIFIED SOLUTION
Avatar of tablaFreak
tablaFreak
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial