Showing posts with label statement. Show all posts
Showing posts with label statement. Show all posts

Tuesday, March 20, 2012

restoring msdb with SQL 2000

Hi,
I'm running SQL 2000, sp4. I use the following statement to backup msdb:
backup database msdb to disk ='c:\msdb.dat'
then restore with:restore database msdb from disk = 'c:\msdb.dat' with
norecovery
The restore seem to succeed. But I get the following messages:
Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
Server: Msg 927, Level 14, State 2, Line 1
Database 'msdb' cannot be opened. It is in the middle of a restore.
Server: Msg 3009, Level 16, State 3, Line 1
Could not insert a backup or restore history/detail record in the msdb
database. This may indicate a problem with the msdb database. The
backup/restore operation was still successful.
RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
MB/sec).
These messages aren't generated with SQL2005, nor do you see the messages if
you specify 'with recovery' on the restore statement.
I would be appreciative if someone could explain these messages. If I ignore
them, it is still possible to recover the database (restore database msdb
with recovery).
Thanks, HowardIf you want the database to be available for users do not restore it using
'with norecovery', just remove this part from your restore command.
Norecovery is used when you want to apply additional backups. If you see the
status on Enterprise Manager or Management Studio when you are using
norecovery it will show 'Restoring ... ' and no users will be able to connect
to it.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Howard" wrote:
> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I ignore
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>|||By the way your restore was sucessful but because you are using with
norecovery the msdb database is not available to users. Regarding the error
messages, the msdb database keeps the backup and restore history of the
databases on the instance, and looks like in this case is not able to record
its own restore operation.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Ben Nevarez" wrote:
> If you want the database to be available for users do not restore it using
> 'with norecovery', just remove this part from your restore command.
> Norecovery is used when you want to apply additional backups. If you see the
> status on Enterprise Manager or Management Studio when you are using
> norecovery it will show 'Restoring ... ' and no users will be able to connect
> to it.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "Howard" wrote:
> > Hi,
> >
> > I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> > backup database msdb to disk ='c:\msdb.dat'
> >
> > then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> > norecovery
> >
> > The restore seem to succeed. But I get the following messages:
> >
> > Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> > Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> > Server: Msg 927, Level 14, State 2, Line 1
> > Database 'msdb' cannot be opened. It is in the middle of a restore.
> > Server: Msg 3009, Level 16, State 3, Line 1
> > Could not insert a backup or restore history/detail record in the msdb
> > database. This may indicate a problem with the msdb database. The
> > backup/restore operation was still successful.
> > RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> > MB/sec).
> >
> > These messages aren't generated with SQL2005, nor do you see the messages if
> > you specify 'with recovery' on the restore statement.
> >
> > I would be appreciative if someone could explain these messages. If I ignore
> > them, it is still possible to recover the database (restore database msdb
> > with recovery).
> >
> > Thanks, Howard
> >
> >
> >
> >
> >
> >|||Also, when restoring MSDB, make sure your SQLAgent service is stopped as
this service is using the MSDB database
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:2D037B41-1D79-4207-8916-3964747C395C@.microsoft.com...
> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages
> if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I
> ignore
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>|||Hi Ben,
Thanks for your quick reply. I did consider using 'with recovery' on the
restore statement. The trouble is that msdb does permit 'full' recovery mode.
So you may still need to restore the transaction log to a PIT after restoring
the database. Also, I understand that the msdb was indeed restored despite
the error message. What I really want to know is what to make of the error
message as I work with a program that deals with other people's data and this
type of message makes them nervous.
Thanks again, Howard|||This is a kind of catch-22 situation. Each RESTORE want to write to the restore history tables in
msdb. Since these aren't available (yet) when you restore msdb, that restore history writing isn't
possible. One could argue that SQL server would be smart enough to produce only a warning or similar
in these situations, of course. Perhaps you want to file an entry at
http://connect.microsoft.com/sqlserver for this... Probably MS didn't find this happening often
enough to warrant any major effort... :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
> Hi Ben,
> Thanks for your quick reply. I did consider using 'with recovery' on the
> restore statement. The trouble is that msdb does permit 'full' recovery mode.
> So you may still need to restore the transaction log to a PIT after restoring
> the database. Also, I understand that the msdb was indeed restored despite
> the error message. What I really want to know is what to make of the error
> message as I work with a program that deals with other people's data and this
> type of message makes them nervous.
> Thanks again, Howard
>|||Thanks for this info. As I said, this is a relic of SQL2000 (SP4). The
problem doesn't appear in SQL 2005. I think I'll take your suggestion and try
to get an official response from Microsoft because at least on of my
customers may be expecting it.
"Tibor Karaszi" wrote:
> This is a kind of catch-22 situation. Each RESTORE want to write to the restore history tables in
> msdb. Since these aren't available (yet) when you restore msdb, that restore history writing isn't
> possible. One could argue that SQL server would be smart enough to produce only a warning or similar
> in these situations, of course. Perhaps you want to file an entry at
> http://connect.microsoft.com/sqlserver for this... Probably MS didn't find this happening often
> enough to warrant any major effort... :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Howard" <Howard@.discussions.microsoft.com> wrote in message
> news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
> > Hi Ben,
> >
> > Thanks for your quick reply. I did consider using 'with recovery' on the
> > restore statement. The trouble is that msdb does permit 'full' recovery mode.
> > So you may still need to restore the transaction log to a PIT after restoring
> > the database. Also, I understand that the msdb was indeed restored despite
> > the error message. What I really want to know is what to make of the error
> > message as I work with a program that deals with other people's data and this
> > type of message makes them nervous.
> >
> > Thanks again, Howard
> >
> >
>
>|||> As I said, this is a relic of SQL2000 (SP4). The
> problem doesn't appear in SQL 2005.
Cool. I didn't know that. So MS did spend some time on this. Thanks for the update. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:2FA4EC15-34D7-41FA-867F-8DC825A67414@.microsoft.com...
> Thanks for this info. As I said, this is a relic of SQL2000 (SP4). The
> problem doesn't appear in SQL 2005. I think I'll take your suggestion and try
> to get an official response from Microsoft because at least on of my
> customers may be expecting it.
> "Tibor Karaszi" wrote:
>> This is a kind of catch-22 situation. Each RESTORE want to write to the restore history tables in
>> msdb. Since these aren't available (yet) when you restore msdb, that restore history writing
>> isn't
>> possible. One could argue that SQL server would be smart enough to produce only a warning or
>> similar
>> in these situations, of course. Perhaps you want to file an entry at
>> http://connect.microsoft.com/sqlserver for this... Probably MS didn't find this happening often
>> enough to warrant any major effort... :-)
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "Howard" <Howard@.discussions.microsoft.com> wrote in message
>> news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
>> > Hi Ben,
>> >
>> > Thanks for your quick reply. I did consider using 'with recovery' on the
>> > restore statement. The trouble is that msdb does permit 'full' recovery mode.
>> > So you may still need to restore the transaction log to a PIT after restoring
>> > the database. Also, I understand that the msdb was indeed restored despite
>> > the error message. What I really want to know is what to make of the error
>> > message as I work with a program that deals with other people's data and this
>> > type of message makes them nervous.
>> >
>> > Thanks again, Howard
>> >
>> >
>>

