Re: When to use Move with Restore in T-SQL
From: Steve Z (szlamany_at_antarescomputing_no_spam.com)
Date: 05/10/04
- Next message: Michael Gaillez: "Re: "Invalid Cursor Error""
- Previous message: Steve Z: "Re: Importing TXT files problems"
- In reply to: Bumpy Brown: "Re: When to use Move with Restore in T-SQL"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 10 May 2004 16:34:20 -0400
We use many variations of the following, which we got right out of BOL. The
two lines that are commented out do a BACKUP - and the two that are not,
restore it, in this case to a different "DATABASE NAME".
--BACKUP DATABASE Funds
-- TO DISK = 'c:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_NB_Jun30.bak'
RESTORE FILELISTONLY
FROM DISK = 'c:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_NB_Jun30.bak'
RESTORE DATABASE Funds_NB_Jun30
FROM DISK = 'c:\Program Files\Microsoft SQL
Server\MSSQL\BACKUP\Funds_NB_Jun30.bak'
WITH MOVE 'Funds_data' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\Funds_NB_Jun30.mdf',
MOVE 'Funds_log' TO 'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\Funds_NB_Jun30.ldf'
GO
"Bumpy Brown" <anonymous@discussions.microsoft.com> wrote in message
news:2329236F-D58B-457C-B10C-B4533BDE7FF8@microsoft.com...
>
> In the example, my "SERVER_B" does not have a drive H, and the
directory structure is different, yet the RESTORE works without specifying
the WITH MOVE option. Am I missing something here?
>
> ----- Keith Kratochvil wrote: -----
>
> Lets say that SERVER_A has its' mdf files on drive K and it's ldf
files on L.
> SERVER_B does not have K and L drives. If you tried to restore a
database from SERVER_A to SERVER_B by using the T-SQL RESTORE command the
process would return an error because drives K and L do not exist. In this
case you will have to specify WITH MOVE... in order to move the mdf and ldf
file(s) to a new location during the restore.
>
> --
> Keith
>
>
> "Bumpy Brown" <anonymous@discussions.microsoft.com> wrote in message
news:1484A506-0A8E-490A-A6A1-C761BB982DA2@microsoft.com...
> > I'm attempting to do some automation of database restores. These
are backups generated on a different server, which I am restoring to my
local machine using T-sql rather than E.M. for speed reasons. My question
is, when exactly do I have to use the "WITH MOVE" option in my restore
script? The documentation states that MOVE must be used when the location
is different, yet I am able to restore "H:\Data\Doodah_Data.mdf" to
"C:\MSSQL\Data\Doodah_Data.mdf" without error. Therefore I surmise that
"location" does not refer to the path, but perhaps to the filename itself?
I'd like this utility to work on other folks' machines, so I can't just get
it to work on mine and call it a day.
> >> Thank you.
> >
- Next message: Michael Gaillez: "Re: "Invalid Cursor Error""
- Previous message: Steve Z: "Re: Importing TXT files problems"
- In reply to: Bumpy Brown: "Re: When to use Move with Restore in T-SQL"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|