HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Over use/correct use of schemas?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
useovercorrectschemas

Problem

Having asked This question on Stackoverflow, I wondered where what I have done is correct/best practise.

Basically, every object that I create is going into a schema with the schema name reflecting a usage. For example, I have the schemas Audit and Admin (amongst others).

This in turn leaves no objects in dbo. Is this ok? Is there anything else that I need to do?

Solution

Schemas are not only a great security tool (which is reason enough to use them), but they are also perfect for logical separation. And it seems as though this is what you are practicing.

Even if the current requirement doesn't need special security, say down the road all of the database objects that are related to Auditing should be secure to a database role. If these objects were scattered throughout the dbo schema, then you would have to explicitly deny permissions on the individual objects. But with the Audit schema, you do a single deny and you're set.

I personally practice the use of schemas. Like all things in databases, though, there is a happy medium. I wouldn't create a schema for each granular aspect of the data layer. There is such thing as too many schemas and separation. But I'm guessing you aren't anywhere close to that.

Context

StackExchange Database Administrators Q#8511, answer score: 14

Revisions (0)

No revisions yet.