Uso MSSQL Server 2005 e SQL Server Management Studio.
Grazie delle risposte!
Ciao GM,
Non devi fare altro che specificare il nome del database che intendi creare
in fase di restore:
RESTORE DATABASE NuovoDB
FROM DISK = 'C:\MioBackup.bak';
Al termine del ripristino otterrai un database chiamato NuovoDB.
> Grazie delle risposte!
Prego.
Ciao!
--
Lorenzo Benaglia
Microsoft MVP - SQL Server
http://blogs.dotnethell.it/lorenzo
http://italy.mvps.org
Dunque, ho provato ad eseguire il comando
RESTORE DATABASE NuovoDB
FROM DISK = 'C:\MioBackup.bak';
Ma mi funziona solo se ho giŕ un database con il nome NuovoDB registrato su
quell'istanza di SQLServer. (ho fatto una prova cn un database di test)
Se non esiste un database con quel nome, mi viene restituito il seguente
errore:
Msg 5133, Level 16, State 1, Line 1
Directory lookup for the file "D:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\XXX_Data.mdf" failed with the operating system
error 3(The system cannot find the path specified.).
Msg 3156, Level 16, State 3, Line 1
File 'XXX_Data' cannot be restored to 'D:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\XXX_Data.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 "D:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\XXX_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 'XXX_Log' cannot be restored to 'D:\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\XXX_Log.ldf'. Use WITH MOVE to identify a valid
location for the file.
Msg 3119, Level 16, State 1, Line 1
Ho provato ad usare "WITH MOVE " per specificare un'altra directory, ma
l'errore restituito č lo stesso (perchč anche nella nuova directory il file
del database non c'č, in quanto non ce l'ho piů).
Forse ho omesso qualche altro comando da specificare in "RESTORE"?
> Ho provato ad usare "WITH MOVE " per specificare un'altra directory, ma
> l'errore restituito è lo stesso (perchè anche nella nuova directory il
> file
> del database non c'è, in quanto non ce l'ho più).
Quell'errore indica che il backup si riferisce ad un db i cui files
risiedevano in un percorso che ora risulta essere inesistente (o l'hai
cancellato, oppure il backup è stato effettuato su un server differente).
Specificando la clausola WITH MOVE puoi specificare il nuovo percorso dei
data file e del transaction log.
Per un esempio leggi questo thread:
http://groups.google.it/group/microsoft.public.it.sql/browse_thread/thread/a2550fb463df19ca
Il comando che ho eseguito era VERAMENTE QUELLO quello... però, leggendo
attentamente la tua risposta, devo specificare che
il backup è stato effettuato su un server differente (o meglio, il server è
lo stesso, ma è stato formattato, quindi suppongo che sia come se fosse un
altro server)
Leggendo il thread che mi hai segnalato, sono riuscito a fare tutto
correttamente, grazie di cuore!
Allego il codice che ho usato con successo (usando management sudio), nel
caso possa tornare utile a chi si imbatte in queto thread!
RESTORE DATABASE XXX
FROM DISK = 'E:\bck\XXX.bak'
WITH
MOVE 'XXX_data' TO 'f:\sqldata\XXX_data.mdf'
, MOVE 'XXX_log' TO 'f:\sqldata\XXX_log.ldf'
, REPLACE;
"Lorenzo Benaglia" <lben...@despammed.com> wrote in message
news:eE%239mOTg...@TK2MSFTNGP03.phx.gbl...