Lock an account to temporarily disable access without removing it, or delete an account that is no longer needed.
Prerequisites
Before you begin, make sure you have:
An ApsaraDB RDS for PostgreSQL instance
Access to the ApsaraDB RDS console
Lock an account
Locking an account prevents it from logging on to the RDS instance. The account and its permissions remain intact — unlock it at any time to restore access.
After an account is locked, you cannot use the account to log on to your RDS instance.
Go to the Instances page. In the top navigation bar, select the region where the RDS instance resides. Find the RDS instance and click the instance ID.
In the left-side navigation pane, click Accounts.
Find the account, click Lock in the Actions column, then click OK in the confirmation dialog. When the Status column shows Locking, the account is locked.
To restore access or remove a locked account, click Unlock or Delete in the Actions column.
Delete an account
Deleting an account is permanent and cannot be undone. Before you delete an account, check which method applies to your account type:
| Method | Supported account types |
|---|---|
| ApsaraDB RDS console | Privileged accounts and standard accounts |
| SQL statements | Standard accounts only |
If the account has permissions on databases, tables, or other objects, deletion fails with the error Some objects depend on account. Remove all object dependencies before deleting the account.Delete an account in the console
Go to the Instances page. In the top navigation bar, select the region where the RDS instance resides. Find the RDS instance and click the instance ID.
In the left-side navigation pane, click Accounts.
Find the account, click Delete in the Actions column, then click OK in the confirmation dialog.
Delete a standard account using SQL
Use this method when you manage accounts through SQL or scripts.
Connect to your RDS instance. For more information, see Connect to an ApsaraDB RDS for PostgreSQL instance.
Transfer ownership of all objects from the account to another account:
REASSIGN OWNED BY <The username of the account that you want to delete> TO <The username of another account>;Delete the account:
DROP USER <The username of the account that you want to delete>;
FAQ
When I delete an account in the console, I get an `AccountActionForbidden` error saying database objects depend on the account. What should I do?
The account owns or has privileges on database objects, which blocks deletion. Identify all objects that depend on the account — such as tables, views, or schemas — and reassign or drop them first. Then retry the deletion.
What's next
After deletion, you can create a replacement account. For more information, see Create an account.
To manage accounts programmatically, use the following API operations:
Operation Description DeleteAccount Deletes an account LockAccount Locks an account UnlockAccount Unlocks an account