• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. SQL Reference
  5. SQL Syntax
  6. ALTER USER

ALTER USER

Function

ALTER USER modifies the attributes of a database user.

Precautions

Session parameters modified by ALTER USER apply to a specified user and take effect in the next session.

Syntax

  • Modify user rights or other information.
    ALTER USER user_name [ [ WITH ] option [ ... ] ];

    The option clause is as follows:

    { CREATEDB | NOCREATEDB }
        | { CREATEROLE | NOCREATEROLE }
        | { INHERIT | NOINHERIT }
        | { AUDITADMIN | NOAUDITADMIN }
        | { SYSADMIN | NOSYSADMIN }
        | { USEFT | NOUSEFT }
        | { LOGIN | NOLOGIN }
        | { REPLICATION | NOREPLICATION }
        | {INDEPENDENT | NOINDEPENDENT}
        | {VCADMIN | NOVCADMIN}
        | CONNECTION LIMIT connlimit
        | [ ENCRYPTED | UNENCRYPTED ] PASSWORD { 'password' | DISABLE }
        | [ ENCRYPTED | UNENCRYPTED ] IDENTIFIED BY { 'password' [ REPLACE 'old_password' ] | DISABLE }
        | VALID BEGIN 'timestamp'
        | VALID UNTIL 'timestamp'
        | RESOURCE POOL 'respool'
        | USER GROUP 'groupuser'
        | PERM SPACE 'spacelimit'
        | NODE GROUP logic_cluster_name
        | ACCOUNT { LOCK | UNLOCK }
        | PGUSER
  • Change the user name.
    ALTER USER user_name 
        RENAME TO new_name;
  • Change the value of a specified parameter associated with the user.
    ALTER USER user_name 
        SET configuration_parameter { { TO | = } { value | DEFAULT } | FROM CURRENT };
  • Reset the value of a specified parameter associated with the user.
    ALTER USER user_name 
        RESET { configuration_parameter | ALL };

Parameter description

  • user_name

    Specifies the current user name.

    Value range: An existing user name.

  • new_password

    Indicates a new password.

    A new password must:

    • Differ from the old password.
    • Contain at least eight characters. This is the default length.
    • Differ from the user name or the user name spelled backward.
    • Contain at least three of the following: uppercase characters (A to Z), lowercase characters (a to z), digits (0 to 9), and other characters (limited to ~!@#$%^&*()-_=+\|[{}];:,<.>/?).

    Value range: A string.

  • old_password

    Indicates the old password.

  • ACCOUNT LOCK | ACCOUNT UNLOCK
    • ACCOUNT LOCK: locks an account to forbid login to databases.
    • ACCOUNT UNLOCK: unlocks an account to allow login to databases.
  • PGUSER

    PGUSER of a user cannot be modified in the current version.

For details about other parameters, see "Parameter Description" in CREATE ROLE and ALTER SESSION.

Examples

See Examples for CREATE USER.