restoring msdb with SQL 2000

Hi,
I'm running SQL 2000, sp4. I use the following statement to backup msdb:
backup database msdb to disk ='c:\msdb.dat'
then restore with:restore database msdb from disk = 'c:\msdb.dat' with
norecovery
The restore seem to succeed. But I get the following messages:
Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
Server: Msg 927, Level 14, State 2, Line 1
Database 'msdb' cannot be opened. It is in the middle of a restore.
Server: Msg 3009, Level 16, State 3, Line 1
Could not insert a backup or restore history/detail record in the msdb
database. This may indicate a problem with the msdb database. The
backup/restore operation was still successful.
RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
MB/sec).
These messages aren't generated with SQL2005, nor do you see the messages if
you specify 'with recovery' on the restore statement.
I would be appreciative if someone could explain these messages. If I ignore
them, it is still possible to recover the database (restore database msdb
with recovery).
Thanks, Howard
If you want the database to be available for users do not restore it using
'with norecovery', just remove this part from your restore command.
Norecovery is used when you want to apply additional backups. If you see the
status on Enterprise Manager or Management Studio when you are using
norecovery it will show 'Restoring ... ' and no users will be able to connect
to it.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Howard" wrote:

> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I ignore
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>
|||By the way your restore was sucessful but because you are using with
norecovery the msdb database is not available to users. Regarding the error
messages, the msdb database keeps the backup and restore history of the
databases on the instance, and looks like in this case is not able to record
its own restore operation.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Ben Nevarez" wrote:
[vbcol=seagreen]
> If you want the database to be available for users do not restore it using
> 'with norecovery', just remove this part from your restore command.
> Norecovery is used when you want to apply additional backups. If you see the
> status on Enterprise Manager or Management Studio when you are using
> norecovery it will show 'Restoring ... ' and no users will be able to connect
> to it.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "Howard" wrote:
|||Also, when restoring MSDB, make sure your SQLAgent service is stopped as
this service is using the MSDB database
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:2D037B41-1D79-4207-8916-3964747C395C@.microsoft.com...
> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages
> if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I
> ignore
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>
|||Hi Ben,
Thanks for your quick reply. I did consider using 'with recovery' on the
restore statement. The trouble is that msdb does permit 'full' recovery mode.
So you may still need to restore the transaction log to a PIT after restoring
the database. Also, I understand that the msdb was indeed restored despite
the error message. What I really want to know is what to make of the error
message as I work with a program that deals with other people's data and this
type of message makes them nervous.
Thanks again, Howard
|||Thanks for this info. As I said, this is a relic of SQL2000 (SP4). The
problem doesn't appear in SQL 2005. I think I'll take your suggestion and try
to get an official response from Microsoft because at least on of my
customers may be expecting it.
"Tibor Karaszi" wrote:

> This is a kind of catch-22 situation. Each RESTORE want to write to the restore history tables in
> msdb. Since these aren't available (yet) when you restore msdb, that restore history writing isn't
> possible. One could argue that SQL server would be smart enough to produce only a warning or similar
> in these situations, of course. Perhaps you want to file an entry at
> http://connect.microsoft.com/sqlserver for this... Probably MS didn't find this happening often
> enough to warrant any major effort... :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Howard" <Howard@.discussions.microsoft.com> wrote in message
> news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
>
>

restoring msdb with SQL 2000

Hi,
I'm running SQL 2000, sp4. I use the following statement to backup msdb:
backup database msdb to disk ='c:\msdb.dat'
then restore with:restore database msdb from disk = 'c:\msdb.dat' with
norecovery
The restore seem to succeed. But I get the following messages:
Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
Server: Msg 927, Level 14, State 2, Line 1
Database 'msdb' cannot be opened. It is in the middle of a restore.
Server: Msg 3009, Level 16, State 3, Line 1
Could not insert a backup or restore history/detail record in the msdb
database. This may indicate a problem with the msdb database. The
backup/restore operation was still successful.
RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
MB/sec).
These messages aren't generated with SQL2005, nor do you see the messages if
you specify 'with recovery' on the restore statement.
I would be appreciative if someone could explain these messages. If I ignore
them, it is still possible to recover the database (restore database msdb
with recovery).
Thanks, HowardIf you want the database to be available for users do not restore it using
'with norecovery', just remove this part from your restore command.
Norecovery is used when you want to apply additional backups. If you see the
status on Enterprise Manager or Management Studio when you are using
norecovery it will show 'Restoring ... ' and no users will be able to connec
t
to it.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Howard" wrote:

> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages
if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I igno
re
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>|||By the way your restore was sucessful but because you are using with
norecovery the msdb database is not available to users. Regarding the error
messages, the msdb database keeps the backup and restore history of the
databases on the instance, and looks like in this case is not able to record
its own restore operation.
Hope this helps,
Ben Nevarez
Senior Database Administrator
AIG SunAmerica
"Ben Nevarez" wrote:
[vbcol=seagreen]
> If you want the database to be available for users do not restore it using
> 'with norecovery', just remove this part from your restore command.
> Norecovery is used when you want to apply additional backups. If you see t
he
> status on Enterprise Manager or Management Studio when you are using
> norecovery it will show 'Restoring ... ' and no users will be able to conn
ect
> to it.
> Hope this helps,
> Ben Nevarez
> Senior Database Administrator
> AIG SunAmerica
>
> "Howard" wrote:
>|||Also, when restoring MSDB, make sure your SQLAgent service is stopped as
this service is using the MSDB database
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:2D037B41-1D79-4207-8916-3964747C395C@.microsoft.com...
> Hi,
> I'm running SQL 2000, sp4. I use the following statement to backup msdb:
> backup database msdb to disk ='c:\msdb.dat'
> then restore with:restore database msdb from disk = 'c:\msdb.dat' with
> norecovery
> The restore seem to succeed. But I get the following messages:
> Processed 1424 pages for database 'msdb', file 'MSDBData' on file 1.
> Processed 1 pages for database 'msdb', file 'MSDBLog' on file 1.
> Server: Msg 927, Level 14, State 2, Line 1
> Database 'msdb' cannot be opened. It is in the middle of a restore.
> Server: Msg 3009, Level 16, State 3, Line 1
> Could not insert a backup or restore history/detail record in the msdb
> database. This may indicate a problem with the msdb database. The
> backup/restore operation was still successful.
> RESTORE DATABASE successfully processed 1425 pages in 2.985 seconds (3.908
> MB/sec).
> These messages aren't generated with SQL2005, nor do you see the messages
> if
> you specify 'with recovery' on the restore statement.
> I would be appreciative if someone could explain these messages. If I
> ignore
> them, it is still possible to recover the database (restore database msdb
> with recovery).
> Thanks, Howard
>
>
>|||Hi Ben,
Thanks for your quick reply. I did consider using 'with recovery' on the
restore statement. The trouble is that msdb does permit 'full' recovery mode
.
So you may still need to restore the transaction log to a PIT after restorin
g
the database. Also, I understand that the msdb was indeed restored despite
the error message. What I really want to know is what to make of the error
message as I work with a program that deals with other people's data and thi
s
type of message makes them nervous.
Thanks again, Howard|||This is a kind of catch-22 situation. Each RESTORE want to write to the rest
ore history tables in
msdb. Since these aren't available (yet) when you restore msdb, that restore
history writing isn't
possible. One could argue that SQL server would be smart enough to produce o
nly a warning or similar
in these situations, of course. Perhaps you want to file an entry at
http://connect.microsoft.com/sqlserver for this... Probably MS didn't find t
his happening often
enough to warrant any major effort... :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
> Hi Ben,
> Thanks for your quick reply. I did consider using 'with recovery' on the
> restore statement. The trouble is that msdb does permit 'full' recovery mo
de.
> So you may still need to restore the transaction log to a PIT after restor
ing
> the database. Also, I understand that the msdb was indeed restored despit
e
> the error message. What I really want to know is what to make of the error
> message as I work with a program that deals with other people's data and t
his
> type of message makes them nervous.
> Thanks again, Howard
>|||Thanks for this info. As I said, this is a relic of SQL2000 (SP4). The
problem doesn't appear in SQL 2005. I think I'll take your suggestion and tr
y
to get an official response from Microsoft because at least on of my
customers may be expecting it.
"Tibor Karaszi" wrote:

