Solved

Updating the database from SQL Server 2008 to 2012

Posted on 2012-12-29
11
587 Views
Last Modified: 2012-12-29
I have been using SQL Server 2008 With Visual Studio 2008. Now I am using SQL Server 2012 With Visual Studio 2012. For now, I just want to get the database updated so I can restore it in SQL Server 2012. Is there a query that will handle this task? I tried using the restore query that I always use:
Database name:  --          jandmmfg

Restore database jandmmfg from disk
= ‘F:\Backups\SQL\jandmmfg.BAK’
With recovery, replace

...

This gave me an error…

...

Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\jandmmfg.mdf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'jandmmfg' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\jandmmfg.mdf'. Use WITH MOVE to identify a valid location for the file.
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\jandmmfg_log.ldf" failed with the operating system error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'jandmmfg_log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\jandmmfg_log.ldf'. Use WITH MOVE to identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
Comment
Question by:jampost
  • 6
  • 3
  • 2
11 Comments
 
LVL 22

Expert Comment

by:Steve Wales
ID: 38730140
I have seen this error when restoring to a new database and the destination directory doesn't exist.  SQL Server won't create directories for you.

Does the directory "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA" exist ?
0
 

Author Comment

by:jampost
ID: 38730143
sjwales,

That directory exists in SQL Server 2008, but not in 2012.
0
 

Author Comment

by:jampost
ID: 38730146
SQL Server 2008 was Developer edition. I am using SQL Server 2012 Express edition while I wait for the delivery of SQL Server 2012 Developer edition if that makes a difference.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 250 total points
ID: 38730164
Use the MOVE clause to place the data and log files wherever you want.  A word of caution, typically using C: is not a good choice, but if this is just your home version it should be fine.
0
 
LVL 22

Assisted Solution

by:Steve Wales
Steve Wales earned 250 total points
ID: 38730166
Create the directories then, and try again.

The original error message even says: Directory lookup for the file "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\jandmmfg_log.ldf" failed

Create the destination directory, try again and you may want to move the files around afterwards to where ever you need them to be.

In fact, there was a question asked today by someone else about moving DB files around:
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL_Server_2008/Q_27980580.html
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 38730167
Something like this (change the logical names and enter the full path to the data files including their physical names as appropriate):
RESTORE DATABASE jandmmfg
   FROM DISK= 'F:\Backups\SQL\jandmmfg.BAK'
   WITH NORECOVERY, 
      MOVE 'jandmmfg_Data' TO '<full path of your data file goes here>', 
      MOVE 'jandmmfg_Log' TO '<full path of your transaction log file goes here>'

Open in new window

0
 

Author Comment

by:jampost
ID: 38730172
acperkins,

I received this error after the MOVE statement.


Msg 3234, Level 16, State 2, Line 1
Logical file 'jandmmfg_Data' is not part of database 'jandmmfg'. Use RESTORE FILELISTONLY to list the logical file names.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
0
 

Author Comment

by:jampost
ID: 38730173
sjwales

I might try that to get things rolling.
0
 

Author Comment

by:jampost
ID: 38730180
sjwales,

    Creating the folders did not work.
0
 

Author Closing Comment

by:jampost
ID: 38730199
Thank you all for your help.  I am going do an upgrade in place from SQL Server 2008 to 2012. I think that in the ticket. Happy New Year everybody.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 38730201
Logical file 'jandmmfg_Data' is not part of database 'jandmmfg'.
That is why I specifically stated change the logical names and enter the full path to the data files including their physical names as appropriate.  I have no idea what names you used.  And yes using RESTORE FILELISTONLY will answer that question for you.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Insert to Begin if data exists 2 33
Row insertion failed. Array 5 48
TSQL convert date to string 4 37
Isolation level setting TSQL View 10 29
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question