Moving the Log File

My database has data and log files on the same physical disk array. I'd like to put the log file on a separate RAID array. What's the quickest way to move the log file?

Using sp_detach_db is the quickest and easiest way to move the log file. You can remove a log file from a database by using DBCC SHRINKFILE and ALTER DATABASE, but that technique takes longer. With sp_detach_db, you can quickly detach the database from the server, then reattach it by using sp_attach_db, specifying a new location for the physical log file. You should take care when moving files in a production database because you don't want to make a mistake that would cause downtime. You can find examples of how to use sp_detach_db in SQL Server Books Online (BOL).

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish