You have a primary database server and a secondary one, and an additional
server (the target server) where you want to make a copy.

The primary log-ships to the secondary.

You need to make a fast copy of a large database from the primary server on
the target server, without causing any downtime.

If you restore a copy of the database from a full backup, there are a few
- If you don't have a recent full backup, you need to make one, which takes
  a while.
- When restoring from a backup, SQL server first writes the entire file's size
  with zeroes, then restores the data. This means it takes twice the length of
  time needed to copy a file the size of the backup. If you need to first copy
  the backup somewhere, then it takes 3 times that length.
- You could turn on "instant file initialization" on the target server to make
  the backup restore much faster, but there are security concerns (Windows
  does not properly support sparse files, so old disk data will magically
  become part of the new file).

Ideally, you would be able to stop the SQL Server service on the secondary
server and just copy its database files (the ones maintained by the log
shipping target). However, files that were in a "restoring..." state cannot be
reattached (SQL Server will refuse).

You can reattach a "restoring..." .mdf file (that you copied from a log
shipping target server) like this:


on the target server, create a new blank database with the same number and kinds of
files as the source database

make a backup of this new database

delete the new blank database

restore the new blank database from the backup file, choosing "norecovery"
option, so that the restored database will be in the "restoring..." state.

stop the SQL Server service on the target server

replace the blank database restoring files with the ones you copied from the
log shipping target (secondary server).

start the SQL Server service on the target server

run this query on the target server to bring the copied database online:

	restore [database_name] with recovery