How can I create a new instance of a database from a .BAK file?
I tried this to restore a .BAK file to a blank CCC database, didn't work.
RESTORE DATABASE [CCC] FILE = N'SDXArchiver_Data', FILE = N'SDXArchiver_Log'
FROM DISK = N'C:\CCC\reporting.BAK' WITH FILE = 1, NOUNLOAD, STATS = 10
GO
Just specify a new database name in the RESTORE DATABASE clause:
RESTORE DATABASE [NEWNAME]
FROM DISK=N'C:\CCC\reporting.BAK'
"andy" wrote:
> How can I create a new instance of a database from a .BAK file?
> I tried this to restore a .BAK file to a blank CCC database, didn't work.
> RESTORE DATABASE [CCC] FILE = N'SDXArchiver_Data', FILE = N'SDXArchiver_Log'
> FROM DISK = N'C:\CCC\reporting.BAK' WITH FILE = 1, NOUNLOAD, STATS = 10
> GO
>
>
|||This is what I tried doing. Here is the error msg.
Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'CCC'
database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
"James Luetkehoelter" <JamesLuetkehoelter@.discussions.microsoft.com> wrote
in message news:840C39ED-C9F7-4BF0-8E17-4DA11ABEDBDC@.microsoft.com...[vbcol=seagreen]
> Just specify a new database name in the RESTORE DATABASE clause:
> RESTORE DATABASE [NEWNAME]
> FROM DISK=N'C:\CCC\reporting.BAK'
> "andy" wrote:
|||Ok, I deleted the existing CCC database and tried to run the script again
and I got the following.
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\microsoft sql
server\MSSQL\data\SDXArchiver.mdf" failed with the operating system error
3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'SDXArchiver_Data' cannot be restored to 'C:\Program Files\microsoft
sql server\MSSQL\data\SDXArchiver.mdf'. Use WITH MOVE to identify a valid
location for the file.
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "C:\Program Files\microsoft sql
server\MSSQL\data\SDXArchiver_Log.ldf" failed with the operating system
error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'SDXArchiver_Log' cannot be restored to 'C:\Program Files\microsoft sql
server\MSSQL\data\SDXArchiver_Log.ldf'. Use WITH MOVE to identify a valid
location for the file.
Msg 3119, Level 16, State 1, Line 1
Problems were identified while planning for the RESTORE statement. Previous
messages provide details.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
"andy" <ajgould@.longlines.com> wrote in message
news:O69b55kIIHA.1208@.TK2MSFTNGP05.phx.gbl...
> This is what I tried doing. Here is the error msg.
> Msg 3154, Level 16, State 4, Line 1
> The backup set holds a backup of a database other than the existing 'CCC'
> database.
> Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
>
>
> "James Luetkehoelter" <JamesLuetkehoelter@.discussions.microsoft.com> wrote
> in message news:840C39ED-C9F7-4BF0-8E17-4DA11ABEDBDC@.microsoft.com...
>
|||REPLACE did the trick! Thanks!
RESTORE DATABASE [CCC]
FROM DISK = N'C:\CCC\reporting.BAK'
WITH REPLACE
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:8CEE8BB4-30D9-4DBD-B71D-87DCEFBF716F@.microsoft.com...[vbcol=seagreen]
> Read up on RESTORE FILELISTONLY and the MOVE and REPLACE options to the
> RESTORE command.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "andy" <ajgould@.longlines.com> wrote in message
> news:%23Pizp9kIIHA.4808@.TK2MSFTNGP05.phx.gbl...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment