Home All Groups Group Topic Archive Search About

Restoring model and msdb databases goes to wrong file locations

Author
17 May 2005 2:49 PM
Christoffer B.
Hi,

I am working on a script which should be able to restore a full sql server
2000 automatically. When I do a full restore of the system databases the
file locations of the mdf and ldf files don't change but when I restore the
differential backup the ldf file places it self in the default directory of
Microsoft SQL Server.

So my script looks like this:

restore database model from disk = 'c:\backup\model.bkf' with norecovery,
replace
go
restore database model from disk ='c:\backup\modeldiff.bkf' with
recovery,replace
go

The model log file should go into "e:\database\data\" but instead it goes
into "C:\Program Files\Microsoft SQL Server\MSSQL\Data"

why does it work fine when I do like this:

restore database model from disk = 'c:\backup\model.bkf' with recovery,
replace

but not when I want to do a diff restore???

I know I can detach and attach the model database, but then I also have to
stop and start the database with a trace flag - not very pretty....


Any ideas???

Christoffer

Author
18 May 2005 3:24 AM
Sue Hoegemeier
You can view the physical files from the backup using
restore filelistonly. If you need to have the files in
another location, use the move option in the restore script
to specify the physical file locations.

-Sue

On Tue, 17 May 2005 16:49:57 +0200, "Christoffer B."
<StofferB@online.nospam> wrote:

Show quote
>Hi,
>
>I am working on a script which should be able to restore a full sql server
>2000 automatically. When I do a full restore of the system databases the
>file locations of the mdf and ldf files don't change but when I restore the
>differential backup the ldf file places it self in the default directory of
>Microsoft SQL Server.
>
>So my script looks like this:
>
>restore database model from disk = 'c:\backup\model.bkf' with norecovery,
>replace
>go
>restore database model from disk ='c:\backup\modeldiff.bkf' with
>recovery,replace
>go
>
>The model log file should go into "e:\database\data\" but instead it goes
>into "C:\Program Files\Microsoft SQL Server\MSSQL\Data"
>
>why does it work fine when I do like this:
>
>restore database model from disk = 'c:\backup\model.bkf' with recovery,
>replace
>
>but not when I want to do a diff restore???
>
>I know I can detach and attach the model database, but then I also have to
>stop and start the database with a trace flag - not very pretty....
>
>
>Any ideas???
>
>Christoffer
>
Author
18 May 2005 6:55 AM
Christoffer B.
"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
news:47dl81t4qahcv4l8gjbrb6c8oo934vl09p@4ax.com...
> You can view the physical files from the backup using
> restore filelistonly.
Correct, I can view the paths with restore filelistonly and it shows the
correct file locations.

> If you need to have the files in
> another location, use the move option in the restore script
> to specify the physical file locations.
No, You cannot use the move option with system databases.
Author
18 May 2005 11:32 AM
Sue Hoegemeier
Yes you can use with move. You can follow the example in the
following knowledge base article:
http://support.microsoft.com/?id=304692

-Sue

On Wed, 18 May 2005 08:55:37 +0200, "Christoffer B."
<StofferB@online.nospam> wrote:

Show quote
>
>"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
>news:47dl81t4qahcv4l8gjbrb6c8oo934vl09p@4ax.com...
>> You can view the physical files from the backup using
>> restore filelistonly.
>Correct, I can view the paths with restore filelistonly and it shows the
>correct file locations.
>
>> If you need to have the files in
>> another location, use the move option in the restore script
>> to specify the physical file locations.
>No, You cannot use the move option with system databases.
>
Author
18 May 2005 1:35 PM
Christoffer B.
"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
news:3s9m811b194jc1qs0v74kugnhqcfg2c4lo@4ax.com...
> Yes you can use with move. You can follow the example in the
> following knowledge base article:
> http://support.microsoft.com/?id=304692
>

In the article is mentioned the following:

NOTE: These instructions in this article do not apply to SQL Server 2000.

The response from the server is :
tempdb is skipped. You cannot run a query that requires tempdb.
Author
19 May 2005 1:23 AM
Sue Hoegemeier
One of the trace flags settings is different on 2000 if you
are following all of the steps but you can restore with
move. Follow the trace flags in the following article or
just use attach/detach as the article does:
http://support.microsoft.com/?id=224071

-Sue

On Wed, 18 May 2005 15:35:57 +0200, "Christoffer B."
<StofferB@online.nospam> wrote:

Show quote
>
>"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
>news:3s9m811b194jc1qs0v74kugnhqcfg2c4lo@4ax.com...
>> Yes you can use with move. You can follow the example in the
>> following knowledge base article:
>> http://support.microsoft.com/?id=304692
>>
>
>In the article is mentioned the following:
>
>NOTE: These instructions in this article do not apply to SQL Server 2000.
>
>The response from the server is :
>tempdb is skipped. You cannot run a query that requires tempdb.
>
Author
19 May 2005 7:16 AM
Christoffer B.
"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
news:otpn81df0cncebavp40flr7v071i8nn22b@4ax.com...
> One of the trace flags settings is different on 2000 if you
> are following all of the steps but you can restore with
> move. Follow the trace flags in the following article or
> just use attach/detach as the article does:
> http://support.microsoft.com/?id=224071

I can still not do a restore with a move as described in my first posting.

if I am going to use detach/attach then we are back to my first posting..
which I want to avoid.
Author
24 May 2005 8:23 AM
Michael Cheng [MSFT]
Hi Christoffer,

As Sue said, I am afraid we will have to use detach and attach in this
scenario. I wanted to post a quick note to see if there is anything more I
could help you on this topic.


Sincerely yours,

Michael Cheng
Microsoft Online Partner Support

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

AddThis Social Bookmark Button