All Products
Search
Document Center

ApsaraDB RDS:Create a database

Last Updated:Mar 28, 2026

Before your applications can connect to an ApsaraDB RDS for SQL Server instance, you must create a database on the instance. This topic describes how to create a database through the console and explains the maximum number of databases your instance supports.

Prerequisites

Before you begin, ensure that you have:

Database limits

The maximum number of databases per instance depends on the instance edition and CPU cores.

SQL Server 2008 R2: 50 databases (fixed limit).

Other SQL Server versions: The limit varies by edition.

  • RDS Cluster Edition / RDS High-availability Edition: max = min(floor(√CPU_cores) × 50, 300)

  • RDS Basic Edition: max = min(floor(√CPU_cores) × 100, 400)

The following table shows the limits for common CPU configurations:

CPU coresCluster Edition / High-availability EditionBasic Edition
150100
250100
4100200
8100200
16200400
32250400
64300400
For a 4-core instance running SQL Server 2016 SE on RDS High-availability Edition, the limit is min(floor(√4) × 50, 300) = min(100, 300) = 100 databases.

Create a database

  1. Go to the Instances page. In the top navigation bar, select the region where the instance resides. Find the instance and click its ID.

  2. In the left-side navigation pane, click Databases.

  3. Click Create Database, configure the parameters, and then click Create.

    ParameterDescription
    Database NameThe database name. 2–64 characters. Allowed characters: letters, digits, underscores (_), and hyphens (-). Must start with a letter and end with a letter or digit. Chinese characters are not allowed.
    Supported Character SetThe character set of the database.
    DescriptionOptional description of the database. Up to 256 characters.

What to do next

After creating the database, authorize an account to access it so your applications can connect. For instructions, see the account management documentation for ApsaraDB RDS for SQL Server.

To create databases programmatically, use the CreateDatabase API operation.

To connect to the instance, use Data Management (DMS) or SQL Server Management Studio (SSMS).

FAQ

Why do I get the error "The current database name is incorrect. Please reset the database name."?

This error (code: InvalidDBName.Duplicate) means a database with the same name already exists on the instance. The console only shows databases in ONLINE status, so the conflicting database may not be visible if it is in RESTORING, RECOVERING, or OFFLINE state.

To confirm, connect to the instance using SQL Server Management Studio (SSMS) and run:

SELECT
    [name] AS DatabaseName,
    state_desc AS StateDescription,
    recovery_model_desc AS RecoveryModel
FROM
    sys.databases
WHERE
    database_id > 4;  -- Exclude system databases
imageimage

Once you identify the conflicting database, resolve it based on its status:

The database is in a non-ONLINE state (OSS backup recovery with incremental option)

When recovering from an OSS backup with the Access Pending (Incremental Backup) option selected, the database stays in a non-ONLINE state until you explicitly open it.

image
  • To continue uploading incremental backup files: open the database from the Cloud Migration Records of Backup Data tab after recovery is complete.

  • To stop incremental recovery: open the database directly.

  • To recreate the database: open it first, then delete it, and create a new one.

image

The database is in `RECOVERING` state (transaction log space full)

When transaction log space is full, the database enters the RECOVERING state. Check the instance error logs to confirm.

image
  • If the instance storage is full: expand the instance storage space, then restart the instance. The database returns to ONLINE status after recovery completes.

  • If only the log file growth limit is reached (instance storage not full): adjust the log file size limit without restarting.

    image

    image

    image

  • To recreate the database: wait for the status to return to ONLINE, then delete it and create a new one.

The database is in `OFFLINE` state (manually set)

Use the sp_rds_set_db_online stored procedure to bring it back online:

USE master;
GO
EXEC sp_rds_set_db_online 'database_name';
GO

To recreate the database: wait for ONLINE status, then delete it and create a new one.

Why do I get the error "Due to the limit number you can't create a database"?

The instance has reached the maximum number of databases allowed for its current specifications. Upgrade the instance specifications to increase the limit. For how limits are calculated, see Database limits.

Can I use Chinese characters in a database name?

No. Chinese characters are not supported and cause compatibility issues, script parsing errors, and migration risks. Database names must be 2–64 characters long, using only letters, digits, underscores (_), and hyphens (-), starting with a letter and ending with a letter or digit.

References