Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Restore Database

Author  Topic 

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2008-05-06 : 07:23:09
hi
how to restore database in another machine in sql2005

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-06 : 07:55:35
Copy the backup file to the other machine then restore the backup as normal. Make sure to change the file locations if the directory structure is different.

Are you getting an error or something?

--
Gail Shaw
Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2008-05-06 : 08:15:20
GilaMonster

i have copy the file in machine but their following error

===================================

Restore failed for Server 'servername'. (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)
at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreDatabaseOptions.RunRestore()

===================================

System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing 'databasename' database. (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&LinkId=20476

------------------------------
Program Location:

at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries, ServerMessageEventHandler dbccMessageHandler, Boolean errorsAsMessages)
at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-06 : 08:44:26
You're trying to restore over an existing database?

On the options tab (assuming you're using management studio), check the option "Overwrite the existing database"

--
Gail Shaw
Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2008-05-06 : 08:59:20
GilaMonster

their is no effect of error to your changes
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-06 : 09:11:50
Try doing a restore using T-SQL.

RESTORE DATABASE <Database name> FROM Disk='<backup file location>'
WITH ... <All file move options here>

See what that does.

--
Gail Shaw
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-05-06 : 11:11:37
Move the files while doing restore.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-05-06 : 13:15:50
Try this

RESTORE FILELISTONLY FROM DISK = '<filepath>\<dbname>.BAK'

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-05-06 : 13:41:06
Try this

RESTORE FILELISTONLY FROM DISK = '<filepath>\<dbname>.BAK'

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -