Showing posts with label update. Show all posts
Showing posts with label update. Show all posts

Friday, March 30, 2012

Puzzled by concurrent update

I have a puzzle in my mind here. I will thank anyone who can solve my puzzle.

I am not familiar with SQL and its theories behind, so please bear with me if I am asking a stupid newbie question.

My puzzle is generally a problem of generating sequence numbers. The following SQL is only a stripped down version - it fetches the max number, add 1 to it and updates the table with the new number.

DECLARE @.max int

SELECT @.max = MAX(next_number) + 1 from sequence_numbers

UPDATE sequence_numbers SET next_number = @.max WHERE next_number = @.max

Now if user1 gets 100 and user2 also gets 100 and they both try to update the table, what would happen? I fear that the result would be 101.

One of my coworker thinks that adding 'WHERE next_number = @.max' can solve the conflict - user2 will fail. His reasoning is like this:

After user1 updates the table, next_number would be 101 and user2's update will fail because his WHERE criteria is still 100.

But I think user2 still sees the old data (100) and still succeeds and thus both users update the table with number 101.

Thanks.

If you want to use a sequence table, you have to lock this table during the update. I wouldn′t use separate statement though the thing that you described first will happen.

You should either do that within a transaction while locking the table or do it within one statement using locking mechanism and queying this with your update statement:

UPDATE sequence_numbers
SET next_number =
( SELECT MAX(next_number) + 1 from sequence_numbers (TABLOCK) )

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Hi Neo,

One of the cruical components of DBMS(Database Management System) is the concurrency control (CC) subsytem. It ensures that concurrent execution of transactions against DB doesn't violate the consistency of the database. While the transactions execute concurrently in real, the CC component ensures that the database state is AS IF THEY EXECUTED SEQUENTIALLY.
In two words, the server "locks" rows that some transaction modifies in order to prevent others from reading/writing those rows, until the first transaction commits.
If you need serious understanding about how all this works, open books online, and look for concurrency control. There's a lot of material there, from concurrency control basics up to some advanced issues.
About your co-workers explanation: Imagine that the updates are done not in form "where next_number=@.max" but "where row_id=something". By the model proposed by your friend, this update will succeed, because the first update hasn't modified the row_id. In fact it doesn't-the explanation is wrong.

To Jens: I guess that under default serializability level, that is, read commited, second update just cannot read the modified rows, because they will be locked with EXCLUSIVE lock, which blocks any reading transactions. If the first transaction reads data(read lock), the second one reads(read lock), then both will be denied an exclusive access to the rows needed to update(this is a deadlock).

In either case the execution will be serializable, and there is no need for a TABLOCK, there is no need for explicit locking. Please correct me if I am wrong.

|||

I looked thru SQL BOL on Concurrency Control. But reading those technical explanation does not lead me to solve my puzzle. Can anyone explain more to me or direct to some 'newbie' level articles on CC (if such articles exist)? Thanks.

|||

You need to use a locking hint to single thread access to the table. There is a good article here: http://blogs.msdn.com/sqlcat/archive/2006/04/10/572848.aspx from the Microsoft SQL Server Development Customer Advisory Team.

You have the basics, and the rest is covered in that article.

|||

I read the blog, but it does not answer my problem.

Option 1 is only for 'low volume' - how low? Does 'low 'mean that if it is used in higher volum there will be concurrent issues, such as two users get duplicate seq number?

Option 2 is not very pratical.

|||

The tablock was useless, you are right, I was thinking one step further, updating the sequence table (if that would be the requirement) to ensure that nobody else will query meanwhile the sequence table. I saw that this was not a requirement, changed the query and forgot about the tablock.

To the original poster: if you don′t want to reset (pushing the sequence number one step further) you can use the update with the inline select, that should do the trick.

No deadlock will occur if two are using the same update command, because the only locked table will be the updated one. After this is not released the Select statement won′t take place.


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

The problem with the first action is that you have to single thread access to the table of sequence numbers in a manner that will be slower than using an identity column. You will not get duplicates, but every user will have to wait.

The biggest problem comes in that when you lock the row to get the max, it has to stay locked until you do the update. But, what if this transaction is part of a greater transaction. Then all processes have to wait until the whole transaction completes because the UPDATE operation causes an exclusive lock that keeps the next user from asking for the max (to avoid dups).

