I've been trying to figure out why SQL Server has db_owner
schema and db_owner
role? This is very confusing. I've been searching for answers and so far this is how my understanding goes:
DBO
being the default schema.If any of this is incorrect let me know. But I think so far so good. Now my questions are:
db_owner
schema as seen in "Database User" dialog box of SQL Server Management Studio? And on the same dialog, you define the "Default Schema" as dbo
. Why aren't the two the same? If by default SQL Server uses dbo
to create all objects under, what use is db_owner
?db_accessadmin
give you?db_owner
schema and db_accessadmin
schema? In other words does anyone legitimately use those schemas?A schema in a SQL database is a collection of logical structures of data. The schema is owned by a database user and has the same name as the database user. From SQL Server 2005, a schema is an independent entity (container of objects) different from the user who creates that object.
A SQL schema is a useful database concept. It helps us to create a logical grouping of objects such as tables, stored procedures, and functions.
A role is a privelege group, whereas a User is a person or Active Directory group. For example, an AD group "IT_Developers" may have Writer access to a database, but the AD group "Domain Administrators" aren't neccessarily admins on the database.
A SQL Server schema is simply container of objects, such as tables, stored procedures, etc. A Database Role is a group of principals, such as windows logins, sql server users, etc.
The idea is you can have a role of say "IT", and have all IT users under that role. Then you have can a schema called "IT", and have all tables that belong to IT under that. Out of the box SQL Server creates matching schemas for each default user and role in the database, but I think the intention is you customize this to match the needs of your organization.
This article has more information on the differences between owners and schemas. This question on Stack Overflow may also be useful.
I am quoting the below from the following link.
https://msdn.microsoft.com/en-us/library/bb669061(v=vs.110).aspx
SQL Server ships with ten pre-defined schemas that have the same names as the built-in database users and roles. These exist mainly for backward compatibility. You can drop the schemas that have the same names as the fixed database roles if you do not need them. You cannot drop the following schemas:
dbo
guest
sys
INFORMATION_SCHEMA
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With