locked
Can I turn on DB Replication using SQL or a script? RRS feed

  • Question

  • Short version: 

    Can SQL Server DB Replication be turned on via an SQL command perhaps some sort of script (such as a ".bat" file)?  We need to turn this capability on in several remote databases where the end user is not a DBA.

    Long Version:

    We are in the process of incorporating Microsoft Sync Framework 2.0 into our application, which is deployed on SQL Server 2005 SP2 (or SP3) or SQL Server 2005 Express (SP2 or SP3).  We probably don't need the entire replication framework, but we do  need a built-in function named "min_active_rowversion".  As far as I know, the only way to get this function is to activate "DB Replication" in these database installations.

    The only way I currently know to do this is to go through "Control Panel -> Add or Remove Programs", find the SQL Server installation and then "Change" it to turn on DB Replication.  Many of our users would be able to handle this, but many would also have difficulty.  Therefore, it would be really helpful if we could simply download a little snippet of SQL or script file to do this automatically.

    As an alternative, my overall goal (as far as I know) is simply to get the "min_active_rowversion" function.  If there is an easier way to get that other than turning on DB replication, or I have completely misunderstood what I need to do, I would like to hear about it.

     

    Wednesday, May 12, 2010 2:58 PM

Answers

  • Hi,

    With two new installed Operating Systems, I tested SQL Server 2005 SP3 without DB Replication installed. For both of them, min_active_rowversion funciton can be successfully executed. Unfortunately, I cannot repro the issue that your hit.

    Here are my test details:

    Machine1 (win7): SQL Server 2005 Express SP3 without DB replication (default setting)

    Machine2 (win2k8): SQL Server 2005 Enterprise without DB Replication (disabled from advanced setting) + upgrade to SQL Server 2005 SP3

    Anyway, I hope the link of the SQL Server 2005 install commandline in my previous reply can resolve your issues.

    Thanks,

    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, May 12, 2010 11:40 PM

All replies

  • Hi,

    With SQL Server 2005 SP2, you can call the built-in function "min_active_rowversion()" directly. I don't think that you need to run any setup or scripts to enable it. The database providers in Microsoft Sync framework also depends on this SQL Server built-in functional. From your description, I'm not see any usage of the Microsoft Sync Framework. If you want to know more about this SQL Server built-in function, you may want to send a question to the SQL Server Forum instead.

    Here is a link from MSDN for this function: http://msdn.microsoft.com/en-us/library/bb839514(SQL.90).aspx

     

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, May 12, 2010 5:46 PM
  • Thanks for taking the time to respond.  Let me offer some clarification.  First, here is the "usage of the Microsoft Sync Framework" from my original posting:

    "We are in the process of incorporating Microsoft Sync Framework 2.0 into our application,"

    Second, a little background on why I asked this particular question: Prior to reaching the point where we decided to do this, I built a fully functioning prototype of a system that we intend to deploy.  While constructing that prototype I hit an error where MSF was failing because the min_active_rowversion() function was not available and this was on SQL Server 2005 SP3.  The only way that I found to make that function available was to turn on the DB Replication capability in SQL Server.  Once I did that, things started working much better.

    It is entirely possible that this was mere coincidence.  However, the first time I encountered this problem was on SQL Server running on my PC.  A couple of weeks later, when I extended my prototype to run on a seperate server, also running SQL Server 2005 SP3, I encountered the exact same problem again.  I also solved it by turning on the DB Replication capability in SQL Server running on that host.

    Again, this could be coincidence or event Sheer Dumb Luck (SDL).  The bottom line is that MSF needs that function and I want to make sure it has it.  I also posted my question to the SQL Server forums, but I also posted here because MSF forum posters have a pretty good record for assisting me with questions.  I thought that perhaps someone else understood this particular issue and was aware of an easier way to solve it.

    So, if anyone has some ideas or thoughts about this, please feel free to share them.

     

    Wednesday, May 12, 2010 7:57 PM
  • Hi,

    Regarding the dependency to DB Replication component in SQL Server 2005 SP3, I'm not aware of it. It is not mentioned in the MSDN document at least. I will try a repro and let you know what I find.

    For the script, you can try the SQL Server 2005 install commandline : http://msdn.microsoft.com/en-us/library/ms144259(SQL.90).aspx. Please look at the section "To add components to an existing, stand-alone instance of SQL Server 2005 from the command prompt". You can find the child feature name of DB Replication for [AddLocal] in this web page too.

    Thanks,

    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, May 12, 2010 9:19 PM
  • Hi,

    With two new installed Operating Systems, I tested SQL Server 2005 SP3 without DB Replication installed. For both of them, min_active_rowversion funciton can be successfully executed. Unfortunately, I cannot repro the issue that your hit.

    Here are my test details:

    Machine1 (win7): SQL Server 2005 Express SP3 without DB replication (default setting)

    Machine2 (win2k8): SQL Server 2005 Enterprise without DB Replication (disabled from advanced setting) + upgrade to SQL Server 2005 SP3

    Anyway, I hope the link of the SQL Server 2005 install commandline in my previous reply can resolve your issues.

    Thanks,

    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Wednesday, May 12, 2010 11:40 PM
  • Based upon what you are saying, I am now inclined to believe that my "solution" of turning on DB replication is more of a coincidence instead of an actual solution.  If I recall correctly, I actually had to apply SP3 to both SQL Server installations.  In any event, your testing suggests that there is a much easier way to "turn on" the min_active_rowversion() function, and I can probably figure it out.

     

    Thursday, May 13, 2010 5:06 PM