Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Model DB Expand / Collapse
Author
Message
Posted Thursday, June 10, 2010 2:46 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, September 18, 2014 1:36 PM
Points: 6,002, Visits: 8,267
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
Post #935225
Posted Thursday, June 10, 2010 7:08 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 16, 2014 7:35 AM
Points: 2,817, Visits: 2,563
I love QOTD. Whether I get them right or I get them wrong, I pretty much always learn something. Thanks for an interesting question.
Post #935328
Posted Thursday, June 10, 2010 8:00 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 5:20 PM
Points: 17,600, Visits: 15,462
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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #935362
Posted Thursday, June 10, 2010 8:02 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 5:20 PM
Points: 17,600, Visits: 15,462
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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #935365
Posted Thursday, June 10, 2010 8:07 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, September 8, 2014 1:40 PM
Points: 925, Visits: 999
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



Post #935369
Posted Thursday, June 10, 2010 8:15 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 5:20 PM
Points: 17,600, Visits: 15,462
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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #935377
Posted Thursday, June 10, 2010 8:19 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, August 27, 2014 9:41 AM
Points: 378, Visits: 267
I got 3 out of 4 right. Don't I get partial credit?
Post #935384
Posted Thursday, June 10, 2010 8:23 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 5:20 PM
Points: 17,600, Visits: 15,462
johnf_amic (6/10/2010)
I got 3 out of 4 right. Don't I get partial credit?


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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #935388
Posted Thursday, June 10, 2010 8:29 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 9:52 AM
Points: 1,589, Visits: 5,628
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?
Post #935395
Posted Thursday, June 10, 2010 8:30 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, July 7, 2014 8:58 AM
Points: 654, Visits: 400
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!
Post #935397
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse