Showing posts with label bak. Show all posts
Showing posts with label bak. Show all posts

Wednesday, March 28, 2012

Problem restoring a database from a .bak file

I'm provided with a .bak file that contains a backup of a small database. My
question is how do I restore it to the SQL Server. I used the import featur
e but it gave me all kinds of errors when attempting to import it.
Any ideas!
thanks!Hi,
You can either use SQL server enterprise manager GUI to restore a database
ot use the Query analyzer ... RESTORE database command.
Enterprise manager
1. Open Enterprise manager -- connect to SQL server -- Right click above the
database -- All tasks -- CLick Restore database
2. In the Restore database as "Give a Database name"
3. IN the restore options choose "From Device"
4. Click select devices command button -- CLick add and choose the backup
file name (.BAK file)
5. Click OK
6. IN restore screen also CLICK OK
-- This will restore the database
From Query Analyzer:-
1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent server
roles.
2. Execute the below command
Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
-- Change the directory and file name based on ur requierement.
Thanks
Hari
MCDBA
"sbinev" <sbinev@.discussions.microsoft.com> wrote in message
news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> I'm provided with a .bak file that contains a backup of a small database.
My question is how do I restore it to the SQL Server. I used the import
feature but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!|||sbinev,
SQL Server Books Online (BOL) installs with SQL Server. I heartily
recommend you look here for how to restore a database. The documentation
is very clear and comprehensive and shows you many methods of
accomplishing this task.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
sbinev wrote:
> I'm provided with a .bak file that contains a backup of a small database.
My question is how do I restore it to the SQL Server. I used the import feat
ure but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!|||Thanks a lot guys!! )
The first method from the Enterprise Manager kept giving me errors, but I us
ed T-SQL looked in the books online and with MOVE TO clause after the RESTOR
E... clause it worked. So thanks for your advice. It's hard to be novice!
"Hari Prasad" wrote:

> Hi,
> You can either use SQL server enterprise manager GUI to restore a database
> ot use the Query analyzer ... RESTORE database command.
> Enterprise manager
> 1. Open Enterprise manager -- connect to SQL server -- Right click above t
he
> database -- All tasks -- CLick Restore database
> 2. In the Restore database as "Give a Database name"
> 3. IN the restore options choose "From Device"
> 4. Click select devices command button -- CLick add and choose the backup
> file name (.BAK file)
> 5. Click OK
> 6. IN restore screen also CLICK OK
> -- This will restore the database
>
> From Query Analyzer:-
> 1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent serv
er
> roles.
> 2. Execute the below command
> Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
> -- Change the directory and file name based on ur requierement.
>
> --
> Thanks
> Hari
> MCDBA
> "sbinev" <sbinev@.discussions.microsoft.com> wrote in message
> news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> My question is how do I restore it to the SQL Server. I used the import
> feature but it gave me all kinds of errors when attempting to import it.
>
>

Problem restoring a database from a .bak file

I'm provided with a .bak file that contains a backup of a small database. My question is how do I restore it to the SQL Server. I used the import feature but it gave me all kinds of errors when attempting to import it.
Any ideas!
thanks!
Hi,
You can either use SQL server enterprise manager GUI to restore a database
ot use the Query analyzer ... RESTORE database command.
Enterprise manager
1. Open Enterprise manager -- connect to SQL server -- Right click above the
database -- All tasks -- CLick Restore database
2. In the Restore database as "Give a Database name"
3. IN the restore options choose "From Device"
4. Click select devices command button -- CLick add and choose the backup
file name (.BAK file)
5. Click OK
6. IN restore screen also CLICK OK
-- This will restore the database
From Query Analyzer:-
1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent server
roles.
2. Execute the below command
Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
-- Change the directory and file name based on ur requierement.
Thanks
Hari
MCDBA
"sbinev" <sbinev@.discussions.microsoft.com> wrote in message
news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> I'm provided with a .bak file that contains a backup of a small database.
My question is how do I restore it to the SQL Server. I used the import
feature but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!
|||sbinev,
SQL Server Books Online (BOL) installs with SQL Server. I heartily
recommend you look here for how to restore a database. The documentation
is very clear and comprehensive and shows you many methods of
accomplishing this task.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
sbinev wrote:
> I'm provided with a .bak file that contains a backup of a small database. My question is how do I restore it to the SQL Server. I used the import feature but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!
|||Thanks a lot guys!! )
The first method from the Enterprise Manager kept giving me errors, but I used T-SQL looked in the books online and with MOVE TO clause after the RESTORE... clause it worked. So thanks for your advice. It's hard to be novice!
"Hari Prasad" wrote:

