Removing Replication in SQL Server 2008 R2

Hi,
I had issues to remove replication. I was trying to remove all articles from replication..it was taking quite long time to complete the process and found blocking while doing it. I stopped the SQL agent and tried but still it was slow..to remove 3 tables
from replication it took more than 30mi. Is there any other preriquisites to do for this process. I searched a lot in the web but didn't get proper help.
Thanks.

Hi Swapana,
According to your description, you want remove all articles from transactional replication, however, it exists some blocks which make the removing process slowly. Usually, articles can be dropped from a publication at any time.  Replication will stop
replicating the changes in schema/data from publisher to subscriber once you remove article from replication . However, we need to verify if you want to remove tables from the subscriber database, if yes, you have to do it manually after removing object from
replication. For more information, see:
http://blog.extreme-advice.com/2012/11/28/delete-article-from-transactional-replication-in-sql-server-2012/
In addition, if you just want to drop articles from existing publications. For snapshot or transactional publications, articles can be dropped with no special considerations prior to subscriptions being created. When you drop an article that is related to
other published articles through foreign key constraints, we recommend that you drop the table at the Subscriber manually.
If an article is dropped after one or more subscriptions is created, the subscriptions must be dropped, recreated, and synchronized. For more information, see:
http://msdn.microsoft.com/en-us/library/ms152493.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support

