Showing posts with label back. Show all posts
Showing posts with label back. Show all posts

Wednesday, March 28, 2012

Problem restoring database ...

Dear Newsgroup,

I am using sql server 2000 over win 2000 server with service pack 4.

I have been given a back up of a database (I have tried both from T-SQL and
Enterprise Manager)

T-SQL

RESTORE FILELISTONLY
FROM DISK = 'c:\A.bck'

RESTORE DATABASE B
FROM DISK = 'c:\A.bck'
WITH MOVE 'A_Data' TO 'c:\test\B.mdf',
MOVE 'A_Log' TO 'c:\test\B.ldf'

and as I try to restore I get the following error :

Server: Msg 3154, Level 16, State 2, Line 1
The backup set holds a backup of a database other than the existing 'B'
database.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Would you kindly help me ?????

Thank you in advance,
YassYass (gol_e_yass@.yahoo.com) writes:
> RESTORE FILELISTONLY
> FROM DISK = 'c:\A.bck'
> RESTORE DATABASE B
> FROM DISK = 'c:\A.bck'
> WITH MOVE 'A_Data' TO 'c:\test\B.mdf',
> MOVE 'A_Log' TO 'c:\test\B.ldf'
> and as I try to restore I get the following error :
> Server: Msg 3154, Level 16, State 2, Line 1
> The backup set holds a backup of a database other than the existing 'B'
> database.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> Would you kindly help me ?????

I'm out on a limb here, but my interpretation is that there is already
a database B on the machine, but the backup is taken from another
database (A?). Adding ", REPLACE" at the end will get rid of the
error message - and wipe out B, so be careful that this is what you
want to do.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

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

Monday, March 26, 2012

Problem removing old back up files....

I am having problems with removing the update files from a folder. When
a do a new backup, I want it to overwrite the old backup files with the
new one. Apparently the code I am using is wrong. Any suggestions?Hi,
Would you be able to post your code so that people can see if they can
see anything with it or if it's fine?
If you are using BACKUP statements then you have to add "INIT" to the
"WITH" section. This will overwrite whatever backup device (e.g. the
file name) that you specify in the statement. For example:
BACKUP DATABASE Test_DB
TO DISK = 'C:\Test_DB_Backup.bak'
WITH INIT
WIll overwrite the previous contents of Test_DB_Backup.bak. Note that
there are some caveats with using INIT (namely that it won't overwrite
in certain situations) but these are described in SQL Server Books
Online in the topic about the BACKUP statement.
Hope that helps a bit|||EXECUTE master.dbo.xp_sqlmaint N'-PlanID
88FF9022-F638-4939-99FF-2FD57140382C -Rpt "C:\Program Files\Microsoft
SQL Server\MSSQL\LOG\<Backup Sever Name> Backup4.txt" -DelTxtRpt 2WEEKS
-WriteHistory -VrfyBackup -BkUpMedia DISK -BkUpDB "\\<Backup Server
Name>\Backup Do Not Touch\<SQL Server Name>" -DelBkUps 1DAYS
-CrBkSubDir -BkExt "BAK"'
There is the one we are using.|||OK, I see...There is an Database Maintenance Plan in place that will
take a backup of the desired database and delete backups older than one
day.
I don't believe that the sqlmaint utility (the utility that will be
called by xp_sqlmaint) has a switch that orders backups to be
overwritten. If you want to take backups but overwrite them each day
then you'll probably need to define your own SQL Server Agent job that
executes the following T-SQL as per whatever schedule you desire:
BACKUP DATABASE <DB_Name>
TO DISK = '<Path Of Backup File (includes the file name)>'
WITH INIT -- Force an overwrite most of the time (some caveats as
described in Books Online)
BTW, I think that generally it is a good idea to keep a few backup
files just in case something goes wrong with the backup you are
currently taking there is something to fall back on.
Hope that helps a bit

Problem registering a remote server

