Wednesday, March 28, 2012

problem restoring backup of DB

Hello,
I copied a backup file of a production DB on a production server to another
location on a Development server. When I try to restore this backup on the
Dev server - from Enterprise Manager, I am getting an error message that
states I need to use "With Move" to identify a valid location for the restor
e
file.
On the Restore Database Dialog I enter the name of the mdf file (which is
not in the dropdown list) in the "Restore as database" textbox. Then I
select the device - "Restore from" Disk, click on Add - select the bak file
,
click OK from that dialog, goto the Options tab and enter the physical path
in the "Move to physical file name" window. Then click OK on the Restore
Database dialog and get the error message above - "use With Move..." How do
I use "With Move"?
I also copied the actual mdf file from the production server and moved it to
the Dev server and tried to attach it to the Dev serve. But the mdf is
trying to reference the old Log file. I thought (hoped) it would create its
own log file. Is there a way to get around this?
Thanks,
Rich> I also copied the actual mdf file from the production server and moved it tod">
> the Dev server and tried to attach it to the Dev serve. But the mdf is
> trying to reference the old Log file. I thought (hoped) it would create i
ts
> own log file. Is there a way to get around this?
>
Did you detach the database first, before copying the mdf file?
If not, try detaching the DB, then copying the file(s), then re-attaching to
the other server.|||The file is a replication DB and I did not want to fiddle with
sp_removereplication. Otherwise I would have used the Copy Database wizard.
But since it is in Replication mode, I can't detach it or use the Copy
Database wizard.
What I did was to stop the production server for a few minutes, copied the
file to the dev server - restart the prod server. I did not copy the ldf
because it was kind of large. I was hoping the copy DB would create its own
log file on the Dev server. Is there a way to force that to happen?
Or am I stuck with using sp_removeReplication and then doing the copy?
"Mark Williams" wrote:

> Did you detach the database first, before copying the mdf file?
> If not, try detaching the DB, then copying the file(s), then re-attaching
to
> the other server.|||You will need the ldf file along with your mdf file. What you did is the
same as detach method except you shut MS SQL server down for a few minutes.
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:625F97FE-6DC8-4DB3-95AE-392A7CCAB396@.microsoft.com...
> The file is a replication DB and I did not want to fiddle with
> sp_removereplication. Otherwise I would have used the Copy Database
> wizard.
> But since it is in Replication mode, I can't detach it or use the Copy
> Database wizard.
> What I did was to stop the production server for a few minutes, copied the
> file to the dev server - restart the prod server. I did not copy the ldf
> because it was kind of large. I was hoping the copy DB would create its
> own
> log file on the Dev server. Is there a way to force that to happen?
> Or am I stuck with using sp_removeReplication and then doing the copy?
> "Mark Williams" wrote:
>|||Yeah, I figured I would have to do that. the ldf is like 3 gigs +. So once
I get the DB attached, what is the best way to shrink down the ldf? Can I
delete it once the mdf is attached and it will create a new one?
"Grant" wrote:

> You will need the ldf file along with your mdf file. What you did is the
> same as detach method except you shut MS SQL server down for a few minutes
.
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:625F97FE-6DC8-4DB3-95AE-392A7CCAB396@.microsoft.com...
>
>|||> I get the DB attached, what is the best way to shrink down the ldf?
You shrink if *before* you detach. Or after you have attached. Use DBCC SHRI
NKFILE.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:D1264111-609E-4190-922C-A88BB233D0CB@.microsoft.com...
> Yeah, I figured I would have to do that. the ldf is like 3 gigs +. So on
ce
> I get the DB attached, what is the best way to shrink down the ldf? Can I
> delete it once the mdf is attached and it will create a new one?
> "Grant" wrote:
>|||Following or explaining GUI in text is incredibly hard. I suggest you invest
igate the file structure
of your backup using RESTORE FILELISTONLY. And based on that construct a RES
TORE command with the
proper commands. If restore from that doesn't work, you can post the output
from RESTORE
FILELISTONLY, your RESTORE command you tried and the error message.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
> Hello,
> I copied a backup file of a production DB on a production server to anothe
r
> location on a Development server. When I try to restore this backup on th
e
> Dev server - from Enterprise Manager, I am getting an error message that
> states I need to use "With Move" to identify a valid location for the rest
ore
> file.
> On the Restore Database Dialog I enter the name of the mdf file (which is
> not in the dropdown list) in the "Restore as database" textbox. Then I
> select the device - "Restore from" Disk, click on Add - select the bak fi
le,
> click OK from that dialog, goto the Options tab and enter the physical pa
th
> in the "Move to physical file name" window. Then click OK on the Restore
> Database dialog and get the error message above - "use With Move..." How
do
> I use "With Move"?
> I also copied the actual mdf file from the production server and moved it
to
> the Dev server and tried to attach it to the Dev serve. But the mdf is
> trying to reference the old Log file. I thought (hoped) it would create i
ts
> own log file. Is there a way to get around this?
> Thanks,
> Rich|||Thank you for your suggestion. Here is what Restore Filelist returned:
Subscriber_Data D:\MSSQLDATA\Subscriber_
Data.MDF D PRIMARY 654573568 3518437
2080640
Subscriber_Log E:\MSSQLLOGS\Subscriber_l
og.LDF L NULL 2818572288 35184372080
640
And here is what I tried with Restore Database - which is currently running
RESTORE DATABASE Subscriber
FROM DISK = 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber.bak'
WITH MOVE 'Subscriber' TO
'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Data.mdf',
MOVE 'Subscriber_log' TO
'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Log.ldf'
I will post the results of this restore effort - still running - probably
for an hour or so.
"Tibor Karaszi" wrote:

> Following or explaining GUI in text is incredibly hard. I suggest you inve
stigate the file structure
> of your backup using RESTORE FILELISTONLY. And based on that construct a R
ESTORE command with the
> proper commands. If restore from that doesn't work, you can post the outpu
t from RESTORE
> FILELISTONLY, your RESTORE command you tried and the error message.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
>|||Success!!! Thank you very much for your help. The restore DB works
perfectly!
"Tibor Karaszi" wrote:

> Following or explaining GUI in text is incredibly hard. I suggest you inve
stigate the file structure
> of your backup using RESTORE FILELISTONLY. And based on that construct a R
ESTORE command with the
> proper commands. If restore from that doesn't work, you can post the outpu
t from RESTORE
> FILELISTONLY, your RESTORE command you tried and the error message.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Rich" <Rich@.discussions.microsoft.com> wrote in message
> news:665B37F8-7FBD-4F62-9939-BFE283A242A7@.microsoft.com...
>|||The restore command looks fine with one comment, and I also noticed the othe
r post where you said it
was successful.
The comment is that you specified the location for the database files to be
created by your restore
process to be in the Backup directory. Not that it is harmful, but perhaps a
little bit unusual.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Rich" <Rich@.discussions.microsoft.com> wrote in message
news:C2E59AEB-3FF8-4930-B0E6-DDACEE2B9104@.microsoft.com...
> Thank you for your suggestion. Here is what Restore Filelist returned:
> Subscriber_Data D:\MSSQLDATA\Subscriber_Data.MDF D PRIMARY 654573568 35184
372080640
> Subscriber_Log E:\MSSQLLOGS\Subscriber_log.LDF L NULL 2818572288 351843720
80640
>
> And here is what I tried with Restore Database - which is currently runnin
g
> RESTORE DATABASE Subscriber
> FROM DISK = 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber.bak'
> WITH MOVE 'Subscriber' TO
> 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Data.mdf',
> MOVE 'Subscriber_log' TO
> 'G:\MSSQL\DevData\MSSQL$Dev\Backup\Subsc
riber_Log.ldf'
> I will post the results of this restore effort - still running - probably
> for an hour or so.
>
> "Tibor Karaszi" wrote:
>sql

No comments:

Post a Comment