Teradata 简明教程
Teradata - User Management
本章讨论了 Teradata 中用户管理的各种策略。
This chapter discussed the various strategies of user management in Teradata.
Users
使用 CREATE USER 命令创建用户。在 Teradata 中,用户类似于数据库。它们都可被分配空间并包含数据库对象,只不过用户被分配了密码。
A user is created using CREATE USER command. In Teradata, a user is also similar to a database. They both can be assigned space and contain database objects except that the user is assigned a password.
Syntax
以下是 CREATE USER 的语法。
Following is the syntax for CREATE USER.
CREATE USER username
AS
[PERMANENT|PERM] = n BYTES
PASSWORD = password
TEMPORARY = n BYTES
SPOOL = n BYTES;
创建用户时,必须提供用户名、永久空间和密码的值。其他字段是可选的。
While creating a user, the values for user name, Permanent space and Password is mandatory. Other fields are optional.
Accounts
创建新用户时,可以将用户分配给一个帐号。CREATE USER 中的 ACCOUNT 选项用于分配帐号。用户可被分配给多个帐号。
While creating a new user, the user may be assigned to an account. ACCOUNT option in CREATE USER is used to assign the account. A user may be assigned to multiple accounts.
Syntax
以下是使用帐户选项的 CREATE USER 的语法。
Following is the syntax for CREATE USER with account option.
CREATE USER username
PERM = n BYTES
PASSWORD = password
ACCOUNT = accountid
Example
以下示例创建用户 TD02,并将帐户分配为 IT 和 Admin。
The following example creates the user TD02 and assigns the account as IT and Admin.
CREATE USER TD02
AS
PERMANENT = 1000000 BYTES
PASSWORD = abc$123
TEMPORARY = 1000000 BYTES
SPOOL = 1000000 BYTES
ACCOUNT = (‘IT’,’Admin’);
用户可以在登录 Teradata 系统时或使用 SET SESSION 命令登录系统后指定帐户 ID。
The user can specify the account id while logging into Teradata system or after being logged into the system using SET SESSION command.
.LOGON username, passowrd,accountid
OR
SET SESSION ACCOUNT = accountid
Grant Privileges
GRANT 命令用于将数据库对象的多个权限分配给用户或数据库。
GRANT command is used to assign one or more privileges on the database objects to the user or database.
Revoke Privileges
REVOKE 命令从用户或数据库中删除权限。REVOKE 命令只能删除显式权限。
REVOKE command removes the privileges from the users or databases. The REVOKE command can only remove explicit privileges.