Professional Documents
Culture Documents
CROSS-DATABASE CHAINING
EXAMPLE:
•It might occur when we view one database that references a table in
another database.
•The view in the first database refers to a table in the second database.
•If it is about objects in the same database and the same user owns the
table and view,it forms an ownership chain that may need the end user
to access the view.
•The same thing is possible with cross-database ownership chaining but
across the database.
•Cross database ownership chaining can be turned on at either the server
or the database level.
• If the cross database ownership chaining is on at the server level, it is
on for all databases on that server, regardless of the individual database
settings.
• B
y default, the cross database ownership chaining is turned off at server
level.
•For databases which are activated for cross database ownership
chaining, an ownership chain is permitted to cross the database layer.
•The way the ownership chain is determined is similar to an ownership
chain within a database.
•The exception is that the owner of each object is ultimately mapped to a
login.
•If you have an object in one database which refers to an object in a
second database, both databases are configured for database ownership
chaining and both objects have the same owner, then a cross-database
ownership chain is formed.
•Security is checked on the first object, but not on the second one.
•The login querying the first object must also have access into the second
database.
•If the login does not have the ability to connect to that second database,
the query will fail.
•If a cross database ownership cannot be formed, and one object refers to
an object in a different database,login must map to a user in each
database.
•It specifies the appropriate rights on the objects.
THREE CONTAINING LEVELS AS PER ANSI
SQL STANDARDS.
• SQL Server implements all the three levels since the 2005 version.
• Database does not have objects as tables/views directly but has
schemas in between which contain the objects.
• Every database object needs to be inside a schema.
• The default schema in SQL Server, in which all objects are created or
specified is named dbo.