To copy a database, you can execute SQL statements and specify the source and destination databases by using the sp_rds_copy_database stored procedure. The time depends on the database size.

Prerequisites

  • Before you copy the database, the unused space of the destination instance must be at least 1.3 times the source database.
  • The instance version is ApsaraDB RDS SQL Server 2012 or later.

Procedure

Execute the following statements to copy the database:

USE master
GO
--Query database engine edition
SELECT @@Version
GO
--Create database
CREATE DATABASE testdb
GO
EXEC sp_rds_copy_database 'testdb','testdb_copy'
SELECT *
FROM sys.databases
WHERE name IN ('testdb','testdb_copy')
SELECT 
    family_guid,database_guid,* 
FROM sys.database_recovery_status
WHERE 
DB_NAME(database_id) IN ('testdb','testdb_copy')