Friday, March 9, 2012

Restore backup file

I have a back up file of a database which is residing in a different server.
I need to restore the database with the .bak file which is available with
me. How should I proceed to set up this.RESTORE FILELISTONLY
FROM DISK = 'F:\backupfilename.bak'
This will provide you the logical filename of backup .mdf and .ldf file.
RESTORE DATABASE DB_NAME_TO_BE_RESTORED
FROM DISK = 'F:\backupfilename.bak'
WITH MOVE 'Logical_Name_Data' TO 'F:\MSSQL\DATA\Physical_Name_Data.mdf',
MOVE 'Logical_Data_Log' TO 'E:\MSSQL\LOG\Physical_Name_Log.ldf',
STATS = 1, REPLACE
GO
Please revert if you have any queries.
Thanks,
Sree
"VBB" wrote:

> I have a back up file of a database which is residing in a different serve
r.
> I need to restore the database with the .bak file which is available with
> me. How should I proceed to set up this.|||I executed the following statements
*************************************
USE master
GO
RESTORE FILELISTONLY
FROM DISK = 'C:\Bkp\Xchange.BAK'
RESTORE DATABASE XChange_DB
FROM DISK = 'C:\Bkp\Xchange.BAK'
WITH MOVE 'L_XChange_Data' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\P_XChange.mdf',
MOVE 'L_XChange_Log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\Data\P_XChange.ldf',
STATS = 1, REPLACE
GO
****************************************
***********
I got the following error
(2 row(s) affected)
Server: Msg 3234, Level 16, State 2, Line 3
Logical file 'L_XChange_Data' is not part of database 'XChange_DB'. Use
RESTORE FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 3
RESTORE DATABASE is terminating abnormally.
Please let me know what has went wrong.
"Sreejith G" wrote:
[vbcol=seagreen]
> RESTORE FILELISTONLY
> FROM DISK = 'F:\backupfilename.bak'
> This will provide you the logical filename of backup .mdf and .ldf file.
> RESTORE DATABASE DB_NAME_TO_BE_RESTORED
> FROM DISK = 'F:\backupfilename.bak'
> WITH MOVE 'Logical_Name_Data' TO 'F:\MSSQL\DATA\Physical_Name_Data.mdf'
,
> MOVE 'Logical_Data_Log' TO 'E:\MSSQL\LOG\Physical_Name_Log.ldf',
> STATS = 1, REPLACE
> GO
> Please revert if you have any queries.
> Thanks,
> Sree
> "VBB" wrote:
>|||You need to provide the logical filename that you got from the output of
"RESTORE FILELISTONLY" +>
RESTORE FILELISTONLY
FROM DISK = 'F:\backupfilename.bak'
as input of
RESTORE DATABASE DB_NAME_TO_BE_RESTORED
FROM DISK = 'F:\backupfilename.bak'
WITH MOVE 'Logical_Name_Data' TO 'F:\MSSQL\DATA\Physical_Name_Data.mdf',
MOVE 'Logical_Data_Log' TO 'E:\MSSQL\LOG\Physical_Name_Log.ldf',
STATS = 1, REPLACE
GO
Its not like you have to run that in one shot.
Thanks,
Sree
"VBB" wrote:
[vbcol=seagreen]
> I executed the following statements
> *************************************
> USE master
> GO
> RESTORE FILELISTONLY
> FROM DISK = 'C:\Bkp\Xchange.BAK'
> RESTORE DATABASE XChange_DB
> FROM DISK = 'C:\Bkp\Xchange.BAK'
> WITH MOVE 'L_XChange_Data' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\P_XChange.mdf',
> MOVE 'L_XChange_Log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\P_XChange.ldf',
> STATS = 1, REPLACE
> GO
> ****************************************
***********
> I got the following error
>
> (2 row(s) affected)
> Server: Msg 3234, Level 16, State 2, Line 3
> Logical file 'L_XChange_Data' is not part of database 'XChange_DB'. Use
> RESTORE FILELISTONLY to list the logical file names.
> Server: Msg 3013, Level 16, State 1, Line 3
> RESTORE DATABASE is terminating abnormally.
> Please let me know what has went wrong.
> "Sreejith G" wrote:
>|||IT WORKED.
Thank you very much for your help.
"Sreejith G" wrote:
[vbcol=seagreen]
> You need to provide the logical filename that you got from the output of
> "RESTORE FILELISTONLY" +>
> RESTORE FILELISTONLY
> FROM DISK = 'F:\backupfilename.bak'
> as input of
> RESTORE DATABASE DB_NAME_TO_BE_RESTORED
> FROM DISK = 'F:\backupfilename.bak'
> WITH MOVE 'Logical_Name_Data' TO 'F:\MSSQL\DATA\Physical_Name_Data.mdf
',
> MOVE 'Logical_Data_Log' TO 'E:\MSSQL\LOG\Physical_Name_Log.ldf',
> STATS = 1, REPLACE
> GO
> Its not like you have to run that in one shot.
> Thanks,
> Sree
> "VBB" wrote:
>|||Can you please provide me your email id. So that I can contact you if I have
any issues with SQL Server.
"Sreejith G" wrote:
[vbcol=seagreen]
> You need to provide the logical filename that you got from the output of
> "RESTORE FILELISTONLY" +>
> RESTORE FILELISTONLY
> FROM DISK = 'F:\backupfilename.bak'
> as input of
> RESTORE DATABASE DB_NAME_TO_BE_RESTORED
> FROM DISK = 'F:\backupfilename.bak'
> WITH MOVE 'Logical_Name_Data' TO 'F:\MSSQL\DATA\Physical_Name_Data.mdf
',
> MOVE 'Logical_Data_Log' TO 'E:\MSSQL\LOG\Physical_Name_Log.ldf',
> STATS = 1, REPLACE
> GO
> Its not like you have to run that in one shot.
> Thanks,
> Sree
> "VBB" wrote:
>|||sreejith.gopalakrishnan@.ustri.com
Always welcome!!!
Thanks
Sree
"VBB" wrote:
[vbcol=seagreen]
> Can you please provide me your email id. So that I can contact you if I ha
ve
> any issues with SQL Server.
> "Sreejith G" wrote:
>

No comments:

Post a Comment