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-06-04 : 01:24:51
hi
how to Restore database in sql server2005
use backup file. i have restore the databse in another machine of same name of database.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-06-04 : 02:51:27
You are correct.
That is a proper procedure.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-04 : 19:27:35
With move option.
Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2008-06-04 : 23:44:18
sodeep
please send how move option is used
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-06-04 : 23:50:51
Like this:

RESTORE DATABASE YourDB
FROM DISK = 'pathofbackupfile'
WITH MOVE 'datafile' TO valid location
MOVE 'logfile' TO valid location
Go to Top of Page

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2008-06-05 : 00:05:37
i have use this syntax of move option

RESTORE DATABASE databasename
FROM DISK = 'path of backfile'
WITH MOVE 'db' TO 'F:\Program Files\MSSQL.1\MSSQL\Data\db.mdf',
MOVE 'db_log' TO 'F:\Program Files\MSSQL.1\MSSQL\Data\db_log.ldf'

but their are following error
Msg 3102, Level 16, State 1, Line 1
RESTORE cannot process database 'db' because it is in use by this session. It is recommended that the master database be used when performing this operation.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.


Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-06-07 : 00:37:21
You have to disconnect users from the db, and don't run restore command under that db.
Go to Top of Page
   

- Advertisement -