> Hi,
> You can either use SQL server enterprise manager GUI to restore a database
> ot use the Query analyzer ... RESTORE database command.
> Enterprise manager
> 1. Open Enterprise manager -- connect to SQL server -- Right click above the
> database -- All tasks -- CLick Restore database
> 2. In the Restore database as "Give a Database name"
> 3. IN the restore options choose "From Device"
> 4. Click select devices command button -- CLick add and choose the backup
> file name (.BAK file)
> 5. Click OK
> 6. IN restore screen also CLICK OK
> -- This will restore the database
>
> From Query Analyzer:-
> 1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent server
> roles.
> 2. Execute the below command
> Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
> -- Change the directory and file name based on ur requierement.
>
> --
> Thanks
> Hari
> MCDBA
> "sbinev" <sbinev@.discussions.microsoft.com> wrote in message
> news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> My question is how do I restore it to the SQL Server. I used the import
> feature but it gave me all kinds of errors when attempting to import it.
>
>
sql

Problem restoring a database from a .bak file

I'm provided with a .bak file that contains a backup of a small database. My question is how do I restore it to the SQL Server. I used the import feature but it gave me all kinds of errors when attempting to import it.
Any ideas!
thanks!Hi,
You can either use SQL server enterprise manager GUI to restore a database
ot use the Query analyzer ... RESTORE database command.
Enterprise manager
1. Open Enterprise manager -- connect to SQL server -- Right click above the
database -- All tasks -- CLick Restore database
2. In the Restore database as "Give a Database name"
3. IN the restore options choose "From Device"
4. Click select devices command button -- CLick add and choose the backup
file name (.BAK file)
5. Click OK
6. IN restore screen also CLICK OK
-- This will restore the database
From Query Analyzer:-
1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent server
roles.
2. Execute the below command
Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
-- Change the directory and file name based on ur requierement.
Thanks
Hari
MCDBA
"sbinev" <sbinev@.discussions.microsoft.com> wrote in message
news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> I'm provided with a .bak file that contains a backup of a small database.
My question is how do I restore it to the SQL Server. I used the import
feature but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!|||sbinev,
SQL Server Books Online (BOL) installs with SQL Server. I heartily
recommend you look here for how to restore a database. The documentation
is very clear and comprehensive and shows you many methods of
accomplishing this task.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
sbinev wrote:
> I'm provided with a .bak file that contains a backup of a small database. My question is how do I restore it to the SQL Server. I used the import feature but it gave me all kinds of errors when attempting to import it.
> Any ideas!
> thanks!|||Thanks a lot guys!! :))
The first method from the Enterprise Manager kept giving me errors, but I used T-SQL looked in the books online and with MOVE TO clause after the RESTORE... clause it worked. So thanks for your advice. It's hard to be novice!
"Hari Prasad" wrote:
> Hi,
> You can either use SQL server enterprise manager GUI to restore a database
> ot use the Query analyzer ... RESTORE database command.
> Enterprise manager
> 1. Open Enterprise manager -- connect to SQL server -- Right click above the
> database -- All tasks -- CLick Restore database
> 2. In the Restore database as "Give a Database name"
> 3. IN the restore options choose "From Device"
> 4. Click select devices command button -- CLick add and choose the backup
> file name (.BAK file)
> 5. Click OK
> 6. IN restore screen also CLICK OK
> -- This will restore the database
>
> From Query Analyzer:-
> 1. Login to Query Analyzer as 'SA' or user with sysadmin ort equalent server
> roles.
> 2. Execute the below command
> Restore database <dbname> from disk='d:\backup\dbname.bak' with stats=10
> -- Change the directory and file name based on ur requierement.
>
> --
> Thanks
> Hari
> MCDBA
> "sbinev" <sbinev@.discussions.microsoft.com> wrote in message
> news:14AACC0D-9E5A-45E6-ABC1-15623DA32CD6@.microsoft.com...
> > I'm provided with a .bak file that contains a backup of a small database.
> My question is how do I restore it to the SQL Server. I used the import
> feature but it gave me all kinds of errors when attempting to import it.
> >
> > Any ideas!
> >
> > thanks!
>
>

Problem restoring a "*.bak" file

