azureazure-sql-database

Azure SQL Msg 45122: The specified max size is invalid


I'm trying to create duplicate a database out of the elastic pool. (The source database is in an elastic pool). The database is 71 GB.

I'm using this command:

CREATE database [MYDATABASE_BAK]
         AS COPY OF [MYSERVER].[MYDATABASE]
         (EDITION = 'BusinessCritical' , SERVICE_OBJECTIVE = 'BC_Gen5_2');

The command fails with:

Msg 45122, Level 16, State 1, Line 1
The specified max size is invalid.

But instead it works if I use BC_Gen5_8

CREATE database [MYDATABASE_BAK]
         AS COPY OF [MYSERVER].[MYDATABASE]
         (EDITION = 'BusinessCritical' , SERVICE_OBJECTIVE = 'BC_Gen5_8');

What do I miss? I'm looking at this page but the memory they provide for BC_Gen5_2 is more that 71 GB.


Solution

  • I found the issue:

    SELECT DATABASEPROPERTYEX(DB_NAME(), 'MaxSizeInBytes');
    

    the MAX size of the database is 2048 GB - (way more that 71 GB actual size) - and more than 1024 GB that BC_Gen5_2 had.