HiveBrain v1.2.0
Get Started
← Back to all entries
principlesqlMinor

Migrate SQL Server database to multiple files (shrinkfile emptyfile vs log shipping)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
logsqlmigratedatabasefilesmultipleshippingserveremptyfileshrinkfile

Problem

I have a SQL Server 2008 database in production that we are moving onto a new server. The current database has a single ~400GB .MDF file. The new server will be running SQL Server 2012, and we are running mirrored Intel 910 SSDs. These drives will present us with 4x 200GB partitions.

To make this work, we will need to split the single .MDF into 4 smaller ones using DBCC SHRINKFILE with EMPTYFILE. We have done this in test, and it still takes ~ 3.5 hours to do which is too long. The existing database is OLTP, and 365/24/7 and I know blocking will occur during this process, so we can't do it on production first.

My question, is there a way to backup and restore the database to the new server in a temp location. create the new files, EMPTY the temp .MDF into the new locations, then apply transaction logs after? That way we can move the data while current old production is up and running, then do a short shutdown, apply logs, and bring up the new DB?

Or are there any other options to get from Server A with one file and Server B with 4 files on different drives with minimal downtime?

Solution

In a word, no. You have to do it live.

What you'll want to do it add 3 new files. Then simply start doing index rebuild operations. As long as you are doing rebuilds not defrags SQL will start spreading the data across all the data files.

I'm assuming that you are running on SQL Enterprise Edition and can do online index rebuilds.

Context

StackExchange Database Administrators Q#36734, answer score: 3

Revisions (0)

No revisions yet.