Are you the publisher? Claim or contact us about this channel


Embed this content in your HTML

Search

Report adult content:

click to rate:

Account: (login)

More Channels


Showcase


Channel Catalog


Channel Description:

Discussions on SQL Server Replication

older | 1 | .... | 168 | 169 | (Page 170) | 171 | 172 | .... | 181 | newer

    0 0

    Hello,

    I was trying to reproduce a issue but got puzzled when I was able to insert duplicate records in a table with UNIQUE non-clustered index, i expected it to fail. Another unique NCI was on a column with PK, insert query with duplicate primary key fails as expected. While I am aware of IGNORE_DUP_KEY option can be set to ON/OFF, but it can't prevent duplicate records. 

    How exactly SQL Server does ensure uniqueness of unique index as I don't see any key (see below screenshots) created for same unlike primary key ? 

    Script 

    CREATE TABLE [dbo].[Test_table103](
    [id] [int]  PRIMARY KEY NONCLUSTERED,
    [NAME] [varchar](40) ,
            [Address] [varchar](40) )  

    /****** Object:  Index [NonClusteredIndex-20161230-173558]    Script Date: 2016-12-30 17:38:01 ******/
    CREATE UNIQUE NONCLUSTERED INDEX [NonClusteredIndex-20161230-173558] ON [dbo].[Test_table103]
    (
    [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, 
    ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO

            ---Inserting data
    INSERT INTO Test_table103 VALUES (15, 'amit','address1')
    INSERT INTO Test_table103 VALUES (11, 'abhi','address1')
    INSERT INTO Test_table103 VALUES (12, 'ankit','address1')
    INSERT INTO Test_table103 VALUES (13, 'anish','address1')
    GO

    -- Inserting duplicate record with different id and duplicate name 
    INSERT INTO Test_table103 VALUES (16, 'amit','address1')
    GO
    -- Inserting duplicate record with different name and duplicate id
    INSERT INTO Test_table103 VALUES (10, 'anuj','address1')

    Appreciate your pointed revert. Thank you.

     


    0 0

    Hello,

    When I configured replication for a table with PK, there were duplicate entries for same table on subscriber and we had no idea where they were coming from. We also noticed unique non-clustered index was created for column with PK.

    Situation was were tight, we broke the replication, truncated table on SUB, manually create unique key and then created new publication and configure same to truncate table on subscriber (SUB) - initialized the replication and it worked.

    Let's say we are trying to replicate below table:

    CREATE TABLE [dbo].[Test_table100](
    [id] [int] IDENTITY(1,1) PRIMARY KEY NONCLUSTERED,
    [NAME] [varchar](40) NOT NULL,
            [Address] [varchar](40) NOT NULL)  

    Unique Non-clustered index would be created on Id column and if we manually create clustered index on name column. what would be sequence of events while replicating this table. Per default setting for publication, unique key constraint are set to replicate but non-clustered indexes are not. I noticed NCI was created on SUB.

    1. Distribution agent will start bulk copying the data in the table on SUB.

    2. Once completed, Primary key would be created 

    3. Non-clustered indexes are created, if publication is configured to do so.

    4. Changes made to table in question on publisher (PUB), during snapshot generation and distribution are applied.

    I would appreciate if you could shed light on below points.

           1. Why is constraint disabled during snapshot generation as shown in below screenshot ? 

           2. When my table on PUB got PK on it, how come there can be duplicate records on SUB ?

           3. Have you come across any issues while replicating table with PK and NCI on same column ?

           4. Does it matter what all indexes are available on table during snapshot generation ? 

    Thank you for your time !


    0 0

    Greetings, I am trying to determine if we have any custom stored procs either by altering the default I/U/D procs created or if sp_register_custom_scripting was used. We are migrating our sql 2000 subscription server to 2008 soon and subsequently the 2000 distribution and publication servers and I am trying to identify what all customization has been done to our transactional replication here.

    0 0

    Greetings, I am trying to determine if we have any custom stored procs either by altering the default I/U/D procs created or if sp_register_custom_scripting was used. We are migrating our sql 2000 subscription server to 2008 soon and subsequently the 2000 distribution and publication servers and I am trying to identify what all customization has been done to our transactional replication here.

    0 0

    Have a weird problem at a client -  2 sites are doing transactional replication to a 3rd.  The table on site 1 and 3 has the same columns in the same order, the 2nd site has the same columns in a different order.  Filter is used so that when a site resnapshots the common target the target data is deleted using the filter and then the snapshot does the BCP to the target.

      Not too surprisingly the site 2 snapshot application is failing with a fieldsize error - most likely because it is trying to insert the wrong data in the wrong field.

      Anyone know of a clever way around this other than fixing the column order on site 2?

    Sources are 2012 and target is 2005 if that matters


    Chuck Pedretti | Magenic – North Region | magenic.com


    0 0
  • 01/07/17--21:02: Log shipping
  • Hello,

    I've configured log shipping from one machine to another with different geographical location , log shipping is working perfectly to

    logs are applying properly it has 15 minutes buffer time to generate log and apply ,but  getting error once I am making DR database read and write mode ,to test SQL server replication I have done below steps,

    disable the log shipping from primary to secondary and make database read,write mode on DR ,and make primary as seconday and start log shipping vice versa ,once we are done with the activity ,again I am trying to put DR database in restore mode to enable log shipping but getting below error to overcome the issue again I've to copy  full database from the primary,

    *************************************************************************************************

    2016-12-07 12:44:35.18  *** Error: Could not apply log backup file '\\ekkerp84\D$\LogShipping\LogShipping_KVL\WSS_Content_MOBAPPS_20161207080002.trn' to secondary database 'WSS_Content_MOBAPPS'.(Microsoft.SqlServer.Management.LogShipping) ***

    2016-12-07 12:44:35.18  *** Error: This backup set cannot be applied because it is on a recovery path that is inconsistent with the database. The recovery path is the sequence of data and log backups that have brought the database to a particular recovery point. Find a compatible backup to restore, or restore the rest of the database to match a recovery point within this backup set, which will restore the database to a different point in time.  For more information about recovery paths, see SQL Server Books Online.

    RESTORE LOG is terminating abnormally.(.Net SqlClient Data Provider) ***

    *******************************************************************************************************

    the above is one error and the second error is when if primary server got rebooted it breaking the log shipping and when I am enabling it or reconfiguring it the restore job is failing with below status ,

    the log shipping is configured to apply with 0 minutes but log not applied with 4320 minutes ,when I am giving 4320 minutes still its not working .

    Thanks,

    Hadi.


    0 0

    Hi All

    I am planning to release a .net web application which will run on Windows Server 2016 with SQL Server 2016 Standard Edition as the database

    I plan to use a 2 node Failover cluster, for availability and I am seeking advice on how to find a relevant expert to advise on the hardware requirements (e.g the number of network cards) and to setup the Failover Cluster on the 2 Dedicated Servers via RDC

    Any help appreciated

    regards

    Steve


    0 0

    Hello.

    I'm working with SQL Server 2014 and configure P2p Transactional Replication between two instances; So each of them is active for Insert,Update and Delete action.

    Now i want to drop an Article from publication, but I can't. 

    From Management Studio i get this error:

    TITLE: Microsoft SQL Server Management Studio
    ------------------------------
    Object reference not set to an instance of an object. (CreatePubWizard)

    And by T-SQL:


    EXEC sp_droparticle   
      @publication = N'pub1',   
      @article = N't1',  
      @force_invalidate_snapshot = 1; 

    I get this error:

    Msg 14046, Level 16, State 1, Procedure sp_MSrepl_droparticle, Line 286 [Batch Start Line 1]
    Could not drop article. A subscription exists on it.

    I don't want to drop subscription. I have tried it in each instances and i have got same error on both of them. 

    What can i do?

    Thanks.



    0 0

    In the November 2015 blog post Transactional Replication to Azure SQL DB now in public preview we're told that we "can now configure Azure SQL DB as a subscriber of SQL Server Transactional Replication". The instructions for how to do so are in other posts, and involve these settings (available through SSMS):

    SSMS Screenshot from Timothy Khouri's blog

    Wind forward to January 2017. When I look at my Azure SQL database in SSMS there is no "Replication", just "Databases" and "Security". How do I access the replication setup for Azure SQL?


    0 0

    The error below  occur when I am  setting up the   pull transactionnal replication on SQLSERVER 2016. But if we change the replication to push replication it works. 

    My SQLSERVER VERSION IS 2016 SP1.

    Could not find stored procedure 'sys.sp_MSaddreplsymmetrickey'. Changed database context to 'CoBRAClientData'. (.Net SqlClient Data Provider).

    Please advise 


    0 0

    hello,,,

    my database got corrupted and showing suspect. I put this on emergency mode but still not able to recover it.

    can anybody suggest me what to do to recover my database


    0 0
  • 01/12/17--02:37: replmon - snapshot
  • Hi guys,

    I got a SQL Server 2014 SP2 with a transactional replication on it.

    The replication itself works fine but when I need to take snapshots i get the following problem:

    If I start a single snapshot agent (in Replication Monitor or Job Activity Monitor or per TSQL), the replication monitor shows (sometimes!) that another (random!) snapshot agent is started too - but it really isn't (Job Activity Monitor Shows status idle).

    The snapshot agent I started runs normally and as expected. The second one that seemed to be started fails after 10 minutes saying: "the replication Monitor has not logged a Progress message in 10 minutes. this might indicate ..." - well, it really didn't run so it fails showing this error.

    This phenomenon doesn't really affect my work but I don't like seeing all those red crosses in my replication monitor.

    Any ideas?

    Thanks in advance

    Diese


    0 0

    Hi,

    I have a requirement to consolidate live identical tables from different database to a central db.

    Site tables have a primary key only unique to that site but not across site. In another words we can find same primary key in different locations. Compound primary key can’t be made on this tables

    Transactional replication was set up with Xcall procedure for article update . I modified the sp_MSupdxxxxxx stored procedures (with 'Where' clause) to make sure updates are unique on the central server. To avoid overwriting the modified procedures I disabled the copying of Insert, Update, and Delete stored procedure in GUI. This worked well on a non-live table 

     While resyncing the live table I am getting an error ‘sp_MSins_xxxx_msrepl_ccs not found’.

    I know this stored procedure is created on run time to update changes made after the initial snapshot. Since I disabled the copying of Insert, Update, and Delete stored procedure in GUI, ‘sp_MSins_xxxx_msrepl_ccs’ is not getting created.

    Is there any way to create Custome ‘sp_MSupdxxxxxx’ and ‘sp_MSins_xxxx_msrepl_ccs ‘ for XCall operation from the publisher?. I am using SQL 2012 R2

    Can anybody help me to get a solution?



    0 0

    Hi, We have a requirement to transfer data from SQL Azure database to our on-premise servers. Planning to consider Replication but I don't see anything in google for the same, other than discussions on Replicatingto SQL Azure. Is that possible to publish an Azure SQL DB? if so, Can we do both Publisher\Distributor on the same Azure SQL server? If it doesn't work, may be I have to build an SSIS package or T-SQL scripts to do the same on daily basis. Appreciate any input here!

    Thank you!


    0 0

    How do you manually do a clean up for change tracking (ie: autocleanup is set to false) in SQL Server 2008?

    0 0

    I am trying to create a merge replication as follows:

    • The publisher on SQL Server 2014 sp1
    • some tables are filtered using for example: @subset_filterclause = N'Siteid like "11%" and Orgid="PMV"'
    • some tables are partially replicated. i.e. not all columns in the table are replicated, and that is because the total number of columns in those tables are more than 246 columns, so we excluded the not needed columns.
    • on the subscriber side, there is an identical database of the publisher database but empty with no records, and I'm using this template database to be the subscriber.

    When I try to run the snapshot agent, and after completing 49%, I'm getting the following error:

    Error messages:
    Message: Invalid column name '11%'.
    Invalid column name 'PMV'.
    Failed to create merge replication triggers for object '[dbo].[a_c_budget]'.
    Command Text: sp_MSaddmergetriggers
    Parameters: 	@source_table = [dbo].[a_c_budget]
    	@recreate_repl_views = 0
    
    Stack:    at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
       at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
       at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
       at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.CreateArticleTriggers()
       at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.CreateArticleProceduresAndTriggers()
       at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
       at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
       at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
       at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
       at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: 207)
    Get help: http://help/207
    Server publisherServer\SQL2014, Level 0, State 1, Procedure sp_MSaddmergetriggers, Line 562
    Failed to create merge replication triggers for object '[dbo].[a_c_budget]'. (Source: MSSQLServer, Error number: 20715)
    Get help: http://help/20715
    Server publisherServer\SQL2014, Level 0, State 1, Procedure sp_MSaddmergetriggers, Line 562
    Failed to create merge replication triggers for object '[dbo].[a_c_budget]'. (Source: MSSQLServer, Error number: 20715)
    Get help: http://help/20715
    Server publisherServer\SQL2014, Level 0, State 1, Procedure sp_MSaddmergetriggers, Line 562
    Failed to create merge replication triggers for object '[dbo].[a_c_budget]'. (Source: MSSQLServer, Error number: 20715)
    Get help: http://help/20715

    The '11%' and 'PMV' are the values that I use to filter not the columns!

    And the following is how the article is added:

    exec sp_addmergearticle @publication = N'MaxLoadBalance_Repl', @article = N'A_C_BUDGET', @source_owner = N'dbo', @source_object = N'a_c_budget', @type = N'table', @description = N'', @creation_script = N'', @pre_creation_cmd = N'drop', @schema_option = 0x000000010C034FD1, @identityrangemanagementoption = N'none', @destination_owner = N'dbo', @force_reinit_subscription = 1, @column_tracking = N'false', @subset_filterclause = N'Siteid like "11%" and Orgid="PMV"', @vertical_partition = N'false', @verify_resolver_signature = 1, @allow_interactive_resolver = N'false', @fast_multicol_updateproc = N'true', @check_permissions = 0, @subscriber_upload_options = 0, @delete_tracking = N'true', @compensate_for_errors = N'false', @stream_blob_columns = N'true', @partition_options = 3

    What to do?


    0 0

    Hello Mates,
    Pardon me for the silly question but I am not going anywhere with it. We have Replication configured on SQL server 2008 for a midsize database (15gigs) to another server. Replication is seems to be working fine but distribution MDF file distribution.MDF is grown huge and filling up E drive on server. Current size of this file is 46 gigs. Can you help me on how to bring this size down?

    Cheers



    0 0

    Hello,

    We have a merge replication SQL 2008 standard to 2000 Express.

    We are having a slow replication issue at one of our clients. When I looked into the MSmerge_genhistory table on all the subscribers, it has ~400k records. And out of those ~391k are from generation 1 which happened 8 months ago and already closed (genstatus 2) on the subscribers. It is still open (genstatus 0) on the publisher, maybe because if new subscriber comes along, it would need it.

    I think the slow replication is because these records are not cleaned up by the metadata cleanup. The retention setting is set to 8 days. All the other generations are deleted correctly.

    Does anybody know why genhistory with generation 1 with art_nick=0 is not deleted on all the subscribers?


    Regards Mayur, MCTS Windows,Web and Distributed applications


    0 0

    Hello everybody,

    1. Can someone tell me if I can place a distributor on a SQL Server 2014 Standard Edition ?

    2. Can my distributor be in SQL server 2016 version and my publisher and subscriber in SQL Server 2014 version ?

    3. Can my subscriber be an Azure SQL instance. Here, it says that it's in preview, is that still the true ? https://azure.microsoft.com/en-us/blog/transactional-replication-to-azure-sql-db/

    Thank you very much :)


    0 0

    Hi All,

    I setup a transaction replication between 2 SQL servers, unfortunately I forgot to schedule log backup on reporting DB which was in full recovery mode. so we got The transaction log for replication database full error one day later.  After I found the issue, I scheduled log backup job and log file size was back to normal. but it seemed replication was hung. I can see action messages in distributor to subscriber history are:

    1. starting agent

    2. initializing

    3. the process is running and it waiting for a response from the server

    4. Query timeout expired. 

    It repeated these actions again and again. Then I changed distribution agents and log reader agents timeout from default 1800 seconds to 3600 seconds, restarted SQL agent, but it still did not work. I did inserted a tracer tokens, it took 4 seconds from publisher to distributor, but took forever from distributor to subscriber.

    Please help.

    Thanks

    David


older | 1 | .... | 168 | 169 | (Page 170) | 171 | 172 | .... | 181 | newer