Changing log and data location in SQL Server 2008 is not having any affect

I have a SQL Server 2008 R2 database and I am trying to change the location of the data and log files from the C drive to the D drive.

I have followed the instructions here:
http://technet.microsoft.com/en-us/library/dd206993.aspx

When I create a new database, it correctly created the data and log files in the new location on the D drive. However I was hoping to move the location of an existing database by doing the following:

1. Backup the database
2. Delete the database
3. Restore the database

The problem is when I do the restore it still saves the data and log files in the old D drive location. I am aware there are commands to alter the database etc but I was hoping by doing the restore it would save everything in the new location.
mike99cAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle AbrahamsSenior .Net DeveloperCommented:
You can restore it.

By default the backup stores the information of the place it came from, however, in the options, you can change the file location to whatever you want.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh RetnakaranDatabase AdministratorCommented:
You need to restore with 'Move' option.

Another way of doing this is, take the database offline. Move the files to the proper places, drop database, and attach the database by browsing these files.
0
Kyle AbrahamsSenior .Net DeveloperCommented:
Change restore as to whatever you want:

Screenshot
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mike99cAuthor Commented:
Found the answer. During the restore, click on "Options" on the left. Then simply change the file location under the "Restore As" column.
0
mike99cAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for mike99c's comment #a39483649

for the following reason:

This is the exact solution.
0
mike99cAuthor Commented:
Apologies everyone as I just found the solution myself before checking Experts Exchange. Happy to split the points however as I don't want you to think I did anythig underhand.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.