Solved

How to move SQL Express server

Posted on 2007-03-22
17
679 Views
Last Modified: 2013-11-16
I'm running an SQL express server as the backend of my database but need to move it to a new server. I cannot find steps on the internet to do so. Any help would be much appeciated.
0
Comment
Question by:prlit
  • 8
  • 5
  • 4
17 Comments
 
LVL 19

Expert Comment

by:aissim
Comment Utility
I haven't personally had to do this with SQL Express....but my best guess would be to install SQL Express on the new machine and then replicate the DB from old to new.
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
Is there somewhere I can find steps to to do the replication?
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
0
 
LVL 19

Expert Comment

by:aissim
Comment Utility
As you probably know there's no SQL agent with express...so there's only two alternate options.

Here's an article that lists your various options, as well as links to 'How-To's' for each option: http://msdn2.microsoft.com/en-us/library/ms165686.aspx


0
 
LVL 1

Author Comment

by:prlit
Comment Utility
If my origional server died and I had to pull it off a backup tape, how would I do so?
0
 
LVL 19

Expert Comment

by:aissim
Comment Utility
You could put it on disk from tape, and then the following from the sql command window:

RESTORE DATABASE dbname
FROM DISK = c:\foldername\backupname.bak
GO
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
That easy?? I just want to copy the olf c:\program files\sql express\ to an external hard drive and then hook that drive to the new server. There's a very little data on the server. What files should I copy?
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
any mdf, ldf or ndf files. Assuming the new server has the same name and IP address. It is a matter of installing the SQL Express as the same name and all. Then shut down the SQL Services, replace the ?df files and restarting the services.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 19

Expert Comment

by:aissim
Comment Utility
You'll probably have to install SQL Express on the new server...then copy the .bak file over (or put it on your external drive), then use the Restore command. It won't work to just copy the program files folder over to the new server - it needs to actually be installed (for registry entries, etc.).
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
The server doesn't have the same/ip name. I did a search of the SQL server express directory and there were no .bak files. I just want to copy all of the "data files" to a external hard drive and move them to the new server. I know I can't copy the program. If I go through and copy the .mdf, .ndf, and .ldf files, what command would I use below?

These commands:
RESTORE DATABASE dbname
FROM DISK = c:\foldername\backupname.bak  "what would go here since there's no .bak"
GO

Thanks for all the help!!!
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 500 total points
Comment Utility
There should be a master.mdf. This is what holds the list of the rest of the databases. If you copy the other ?df files you can put them in the same direstory and then bring them in by executing an attach. The syntax would look something like:
sp_attach_db 'MyDBName', 'C:\MyPath\MyDBName.mdf', 'C:\MyPath\MyDBName.ldf'
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
MY command: sqlcmd sp_attach_db 'MyDBName', 'C:\Data\PRL.mdf', 'C:\Data\PRL_log.ldf'

Gives me: Sqlcmd: 'sqlcmd sp_attach_db' : Unkown Option. Enter -? for help
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
Or am I actually copying the master.mdf or the dbname.mdf
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
If you copy the master.mdf from the Oldserver and replace it the newserver, and have the same paths to on your newserver for all the other ?df files they will be there.

If you are using the the new master from the new install then you can attach the pre-existing ?df files using the sp_attach_db command. The syntax I have is for SQL2K/MSDE. It may have changed. And wouldn't it be:

sqlcmd sp_attach_db 'PRL', 'C:\Data\PRL.mdf', 'C:\Data\PRL_log.ldf'

Note that you will have orphaned user ids between the master database and the PRL DB.
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
Gives me: Sqlcmd: 'sqlcmd sp_attach_db' : Unkown Option. Enter -? for help

I used: sqlcmd sp_attach_db 'PRL', 'C:\Data\PRL.mdf', 'C:\Data\PRL_log.ldf' Everything in that line is right for my details. Is there a typo in the command?
0
 
LVL 1

Author Comment

by:prlit
Comment Utility
I was able to attach the server using the GUI of SQL Express. Very easy, did not require any commands.
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
I'm used to MSDE which did not really have any native GUI. Glad it worked out for you.

Glad to be of assistance. May all your days get brighter and brighter.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now