Hey all...
We have several websites running SQL server back ends and we have
successful registrations for each in SQL Servers Enterprise Manager.
We also have a client who hosts their own SQL Server Database and we
used to have a good registration for their SQL Server.
Our client has moved their website and SQL Server to a new server as
the machine they were running on had an unknown fault, and since they
have moved everything we can no longer see the database or register
the server in Enterprise Manager.
We can still register servers from other clients and the client we are
having trouble with can register their server using standard dial up
connections and the admin guy did it from his cable modem account from
home. We have tried using the VPN tunnel they prepared for us as well
as trying to register after they put the server outside the firewall.
The only firewall changes that were made wer after our first being
unable to connect, then they allowed all traffic from our IP in.
To summerize, They can register SQL Server externally (from home etc)
and we cannot, but we can register all other SQL Servers except
theirs.
Any Ideas?What error do you get when you try to connect?
Rand
This posting is provided "as is" with no warranties and confers no rights.|||The error dialog reads:
==========
SQL Server registration failed because of the connection failure
displayed below. Do you wish to register anyway?
SQL Server does not exist or access denied
ConnectionOpen(Connect())
==========
I think it may be some sort of firewall problem, but they assure us
that the server has been placed outside their firewall during some
attempts to connect and our firewall is definately working OK as we
can connect to other, ISP hosted SQL Servers.
rboyd@.onlinemicrosoft.com (Rand Boyd [MSFT]) wrote in message news:<NGHck8z7DHA.1812@.cpmsftngx
a07.phx.gbl>...
> What error do you get when you try to connect?
> Rand
> This posting is provided "as is" with no warranties and confers no rights.sql

Wednesday, March 21, 2012

Problem populating temp table from linked server.

Hello,

I have a 2000 sql server linked to a 2005 sql server an I am trying to return data across the link. If I just run the sp I get the data back fine but if I try to Insert the data into a temp table the process just hangs and has to be killed.

This works fine:

EXEC [MyLink].[MyDocs].[dbo].[spGetSearchWrapper] -- (returns 156k records in about 2 sec.)

However inserting the results into a local temp table never returns. In fact the process never really runs.

CREATE TABLE #tmpOrgResult
(
intObjectID INT NOT NULL,
intObjectTypeCodeID INT NOT NULL

)
GO

-- Insert org records that match the search.
INSERT INTO #tmpOrgResult
(
intObjectID,
intObjectTypeCodeID
)
EXEC [MyLink].[MyDocs].[dbo].[spGetSearchWrapper] -- (This statement just hangs)

Try with

SET REMOTE_PROC_TRANSACTIONS OFF

before the INSERT statement. What I suspect happens is the local transaction is promoted to a distributed one and something gets messed up.

Zlatko

|||

You are correct it is getting promoted to a distributed transaction. Turns out MSDTC was off by default on the server. The following article showed me how to enable it. Works like a champ now.

http://support.microsoft.com/?kbid=873160

|||You are welcome.

Tuesday, March 20, 2012

Problem On Store Report Parameter in Subscription ( by custom UI)

I wrote a interface on my website about create/update subscription .
when I get the parameter back by using GetReportParameters ()
the value was swap
for example:
I have 8 reportparameter: tcust, fcust, fdnnum, tdnnum, fdept, tdept, fairline, tairline.
all of them are string
when I create the subscription by:
tcust 1
fcust 2
fdnnum 3
tdnnum 4
fdept 5
tdept 6
fairline 7
tairline 8

then I get back that subscription
the value will be :
tcust 2

fcust 3

fdnnum 8

tdnnum 5

fdept 1

tdept 7

fairline 4

tairline 6

are there any order for storing the ReportParameter[] ?
thank youYou should not rely on order. ReportParameter has property Name which can be used to identify the parameter. See sample code at http://msdn2.microsoft.com/en-gb/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.getreportparameters.aspx

Monday, February 20, 2012

Problem in Visual Basic

When I run Visual Basic Application With Back hand Is SQL SERVER DataBAse I Had Connect database with ODBC
But its very Slow What can i do
As there are many ways of doing the same thing, I would recommend that you
encapsulate your data manipulation language into a stored procedure and
make calls to that SP through your VB application. In programming, I can
assure you that short cuts kill the performance.
You can always embed the manipulation language in your VB code itself, but
to enhance performance, the recommended way (from experience) would be to
do so through Stored Procedures. However, this is not a generic statement
but should be evaluated in the light of your own application's
architecture. Have a look at this great article
http://www.sql-server-performance.co...erformance.asp
Kindly review it and analyse the same with respect to your application and
database design.
Hope this helps.
Sanchan [MSFT]
sanchans@.online.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.