> This is a kind of catch-22 situation. Each RESTORE want to write to the re
store history tables in
> msdb. Since these aren't available (yet) when you restore msdb, that resto
re history writing isn't
> possible. One could argue that SQL server would be smart enough to produce
only a warning or similar
> in these situations, of course. Perhaps you want to file an entry at
> http://connect.microsoft.com/sqlserver for this... Probably MS didn't find
this happening often
> enough to warrant any major effort... :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Howard" <Howard@.discussions.microsoft.com> wrote in message
> news:9AE3DA6D-40B3-4577-894C-D9347C11C28A@.microsoft.com...
>
>|||> As I said, this is a relic of SQL2000 (SP4). The
> problem doesn't appear in SQL 2005.
Cool. I didn't know that. So MS did spend some time on this. Thanks for the
update. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Howard" <Howard@.discussions.microsoft.com> wrote in message
news:2FA4EC15-34D7-41FA-867F-8DC825A67414@.microsoft.com...[vbcol=seagreen]
> Thanks for this info. As I said, this is a relic of SQL2000 (SP4). The
> problem doesn't appear in SQL 2005. I think I'll take your suggestion and
try
> to get an official response from Microsoft because at least on of my
> customers may be expecting it.
> "Tibor Karaszi" wrote:
>

Tuesday, February 21, 2012

restoring database when guest account is missing

