Every night we use sp_attachdb to attach a 1TB database to our data
warehouse server. Each night we kill off all nonsystem related spids, set
all the other databases to DBO only and then attach. The attach seems to
take between 4 minutes to an hour. With an idle server and filegroup sizes
that have not grown what could be causing the variance? The number of
transactions to rollback or forward doesn't seem to have an impact. The log
indicates that the attach is spending almost all its time in phase 2.
Anyone know exactly what happens in phase 2?
Books online and reading the sp_attachdb proc weren't much help.
sp_attachdb is simply a derived call to create database ... for attach.
Any insight is appreciated.
Thanks,
Ray