SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Model DB


Model DB

Author
Message
Hugo Kornelis
Hugo Kornelis
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11066 Visits: 12000
Interesting find, Jason. I missed my point because I believed Books Online. The only small critisism (sp?) I have on this question is the incorrect use of uppercase ("MODEL" instead of "model"), which will cause errors on a server with a case sensitive collation.

UMG's comment is not entirely correct. SQL Server does nog ignore the READ_ONLY property in model; it just does not propagate it to the new database. Try createing a table in model after setting it to READ_ONLY; you'll see that this fails.

It does of course make sense that the READ_ONLY property won't propagate. After all, creating a database involves writing by itself! And I can also see the value in using READ_ONLY to protect from accidental changes to the model database.

It's just a big shame that the description in Books Online is completely wrong!


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Daniel Bowlin
Daniel Bowlin
SSCarpal Tunnel
SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)SSCarpal Tunnel (4.1K reputation)

Group: General Forum Members
Points: 4120 Visits: 2629
I love QOTD. Whether I get them right or I get them wrong, I pretty much always learn something. Thanks for an interesting question.
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32591 Visits: 18557
Hugo Kornelis (6/10/2010)
Interesting find, Jason. I missed my point because I believed Books Online. The only small critisism (sp?) I have on this question is the incorrect use of uppercase ("MODEL" instead of "model"), which will cause errors on a server with a case sensitive collation.

UMG's comment is not entirely correct. SQL Server does nog ignore the READ_ONLY property in model; it just does not propagate it to the new database. Try createing a table in model after setting it to READ_ONLY; you'll see that this fails.

It does of course make sense that the READ_ONLY property won't propagate. After all, creating a database involves writing by itself! And I can also see the value in using READ_ONLY to protect from accidental changes to the model database.

It's just a big shame that the description in Books Online is completely wrong!


Thanks Hugo. Also, thanks for correcting the case. I think the BOL description should be updated. It is still possible to interpret the findings of this test as supporting BOL (if you stretch it a bit). Think about it, you can set model to READ_ONLY however you can't enforce that setting on a new DB - which makes it appear that the setting is indeed not in effect on model.

However, I will have to investigate a bit further due to the behavior of the wizard. I need to see if I can duplicate the results of michael.kaufmann.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32591 Visits: 18557
stewartc-708166 (6/10/2010)
Good question.
I found the inconsistency with BOL interesting.
Thanks


Thanks



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

DavidSimpson
DavidSimpson
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1152 Visits: 1077
Good question which I missed because I thought that the model db could not be set to Read_only... very interesting. A good start to the day when you learn something new. As Hugo points out, though, it makes sense because there is value to set the model to read only to protect it from accidental changes once you have it set like you want.

David



SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32591 Visits: 18557
DavidSimpson (6/10/2010)
Good question which I missed because I thought that the model db could not be set to Read_only... very interesting. A good start to the day when you learn something new. As Hugo points out, though, it makes sense because there is value to set the model to read only to protect it from accidental changes once you have it set like you want.

David


Thanks



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

johnf_amic
johnf_amic
SSC-Addicted
SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)SSC-Addicted (420 reputation)

Group: General Forum Members
Points: 420 Visits: 277
I got 3 out of 4 right. Don't I get partial credit? :-D
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32591 Visits: 18557
johnf_amic (6/10/2010)
I got 3 out of 4 right. Don't I get partial credit? :-D


You did. You got .75 pts and then it is rounded down for your final score. ;-)



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

paul.knibbs
paul.knibbs
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2561 Visits: 6232
Mark me down as another believer in what Books Online said...I assumed that when it said the model database couldn't be set READ_ONLY that SQL would, you know, actually give you some sort of error when you tried it!

Having said that, it's kind of an odd restriction anyway. The contents of the model database are copied to create a new database--what part of that would be broken if the model database actually WERE read only?
Michael Poppers
Michael Poppers
SSC Eights!
SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)SSC Eights! (829 reputation)

Group: General Forum Members
Points: 829 Visits: 416
CirquedeSQLeil (6/9/2010)
Thanks. True - BOL does state that the MODEL DB cannot be set to ReadOnly, that's why I found this to be an interesting behavior.

Agreed. Good QotD, Jason!

Thanks for pointing out the DB name too.

The radiogroup choice still says "TestA" -- if the proper database name had been listed, I would have chosen it and, by virtue of then receiving FLOOR(0.75) credit, would have missed my QotD point! :-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search