I have a Demo db in a MSDE instance called "Instance1"
I used the "RESTORE Database..." statement to back it up into a file called
"demo.bak"
I moved that file onto another machine which is MSDE with an instance
called "MyInstance" and I tried restoring with this line:
RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
It gives the error:
Server: Msg 5105, Level 16, State 2, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 5105, Level 16, State 1, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I tried with both a newly created blank database called demo in the
destination server and without. It says the same thing.
I seriously don't understand anything of this Errormessage, what should I do
to be able to restore this "demo.bak" onto another machine?
I was looking a little bit into the WITH MOVE thing, but I could figure it
out.
(so you know.. I''m a .NET programmer and haven't messed around with these
backup/restore thingies before)
/LarsGet Books Online, read Restore database and with move option and use it to
set correct destination of files - path to files is kept in the backup but
on this computer there are no such folder.
Bojidar Alexandrov
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||By default SQL Server will try to restore to the same location. If the path
does not exist then it will fail. Use the MOVE option to move the files.
Something like this will do it.
RESTORE DATABASE XXXXX
FROM DISK = 'C:\....'
WITH MOVE 'demo_dat' TO 'C:\newlocation',
MOVE 'demo_log' TO 'C:\newlocation'
Barry McAuslin
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||Lars,
Yes, you need to specify the MOVE parameter for each logical filename to spe
cify where these files should be
created. Use RESTORE HEADERONLY and then RESTORE FILELISTONLY to examine the
backup file, including getting
the logical file names for each database files. Then use the MOVE option to
specify where these files are to
be created. And don't create the destination database first, it will be crea
ted for you when you do the
RESTORE.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file calle
d
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsof
t
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsof
t
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||Thank you! It works now with those "With MOVE, MOVE". thankx!
/Lars
"Barry McAuslin" <barry_mcauslin@.yahoo.com.nospam> skrev i meddelandet
news:uUaxok0MEHA.2628@.TK2MSFTNGP12.phx.gbl...
> By default SQL Server will try to restore to the same location. If the
path
> does not exist then it will fail. Use the MOVE option to move the files.
> Something like this will do it.
> RESTORE DATABASE XXXXX
> FROM DISK = 'C:\....'
> WITH MOVE 'demo_dat' TO 'C:\newlocation',
> MOVE 'demo_log' TO 'C:\newlocation'
> --
> Barry McAuslin
> Look inside your SQL Server files with SQL File Explorer.
> Go to http://www.sqlfe.com for more information.
> "Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
> news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> called
> Files\Microsoft
> Files\Microsoft
I[vbcol=seagreen]
> do
it[vbcol=seagreen]
these[vbcol=seagreen]
>

Problem restoring a "*.bak" file

I have a Demo db in a MSDE instance called "Instance1"
I used the "RESTORE Database..." statement to back it up into a file called
"demo.bak"
I moved that file onto another machine which is MSDE with an instance
called "MyInstance" and I tried restoring with this line:
RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
It gives the error:
Server: Msg 5105, Level 16, State 2, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 5105, Level 16, State 1, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I tried with both a newly created blank database called demo in the
destination server and without. It says the same thing.
I seriously don't understand anything of this Errormessage, what should I do
to be able to restore this "demo.bak" onto another machine?
I was looking a little bit into the WITH MOVE thing, but I could figure it
out.
(so you know.. I''m a .NET programmer and haven't messed around with these
backup/restore thingies before)
/Lars
Get Books Online, read Restore database and with move option and use it to
set correct destination of files - path to files is kept in the backup but
on this computer there are no such folder.
Bojidar Alexandrov
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>
|||By default SQL Server will try to restore to the same location. If the path
does not exist then it will fail. Use the MOVE option to move the files.
Something like this will do it.
RESTORE DATABASE XXXXX
FROM DISK = 'C:\....'
WITH MOVE 'demo_dat' TO 'C:\newlocation',
MOVE 'demo_log' TO 'C:\newlocation'
Barry McAuslin
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>
|||Lars,
Yes, you need to specify the MOVE parameter for each logical filename to specify where these files should be
created. Use RESTORE HEADERONLY and then RESTORE FILELISTONLY to examine the backup file, including getting
the logical file names for each database files. Then use the MOVE option to specify where these files are to
be created. And don't create the destination database first, it will be created for you when you do the
RESTORE.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>
|||Thank you! It works now with those "With MOVE, MOVE". thankx!
/Lars
"Barry McAuslin" <barry_mcauslin@.yahoo.com.nospam> skrev i meddelandet
news:uUaxok0MEHA.2628@.TK2MSFTNGP12.phx.gbl...
> By default SQL Server will try to restore to the same location. If the
path[vbcol=seagreen]
> does not exist then it will fail. Use the MOVE option to move the files.
> Something like this will do it.
> RESTORE DATABASE XXXXX
> FROM DISK = 'C:\....'
> WITH MOVE 'demo_dat' TO 'C:\newlocation',
> MOVE 'demo_log' TO 'C:\newlocation'
> --
> Barry McAuslin
> Look inside your SQL Server files with SQL File Explorer.
> Go to http://www.sqlfe.com for more information.
> "Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
> news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> called
> Files\Microsoft
> Files\Microsoft
I[vbcol=seagreen]
> do
it[vbcol=seagreen]
these
>