Option 2 beats that by using INSERT operations with identity values that do not block one another and do not require an EXCLUSIVE lock that will block other rows from inserting with the next new value. You can get gaps if transactions are rolled back, but it will work nicely.

The second option can be done with very little work just like the first, though it will look messier.

|||

Thanks for all your replies. They are useful to me.

But how about my original question. Will the two users both succeed in updating (note tha next_number = @.max criteria)?

|||

You can use the TSQL update extension like:

UPDATE sequence_numbers

SET @.max = next_number = next_number + 1

WHERE name = @.blah

The above increments next_number by one and assigns the final result to max in one statement. There is no concurrency issue and the statement itself is serialized due to the exclusive lock on the table or row.

You code doesn't serialize access to getting current maximum number so it will not work.

Wednesday, March 28, 2012

put inserted value into a parameter in a trigger

How would i get the value of a field that i just inserted and put that into a parameter, so that i could update another table.

This is the code that i used in the trigger that did not work:
@.field1 = select srcfield1 from inserted

Anyway here is the full code:

CREATE TABLE Source (srcID int IDENTITY, srcField1 nvarchar(50))
CREATE TABLE Destination (destID int IDENTITY, destField1 nvarchar(50))
go

CREATE TRIGGER tr_SourceInsert ON [dbo].[Source]
FOR INSERT
@.Field nvarchar(50) output
AS
SELECT @.Field1 = SELECT Field1 FROM inserted
UPDATE Destination
SET Field1 = @.Field
where destID = '1'
go

INSERT Source(srcfield1) VALUES ('A')
goBased on your sample, there are no rows in the destination table. There couldn't be anything to update.

Just FYI, you appear to be taking a "one row" approach to your trigger, This will fail the first time you insert multiple rows into the source table using a single SQL statement.

If you explain a bit more about what you are trying to do, I'd bet that someone here can help you, but I don't understand well enough to be much help yet.

-PatP|||Okay, i forgot the line of sql that inserted a row into the DESTINATION table. Here it is data in it.
INSERT Source(srcfield1) VALUES ('1')

And i got the trigger to work by changing the code to:
SELECT @.field1 = srcField1 from inserted

How would i change this to take a 'multiple row' that you refer to.

thanks.|||To allow for multiple row inserts, you'd do something like:CREATE TABLE Source (srcID int IDENTITY, srcField1 nvarchar(50))
GO

CREATE TABLE Destination (destID int IDENTITY, destField1 nvarchar(50))
go

CREATE TRIGGER tr_SourceInsert ON [dbo].[Source]
FOR INSERT AS

UPDATE d
SET d.Field1 = i.Field1
FROM inserted AS i
JOIN destination AS d
ON d.destID = '1'

RETURN
GO

INSERT Source(srcfield1) VALUES ('1')
GO

INSERT Source(srcfield1) VALUES ('A')
GOThis code still seems suspect for a trigger, since I can't fathom why you would always want to update the destination table this way. There may be a reason for it, but I'm skeptical.

-PatP

Monday, March 26, 2012

Push subscription: "schema and data"

