Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Updating the database from SQL Server 2008 to 2012

Posted on 2012-12-29
11
Medium Priority
?
596 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 23

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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 750 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 23

Assisted Solution

by:Steve Wales
Steve Wales earned 750 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

772 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