There is a difference between creating and owning objects in the database hierarchy. Owner privileges and creator privileges are different and determine default settings for undefined parameters during creation.
- The creator of an object is the user who submitted the CREATE statement. Every object has one and only one creator.If the CREATE statement is executed within a macro, then the user who executed the macro is the creator of the object. The macro is just a vehicle for that creation.
- The owner of an object is any database or user above the object in the database hierarchy.
- The immediate owner (or parent) of a new user or database is the owner of the space in which the object resides. (In other words, a database or user that has space subtracted from its own permanent space to create a new object becomes the immediate owner of that new object.) The creator is the user who submitted the CREATE statement, but that user can specify a different database with the FROM database option of the CREATE USER or CREATE DATABASE statement.
The default database is the database of the creating user, but can be a different database if you precede the object name with the database name and a period separator (databasename.objectname) in the CREATE statement.
An object must always have an immediate owner; that is, an immediate owner of one or more objects cannot be dropped. However, the immediate owner of a database or user can be changed.
The following table lists the basic rules defining a creator, an owner, and an immediate owner.
|You execute a CREATE statement that creates an object (anywhere in the database).||You are the creator of that object. You are not necessarily an owner, or the immediate owner, of that object.|
|You see an object directly below you in the hierarchy.||You are the immediate owner of that object.|
|You create an object in your own database.||You are both the creator and the immediate owner of that object.|
|You create an object in the space of another user or database (assuming you have the privilege that allows you to do so).||
|You are using directory server integration. UserC is a directory-based user mapped to database-based UserA. UserC creates a database in UserD.||UserA is recorded as the creator and UserD is recorded as the immediate owner of the new database.|