サマリー
Alters a SQL Server database user to match the name of the specified schema and sets its default schema to the specified schema. This tool should be used in environments that prohibit the use of database users without associated logins and headless domain users. It allows users with appropriate database permissions to perform actions within the geodatabase that require the user to act as the data owner user.
使用法
Supports SQL Server geodatabases only.
The Database Connection must use OS authentication.
Will alter the database user of the associated login.
The associated database user must exist prior to executing this tool.
The database user must have the CREATE SCHEMA permission, or the associated schema must exist prior to executing this tool.
The database user must have rights to the target schema in order to perform actions within the geodatabase.
This tool will not automatically revert the database user to the previous state. When you have finished processing as the data owner, you must run the tool again while providing your DOMAIN\username as the target schema to release ownership of the previous schema.
Executing this tool may require you to restart your application if you had a previously open connection to the target database within the application session.
The suggested workflow for using this tool is the following:
- Open the application.
- Launch the tool.
- Set parameters and execute the tool.
- Connect to the target geodatabase.
- Perform actions as data owner.
- Launch the tool to revert user settings.
- Set parameters and execute the tool.
- Restart the application.
The tool will return an error message if the target schema does not exist in the database or if another user has already assumed ownership of the schema. The content of the error message will be determined by the permissions of the database user.
The tool may also automatically assume ownership of a target schema for which another user has previously assumed ownership if that user is not currently connected to the database. This feature requires advanced permissions.
構文
SetDataOwner_defense (Connection_File, Schema)
パラメーター | 説明 | データ タイプ |
Connection_File | The enterprise geodatabase workspace stored in Microsoft SQL Server in which you will alter the database user. | String |
Schema | The name of the schema that will be applied to the user. | String |
コードのサンプル
SetDataOwner example (Python window)
The following sample demonstrates how to execute the SetDataOwner tool.
# Importing necessary modules
from arcpy import defense
# Setting variables for tool inputs
sde_connection_file = r'C:\Data\MGCP_TRD_4_2.sde'
schema = 'new_schema_user'
# Calling Set Data Owner and passing in variables
defense.SetDataOwner(sde_connection_file, schema)
環境
ライセンス情報
- ArcGIS Desktop Basic: いいえ
- ArcGIS Desktop Standard: 次のものが必要 Defense Mapping
- ArcGIS Desktop Advanced: 次のものが必要 Defense Mapping