If I make a database-structure change on the Publisher, will the structure
change replicate to the Subscriber (and update the structure there) ?
When pushing a new subscription, the wizard prompts if you would like to
push schema and data. Does 'schema' mean ... the database structure?
Thank you,
Bob
Use the sp_repladcolumn and sp_repldropcolumn stored procedures to replicate
schema changes for existing publications with subscriptions.
When you get the message - push schema and data, the schema does refer to
the table (and other objects) creation scripts - or as you put it database
structure.
"Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
news:eHTYxKGaEHA.3708@.TK2MSFTNGP10.phx.gbl...
> If I make a database-structure change on the Publisher, will the structure
> change replicate to the Subscriber (and update the structure there) ?
> When pushing a new subscription, the wizard prompts if you would like to
> push schema and data. Does 'schema' mean ... the database structure?
> Thank you,
> Bob
>
|||Thank you very much.
Just so that I am very clear, if I had made a manual change to the database
(not using the sp's you have pointed out) and I push out the subscription
without the database and schema because there is an existing database, then
the structure change would NOT replicate. Is this correct?
Thank you.
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:OTqXliGaEHA.2516@.TK2MSFTNGP10.phx.gbl...
> Use the sp_repladcolumn and sp_repldropcolumn stored procedures to
replicate[vbcol=seagreen]
> schema changes for existing publications with subscriptions.
> When you get the message - push schema and data, the schema does refer to
> the table (and other objects) creation scripts - or as you put it database
> structure.
> "Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
> news:eHTYxKGaEHA.3708@.TK2MSFTNGP10.phx.gbl...
structure
>
|||its hard to tell what you mean.
If you make a schema change, and then create a publication and push it to a
subscription, yet the subscribers will get the schema change.
If you attempt to make a schema change to an existing publication and
subscription(s) you will be prevented from doing with an error message like
'This table is published for replication'.
The only way to do this is using the above mentioned replication stored
procedures.
"Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
news:ei7Tb4GaEHA.2488@.tk2msftngp13.phx.gbl...
> Thank you very much.
> Just so that I am very clear, if I had made a manual change to the
database
> (not using the sp's you have pointed out) and I push out the subscription
> without the database and schema because there is an existing database,
then[vbcol=seagreen]
> the structure change would NOT replicate. Is this correct?
> Thank you.
>
>
> "Hilary Cotter" <hilaryk@.att.net> wrote in message
> news:OTqXliGaEHA.2516@.TK2MSFTNGP10.phx.gbl...
> replicate
to[vbcol=seagreen]
database[vbcol=seagreen]
> structure
to
>
|||The situation is this:
I had to delete my publication in order to make a database structure change
at the publisher ( I did get the error you mention).
I then re-created my publication and pushed a new subscription to my
subscriber. But I did not "check" the box to send schema and data.
So my subscriber indeed does not have the database change. This appears to
be my problem.
In the future it would appear I have three options:
1) update the databases at both the publisher and the subscriber.
Indicate that the schema and data do not have to be sent when pushing a new
subscription.
2) update the publisher and push the new database structure along with
the data, with the new subscription (which may take a while over the
Internet)
3) Just use those stored procedures and I am done!
Would you agree? Looks like I'll take curtain number 3...
thank you very much for your time and patience,
bob.
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:%23gb6XBHaEHA.1488@.TK2MSFTNGP09.phx.gbl...
> its hard to tell what you mean.
> If you make a schema change, and then create a publication and push it to
a
> subscription, yet the subscribers will get the schema change.
> If you attempt to make a schema change to an existing publication and
> subscription(s) you will be prevented from doing with an error message
like[vbcol=seagreen]
> 'This table is published for replication'.
> The only way to do this is using the above mentioned replication stored
> procedures.
> "Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
> news:ei7Tb4GaEHA.2488@.tk2msftngp13.phx.gbl...
> database
subscription[vbcol=seagreen]
> then
> to
> database
?[vbcol=seagreen]
like[vbcol=seagreen]
> to
structure?
>
|||yes, I would try option 3.
It seems to me that in the past #3 has bitten me in certain situation like
when you have filters, but I have been able to repro it.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Robert A. DiFrancesco" <bob.difrancesco@.comcash.com> wrote in message
news:OLSBwMHaEHA.1448@.TK2MSFTNGP12.phx.gbl...
> The situation is this:
> I had to delete my publication in order to make a database structure
change
> at the publisher ( I did get the error you mention).
> I then re-created my publication and pushed a new subscription to my
> subscriber. But I did not "check" the box to send schema and data.
> So my subscriber indeed does not have the database change. This appears
to
> be my problem.
> In the future it would appear I have three options:
> 1) update the databases at both the publisher and the subscriber.
> Indicate that the schema and data do not have to be sent when pushing a
new[vbcol=seagreen]
> subscription.
> 2) update the publisher and push the new database structure along with
> the data, with the new subscription (which may take a while over the
> Internet)
> 3) Just use those stored procedures and I am done!
> Would you agree? Looks like I'll take curtain number 3...
> thank you very much for your time and patience,
> bob.
>
>
> "Hilary Cotter" <hilaryk@.att.net> wrote in message
> news:%23gb6XBHaEHA.1488@.TK2MSFTNGP09.phx.gbl...
to[vbcol=seagreen]
> a
> like
> subscription
refer[vbcol=seagreen]
message[vbcol=seagreen]
there)
> ?
> like
> structure?
>

