Description

The following error occurs when you delete a database in apsaradb RDS for PostgreSQL.

ERROR: database "mctest" is being accessed by other users detailed: There are 2 other sessions using the database. 

 

Causes

The database is being used by other connections.

 

Solutions

Alibaba Cloud reminds you that:

  • When you perform operations that have risks, such as modifying instance configurations or data, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • Before you modify the configurations and data of instances including but not limited to ECS and RDS instances, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted security information such as the logon account and password in the Alibaba Cloud Management console, we recommend that you modify such information in a timely manner.
  1. Run the following command to disconnect all connections to the mctest database:
    select pg_terminate_backend(pid) from (select pid from pg_stat_activity where datname = '[$Database_Name]' ) a;
    Note:[$Database_Name] is the database name.
  2. Delete the database.

 

Application scope

  • ApsaraDB RDS for PostgreSQL

 

If the problem persists, you can receive a free consultation in Alibaba Cloud Community or submit a ticket to contact Alibaba Cloud technical support personnel.