Developer Reference : Data Access Methods : SQL Engine Reference : SQL Syntax Reference : SET OWNER
 
SET OWNER
The SET OWNER statement lists owner names for files to be accessed by SQL commands in the current database session. For more information about this file-level security feature, see Owner Names.
Syntax
SET OWNER = [']ownername['] [,[']ownername[']] ...
Remarks
In SET OWNER statements, owner names that begin with a nonalphabetic character and ASCII owner names that contain spaces must be enclosed in single quotation marks. A long owner name in hexadecimal begins with 0x or 0X, so it always requires single quotation marks.
A SET OWNER statement can list all owner names needed for data files in a session. The Relational Engine caches the owner names to use as needed in requesting file access from the MicroKernel Engine.
A SET OWNER statement is effective only for the current connection session. If a user logs out after issuing SET OWNER, the command must be reissued the next time the user logs in.
Each SET OWNER statement resets the current owner name list for the session. You cannot add owner names to the list with more statements.
In a database with security turned off, the SET OWNER statement allows full access to any data file that has an owner name matching an owner name supplied in the statement.
In a database with security turned on, the SET OWNER statement has no effect for users other than the Master user. If the Master user has not granted itself rights, executing SET OWNER gives the Master user full access to any data file with one of the owner names provided. For other users, the Master user can authorize access in either of the following two ways:
Execute SET OWNER with owner names, followed by GRANT with no owner name.
Execute GRANT with an owner name.
These two options are illustrated in the following examples.
Examples
In this example, the owner name begins with a numeral, so it has single quotation marks.
SET OWNER = '1@lphaOm3gA'
============ 
This example provides a list of owner names used by files to be accessed in the current session.
SET OWNER = 'serverl7 region5', '0x7374726f6e672050617373776f7264212425fe'
Single quotation marks are used for the ASCII string because it includes a space and for the hexadecimal string because its prefix 0x starts with a numeral.
============ 
During a a database session, each SET OWNER statement overrides the previous one. In this example, after the second command runs, the first three owner names are no longer available to use for file access.
SET OWNER = judyann, krishna1, maxima
SET OWNER = d3ltagamm@, V3rs10nXIII, m@X1mumSp33d
============ 
This example demonstrates the use of SET OWNER by the Master user in a secure database where security has been turned on, but no permissions have been granted to users. The data file named inventory1 has the owner name admin.
To grant itself permissions, the Master user has two options. For the first, you can issue a SET OWNER followed by a GRANT without an owner name:
SET OWNER = admin
GRANT ALL ON inventory1 TO MASTER
For the second option, the Master user can omit the SET OWNER statement and issue a GRANT that includes the owner name:
GRANT ALL ON inventory1 admin TO MASTER
Both methods achieve the same result.
See Also
GRANT
REVOKE