Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 96
  • Last Modified:

How to transfer / copy a database from one server to another

I need to copy or transfer a database (tables, views, stored procedures, functions, etc.) from one database server to another. I tried using the wizard and the wizard did not copy over any of the tables, views, stored procedures, functions. I tried import / export function and only the tables were copied over from the old database to the new one.  I also tried to use generate scripts for views and stored procedures and I have the script to my desktop or another location but I don't know how to import the views or stored procedures from the scripts to the database.
Is the a SQL script or any other way that I can copy the entire database from one server to another server. Time is of the issue. So your help is greatly appreciated.
Thank you
0
newjeep19
Asked:
newjeep19
1 Solution
 
ste5anSenior DeveloperCommented:
The easiest way is to restore a backup on the second server.
0
 
newjeep19Author Commented:
Can you give me the steps? I have never done this before. Thanks
0
 
ZberteocCommented:
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Daniel JonesData Research AnalystCommented:
You can also take the help of this link to copy data between servers
https://technet.microsoft.com/en-us/library/ms190923(v=sql.105).aspx
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Hi newjeep19,
I have 3 articles written about migrating databases. Each article talks about a method so you can choose the one that fits you more:
The Detach/Attach method
The Backup & Restore method
The Copy Database Wizard method
0
 
newjeep19Author Commented:
Thanks for sending me the links on the steps. I think that the backup and restore method is the best way to go about this. However, I am still on clear of how I can copy the full backup file from the source location backup path to the destination server. When I am on the destination server I go to Task-> Restore-> Restore Files and File groups and then click on the add button. However, their is no backup because the backup is on the source server and not the destination server. Thought? Examples? Thanks
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
However, I am still on clear of how I can copy the full backup file from the source location backup path to the destination server.
You can copy the file through the network from the source to the target server.

When I am on the destination server I go to Task-> Restore-> Restore Files and File groups and then click on the add button. However, their is no backup because the backup is on the source server and not the destination server.
This is because SSMS only works with drive letters. If you want to use a share you need to type it as \\SourceServerName\c$\BackupFolder\BackupFileName.bak

Other option is to use T-SQL to restore the backup as I also wrote in my article. Just replace the path with the correct network path:
RESTORE DATABASE [DatabaseNameHere] 
FROM  DISK = N'\\ServerName\Backup\DatabaseName.bak' 

Open in new window

0
 
newjeep19Author Commented:
OK  when I try using the SSMS method I get the below error:
ErrorMEssage.png
0
 
Pawan KumarDatabase ExpertCommented:
Change the name of the backup and try again - it will work.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
You're trying to overwrite another database? If so you'll need to check the Overwrite option before running the Restore.
0
 
newjeep19Author Commented:
Thank you all for your assistance. I am able to due a full back up of multiple databases from your suggestions.
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Great.
If your issue has been solved please choose one or more comments that helped you so this question can be properly closed.
Cheers
1
 
newjeep19Author Commented:
Thanks for all your help
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now