About Me

My photo
I am an MCSE in Data Management and Analytics, specializing in MS SQL Server, and an MCP in Azure. With over 19+ years of experience in the IT industry, I bring expertise in data management, Azure Cloud, Data Center Migration, Infrastructure Architecture planning, as well as Virtualization and automation. I have a deep passion for driving innovation through infrastructure automation, particularly using Terraform for efficient provisioning. If you're looking for guidance on automating your infrastructure or have questions about Azure, SQL Server, or cloud migration, feel free to reach out. I often write to capture my own experiences and insights for future reference, but I hope that sharing these experiences through my blog will help others on their journey as well. Thank you for reading!

How to move a database to a elastic pool after DB Copy or export from one logical server to another logical server.


Moving a database to a elastic pool after DB Copy or export from one Azure logical server to another Azure logical server. 





Customer says you to copy/ export database from development Azure logical server to Stage Azure logical server.

you

Development databases is not in a elastic pool, however the stage database is in elastic pool.

After moving  the database from Development  to Stage, you realized that your database in not in a elastic pool.
so how will you move the database to specific elastic pool.

First execute below command to see your database is in which service objective and in which elastic pool name

SELECT  d.name, 
     slo.* 
FROM sys.databases d 
JOIN sys.database_service_objectives slo 
ON d.database_id = slo.database_id;




In above screenshot elastic_pool_name is NULL

Now we have to move this database to stage_pool

Elastic pool with the name stage_pool is already created..

and using T-SQL Commands we just have to move the database to that pool.

hence we have to execute below command.  

ALTER DATABASE  [stage_TestDB]
MODIFY ( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = [stage_pool] ) ) ; 









For complete reference refer this blog

https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql?view=sql-server-2017&tabs=sqldbls