Sunday, February 19, 2012

Backup/Restore Script

am new at this and I am stuck...
I am trying to backup an entire database and restore it on the same SQL
server with a different name.
I have this in the Query Analyzer
BACKUP DATABASE merchant
TO DISK = 'c:\merchant.bak'
RESTORE FILELISTONLY
FROM DISK = 'c:\merchant.bak'
RESTORE DATABASE TestDB
FROM DISK = 'c:\merchant.bak'
WITH MOVE 'merchant' TO 'c:\testdb.mdf',
MOVE 'merchant_log' TO 'c:\testdb.ldf'
GO
I get the following error
Processed 2304 pages for database 'merchant', file 'Struky3_Data' on file
13.
Processed 1 pages for database 'merchant', file 'Struky3_Log' on file 13.
BACKUP DATABASE successfully processed 2305 pages in 2.539 seconds (7.434
MB/sec).
(2 row(s) affected)
Server: Msg 3234, Level 16, State 2, Line 5
Logical file 'merchant' is not part of database 'TestDB'. Use RESTORE
FILELISTONLY to list the logical file names.
Server: Msg 3013, Level 16, State 1, Line 5
RESTORE DATABASE is terminating abnormally.
Can anyone help with this?
I want to copy the entire database called MERCHANT to another databaseWell that because it looks like your Data files logical name is
'Struky3_Data' and the Log files logical name is really 'Struky3_Log'. So
your restore script needs to specify those for the Logical names.
Andrew J. Kelly SQL MVP
"Brian Branco" <bbranco@.bncconsulting.com> wrote in message
news:OTAtoi5HFHA.3376@.TK2MSFTNGP14.phx.gbl...
> am new at this and I am stuck...
> I am trying to backup an entire database and restore it on the same SQL
> server with a different name.
> I have this in the Query Analyzer
> BACKUP DATABASE merchant
> TO DISK = 'c:\merchant.bak'
> RESTORE FILELISTONLY
> FROM DISK = 'c:\merchant.bak'
> RESTORE DATABASE TestDB
> FROM DISK = 'c:\merchant.bak'
> WITH MOVE 'merchant' TO 'c:\testdb.mdf',
> MOVE 'merchant_log' TO 'c:\testdb.ldf'
> GO
> I get the following error
> Processed 2304 pages for database 'merchant', file 'Struky3_Data' on file
> 13.
> Processed 1 pages for database 'merchant', file 'Struky3_Log' on file 13.
> BACKUP DATABASE successfully processed 2305 pages in 2.539 seconds (7.434
> MB/sec).
> (2 row(s) affected)
> Server: Msg 3234, Level 16, State 2, Line 5
> Logical file 'merchant' is not part of database 'TestDB'. Use RESTORE
> FILELISTONLY to list the logical file names.
> Server: Msg 3013, Level 16, State 1, Line 5
> RESTORE DATABASE is terminating abnormally.
>
> Can anyone help with this?
> I want to copy the entire database called MERCHANT to another database
>
>

No comments:

Post a Comment