Problem restoring a "*.bak" file

I have a Demo db in a MSDE instance called "Instance1"
I used the "RESTORE Database..." statement to back it up into a file called
"demo.bak"
I moved that file onto another machine which is MSDE with an instance
called "MyInstance" and I tried restoring with this line:
RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
It gives the error:
Server: Msg 5105, Level 16, State 2, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 5105, Level 16, State 1, Line 1
Device activation error. The physical file name 'C:\Program Files\Microsoft
SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
Server: Msg 3156, Level 16, State 1, Line 1
File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
location for the file.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
I tried with both a newly created blank database called demo in the
destination server and without. It says the same thing.
I seriously don't understand anything of this Errormessage, what should I do
to be able to restore this "demo.bak" onto another machine?
I was looking a little bit into the WITH MOVE thing, but I could figure it
out.
(so you know.. I''m a .NET programmer and haven't messed around with these
backup/restore thingies before)
/LarsGet Books Online, read Restore database and with move option and use it to
set correct destination of files - path to files is kept in the backup but
on this computer there are no such folder.
Bojidar Alexandrov
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||By default SQL Server will try to restore to the same location. If the path
does not exist then it will fail. Use the MOVE option to move the files.
Something like this will do it.
RESTORE DATABASE XXXXX
FROM DISK = 'C:\....'
WITH MOVE 'demo_dat' TO 'C:\newlocation',
MOVE 'demo_log' TO 'C:\newlocation'
--
Barry McAuslin
Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file
called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program
Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I
do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||Lars,
Yes, you need to specify the MOVE parameter for each logical filename to specify where these files should be
created. Use RESTORE HEADERONLY and then RESTORE FILELISTONLY to examine the backup file, including getting
the logical file names for each database files. Then use the MOVE option to specify where these files are to
be created. And don't create the destination database first, it will be created for you when you do the
RESTORE.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> I have a Demo db in a MSDE instance called "Instance1"
> I used the "RESTORE Database..." statement to back it up into a file called
> "demo.bak"
> I moved that file onto another machine which is MSDE with an instance
> called "MyInstance" and I tried restoring with this line:
> RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> It gives the error:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 5105, Level 16, State 1, Line 1
> Device activation error. The physical file name 'C:\Program Files\Microsoft
> SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> Server: Msg 3156, Level 16, State 1, Line 1
> File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> location for the file.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> I tried with both a newly created blank database called demo in the
> destination server and without. It says the same thing.
> I seriously don't understand anything of this Errormessage, what should I do
> to be able to restore this "demo.bak" onto another machine?
> I was looking a little bit into the WITH MOVE thing, but I could figure it
> out.
> (so you know.. I''m a .NET programmer and haven't messed around with these
> backup/restore thingies before)
> /Lars
>|||Thank you! It works now with those "With MOVE, MOVE". thankx!
/Lars
"Barry McAuslin" <barry_mcauslin@.yahoo.com.nospam> skrev i meddelandet
news:uUaxok0MEHA.2628@.TK2MSFTNGP12.phx.gbl...
> By default SQL Server will try to restore to the same location. If the
path
> does not exist then it will fail. Use the MOVE option to move the files.
> Something like this will do it.
> RESTORE DATABASE XXXXX
> FROM DISK = 'C:\....'
> WITH MOVE 'demo_dat' TO 'C:\newlocation',
> MOVE 'demo_log' TO 'C:\newlocation'
> --
> Barry McAuslin
> Look inside your SQL Server files with SQL File Explorer.
> Go to http://www.sqlfe.com for more information.
> "Lars Netzel" <[no_spam_please]lars.netzel@.qlogic.se> wrote in message
> news:%23mlLbe0MEHA.3016@.tk2msftngp13.phx.gbl...
> > I have a Demo db in a MSDE instance called "Instance1"
> >
> > I used the "RESTORE Database..." statement to back it up into a file
> called
> > "demo.bak"
> >
> > I moved that file onto another machine which is MSDE with an instance
> > called "MyInstance" and I tried restoring with this line:
> >
> > RESTORE DATABASE demo FROM DISK ='C:\demo.bak'
> >
> > It gives the error:
> >
> > Server: Msg 5105, Level 16, State 2, Line 1
> > Device activation error. The physical file name 'C:\Program
> Files\Microsoft
> > SQL Server\MSSQL$Instance1\Data\demo.mdf' may be incorrect.
> > Server: Msg 3156, Level 16, State 1, Line 1
> > File 'demo_dat' cannot be restored to 'C:\Program Files\Microsoft SQL
> > Server\MSSQL$Instance1\Data\demo.mdf'. Use WITH MOVE to identify a valid
> > location for the file.
> > Server: Msg 5105, Level 16, State 1, Line 1
> > Device activation error. The physical file name 'C:\Program
> Files\Microsoft
> > SQL Server\MSSQL$Instance1\Data\demo.ldf' may be incorrect.
> > Server: Msg 3156, Level 16, State 1, Line 1
> > File 'demo_log' cannot be restored to 'C:\Program Files\Microsoft SQL
> > Server\MSSQL$Instance1\Data\demo.ldf'. Use WITH MOVE to identify a valid
> > location for the file.
> > Server: Msg 3013, Level 16, State 1, Line 1
> > RESTORE DATABASE is terminating abnormally.
> >
> > I tried with both a newly created blank database called demo in the
> > destination server and without. It says the same thing.
> >
> > I seriously don't understand anything of this Errormessage, what should
I
> do
> > to be able to restore this "demo.bak" onto another machine?
> >
> > I was looking a little bit into the WITH MOVE thing, but I could figure
it
> > out.
> >
> > (so you know.. I''m a .NET programmer and haven't messed around with
these
> > backup/restore thingies before)
> >
> > /Lars
> >
> >
>sql