Similar Messages

  • Hetrogenous replication in sql server 2008

    I am trying to setup a transaction rpelication between a Oracle publisher (version 10.2) and sql server 2008 sp1 on windows 2008, 64 bit AMD Processor.
    I have installed the oracle client 11.0.1 and followed the permissions for the login on the orcale server.
    I was able to add the oracle publusher.
    I am tryign to create the publication and atricles and i get the following error.
    TITLE: Publication Properties
    Cannot add article 'CACHE_LEVEL_LU'.
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot publish the table 'SAT.CACHE_LEVEL_LU' from the Publisher 'CD15'. Verify connection information and ensure that you can connect to the Publisher through a tool like SQL*PLUS. Ensure that the replication administrative user schema has the required permissions.
    Cannot add the Publisher triggers and the article log table to the Oracle Publisher for the article 'CACHE_LEVEL_LU'. Verify connection information and ensure that you can connect to the Publisher through a tool like SQL*PLUS. Ensure that the replication administrative user schema has the required permissions.
    Changed database context to 'distribution'.
    OLE DB provider "OraOLEDB.ORACLE" for linked server "CD15" returned message "ORA-00936: missing expression
    ORA-06512: at "BIA_REPL.HREPL", line 1722
    ORA-06512: at line 1".
    Error: 7215, Sev: 17, State: 1, Msg: Could not execute statement on remote server 'CD15'. (Microsoft SQL Server, Error: 21790)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.00.2531&EvtSrc=MSSQLServer&EvtID=21790&LinkId=20476
    BUTTONS:
    OK
    Any idea?
    Do you guys knwo fi the replication between Oracle and sql works?
    thanks
    uday

    Did you ever find a solution here? I'm running into the exact same issue with my attempted replication setup - I'm hopeful that you were able to solve this!

  • Database Mirroring and Replication in SQL Server 2008 R2

    I have configured the mirroring and replication between 4 servers (A,B,C,D).i.e, Mirroring between A to B and C to D, Replication between A and C. The configuration was a success and I am able test the replication(B to C) when I have failed over the mirroring
    dbs(A to B). The replication works fine after the mirroring fail over but I am not able to check its status in the Replication monitor. When I am having any insert in a table which is replicated in B, it is reflected back to C..it means the replication is
    working fine.
    Any thought on how I can view the status of replication from mirrored server. I tried adding the publisher in the monitor, but no luck. If I check the snapshot agent status, it says could not retrieve the info, same with the log reader agent status.
    Any suggestions on this please.
    Thanks, Siri

    For example in your case...
    Server A is principal and Server B is Mirror with either Manual or Automatic Failover.
    Server A is replicated to Server B ( publisher & B is subscriber )
    In Server A Database named Test_Mirror_Replication is configured for both mirroring and Replication.
    Now you have failed over your Database 'Test_Mirror_Replication' from Server A to Server B.
    After the Failover Server A will act as Mirror for DB 'Test_Mirror_Replication' & Server B will act as Principal for DB 'Test_Mirror_Replication'
    Hope my understanding is correct ?
    If yes then have you tried monitoring the replication after registering in other instance with current principal database sql instance name ? I mean current Publisher database name sql instance ? not your old sql instance name which was before the mirroring
    role change or failover...
    Hope you are trying with mirror database server name ?
    Raju Rasagounder MSSQL DBA

  • SQL Server 2008 R2 Replication - not applying snapshot and not updating all repliacted columns

    We are using transactional replicating on SQL Server 2008 R2 (SP1) using a remote distributor. We are replicating from BaanLN, which is an ERP application to up to 5 subscribers, all using push publications. 
    Tables can range from a couple million rows to 12 million rows and 100's of GBs in size. 
    And it's due to the size of the tables that it was designed with a one publisher to one table architecture.  
    Until recently it has been working very smooth (last four years)) but we have come across two issues I have never encountered.
    While this has happen a half dozen times before, it last occurred a couple weeks ago when I was adding three new publications, again a one table per publication architecture.
    We use standard SS repl proc calls to create the publications, which have been successful for years. 
    On this occasion replication created the three publications, assigned the subscribers and even generated the new snapshot for all three new publications. 
    However,  while it appeared that replication had created all the publications correctly from end to end, it actually only applied one of the three snapshot and created the new table on both of the new subscribers (two on each of the
    publications).  It only applied the snapshot to one of the two subscribers for the second publications, and did not apply to any on the third.  
    I let it run for three hours to see if it was a back log issue. 
    Replication was showing commands coming across when looking at the sync verification at the publisher and 
    it would even successfully pass a tracer token through each of the three new publications, despite there not being tables on either subscriber on one of the publishers and missing on one of the subscribers on another.  
    I ended up attempting to reinitialize roughly a dozen times, spanning a day, and one of the two remaining publications was correctly reinitialized and the snapshot applied, but the second of the two (failed) again had the same mysterious result, and
    again looked like it was successful based on all the monitoring. 
    So I kept reinitializing the last and after multiple attempts spanning a day, it too finally was built correctly.  
    Now the story only get a little stranger.  We just found out yesterday that on Friday the 17th 
    at 7:45, the approximate time started the aforementioned deployment of the three new publications, 
    we also had three transaction from a stable and vetted publication send over all changes except for a single status column. 
    This publication has 12 million rows and is very active, with thousands of changes daily. 
    , The three rows did not replicate a status change from a 5 to a 6. 
    We verified that the status was in fact 6 on the publisher, and 
    5 on both subscribers, yet no messages or errors.  All the other rows successfully updated.  
    We fixed it by updating the publication from 6 back to 5 then back to 6 again on those specific rows and it worked.
    The CPU is low and overall latency is minimal on the distributor. 
    From all accounts the replication is stable and smooth, but very busy. 
    The issues above have only recently started.  I am not sure where to look for a problem, and to that end, a solution.

    I suspect the problem with the new publication/subscriptions not initializing may have been a result of timeouts but it is hard to say for sure.  The fact that it eventually succeeded after multiple attempts leads me to believe this.  If this happens
    again, enable verbose agent logging for the Distribution Agent to see if you are getting query timeouts.  Add the parameters
    -OutputVerboseLevel 2 -Output C:\TEMP\DistributionAgent.log to the Distribution Agent Run Agent job step, rerun the agent, and collect the log.
    If you are getting query timeouts, try increasing the Distribution Agent -QueryTimeOut parameter.  The default is 1800 seconds.  Try bumping this up to 3600 seconds.
    Regarding the three transactions not replicating, inspect MSrepl_errors in the distribution database for the time these transactions occurred and see if any errors occurred.
    Brandon Williams (blog |
    linkedin)

  • SQL Server 2008 R2 - Adding Replication Components to an Existing Installation

    Hi All
    I have a SQL Server 2008 R2 instance that I need to install Replication components on. 
    I've been going through the appropriate wizard and selecting to upgrade an existing instance, the wizard recognizes the SQL Server that we have installed so that one is selected. On the next screen, I'd expect to see the feature selector with everything
    we currently have installed selected and greyed out, however nothing is selected (except for BOL).
    So in order to select Replication Components, I'd have to also select Database Engine, suggesting that a new SQL Instance would be installed. Not wanting to do this, I'm having to abort.
    I've tried a number of different ISOs now (one I found lying around on the server), but I haven't had any luck. My only option now seems to be to recreate the instance entirely, but that being a last resort, I was wondering if anyone may have had some experience
    with this problem?
    I am running the installer with the highest level of Windows and SQL access, if that helps.
    Thank you

    Just to confirm when you try to install you select the option "Add features to an existing Instance of SQL" and below you see the instance name and you *Dont* see replication.
    Now when you click next in the feature selection page you see replication as greyed out is that correct?
    Regards, Ashwin Menon My Blog - http:\\sqllearnings.com
    To confirm, the steps I'm taking are as follows:
    Once all the Setup Support files have been installed, and the Setup Support rules have been checked (with no errors)
    - At the Installation Type screen I select Add features to an existing instance of SQL Server 2008 R2. My server appears in the drop down as the only instance on this server. I see the list of installed instances too, and can confirm that Replication does
    not appear in the Features column. I click next.
    - At the Feature selection screen, the only items that are selected are Books Online, SQL Client Connectivity and Microsoft Sync Framework. No other features are selected and greyed out, where I would expect Database Engine Services, Analysis Services and
    Reporting Services (among others) to be selected. Selecting SQL Server Replication at this stage results in Database Engine Services also being ticked, suggesting the wizard will add a new instance on this machine.
    The only peculiarity that I've noticed is with the version number reported on the Installation Type screen, which shows 10.51.2500. Not the same as the version that is reported if I inspect object browser or I user the @@Version command. In fact, I believe
    this version relates to MDS instead? This being said, our other production server reports the same version here, and I was able to install replication components here with no problem.
    I hope this helps, I don't know if I can attach some images to my post to make it more clear? It's quite a difficult and unusual problem to explain!

  • Things to consider when removing from AD domain a SQL Server 2008 which includes Reporting Services

    Do any one have a link to a list of things to consider when removing from AD domain a SQL Server 2008 which includes Reporting Services, Analysis Services and Integration Services?
    I am taking from an Active Directory domain several servers with SQL 2008 and Reporting Services, Analysis Services and Integration Services. The server will stay on its own without association to any domain, the server will keep its IP address and
    the server will not change names.
    I have done some research and I got the basic steps including, removing the user accounts from the domain, changing the services accounts, changing jobs and databases from being owned by users from the domain. But...
    Are there other things in Reporting Services, Analysis Services and Integration Services internal databases that have an association with the domain AND that will fail after no longer being in the domain?
    I've heard of Reporting Services subscriptions failing when the domain user account is no longer there...Are there any other got ya's that any one has encountered?
    Please advice.
    Note: I am posting in this forum basically because of what I heard on Reporting Services, but it may be a better idea to post into a more broad forum such as SQL Server Migration section.
    Thanks beforehand
    Paulino

    Do any one have a link to a list of things to consider when removing from AD domain a SQL Server 2008 which includes Reporting Services, Analysis Services and Integration Services?
    I am taking from an Active Directory domain several servers with SQL 2008 and Reporting Services, Analysis Services and Integration Services. The server will stay on its own without association to any domain, the server will keep its IP address and
    the server will not change names.
    I have done some research and I got the basic steps including, removing the user accounts from the domain, changing the services accounts, changing jobs and databases from being owned by users from the domain. But...
    Are there other things in Reporting Services, Analysis Services and Integration Services internal databases that have an association with the domain AND that will fail after no longer being in the domain?
    I've heard of Reporting Services subscriptions failing when the domain user account is no longer there...Are there any other got ya's that any one has encountered?
    Please advice.
    Note: I am posting in this forum basically because of what I heard on Reporting Services, but it may be a better idea to post into a more broad forum such as SQL Server Migration section.
    Thanks beforehand
    Paulino

  • SQL Server 2008 R2 - Cannot remove 50th instance with command line uninstall

    I have reached the 50 instance SQL Server limit on my Microsoft Server 2008.  I have tried to remove an existing instance using the command line below but it still is reporting that "No more transforms are available because the maximum 50 has been
    reached." and the uninstall is hanging on Select Features.  Some of the instances on this server are for SQL Server 2008 and some are for R2.  Where do I go from here?
    "C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\SQLServer2008R2\setup.exe" /Action=Uninstall /FEATURES=SQL /INSTANCENAME=myinstance

    "C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\SQLServer2008R2\setup.exe" /Action=Uninstall
    /FEATURES=SQL /INSTANCENAME=myinstance /Q
    Try this..
    /Q = Quite Mode.. 
    Chetan ================================================================== ================================================================ This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to
    click "Mark as Answer" and "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • SQL SERVER 2008 R2 - REPLICATION BEGINNERS

    Hi all Friends,
    Am beginner to ms sql 2008 and i have installed sql Express edition and management studio and tried to do replication there some issues i have faced 
    1) Cant use my host as distributor
    2) SQL server agent Edition is running 
    3)Cant create publisher also 
    May i know which edition supports for all replication ( Merge,Transactional,Snapshot)
    Thankful to repliers

    You do not mention what you are replicating to. SQL Server express can only be a merge replication subscriber. If you want to replicate to a SQL Server Standard Edition and above you will need to make the SQL Server Standard Edition server your publisher
    and the SQL Server express edition your subscriber and then changes will move from the merge replication subscriber to the publisher and vice versa.
    As the SQL Server Express client does not have SQL Server agent, you will need to do a push subscription from the Standard Edition, or run RMO, or a batch file which runs replmerg.exe on the subscriber. You might also be able to run web sychronization.
    If the source and destination servers are both SQL Server Express editions you might want to use Sync Services.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • SQL Server 2008 R2 and storage replication

    Hello All !
    On a Production site, I have a SQL Server 2008 R2 for a fat application. On a DRP site, I have the same SQL Server 2008 R2 fat application.
    The production and DRP sites are interconnected with a physical SAN storage (synchrone replication). SAN LUNs are synchronous replicated (Data + logs).
    In this case, is it necessary to keep logshipping beetween the 2 sites or the LUNs replication is sufficient ?
    Thanks for advance for your ideas / help - Regards - Have a nice day ! RHUM2

    <<In this case, is it necessary to keep logshipping beetween the 2 sites or the LUNs replication is sufficient ?>>
    That question is impossible for us to answer, since we don't know your requirements (SLA etc). But if you re-phrase your question, we can give feeback with which you hopefully can make that decision:
    What can log ahipping protect me from which SAN replication can't? I can think of a couple of things (others are free to chime in):
    Corruption at the page level. SAN replication give you a binary image of the data. If a page is corrupt at site A, it will be corrupt at site B. Log shipping work by retorting transaction log backups.
    Delayed log restore. If a problem happens at site A, you can decide to have delayed log restores at site be and restore a log backup until just prior to the accident.
    Both above assumes that you know what you are doing have basically have planned for these things. But technically, they are examples of things that log shipping allows for.
    Tibor Karaszi, SQL Server MVP |
    web | blog

  • Understand SQL Server 2008 R2 replication features for a reporting database

    Hi, I am using SQL Server 2008 R2 and working on building a reporting database using transactional push replication and want to know the downside that we should aware of using this.
    For instance, is the data always available to the users even when changes are being written from the publisher?
    I am also interested in learning replication mechanism & internals. How should I proceed?
    Thanks in advance........
    Ione

    >>For instance, is the data always available to the users even when changes are being
    written from the publisher?
    Answer is Yes.
    For more information
    http://www.codeproject.com/Articles/715550/SQL-Server-Replication-Step-by-Step
    --Prashanth

  • Replication Configuration issue after migrating from SQL Server 2005 to SQL Server 2008 R2

    Hi All,
    This weekend we have migrated one of our Core system from SQL Server 2005 SP3 to SQL Server 2008 R2 SP2. Migration went successful. However when we are trying to Configure transaction replication we are getting below Error:
    Msg 21854, Level 16, State 1, Procedure sp_MSrepl_addarticle, Line 573
    Could not add new article to publication 'abc' because of active schema change activities or a snapshot is being generated.
    Background:
    Database compability Changed from 90 to 100.
    A quick Help would be appreciated.
    Best Regards - Viral
    Thanks - Viral

    Is a snapshot being generated? the message seems to indicate one is.
    looking for a book on SQL Server 2008 Administration?
    http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search?
    http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • HELP ME!!! I have a problem regarding SQL Server 2008 R2 Replication! :((((

    Good day!
    I'm having a big problem in my SQL Server 2008 R2... I can't see the "Local Publication" under the Replication...
    About not installing it, I guess that's not true because I checked all the features to install.
    Is this a bug? Do I need to re-install my SQL Server 2008 R2? Or simply, do I need to do something simple without re-installing it?
    PLEASE HELP....
    See Link below:
    http://oi59.tinypic.com/4jx3y1.jpg

    None. This is a freshly installed SQL Server 2008 R2. After installing, All I did was create a database.
    If you want to know how I did it, simply:
    1. Open SSMS, connect to local server
    2. Open Object Explorer
    3. Expand your local server
    4. Right+Click on the Database then clicked on to "New Database..."
    5. Entered my database name then clicked "OK"

  • SQL Server 2008 R2 Transaction Replication Tracer Tokens always pending

    On a new transaction replication publiciation/subscription, the tracer tokens I generate always show pending for publisher to distributor and distributor to subscriber.  The log reader agent is running and last action continues to update.   The
    Performance column in the repl monitor shows Excellent with a 00:00:03 latency.  Distribution cleanup, agent history clean up, and replication agents checkup all show job succeeded and a resent last start time and their running times are usualy around
    a second or show 00:00:00.  On the subscriber, the "view synchronization status"  is being updated with number of transactions and commands being delivered.  I can confirm that updates are making it to the subscriber database.  On
    the surface, everything apears ok but I'm bothered by the tracker tokens not working.
    this is SQL Server 2008 R2 10.50.1600.1 - OS is Windows Server 2008 R2 SP1.
    -Larry
    -Larry

    In this case run sp_replcounters at the published db to see if the log reader delivers commands from the published db to the distribution db.
    Yaniv Etrogi
    site |
    blog | linked in |
    mail
    Please click the Mark as Answer button if a post solves your problem! or
    Vote As Helpful

  • Windows Server 2008 and SQL Server 2008 R2 - ?? for replication with Oracle

    Hello:
    I am running Windows Server 2008 and SQL Server 2008 R2 - 64 bit
    I need to replicate data between the SQL 2008 and Oracle 11.2 ?? with Oracle being the publisher
    I also would lile SqlPlus installed on the server.
    I need a definite answer as to what I should download from the Oracle download area. There are just so many packages and so many version I dont know what to download.
    Thanks

    Hi,
    Currently Microsoft Windows Server 2008 and SQL Server 2008 are not supported for SAP Business One.
    For detailed information about all supported platforms, we have the following link for your reference:
    www.service.sap.com/smb/sbo >product availability > supported platforms.
    Regarding the information on the service marketplace this is updated on a regular basis and provides the most up to date information regarding the supported platforms for Business One.
    Platforms not mentioned in this documentation are not supported.
    hope it helps,
    Regards,
    Ladislav
    SAP Business One Forum Team

  • Msg 8631 Internal error: Server stack limit has been reached on SQL Server 2012 from T-SQL script that runs on SQL Server 2008 R2

    I have an Script mostly that is generated by SSMS which works with-out issue on SQL Server 2008, but when I attempt to run it on a new fresh install of SQL Server 2012 I get an Msg 8631. Internal error: Server stack limit has been reached. Please look for
    potentially deep nesting in your query, and try to simplify it.
    The script itself doesn't seem to be all that deep or nested.  The script is large 2600 lines and when I remove the bulk of the 2600 lines, it does run on SQL Server 2012.  I'm just really baffled why something that SQL Server generated with very
    few additions/changes AND that WORKS without issue in SQL Server 2008 R2 would suddenly be invalid in SQL Server 2012
    I need to know why my script which is working great on our current SQL Server 2008 R2 servers suddenly fails and won't run on an new SQL Server 2012 server.  This script is used to create 'bulk' Replications on a large number of DBs saving a tremendous
    amount of our time doing it the manual way.
    Below is an 'condensed' version of the script which fails.  I have removed around 2550 lines of specific sp_addarticle statements which are mostly just copy and pasted from what SQL Management Studio 'scripted' for me went I when through the Replication
    Wizard and told it to save to script.
    declare @dbname varchar(MAX), @SQL nvarchar(MAX)
    declare c_dblist cursor for
    select name from sys.databases WHERE name like 'dbone[_]%' order by name;
    open c_dblist
    fetch next from c_dblist into @dbname
    while @@fetch_status = 0
    begin
    print @dbname
    SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
    use ['+@dbname+']
    exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
    use ['+@dbname+']
    exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
    -- Adding the transactional publication
    use ['+@dbname+']
    exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
    '''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
    = N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
    @immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
    exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
    @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
    -- There are around 2400 lines roughly the same as this only difference is the tablename repeated below this one
    use ['+@dbname+']
    exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script =
    null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509F, @identityrangemanagementoption = N''manual'', @destination_table = N''TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false'', @ins_cmd = N''CALL sp_MSins_dboTABLE_ONE'',
    @del_cmd = N''CALL sp_MSdel_dboTABLE_ONE'', @upd_cmd = N''SCALL sp_MSupd_dboTABLE_ONE''
    EXEC sp_executesql @SQL
    SET @dbname = REPLACE(@dbname, 'dbone_', 'dbtwo_');
    print @dbname
    SET @SQL = 'DECLARE @dbname NVARCHAR(MAX); SET @dbname = ''' + @dbname + ''';
    use ['+@dbname+']
    exec sp_replicationdboption @dbname = N'''+@dbname+''', @optname = N''publish'', @value = N''true''
    use ['+@dbname+']
    exec ['+@dbname+'].sys.sp_addlogreader_agent @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1, @job_name = null
    -- Adding the transactional publication
    use ['+@dbname+']
    exec sp_addpublication @publication = N'''+@dbname+' Replication'', @description = N''Transactional publication of database
    '''''+@dbname+''''' from Publisher ''''MSSQLSRV\INSTANCE''''.'', @sync_method = N''concurrent'', @retention = 0, @allow_push = N''true'', @allow_pull = N''true'', @allow_anonymous = N''false'', @enabled_for_internet
    = N''false'', @snapshot_in_defaultfolder = N''true'', @compress_snapshot = N''false'', @ftp_port = 21, @allow_subscription_copy = N''false'', @add_to_active_directory = N''false'', @repl_freq = N''continuous'', @status = N''active'', @independent_agent = N''true'',
    @immediate_sync = N''true'', @allow_sync_tran = N''false'', @allow_queued_tran = N''false'', @allow_dts = N''false'', @replicate_ddl = 1, @allow_initialize_from_backup = N''true'', @enabled_for_p2p = N''false'', @enabled_for_het_sub = N''false''
    exec sp_addpublication_snapshot @publication = N'''+@dbname+' Replication'', @frequency_type = 1, @frequency_interval = 1, @frequency_relative_interval = 1, @frequency_recurrence_factor = 0, @frequency_subday = 8,
    @frequency_subday_interval = 1, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = N''DOMAIN\DBServiceAccount'', @job_password = N''secret'', @publisher_security_mode = 1
    -- There are around 140 lines roughly the same as this only difference is the tablename repeated below this one
    use ['+@dbname+']
    exec sp_addarticle @publication = N'''+@dbname+' Replication'', @article = N''DB_TWO_TABLE_ONE'', @source_owner = N''dbo'', @source_object = N''DB_TWO_TABLE_ONE'', @type = N''logbased'', @description = null, @creation_script
    = null, @pre_creation_cmd = N''drop'', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N''manual'', @destination_table = N''DB_TWO_TABLE_ONE'', @destination_owner = N''dbo'', @vertical_partition = N''false''
    EXEC sp_executesql @SQL
    fetch next from c_dblist into @dbname
    end
    close c_dblist
    deallocate c_dblist
    George P Botuwell, Programmer

    Hi George,
    Thank you for your question. 
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 
    Thank you for your understanding and support.
    If you have any feedback on our support, please click
    here.
    Allen Li
    TechNet Community Support

Maybe you are looking for

  • Delete  row  internal  bank  problem

    Hi, i  wasn't  able  to   delete   row  of   my  internal  bank,  despite  i   delete  this  bank   in  my   BP  account and   in  all  payment  method. Also   i   delete   all  the  information  in  internal  banck  account  (  branch,  count  numbe

  • Airport stopped working

    My airport express suddenly stopped working.  I've checked for s/w updates and have tried unplugging and re-plugging.  Any thoughts on how to fix? Thanks

  • Hi company code level

    hi  what is company code level ,company level and COA level  can u explain how the transctions are stored and maintained what is the main differences explain step by step manner plz

  • Make selection of tree in scrollcontainer visible?

    hi, I have a recursive node bound to a tree, due to the high number of entries I placed the tree in a scroll container below a find button (so that the find button always stays visible even if the tree scrolls). but now I have the problem that the tr

  • Beige won't start at all

    Got to the root of the USB problem -- not the card at all. The computer was not communicating with the printer, or any printer for that matter. So I decided to re-install OS 10.3. The installation was near complete from disc 1 when the screen went to