About Me

My photo
I am MCSE in Data Management and Analytics with specialization in MS SQL Server and MCP in Azure. I have over 13+ years of experience in IT industry with expertise in data management, Azure Cloud, Data-Canter Migration, Infrastructure Architecture planning and Virtualization and automation. Contact me if you are looking for any sort of guidance in getting your Infrastructure provisioning automated through Terraform. I sometime write for a place to store my own experiences for future search and read by own blog but can hopefully help others along the way. Thanks.

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