I have two database, let's call them DbA and DbB. DbA was already in the
right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
and reattached it. Everything seems to be working (I can see the database
from Management Studio Express (MSE), the website can access it just fine)
except when I try to backup DbB. Backing up from MSE works without a
problem, however if I try to run this query:
BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
NOUNLOAD, STATS = 10
GO
with this sqlcmd.exe command:
sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o c:\WebBackupScripts\BkDbB.sql.txt
I get this:
Msg 911, Level 16, State 1, Server DEV, Line 1
Could not locate entry in sysdatabases for database 'DbB'. No entry found
with that name. Make sure that the name is entered correctly.
Msg 3013, Level 16, State 1, Server DEV, Line 1
BACKUP DATABASE is terminating abnormally.
The exact same query runs fine from MSE, but fails when ran from sqlcmd --
the sql was actually generated by MSE. A similar query, but for DbA works
fine from sqlcmd. The only thing that I can think of that's different is
that I've attached/reattached DbB. I've searched the net, but nothing
really helped. Any suggestions?
Thank you,
Peter.
Hello,
Do you have multiple instances of SQL Server in the same server. Just issue
the -S Servername parameter along with
SQLCMD statement and try.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:eYTyx4uPHHA.2140@.TK2MSFTNGP03.phx.gbl...
>I have two database, let's call them DbA and DbB. DbA was already in the
>right folder, but DbB wasn't. So I detached DbB, moved it to the new folder
>and reattached it. Everything seems to be working (I can see the database
>from Management Studio Express (MSE), the website can access it just fine)
>except when I try to backup DbB. Backing up from MSE works without a
>problem, however if I try to run this query:
> BACKUP DATABASE [DbB] TO DISK = N'C:\WebDb.backup\DbB\DbB.bak' WITH
> NOFORMAT, NOINIT, NAME = N'DbB-Full Database Backup', SKIP, NOREWIND,
> NOUNLOAD, STATS = 10
> GO
> with this sqlcmd.exe command:
> sqlcmd -i c:\WebBackupScripts\BkDbB.sql -o
> c:\WebBackupScripts\BkDbB.sql.txt
> I get this:
> Msg 911, Level 16, State 1, Server DEV, Line 1
> Could not locate entry in sysdatabases for database 'DbB'. No entry found
> with that name. Make sure that the name is entered correctly.
> Msg 3013, Level 16, State 1, Server DEV, Line 1
> BACKUP DATABASE is terminating abnormally.
>
> The exact same query runs fine from MSE, but fails when ran from sqlcmd --
> the sql was actually generated by MSE. A similar query, but for DbA works
> fine from sqlcmd. The only thing that I can think of that's different is
> that I've attached/reattached DbB. I've searched the net, but nothing
> really helped. Any suggestions?
> Thank you,
> Peter.
>
|||> Do you have multiple instances of SQL Server in the same server. Just
> issue the -S Servername parameter along with
> SQLCMD statement and try.
Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
same machine. SQL2005 is installed under the SQLExpress instance. So adding
"-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm still
puzzled why that wasn't required for DbA... could it be that DbA is the
"default" database?
In any case, thanks a LOT for you help!
|||Hello,
Yes, thats the default instance.
You will have to give the server instance name if you have multiple servers
in one machine.
Thanks
Hari
"Peter Zolja" <x@.x.com> wrote in message
news:%23tu1GEvPHHA.1248@.TK2MSFTNGP03.phx.gbl...
> Ahaaaaaa... right on the money :-) I have SQL 2005 Express and MSDE on the
> same machine. SQL2005 is installed under the SQLExpress instance. So
> adding "-S .\SQLExpress" to the sqlcmd parameter list made it work. I'm
> still puzzled why that wasn't required for DbA... could it be that DbA is
> the "default" database?
> In any case, thanks a LOT for you help!
>
|||Thanks to Hari! You're a life saver. Where were you 5 hours ago?
From http://www.developmentnow.com/g/118_2007_1_0_0_928077/Could-not-locate-entry-in-sysdatabases-for-database.htm
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment