I am trying to create a new database from an old backup of database on the same server. When using SQL server management studio and trying to restore to the new DB from the backup I get this error
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'test' database. (Microsoft.SqlServer.Smo)
after googling around I found this piece of code
RESTORE DATABASE myDB FROM DISK = 'C:\myDB.bak' WITH MOVE 'myDB_Data' TO 'C:\DATA\myDB.mdf', MOVE 'myDB_Log' TO 'C:\DATA\myDB_log.mdf' GO
I was wondering will the move statements mess with the database that the backup came from on that server?
Thanks, all help appreciated.
On either the source or destination SQL Server instance, launch the Copy Database Wizard in SQL Server Management Studio from Object Explorer and expand Databases. Then right-click a database, point to Tasks, and then select Copy Database.
Create Database from Backup on SQL Server 1 Restore Database... . 2 General . 3 Select backup devices . Keep default option File for Backup Media Type unchanged. Point to backup file on File Explorer... More ...
In Step 1, click Add Computers to detect all the controlled computers with SQL instances, select the correct IP and click OK. In Step 2, click Add and you can select multiple databases you want to backup. In Step 3, click Add Storage to add a Share or NAS Device as a storage end, select a path.
Note: You can choose to backup and restore the database backup of any SQL Server version. Step 1: Open SSMS and connect to another SQL Server instance from where you want to restore the backed up database copy of the old server. Step 2: Create a database with the same name that you want to restore. In our example, we have created a ‘Test’ database.
And yes, you can do this through several methods - including but not limited to SSMS backup and restore For large volumes of data, the most secure way is to backup SQL database and restore to another server. It is less error prone than other methods, but also requires a downtime when migrating database.
IDk why I prefer to do this:
You can change 'tabs' at left side of the wizard (General, Files, Options)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With