Tuesday, March 20, 2012

Pulling data from shared drives

I am trying to update and pull data from a table on an
Access database that is located on a shared Novell drive.
When I run the DTS package there is no problem. When I
run the DTS Package through a scheduled job, the job
fails. I keep the SQL Server logged in as "Administrator"
so it keeps the shared drive while the job is running.
Still the job fails. Does any one know why this happens?SQL cannot see the mapped drive since it is running under a service account.
Make sure you use UNC names and that the service account for SQL has
permissions to access the network location. If you run SQL under
localsystem it cannot access network resources such as remote file shares.
--
Geoff N. Hiten
SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Mike" <mmather@.semprautilities.com> wrote in message
news:106701c3724a$a8d47c70$a601280a@.phx.gbl...
> I am trying to update and pull data from a table on an
> Access database that is located on a shared Novell drive.
> When I run the DTS package there is no problem. When I
> run the DTS Package through a scheduled job, the job
> fails. I keep the SQL Server logged in as "Administrator"
> so it keeps the shared drive while the job is running.
> Still the job fails. Does any one know why this happens?|||Mike,
When the job is being run, it uses the account under which sqlagent runs.
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Mike" <mmather@.semprautilities.com> wrote in message
news:106701c3724a$a8d47c70$a601280a@.phx.gbl...
> I am trying to update and pull data from a table on an
> Access database that is located on a shared Novell drive.
> When I run the DTS package there is no problem. When I
> run the DTS Package through a scheduled job, the job
> fails. I keep the SQL Server logged in as "Administrator"
> so it keeps the shared drive while the job is running.
> Still the job fails. Does any one know why this happens?|||More details here..
INF: How to Run a DTS Package as a Scheduled Job
http://support.microsoft.com/default.aspx?scid=kb;en-us;269074
--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com
"Dinesh.T.K" <tkdinesh@.nospam.mail.tkdinesh.com> wrote in message
news:OKX3awkcDHA.356@.TK2MSFTNGP11.phx.gbl...
> Mike,
> When the job is being run, it uses the account under which sqlagent runs.
> --
> Dinesh.
> SQL Server FAQ at
> http://www.tkdinesh.com
> "Mike" <mmather@.semprautilities.com> wrote in message
> news:106701c3724a$a8d47c70$a601280a@.phx.gbl...
> > I am trying to update and pull data from a table on an
> > Access database that is located on a shared Novell drive.
> > When I run the DTS package there is no problem. When I
> > run the DTS Package through a scheduled job, the job
> > fails. I keep the SQL Server logged in as "Administrator"
> > so it keeps the shared drive while the job is running.
> > Still the job fails. Does any one know why this happens?
>|||Thank you for your help
>--Original Message--
>SQL cannot see the mapped drive since it is running under
a service account.
>Make sure you use UNC names and that the service account
for SQL has
>permissions to access the network location. If you run
SQL under
>localsystem it cannot access network resources such as
remote file shares.
>--
>Geoff N. Hiten
>SQL Server MVP
>Senior Database Administrator
>Careerbuilder.com
>
>
>"Mike" <mmather@.semprautilities.com> wrote in message
>news:106701c3724a$a8d47c70$a601280a@.phx.gbl...
>> I am trying to update and pull data from a table on an
>> Access database that is located on a shared Novell
drive.
>> When I run the DTS package there is no problem. When I
>> run the DTS Package through a scheduled job, the job
>> fails. I keep the SQL Server logged in
as "Administrator"
>> so it keeps the shared drive while the job is running.
>> Still the job fails. Does any one know why this
happens?
>
>.
>

Monday, March 12, 2012

Pull Subscription Continues to Run Indefinitely

