Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Scripting Replication using Powershell

$
0
0

Earlier today I was trying to script a transaction replication using powershell, everything seems to be working fine except for this part

-- Adding the transactional subscriptions
use [aGrepl]
exec sp_addsubscription @publication = N'aGreplTran', @subscriber = N'aGServer', @destination_db = N'aGrepl', @subscription_type = N'Pull', @sync_type = N'automatic', @article = N'all', @update_mode = N'read only', @subscriber_type = 0
GO

It appears nowhere in the script. Here is a part of the powershell code I have used

-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublisherSideSubscriptions `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeSubscriberSideSubscriptions `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeArticles `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateSnapshotAgent `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeGo `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::EnableReplicationDB `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludePublicationAccesses `
-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeCreateLogreaderAgent `

-bor  [Microsoft.SqlServer.Replication.scriptoptions]::IncludeSubscriberSideSubscriptions `
If I comment out all except IncludeSubscriberSideSubscriptions I get the sp_addpublication piece of code instead. I also don't see a description for IncludeSubscriberSideSubscriptions at

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.replication.scriptoptions.aspx

Can someone point out what am I doing wrong here/help me understand why am I not able to script sp_addsubscription part? Thanks!


Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>