Previous Topic

Next Topic

Alter User

Valid in: SQL, ESQL

The Alter User statement changes the characteristics of an existing user.

Use ADD PRIVILEGES to give the user additional privileges. Use DROP PRIVILEGES to remove privileges from the user.

Note: You cannot use either ADD PRIVILEGES or DROP PRIVILEGES if with_option is specified in the with_clause.

Previous Topic

Next Topic

Syntax

The Alter User statement has the following format:

[EXEC SQL] ALTER USER user_name

[ADD PRIVILEGES (priv {, priv}) |DROP PRIVILEGES (priv {, priv})]

[WITH with_item {, with_item}]

with_item = NOPRIVILEGES| PRIVILEGES = ( priv {, priv} )

                            | NOGROUP | GROUP = default_group

                            | SECURITY_AUDIT= ( audit_opt {,audit_opt})

                            | NOEXPIREDATE | EXPIRE_DATE = 'expire_date'

                            | DEFAULT_PRIVILEGES = (priv {,priv})| ALL

| NODEFAULT_PRIVILEGES

                            | NOPROFILE | PROFILE= profile_name

                            | NOPASSWORD | PASSWORD = 'user_password'

| PASSWORD = X'encrypted_role_password'

                            | EXTERNAL_PASSWORD

                            | OLDPASSWORD = 'oldpassword'

Previous Topic

Next Topic

Embedded Usage

In an embedded Alter User statement, specify the with clause using a host string variable (with :hostvar). The privilege type can be specified using a host string variable.

Previous Topic

Next Topic

Permissions

You must be connected to the iidbdb database. The maintain_users privilege is required, except for users who simply want to change their own password. You must have maintain_audit privileges to change security audit attributes.

Previous Topic

Next Topic

Locking

The Alter User statement locks pages in the iiuser system catalog.

Previous Topic

Next Topic

Related Statements

Create User

Create Profile

Alter Profile

Drop Profile

Previous Topic

Next Topic

Examples: Alter User

The following examples change the characteristics of an existing user:

  1. Change an existing user, specifying privileges and group.

    alter user bspring with
    group = engineering,
    noprivileges;

  2. Change an existing user, specifying privileges and group.

    alter user barney with
    group = marketing,
    privileges = (createdb,trace,security);

  3. Specify no expiration date for a predefined user.

    alter user bspring
    with noexpiration_date

  4. Allow a user to change their existing password.

    alter user with
    oldpassword='myoldpassword',
    password='mypassword';

  5. Allow a user with maintain_users privilege to change or remove any password.

    alter user username
    with password='theirpassword'
    | nopassword

  6. Grant createdb privilege to user bspring.

    alter user bspring add privileges ( createdb )

    Specify a profile for a particular user.

    alter user bspring with profile = dbop

    where "dbop" is an existing profile.

  7. Specify that a user has an externally verified password.

    alter user bspring
    with external_password;


© 2007 Ingres Corporation. All rights reserved.