I have a publication that is being pulled and when I execute a UPDATE command
example: UPDATE Oils SET Description = 'This is a description'
The SQL Query Analyzer completes the command successfully.
I am receiving confirmation that more than 30,0000 rows have been updated
when I run this command.
When I go to the Replication Manager and view the Subscription it continues
to run indefinitely.
In some cases more than 8 hrs.
Are there some parameters that might need to be set when running this
process?
Any feedback is appreciated.
Thank you
open up profiler on the subscriber and see if there is any activity from the
replication process.
"BSandia" <BSandia@.discussions.microsoft.com> wrote in message
news:2B137D55-AD5A-4E61-9D77-9CB0DDF5C1B9@.microsoft.com...
>I have a publication that is being pulled and when I execute a UPDATE
>command
> example: UPDATE Oils SET Description = 'This is a description'
> The SQL Query Analyzer completes the command successfully.
> I am receiving confirmation that more than 30,0000 rows have been updated
> when I run this command.
> When I go to the Replication Manager and view the Subscription it
> continues
> to run indefinitely.
> In some cases more than 8 hrs.
> Are there some parameters that might need to be set when running this
> process?
> Any feedback is appreciated.
> Thank you
>
>
>
|||There are several optimization techniques for transactional replication one
half is to create a new distribution agent profile with a lower amount of
transactions set per commit, and the second half is to add [-MaxCmdsInTran
10000] to the log reader agent where 10000 is the maximum number of commands
per transaction. With this switch added to the execution command in the
actual log reader agent you will only send 10000 commands down the
replication pipe per transaction. The combination of these two performance
enhancements will reduce that 8 hour run to quite a bit smaller.
"BSandia" wrote:

> I have a publication that is being pulled and when I execute a UPDATE command
> example: UPDATE Oils SET Description = 'This is a description'
> The SQL Query Analyzer completes the command successfully.
> I am receiving confirmation that more than 30,0000 rows have been updated
> when I run this command.
> When I go to the Replication Manager and view the Subscription it continues
> to run indefinitely.
> In some cases more than 8 hrs.
> Are there some parameters that might need to be set when running this
> process?
> Any feedback is appreciated.
> Thank you
>
>
>
|||Thank you for your responsive posts I will give them a try.
Brett
"Richard S. Hale" wrote:
[vbcol=seagreen]
> There are several optimization techniques for transactional replication one
> half is to create a new distribution agent profile with a lower amount of
> transactions set per commit, and the second half is to add [-MaxCmdsInTran
> 10000] to the log reader agent where 10000 is the maximum number of commands
> per transaction. With this switch added to the execution command in the
> actual log reader agent you will only send 10000 commands down the
> replication pipe per transaction. The combination of these two performance
> enhancements will reduce that 8 hour run to quite a bit smaller.
> "BSandia" wrote:

Monday, February 20, 2012

Public Role for SQL 2000

For SQL 2000, I see that the Public role has some privileges like SELECT,
UPDATE, DELETE, & EXECUTE, permissions for some User's database objects
(Tables, views, &Stored procedures .)
Is that a security concern?
What will happen if I remove these privileges or revoke them?
Will that effect the rest of the users?
I read many threads on the internet, but no one could tell me the answers
for the 3 questions above.
Thanks in advance.wit1 (wit1@.hotmail.com) writes:
> For SQL 2000, I see that the Public role has some privileges like SELECT,
> UPDATE, DELETE, & EXECUTE, permissions for some User's database objects
> (Tables, views, &Stored procedures .)
That is not the default.

> Is that a security concern?
It does not sound like the best security to me.

> What will happen if I remove these privileges or revoke them?
Impossible to tell as it depends on the application using the database.

