Updating the multiple database structure in Azure

Asked

Viewed 394 times

3

I have 5 SQL database (Web Edition) in Azure which must be exactly the same as the structure (procedures, tabelas, views, triggers,...) but the data is different.

It has to update the structure of the banks in a more agile way, as if they were a mirror of a master bank?

2 answers

3


I found something that solves my problems. SQL Server Management Studio 2008 has a feature called Registered Databases. After registering the databases with their respective credentials, it is possible to run a script in all the databases at the same time. For that reason:

  1. Open MSSMS and connect to any server, in my case it is the server called "LOCALDB";
  2. In the "Object Researcher" connect to other servers. "WEBDB" in my case;
  3. Right-click on one of the servers and choose "Register";
  4. Set the credentials and any name for the server and click Save;
  5. Do the same with other servers;

Now to run scripts on all at once just go to View > Registered Servers. Or press Ctrl+Alt+G. Expand the "Database Engine", right-click on "Local Server Groups" > "New Query". inserir a descrição da imagem aqui

Note that if there is more than one server in the "Local Server Groups" the status bar of the script area will turn red indicating that the command will be executed on behalf of multiple logons. inserir a descrição da imagem aqui

The name of the banks on both servers must be the same and you must use the use command, i.e.:

use meuBancodeDados
select * from minhaTB

myBancodeDados must exist on the 2 servers or will be run only on the one that exists.

For more information: http://msdn.microsoft.com/en-us/library/bb964743(v=sql.100). aspx

1

  • Thank you for the reply Thiago.

  • Hello Thiago. I found something better. See my answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.