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:
- All tables and objects (such as constraints etc) belong to a schema.
DBObeing the default schema. - A user may be given permission to edit each object or the schema. A permission on the schema extends the permission to all objects within that schema. So you don't have to grant permission on each individual object.
- A role groups permissions together for convenience.
If any of this is incorrect let me know. But I think so far so good. Now my questions are:
- What exactly is
db_ownerschema as seen in "Database User" dialog box of SQL Server Management Studio? And on the same dialog, you define the "Default Schema" asdbo. Why aren't the two the same? If by default SQL Server usesdboto create all objects under, what use isdb_owner? - Why would a user want to own a schema? You are assigning permissions/roles already. What does owning
db_accessadmingive you? - Can you give an example of when you create objects under
db_ownerschema anddb_accessadminschema? In other words does anyone legitimately use those schemas?