Question

I have a stored procedure that takes a "DBname" parameter and creates a new database from a backup, naming the new database with the parameter. So if i execute the sproc with param = 'myDB1" it creates a new database from an existing backup and names it myDB1.

As databases are created I manually set up Merge Replication for each one. The publication configurations are basically the same, just one for each database. I have custom snapshot folder, specific account for Agent Security, and some accounts added into the PAL.

Is there a way to automate the Publication setup? Can I add some sql to the database generation sproc that will create a Publication for the new database at the time of creation? And have all the settings set correctly?

Was it helpful?

Solution

Figured it out - In the Publication list, right click a publication that you'd like to clone and use the Generate Script option. Script to query window and then change some of the static inputs to SQL paramaters. I created as a stored procedure in the backed up database. Now when a new database is generated from that backup, I run the SP in the new database and replication is generated for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top