problem restore database SQL2005

Dear all,
I'm trying to restore a database saved last week in a .bak file through the
GUI of Management Studio but i have the following message error : "the
database is in use".
So i restarted the service engine SQL and changed the option to put Single
User but i have still the same error message when trying to restore.
Do you the procedure to restore a database with SQL2005 through the
Management Studio ?
Thanks in advance.
Check the ActivityLog to find out who is connected to database.
Thanks & Rate the Postings.
-Ravi-
"Ving" wrote:

> Dear all,
> I'm trying to restore a database saved last week in a .bak file through the
> GUI of Management Studio but i have the following message error : "the
> database is in use".
> So i restarted the service engine SQL and changed the option to put Single
> User but i have still the same error message when trying to restore.
> Do you the procedure to restore a database with SQL2005 through the
> Management Studio ?
> Thanks in advance.
>
>

problem restore database SQL2005

Dear all,
I'm trying to restore a database saved last week in a .bak file through the
GUI of Management Studio but i have the following message error : "the
database is in use".
So i restarted the service engine SQL and changed the option to put Single
User but i have still the same error message when trying to restore.
Do you the procedure to restore a database with SQL2005 through the
Management Studio ?
Thanks in advance.Check the ActivityLog to find out who is connected to database.
--
Thanks & Rate the Postings.
-Ravi-
"Ving" wrote:
> Dear all,
> I'm trying to restore a database saved last week in a .bak file through the
> GUI of Management Studio but i have the following message error : "the
> database is in use".
> So i restarted the service engine SQL and changed the option to put Single
> User but i have still the same error message when trying to restore.
> Do you the procedure to restore a database with SQL2005 through the
> Management Studio ?
> Thanks in advance.
>
>

problem restore database SQL2005

Dear all,
I'm trying to restore a database saved last week in a .bak file through the
GUI of Management Studio but i have the following message error : "the
database is in use".
So i restarted the service engine SQL and changed the option to put Single
User but i have still the same error message when trying to restore.
Do you the procedure to restore a database with SQL2005 through the
Management Studio ?
Thanks in advance.Check the ActivityLog to find out who is connected to database.
--
Thanks & Rate the Postings.
-Ravi-
"Ving" wrote:

> Dear all,
> I'm trying to restore a database saved last week in a .bak file through th
e
> GUI of Management Studio but i have the following message error : "the
> database is in use".
> So i restarted the service engine SQL and changed the option to put Single
> User but i have still the same error message when trying to restore.
> Do you the procedure to restore a database with SQL2005 through the
> Management Studio ?
> Thanks in advance.
>
>