Hello,
I need to restore a database from backup, which has no guest account
specified. Sql user which executes the following statement is in Database
Creators server role:
RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
WITH REPLACE,
MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs.mdf',
MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\data\pubs_log.ldf'
The message I receive is:
Processed 208 pages for database 'pubs', file 'pubs' on file 1.
Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
Server: Msg 916, Level 14, State 1, Line 1
Server user 'DK_user' is not a valid user in database 'pubs'.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
The database is actually restored and I could proceed to the next step in my
script, but @.@.error <> 0 which is not what I want to see. I can not create
'guest' account in the db backup as it is provided by the other department
and the user who is restoring the database can not be granted sysadmin
permissions.
If I create 'guest' account in 'pubs' database, backup it and restore,
everything works fine
Has anybody got ideas how to restore the database without receiving an error
message?
Thanks,
DariusHi
D you have the use 'DK_user' ?
> Server user 'DK_user' is not a valid user in database 'pubs'.
I did just testing
--removed a guest user from the pubs database and run backup command
backup database pubs to disk='c:\pubs2.bak'
go
--went to EM and create a guest account
restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
MOVE 'pubs' TO 'c:\pubs2.mdf',
MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
It worked without errors
"Sabotage" <nospam> wrote in message
news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
> Hello,
> I need to restore a database from backup, which has no guest account
> specified. Sql user which executes the following statement is in Database
> Creators server role:
> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
> WITH REPLACE,
> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs.mdf',
> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs_log.ldf'
> The message I receive is:
> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs'.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> The database is actually restored and I could proceed to the next step in
> my
> script, but @.@.error <> 0 which is not what I want to see. I can not create
> 'guest' account in the db backup as it is provided by the other department
> and the user who is restoring the database can not be granted sysadmin
> permissions.
> If I create 'guest' account in 'pubs' database, backup it and restore,
> everything works fine
> Has anybody got ideas how to restore the database without receiving an
> error
> message?
> Thanks,
> Darius
>|||Hi Uri,
Yes, I want to use DK_user, which has dbcreator server role, but is not
sysadmin (sorry, I haven't made myself clear enough in the previous post).
It woks fine when you restore with a user which has got sysadmin role. But
in my case DK_user has dbcreator role only. It's quite weird behaviour, as
after restore DK_user becomes the owner of pubs1 database, but is not
allowed to access it:
use pubs1
Server: Msg 916, Level 14, State 1, Line 1
Server user 'DK_user' is not a valid user in database 'pubs1'.
Darius
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
> Hi
> D you have the use 'DK_user' ?
>
> I did just testing
> --removed a guest user from the pubs database and run backup command
> backup database pubs to disk='c:\pubs2.bak'
> go
> --went to EM and create a guest account
> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
> MOVE 'pubs' TO 'c:\pubs2.mdf',
> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>
> It worked without errors
>
>
> "Sabotage" <nospam> wrote in message
> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>|||Hi
If the database being restoring is aleady exist the member of the dbcreator
is available to run restore command
I did successfuly restored the database by using an user who's memebr of
dbcreator role ONLY
"Sabotage" <nospam> wrote in message
news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
> Hi Uri,
> Yes, I want to use DK_user, which has dbcreator server role, but is not
> sysadmin (sorry, I haven't made myself clear enough in the previous post).
> It woks fine when you restore with a user which has got sysadmin role. But
> in my case DK_user has dbcreator role only. It's quite weird behaviour, as
> after restore DK_user becomes the owner of pubs1 database, but is not
> allowed to access it:
> use pubs1
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs1'.
> Darius
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>|||My script needs to restore the database and to overwrite it if one exists
already. But I receive an error in both cases (SQL Server 2000 SP4). Have
you tried to restore if the database does not exist?
D.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
> Hi
> If the database being restoring is aleady exist the member of the
> dbcreator is available to run restore command
> I did successfuly restored the database by using an user who's memebr of
> dbcreator role ONLY
>
>
> "Sabotage" <nospam> wrote in message
> news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
>|||Wait, wait, if the database does not exist on the server the user needs
CREATE DATABASE permission , which means that your user does not have it in
this case.
Cannot test it on SP4 , right now I'm having only SP3
"Sabotage" <nospam> wrote in message
news:OQ7MFtttGHA.3392@.TK2MSFTNGP04.phx.gbl...
> My script needs to restore the database and to overwrite it if one exists
> already. But I receive an error in both cases (SQL Server 2000 SP4). Have
> you tried to restore if the database does not exist?
> D.
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
>|||db_creator fixed server role is granted to execute several statement
permissions as CREATE DATABASE, ALTER DATABASE, DROP DATABASE, RESTORE
DATABASE and few others, so I think it's not the case...
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:Opo56xttGHA.4968@.TK2MSFTNGP03.phx.gbl...
> Wait, wait, if the database does not exist on the server the user needs
> CREATE DATABASE permission , which means that your user does not have it
> in this case.
> Cannot test it on SP4 , right now I'm having only SP3
>
>
>
> "Sabotage" <nospam> wrote in message
> news:OQ7MFtttGHA.3392@.TK2MSFTNGP04.phx.gbl...
>|||Yep, I was reading just this explanation and must admit that its a little
bit confused
RESTORE command
Permissions
If the database being restored does not exist, the user must have CREATE
DATABASE permissions to be able to execute RESTORE. If the database exists,
RESTORE permissions default to members of the sysadmin and dbcreator fixed
server roles and the owner (dbo) of the database.
"Sabotage" <nospam> wrote in message
news:Owlhx7ttGHA.1536@.TK2MSFTNGP02.phx.gbl...
> db_creator fixed server role is granted to execute several statement
> permissions as CREATE DATABASE, ALTER DATABASE, DROP DATABASE, RESTORE
> DATABASE and few others, so I think it's not the case...
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:Opo56xttGHA.4968@.TK2MSFTNGP03.phx.gbl...
>|||Sabotage wrote:
> Hello,
> I need to restore a database from backup, which has no guest account
> specified. Sql user which executes the following statement is in Database
> Creators server role:
> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
> WITH REPLACE,
> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs.mdf'
,
> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs_log.ldf'
> The message I receive is:
> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs'.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> The database is actually restored and I could proceed to the next step in
my
> script, but @.@.error <> 0 which is not what I want to see. I can not create
> 'guest' account in the db backup as it is provided by the other department
> and the user who is restoring the database can not be granted sysadmin
> permissions.
> If I create 'guest' account in 'pubs' database, backup it and restore,
> everything works fine
> Has anybody got ideas how to restore the database without receiving an err
or
> message?
> Thanks,
> Darius
>
I think the problem is that 'DK_User' is defined as a user in the
"source" database (the database that the backup was created from), but
has a different SID than 'DK_User' on your "restore" server. Do a
Google search for "sql server orphaned users" for information on how to
transfer a login from one server to another while retaining the original
SID.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy,
no, DK_user is not defined in the "source" database. Only "sa" user is
defined in the backuped database. It's not the case with orphaned users.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:%23b$fwNwtGHA.4928@.TK2MSFTNGP04.phx.gbl...
> Sabotage wrote:
> I think the problem is that 'DK_User' is defined as a user in the "source"
> database (the database that the backup was created from), but has a
> different SID than 'DK_User' on your "restore" server. Do a Google search
> for "sql server orphaned users" for information on how to transfer a login
> from one server to another while retaining the original SID.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

restoring database when guest account is missing

Hello,
I need to restore a database from backup, which has no guest account
specified. Sql user which executes the following statement is in Database
Creators server role:
RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
WITH REPLACE,
MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs.mdf',
MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
Server\MSSQL\data\pubs_log.ldf'
The message I receive is:
Processed 208 pages for database 'pubs', file 'pubs' on file 1.
Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
Server: Msg 916, Level 14, State 1, Line 1
Server user 'DK_user' is not a valid user in database 'pubs'.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
The database is actually restored and I could proceed to the next step in my
script, but @.@.error <> 0 which is not what I want to see. I can not create
'guest' account in the db backup as it is provided by the other department
and the user who is restoring the database can not be granted sysadmin
permissions.
If I create 'guest' account in 'pubs' database, backup it and restore,
everything works fine
Has anybody got ideas how to restore the database without receiving an error
message?
Thanks,
DariusHi
D you have the use 'DK_user' ?
> Server user 'DK_user' is not a valid user in database 'pubs'.
I did just testing
--removed a guest user from the pubs database and run backup command
backup database pubs to disk='c:\pubs2.bak'
go
--went to EM and create a guest account
restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
MOVE 'pubs' TO 'c:\pubs2.mdf',
MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
It worked without errors
"Sabotage" <nospam> wrote in message
news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
> Hello,
> I need to restore a database from backup, which has no guest account
> specified. Sql user which executes the following statement is in Database
> Creators server role:
> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
> WITH REPLACE,
> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs.mdf',
> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs_log.ldf'
> The message I receive is:
> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs'.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> The database is actually restored and I could proceed to the next step in
> my
> script, but @.@.error <> 0 which is not what I want to see. I can not create
> 'guest' account in the db backup as it is provided by the other department
> and the user who is restoring the database can not be granted sysadmin
> permissions.
> If I create 'guest' account in 'pubs' database, backup it and restore,
> everything works fine
> Has anybody got ideas how to restore the database without receiving an
> error
> message?
> Thanks,
> Darius
>|||Hi Uri,
Yes, I want to use DK_user, which has dbcreator server role, but is not
sysadmin (sorry, I haven't made myself clear enough in the previous post).
It woks fine when you restore with a user which has got sysadmin role. But
in my case DK_user has dbcreator role only. It's quite weird behaviour, as
after restore DK_user becomes the owner of pubs1 database, but is not
allowed to access it:
use pubs1
Server: Msg 916, Level 14, State 1, Line 1
Server user 'DK_user' is not a valid user in database 'pubs1'.
Darius
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
> Hi
> D you have the use 'DK_user' ?
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>
> I did just testing
> --removed a guest user from the pubs database and run backup command
> backup database pubs to disk='c:\pubs2.bak'
> go
> --went to EM and create a guest account
> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
> MOVE 'pubs' TO 'c:\pubs2.mdf',
> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>
> It worked without errors
>
>
> "Sabotage" <nospam> wrote in message
> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next step in
>> my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving an
>> error
>> message?
>> Thanks,
>> Darius
>|||Hi
If the database being restoring is aleady exist the member of the dbcreator
is available to run restore command
I did successfuly restored the database by using an user who's memebr of
dbcreator role ONLY
"Sabotage" <nospam> wrote in message
news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
> Hi Uri,
> Yes, I want to use DK_user, which has dbcreator server role, but is not
> sysadmin (sorry, I haven't made myself clear enough in the previous post).
> It woks fine when you restore with a user which has got sysadmin role. But
> in my case DK_user has dbcreator role only. It's quite weird behaviour, as
> after restore DK_user becomes the owner of pubs1 database, but is not
> allowed to access it:
> use pubs1
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs1'.
> Darius
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>> Hi
>> D you have the use 'DK_user' ?
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>
>> I did just testing
>> --removed a guest user from the pubs database and run backup command
>> backup database pubs to disk='c:\pubs2.bak'
>> go
>> --went to EM and create a guest account
>> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
>> MOVE 'pubs' TO 'c:\pubs2.mdf',
>> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>>
>> It worked without errors
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in
>> Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next step
>> in my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving an
>> error
>> message?
>> Thanks,
>> Darius
>>
>|||My script needs to restore the database and to overwrite it if one exists
already. But I receive an error in both cases (SQL Server 2000 SP4). Have
you tried to restore if the database does not exist?
D.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
> Hi
> If the database being restoring is aleady exist the member of the
> dbcreator is available to run restore command
> I did successfuly restored the database by using an user who's memebr of
> dbcreator role ONLY
>
>
> "Sabotage" <nospam> wrote in message
> news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
>> Hi Uri,
>> Yes, I want to use DK_user, which has dbcreator server role, but is not
>> sysadmin (sorry, I haven't made myself clear enough in the previous
>> post). It woks fine when you restore with a user which has got sysadmin
>> role. But in my case DK_user has dbcreator role only. It's quite weird
>> behaviour, as after restore DK_user becomes the owner of pubs1 database,
>> but is not allowed to access it:
>> use pubs1
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs1'.
>> Darius
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>> Hi
>> D you have the use 'DK_user' ?
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>
>> I did just testing
>> --removed a guest user from the pubs database and run backup command
>> backup database pubs to disk='c:\pubs2.bak'
>> go
>> --went to EM and create a guest account
>> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
>> MOVE 'pubs' TO 'c:\pubs2.mdf',
>> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>>
>> It worked without errors
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in
>> Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next step
>> in my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving an
>> error
>> message?
>> Thanks,
>> Darius
>>
>>
>|||Wait, wait, if the database does not exist on the server the user needs
CREATE DATABASE permission , which means that your user does not have it in
this case.
Cannot test it on SP4 , right now I'm having only SP3
"Sabotage" <nospam> wrote in message
news:OQ7MFtttGHA.3392@.TK2MSFTNGP04.phx.gbl...
> My script needs to restore the database and to overwrite it if one exists
> already. But I receive an error in both cases (SQL Server 2000 SP4). Have
> you tried to restore if the database does not exist?
> D.
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
>> Hi
>> If the database being restoring is aleady exist the member of the
>> dbcreator is available to run restore command
>> I did successfuly restored the database by using an user who's memebr of
>> dbcreator role ONLY
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
>> Hi Uri,
>> Yes, I want to use DK_user, which has dbcreator server role, but is not
>> sysadmin (sorry, I haven't made myself clear enough in the previous
>> post). It woks fine when you restore with a user which has got sysadmin
>> role. But in my case DK_user has dbcreator role only. It's quite weird
>> behaviour, as after restore DK_user becomes the owner of pubs1 database,
>> but is not allowed to access it:
>> use pubs1
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs1'.
>> Darius
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>> Hi
>> D you have the use 'DK_user' ?
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>
>> I did just testing
>> --removed a guest user from the pubs database and run backup command
>> backup database pubs to disk='c:\pubs2.bak'
>> go
>> --went to EM and create a guest account
>> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
>> MOVE 'pubs' TO 'c:\pubs2.mdf',
>> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>>
>> It worked without errors
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in
>> Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next step
>> in my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving an
>> error
>> message?
>> Thanks,
>> Darius
>>
>>
>>
>|||db_creator fixed server role is granted to execute several statement
permissions as CREATE DATABASE, ALTER DATABASE, DROP DATABASE, RESTORE
DATABASE and few others, so I think it's not the case...
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:Opo56xttGHA.4968@.TK2MSFTNGP03.phx.gbl...
> Wait, wait, if the database does not exist on the server the user needs
> CREATE DATABASE permission , which means that your user does not have it
> in this case.
> Cannot test it on SP4 , right now I'm having only SP3
>
>
>
> "Sabotage" <nospam> wrote in message
> news:OQ7MFtttGHA.3392@.TK2MSFTNGP04.phx.gbl...
>> My script needs to restore the database and to overwrite it if one exists
>> already. But I receive an error in both cases (SQL Server 2000 SP4). Have
>> you tried to restore if the database does not exist?
>> D.
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
>> Hi
>> If the database being restoring is aleady exist the member of the
>> dbcreator is available to run restore command
>> I did successfuly restored the database by using an user who's memebr of
>> dbcreator role ONLY
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
>> Hi Uri,
>> Yes, I want to use DK_user, which has dbcreator server role, but is not
>> sysadmin (sorry, I haven't made myself clear enough in the previous
>> post). It woks fine when you restore with a user which has got sysadmin
>> role. But in my case DK_user has dbcreator role only. It's quite weird
>> behaviour, as after restore DK_user becomes the owner of pubs1
>> database, but is not allowed to access it:
>> use pubs1
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs1'.
>> Darius
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>> Hi
>> D you have the use 'DK_user' ?
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>
>> I did just testing
>> --removed a guest user from the pubs database and run backup command
>> backup database pubs to disk='c:\pubs2.bak'
>> go
>> --went to EM and create a guest account
>> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
>> MOVE 'pubs' TO 'c:\pubs2.mdf',
>> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>>
>> It worked without errors
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in
>> Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next
>> step in my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted
>> sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and
>> restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving
>> an error
>> message?
>> Thanks,
>> Darius
>>
>>
>>
>>
>|||Yep, I was reading just this explanation and must admit that its a little
bit confused
RESTORE command
Permissions
If the database being restored does not exist, the user must have CREATE
DATABASE permissions to be able to execute RESTORE. If the database exists,
RESTORE permissions default to members of the sysadmin and dbcreator fixed
server roles and the owner (dbo) of the database.
"Sabotage" <nospam> wrote in message
news:Owlhx7ttGHA.1536@.TK2MSFTNGP02.phx.gbl...
> db_creator fixed server role is granted to execute several statement
> permissions as CREATE DATABASE, ALTER DATABASE, DROP DATABASE, RESTORE
> DATABASE and few others, so I think it's not the case...
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:Opo56xttGHA.4968@.TK2MSFTNGP03.phx.gbl...
>> Wait, wait, if the database does not exist on the server the user needs
>> CREATE DATABASE permission , which means that your user does not have it
>> in this case.
>> Cannot test it on SP4 , right now I'm having only SP3
>>
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:OQ7MFtttGHA.3392@.TK2MSFTNGP04.phx.gbl...
>> My script needs to restore the database and to overwrite it if one
>> exists already. But I receive an error in both cases (SQL Server 2000
>> SP4). Have you tried to restore if the database does not exist?
>> D.
>>
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:ef$p8kttGHA.1808@.TK2MSFTNGP06.phx.gbl...
>> Hi
>> If the database being restoring is aleady exist the member of the
>> dbcreator is available to run restore command
>> I did successfuly restored the database by using an user who's memebr
>> of dbcreator role ONLY
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:OX9mAYttGHA.1512@.TK2MSFTNGP03.phx.gbl...
>> Hi Uri,
>> Yes, I want to use DK_user, which has dbcreator server role, but is
>> not sysadmin (sorry, I haven't made myself clear enough in the
>> previous post). It woks fine when you restore with a user which has
>> got sysadmin role. But in my case DK_user has dbcreator role only.
>> It's quite weird behaviour, as after restore DK_user becomes the owner
>> of pubs1 database, but is not allowed to access it:
>> use pubs1
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs1'.
>> Darius
>> "Uri Dimant" <urid@.iscar.co.il> wrote in message
>> news:OjDX2frtGHA.5044@.TK2MSFTNGP05.phx.gbl...
>> Hi
>> D you have the use 'DK_user' ?
>>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>
>> I did just testing
>> --removed a guest user from the pubs database and run backup command
>> backup database pubs to disk='c:\pubs2.bak'
>> go
>> --went to EM and create a guest account
>> restore database pubs1 from disk ='c:\pubs2.bak' WITH REPLACE,
>> MOVE 'pubs' TO 'c:\pubs2.mdf',
>> MOVE 'pubs_log' TO 'c:\pubs_Log2.LDF'
>>
>> It worked without errors
>>
>>
>> "Sabotage" <nospam> wrote in message
>> news:uTew%23HktGHA.2392@.TK2MSFTNGP05.phx.gbl...
>>> Hello,
>>>
>>> I need to restore a database from backup, which has no guest account
>>> specified. Sql user which executes the following statement is in
>>> Database
>>> Creators server role:
>>>
>>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>>> WITH REPLACE,
>>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>>> Server\MSSQL\data\pubs.mdf',
>>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>>> Server\MSSQL\data\pubs_log.ldf'
>>>
>>> The message I receive is:
>>>
>>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>>> Server: Msg 916, Level 14, State 1, Line 1
>>> Server user 'DK_user' is not a valid user in database 'pubs'.
>>> Server: Msg 3013, Level 16, State 1, Line 1
>>> RESTORE DATABASE is terminating abnormally.
>>>
>>> The database is actually restored and I could proceed to the next
>>> step in my
>>> script, but @.@.error <> 0 which is not what I want to see. I can not
>>> create
>>> 'guest' account in the db backup as it is provided by the other
>>> department
>>> and the user who is restoring the database can not be granted
>>> sysadmin
>>> permissions.
>>>
>>> If I create 'guest' account in 'pubs' database, backup it and
>>> restore,
>>> everything works fine
>>>
>>> Has anybody got ideas how to restore the database without receiving
>>> an error
>>> message?
>>>
>>> Thanks,
>>> Darius
>>>
>>
>>
>>
>>
>>
>|||Sabotage wrote:
> Hello,
> I need to restore a database from backup, which has no guest account
> specified. Sql user which executes the following statement is in Database
> Creators server role:
> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
> WITH REPLACE,
> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL Server\MSSQL\data\pubs.mdf',
> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
> Server\MSSQL\data\pubs_log.ldf'
> The message I receive is:
> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
> Server: Msg 916, Level 14, State 1, Line 1
> Server user 'DK_user' is not a valid user in database 'pubs'.
> Server: Msg 3013, Level 16, State 1, Line 1
> RESTORE DATABASE is terminating abnormally.
> The database is actually restored and I could proceed to the next step in my
> script, but @.@.error <> 0 which is not what I want to see. I can not create
> 'guest' account in the db backup as it is provided by the other department
> and the user who is restoring the database can not be granted sysadmin
> permissions.
> If I create 'guest' account in 'pubs' database, backup it and restore,
> everything works fine
> Has anybody got ideas how to restore the database without receiving an error
> message?
> Thanks,
> Darius
>
I think the problem is that 'DK_User' is defined as a user in the
"source" database (the database that the backup was created from), but
has a different SID than 'DK_User' on your "restore" server. Do a
Google search for "sql server orphaned users" for information on how to
transfer a login from one server to another while retaining the original
SID.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Tracy,
no, DK_user is not defined in the "source" database. Only "sa" user is
defined in the backuped database. It's not the case with orphaned users.
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:%23b$fwNwtGHA.4928@.TK2MSFTNGP04.phx.gbl...
> Sabotage wrote:
>> Hello,
>> I need to restore a database from backup, which has no guest account
>> specified. Sql user which executes the following statement is in Database
>> Creators server role:
>> RESTORE DATABASE pubs FROM DISK = 'C:\Temp\pubs_full.BAK'
>> WITH REPLACE,
>> MOVE 'pubs' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs.mdf',
>> MOVE 'pubs_log' TO 'C:\Program Files\Microsoft SQL
>> Server\MSSQL\data\pubs_log.ldf'
>> The message I receive is:
>> Processed 208 pages for database 'pubs', file 'pubs' on file 1.
>> Processed 1 pages for database 'pubs', file 'pubs_log' on file 1.
>> Server: Msg 916, Level 14, State 1, Line 1
>> Server user 'DK_user' is not a valid user in database 'pubs'.
>> Server: Msg 3013, Level 16, State 1, Line 1
>> RESTORE DATABASE is terminating abnormally.
>> The database is actually restored and I could proceed to the next step in
>> my
>> script, but @.@.error <> 0 which is not what I want to see. I can not
>> create
>> 'guest' account in the db backup as it is provided by the other
>> department
>> and the user who is restoring the database can not be granted sysadmin
>> permissions.
>> If I create 'guest' account in 'pubs' database, backup it and restore,
>> everything works fine
>> Has anybody got ideas how to restore the database without receiving an
>> error
>> message?
>> Thanks,
>> Darius
> I think the problem is that 'DK_User' is defined as a user in the "source"
> database (the database that the backup was created from), but has a
> different SID than 'DK_User' on your "restore" server. Do a Google search
> for "sql server orphaned users" for information on how to transfer a login
> from one server to another while retaining the original SID.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com