> Will that effect the rest of the users?
Again, that depends on the application using the database.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi, I too have same questions.
I tried to drop this public role but not able to drop.
I tried to Revoke Select permission but not able to do that. It is not
giving any error but not working as expected. Any urgent reply will be
gratly appreciated.
Thank,
Tushar Vaja
"wit1" <wit1@.hotmail.com> wrote in message
news:%23DBcPkqiHHA.1244@.TK2MSFTNGP04.phx.gbl...
> For SQL 2000, I see that the Public role has some privileges like SELECT,
> UPDATE, DELETE, & EXECUTE, permissions for some User's database objects
> (Tables, views, &Stored procedures .)
>
> Is that a security concern?
> What will happen if I remove these privileges or revoke them?
> Will that effect the rest of the users?
>
> I read many threads on the internet, but no one could tell me the answers
> for the 3 questions above.
> Thanks in advance.
>
>|||> Hi, I too have same questions.
> I tried to drop this public role but not able to drop.
> I tried to Revoke Select permission but not able to do that. It is not
> giving any error but not working as expected. Any urgent reply will be
> gratly appreciated.
> Thank,
> Tushar Vaja
>
> "wit1" <wit1@.hotmail.com> wrote in message
> news:%23DBcPkqiHHA.1244@.TK2MSFTNGP04.phx.gbl...
>|||Tushar (tushar_vaja@.yahoo.co.in) writes:
> I tried to drop this public role but not able to drop.
> I tried to Revoke Select permission but not able to do that. It is not
> giving any error but not working as expected. Any urgent reply will be
> gratly appreciated.
You could try DENY, but since everyone is in public, this could have
the undesired effect that no one can access anything.
But maybe there is some misunderstanding? Could you clarify more precisely
what tables that are accessible to users who should not get there?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi, thanks for reply. My problem is below:
Whenever user run my exe on his system, my app will create two DB on his
local system. 1 DB contain general info and second DB contain some very
confidenmt info. Now i do not want user(the person who has installed my app)
to access the second DB but he can access 1st DB if he wants.
I do not knwo how to implemet this thing. Please help.
"Erland Sommarskog" <esquel@.sommarskog.se> wrote in message
news:Xns99337CC774783Yazorman@.127.0.0.1...
> Tushar (tushar_vaja@.yahoo.co.in) writes:
> You could try DENY, but since everyone is in public, this could have
> the undesired effect that no one can access anything.
> But maybe there is some misunderstanding? Could you clarify more precisely
> what tables that are accessible to users who should not get there?
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||Tushar (tushar_vaja@.yahoo.co.in) writes:
> Whenever user run my exe on his system, my app will create two DB on his
> local system. 1 DB contain general info and second DB contain some very
> confidenmt info. Now i do not want user(the person who has installed my
> app) to access the second DB but he can access 1st DB if he wants. I do
> not knwo how to implemet this thing. Please help.
Presumably the user who installed the application will have admin rights
on the machine, and you cannot hide anything from an administrator.
You can of course, store the data in the database encrypted, and then
your application could decrypt the data as needed. But since the
application would have to hide the encryption key somewhere, it's not
safe from a user who is dead set from accessing the data, but at least
it protects you from the stray wanderer.
In any case, you need to cover this situation in the license agreement,
and explicitly say that disclosing the data in the database is not
permitted.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi,
The following excerpt is taken from Chapter 5 - Microsoft SQL Server 2000
Security of Microsoft SQL Server 2000 Administrator's Pocket Consultant (ISB
N
0-7356-1129-7):
public is the default role for all database users. Users inherit the
permissions and privileges of the public role, and this role represents
their minimum permissions and privileges. Any role that you assign to a
user, beyond the public role, add permissions and privileges. If you want
all database users to have specific permissions, assign the permissions to
the public role.
The following excerpt is taken from Chapter 8 - Managing SQL Serer 2005
Security of Microsoft SQL Server 2005 Administrator's Pocket Consultant:
The guest user is a special user that you can add to a database to allow
anyone with a valid SQL Server login to access the database... Before using
the guest user, you should not the following information about the account:
The guest user is a member of the public server role and inherits the
permissions of this role.
The guest user must exist in a database before anyone can access it as a
guest.
The guest user is used only when a user account has access to SQL Server
but does not have access to the database through this user account.
Other topics around public server role that may be of interest include:
http://www.microsoft.com/technet/pr...in/sqlops3.mspx
http://www.microsoft.com/technet/pr...n/sp3sec01.mspx
http://www.microsoft.com/technet/pr...ploy/mysql.mspx
10 Steps to help Secure SQL Server 2000
https://www.microsoft.com/sql/prodi...n/sp3sec04.mspx
SQL Server 2000 SP3 Security Features and Best Practices: Implementation of
Server Level Security and Object Level Security
http://www.microsoft.com/technet/pr...n/sp3sec02.mspx
SQL Server 2005 (BOL) - Security Considerations for a SQL Server Installatio
n
http://msdn2.microsoft.com/en-us/library/ms144228.aspx
Regards,
Keith Wilson
Disclaimer: this posting is provided "as is" without implied or express
warranties.
"Tushar" wrote:

>
>