how I can backup a database and restore it to a new database. For example, I
have a database named "WidgetsInc." I'd like to back it up and then restore
it to a db with a new name of "WidgetsInc_Test"
BACKUP DATABASE WidgetsInc TO DISK = 'C:\TempFolder\WidgetsInc_DBBackup'
The backup works fine but I can't figure out how to do the restore. I tried
this:
RESTORE DATABASE WidgetsInc_Test FROM DISK =
'C:\TempFolder\WidgetsInc_DBBackup' WITH MOVE
'C:\Data\MSSQL\Data\WidgetsInc_Data.MDF' TO
'C:\Data\MSSQL\Data\WidgetsInc_Test_Data
.MDF', REPLACE
I get the error >>> Logical file 'C:\Data\MSSQL\Data\WidgetsInc_Data.MDF'
is not part of database 'WidgetsInc_Test'
From what I've read it looks like what I want to do is possible but I could
be wrong. I know I'm having trouble with the logical file name part.
I've tried it where I have already created 'WidgetsInc_Test' as an empty db
and also where it doesn't yet exist. Neither way works. Same error for both.
Any help on this would be appreciated (if you're one of those that feels the
need to yell at me because I might be trying to do something impossible or
what I'm doing is altogether wrong [that sort of help is very much
unappreciated], then I'll be patient to wait for a nice person to answer my
questions).
Thanks,
KeithIt is MOVE *logical file name* TO physical file name...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Keith G Hicks" <krh@.comcast.net> wrote in message news:OtP9m7YuGHA.724@.TK2MSFTNGP05.phx.gbl
..
> I'm reading over the Backup and Restore sections of BOL in an effort to se
e
> how I can backup a database and restore it to a new database. For example,
I
> have a database named "WidgetsInc." I'd like to back it up and then restor
e
> it to a db with a new name of "WidgetsInc_Test"
> BACKUP DATABASE WidgetsInc TO DISK = 'C:\TempFolder\WidgetsInc_DBBackup'
> The backup works fine but I can't figure out how to do the restore. I trie
d
> this:
> RESTORE DATABASE WidgetsInc_Test FROM DISK =
> 'C:\TempFolder\WidgetsInc_DBBackup' WITH MOVE
> 'C:\Data\MSSQL\Data\WidgetsInc_Data.MDF' TO
> 'C:\Data\MSSQL\Data\WidgetsInc_Test_Data
.MDF', REPLACE
> I get the error >>> Logical file 'C:\Data\MSSQL\Data\WidgetsInc_Data.MD
F'
> is not part of database 'WidgetsInc_Test'
> From what I've read it looks like what I want to do is possible but I coul
d
> be wrong. I know I'm having trouble with the logical file name part.
> I've tried it where I have already created 'WidgetsInc_Test' as an empty d
b
> and also where it doesn't yet exist. Neither way works. Same error for bot
h.
> Any help on this would be appreciated (if you're one of those that feels t
he
> need to yell at me because I might be trying to do something impossible or
> what I'm doing is altogether wrong [that sort of help is very much
> unappreciated], then I'll be patient to wait for a nice person to answer m
y
> questions).
> Thanks,
> Keith
>|||Thanks Tibor. Works fine now. -keith
No comments:
Post a Comment