Articles on this Page
- 08/22/15--22:13: _sp_MSrestoresavedfo...
- 09/17/15--19:00: _See we have a full ...
- 09/18/15--01:26: _Replication not wor...
- 09/17/15--18:57: _Can you tell me rep...
- 09/17/15--21:18: _Problem facing in m...
- 09/18/15--07:40: _Which replication/ ...
- 09/20/15--23:19: _Replication over In...
- 09/22/15--02:54: _SQL server 2014 SNA...
- 08/04/15--19:17: _Merge Replication -...
- 09/22/15--10:01: _Edit publication in...
- 09/23/15--04:48: _ Copy foreign key c...
- 09/23/15--04:55: _how to add a new ta...
- 09/23/15--08:07: _maintaining 3 ident...
- 09/24/15--01:20: _Re-initializing a s...
- 12/08/14--00:59: _Using Merge Replica...
- 09/24/15--13:19: _Mirroring + Replica...
- 09/25/15--04:14: _Database replication
- 09/25/15--05:58: _Trying Replication ...
- 09/26/15--14:26: _Best way to refresh...
- 08/18/09--09:17: _SQL Server
- 09/18/15--01:26: Replication not working after password change
- 09/17/15--18:57: Can you tell me replication monitoring tables?
- 09/17/15--21:18: Problem facing in merge replication
- 09/18/15--07:40: Which replication/ Backup method should i use?
- 09/20/15--23:19: Replication over Internet
- 09/22/15--10:01: Edit publication in transaction replication
- 09/23/15--04:48: Copy foreign key constraints value is always False.
- 09/23/15--04:55: how to add a new table to the existing publisher .
- 09/23/15--08:07: maintaining 3 identical tables in 3 different servers
- 09/24/15--01:20: Re-initializing a single article in replication
- 09/24/15--13:19: Mirroring + Replication
- Server1 is the principal
- They are using transactional replication to replicate asingle databse to server3 is AWS.
- Distribution database is on Server1
- All Agents (log reader, snapshot, distributor) run on Server1
- Server2 has not been set up for replication
- What happens if they failover? Replication would stop, and presumably records added while the mirror is the active database would not be marked for replication?
- How would they recover? Failback and reinintialize? Worse?
- 09/25/15--04:14: Database replication
- 09/25/15--05:58: Trying Replication and hoping for the best
- 09/26/15--14:26: Best way to refresh dev environment
- 08/18/09--09:17: SQL Server
sp_MSrestoresavedforeignkeys do not restore FK which relay on unique index.
Here is an example :
I have 2 tables With a FK between them. The FK relays on unique index.
(parent table tblACConfigurations is replicated) :
CREATE TABLE [dbo].[tblACConfigurations](
[iConfigurationId] [INT] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[iClientId] [INT] NOT NULL,
[vcConfigurationDesc] [VARCHAR](255) NULL,
CONSTRAINT [PK_tblACConfigurations] PRIMARY KEY NONCLUSTERED
CREATE UNIQUE CLUSTERED INDEX [idx_tblACConfigurations_ConfigClient] ON [dbo].[tblACConfigurations]
CREATE TABLE [dbo].[tblLocationConfigurations](
[iLocationId] [int] NOT NULL,
[iConfigurationId] [int] NOT NULL,
[iClientId] [int] NOT NULL,
CONSTRAINT [PK_tblLocationConfigurations] PRIMARY KEY CLUSTERED
ALTER TABLE [dbo].[tblLocationConfigurations]
ADD CONSTRAINT [FK_tblLocationConfigurations_iConfigurationId_iClientId_tblACConfigurations_iConfigurationId_iClientId] FOREIGN KEY ([iConfigurationId], [iClientId]) REFERENCES [dbo].[tblACConfigurations] ([iConfigurationId], [iClientId]) ON DELETE NO ACTION ON UPDATE NO ACTION NOT FOR REPLICATION;
When pushing a snapshot sql server executes the following :
EXEC dbo.sp_MSdropfkreferencingarticle @destination_object_name = N'tblACConfigurations', @destination_owner_name = N'dbo'
The problem is that the FK is not restored. The cause of this problem is that before sqlServer (in sp_MSrestoresavedforeignkeys) restores a FK it does some checks :
1.Is the foreign key already present?
2.Is the referencing table present?
3.Is the referenced table present?
4.Are all the referencing columns present?
5.Are all the referenced columns present?
6.Is there a candidate referenced index key present? - This is the reason my FK is not restored. Not all columns in the FK include in sys.key_constraints.
Is it a bug ?
BTW : I understand the design is bad, but it is an old database.
Regards, Asi Pesa
See we have a full backup on Sunday 8 PM, Diff and every day : 8 PM and log bkp on every 15 min. DB Crashed on Saturday afternoon 2:55 PM. How to rebuild the database? If suppose the last Sunday full backup is corrupted then how can you restore the database in current in time?<o:p></o:p>
I have a publisher, distributor and subscribed in transactional replication topology, each on a different MS Windows 2008 server. SQL server version is 2008. I changed the password of the service account used to the the sql server and sql server agent services on all 3 servers. But now replication stopped working (Distributor to publishers shows errors in replication monitor for all publications). I restarted the services and also tried restarting the servers. I did "update replication passwords" and also used sp_changereplicationserverpasswords to change replication passwords. But it doesn't seem to work.
From [MSrepl_errors], i get the below errors:
The process could not connect to Subscriber 'XXX'.
Cannot generate SSPI context
SQL Server Network Interfaces: The target principal name is incorrect.
Can someone please help me here?
Can you tell me replication monitoring tables?
I am not an expert in merge replication. Was trying to learn and getting this error again and again what should I do.
Regards, Wasif Shahid ACCEDER software
I have a big database on SQL server 2012 which is updated frequently every day. The system creates a database backup from the current data files, in weekly basis. Based on the requirements, the database purges the data older than 3 months. The backup files that i have from the system are discrete database files. In case of a request to execute a query on data related to 3 months ago, the backup should be restored into a new database and then we run the query. I need to be able to have 5 years of data consolidated into a single database file on another server, so that the changes to the historical database be sync to the in-use database. However, when i purge data from the in-use database as they are outdated with respect to three month time-window, the historical database is not affected. Wonder to know if Transactional Replication is able to do this job? Which replication/ backup method is more suitable for this case? Thank you
I want to do replication between two sql server over internet, Both the sql server are on different place and having different network.
At one place i have a static ip.
Help me to do it.
I am facing huge slowness during snapshot generation for a transaction replication set up. the replication set up code is running fine for lower version of sql server. here is my findings.
SP ID 218 program name - Snapshot Agent Smo Connection find the exact query running under this process id was
(@_msparam_0 nvarchar(4000),@_msparam_1 nvarchar(4000))SELECT SCHEMA_NAME(tbl.schema_id) AS [Table_Schema], tbl.name AS [Table_Name], i.name AS [Index_Name], p.name AS [Name], CAST(p.value AS sql_variant) AS [Value] FROM sys.tables AS tbl INNER JOIN sys.indexes AS i ON (i.index_id > @_msparam_0 and i.is_hypothetical = @_msparam_1) AND (i.object_id=tbl.object_id) LEFT OUTER JOIN sys.key_constraints AS k ON k.parent_object_id = i.object_id AND k.unique_index_id = i.index_id INNER JOIN sys.extended_properties AS p ON p.major_id=CASE (i.is_primary_key + 2*i.is_unique_constraint) WHEN 0 THEN i.object_id ELSE k.object_id END AND p.minor_id=CASE (i.is_primary_key + 2*i.is_unique_constraint) WHEN 0 THEN CAST(i.index_id AS int) ELSE 0 END AND p.class=CASE (i.is_primary_key+ 2*i.is_unique_constraint) WHEN 0 THEN 7 ELSE 1 END ORDER BY [Table_Schema] ASC,[Table_Name] ASC,[Index_Name] ASC,[Name] ASC
this part is taking huge time. in the sql server snapshot agent lock I find the below log.
2015-09-22 09:22:03.62 [77%] Bulk copying snapshot data for article 'TransPostErrLog (part 16 of 16)'
2015-09-22 09:22:03.62 [77%] Bulk copied snapshot data for article 'TransPostErrLog (part 12 of 16)' (548 rows).
2015-09-22 09:22:03.63 [77%] Bulk copying snapshot data for article 'UnallocPayBalConv'
2015-09-22 09:22:03.63 [77%] Bulk copied snapshot data for article 'TransPostErrLog (part 14 of 16)' (600 rows).
2015-09-22 09:22:03.64 [77%] Bulk copied snapshot data for article 'TransPostErrLog (part 13 of 16)' (624 rows).
2015-09-22 09:22:03.65 [77%] Bulk copied snapshot data for article 'UnallocPayBalConv' (0 rows).
2015-09-22 09:22:03.66 [77%] Bulk copied snapshot data for article 'TransPostErrLog (part 16 of 16)' (1954 rows).
2015-09-22 09:22:03.67 [87%] Bulk copied snapshot data for article 'TransPostErrLog (part 15 of 16)' (562 rows).
2015-09-22 09:26:02.82 [87%] The replication agent was shut down in response to an abort request.
I have also change the connection timeout to some higher value but no help.
The merge replication on the table in question works fine for Updates and Inserts which I can see in replication monitor but when deletes occur I get this error when merge replication tries to delete the row on the subscriber.
Please note that below is a screenshot showing that referenced objects for deletions are correct and I have verified that the objects are present etc , all of that look Ok.
I tracked through the objects and tried to manually recall replication to deleted the row on the subscriber with the call
and that went through with no error and it looks like replication is no longer retrying to run the delete and subsequently causing another conflict to tick for this row.
My question is, having a look at the tombstone records below (Publisher is first and then the Subscriber) given that the generation and lineage are different, is this the cause?
Like I said Inserts and Updates go through to the subscriber with No issue and work fine, its just when delete operations get called it seems that this error gets raised.
Any advice appreciated.
I have setup transaction replication to synch production DB with reporting DB. Our production DB consist of year old data however reporting DB consists of data for 3 years.
Due to recent changes in production DB, 2 new tables to be added in production DB. To include these 2 tables in replication I would need to edit publication. However it seems that new snapshot will be generated. It will overwrite existing reporting DB.
I wanted your help to understand is there any option to edit existing publication without overwriting reporting DB with production DB. Else Do I need to create new publication for these 2 tables, in this case whenever I add new tables new publication would need to be created?
I want to replicate the foreign keys to secondary.I changed the value Copy foreign key constraints value is to True.
I changed this value at pub properties - Articles -
And then it is asking for MARK for reinitialization with the new snapshot.I clicked ok.
When I checked sync status it has given the message like initial snapshot is not yet available.I started the snapshot and the subscription started replication records.When check at pup properties the value Copy foreign key constraints again false.
After changing the value to true it is showing as False.
Can you suggest me the correct process if it is wrong.
I want to add some new tables to the existing pub.We are using transactional replication.
As per my knowledge,by using below option we can do it.
@property = 'immediate_sync', @value = 'False'
Insetad of this can i craete another publication and subscription for the new articles on the same db?
when have tried both publications are working fine and the data also replicating with out any issues.
Will there be any impact if we this method.
I have a requirement to maintain 3 identical tables in 3 different servers. The tables are roughly 300 rows and contain configurations for SSIS jobs.
The basic function of the table is that 1 row can only be updated by one server and then that row needs to be updated to the other two servers. Each server has it's own 'master' rows.
e.g row A updated by server1 needs to be updated to server2 and 3 (there is logic in each server so only certain rows can be updated by each server. e.g. server2 and 3 can never update row A)
My first idea was to link servers and use triggers after the table updates. this works fine, however I have concerns on the security implactions of using linked servers. Thoughts?
Is there a replication technology that would be better? Maybe transactional? My concern is that I dont want to replicate the full table to each server. Only the rows updated. And this would be a 3 way replication, each table will have 'master' rows that need to be updated on the other two servers.
Any help would be great.
I want to add some tables to the existing publication.I have done this by using "Turn off @allow_anonymous and @immediate_sync on the publication".
After this, when checked it is showing the new snapshot created only for the new tables and the data is replicating to secondary successfully for all tables(new and old) successfully.I can see all articles once re-created the snapshot.
I have small doubt here.
If the snapshot has only new articles how it is replicating the other tables records also.If we add the tables like this method, is there any impact on tables which we created in old snapshot.
Sorry if it is a trivial question.
In this setup the regular users on-site have an application frontend installed locally on their computer, while the data resides on a central SQL Server. Some users works off-site, and randomly connects to the company's data network. These users have SQL Server Express installed locally on their laptop which their frontend application connects to. The SQL Server Express is configured as subscribers with Merge Replication. Whenever the off-site users connect to the company's data network through VPN a small program runs the "replmerge.exe" program on a schedule in the background, keeping the data in sync.
To improve the uptime for the regular users on-site the database has been moved to a configuration with AlwaysOn Availability Group with a primary replica and a secondary replica. The on-site users connect to the Availability Group through the Availability Group Listener, this works perfectly for on-site users if a failover occurs.
The primary replica is also set up as the publisher for the Merge Replication while the Distributor role is being taking care of by a different SQL Server. When the off-site users run the "replmerge.exe"-command they connect directly to the primary replica/publisher. This works very well as long as the Availability Group is running on the primary replica, but if the Availability Group fails over to the secondary replica the pull subscribers off-site will not be able to replicate. I wish the subscribers could be configured to connect to the Availability Group Listener instead of directly to the primary replica/publisher, but that will not work.
In http://msdn.microsoft.com/en-us/library/hh882436.aspx I can the following:
Failover of a Merge Pull Subscription
A pull subscription fails upon availability group failover, because pull agent cannot find the jobs stored in the msdb database of the server instance that hosts the primary replica; which is not available because the server instance has failed.
But I’m not sure if this is a problem when the Publisher is configured in a Availability Group or when the Subscriber is configured in a Publisher Group. I’m not sure if this is a problem if the replication is triggered by the “replmerge.exe”-command and not by a SQL Server Agent job.
My questions are:
- -Have anyone accomplished to get Merge Replication with Pull Subscription connect to the Publisher using an Availability Group Listener working?
- -In the setup described, will it be possible to reconfigure the subscriber from connecting to the primary replica to the secondary replica in the Availability Group if the Availability Group fails over? If so, any ideas of how to script this so it happens automatically? Is It possible to achieve any of this without having the subscriber to download the snapshot again?
I'm looking at a setup where they have server1 and server2 in a mirroring relationship with automatic failover.
My understanding is that in this set up you would normallly place the distribution database on a separate server and enable publication on the mirror, Server2.
But my questions is are regarding the current configuration:
We are currently thinking about replicating our databases. One issue may come up, is that these database servers will belong to different (untrusted) domains. Assuming network issues can get bypassed, Could anyone tell us replication mechanism allows us to use local (or other type) accounts?
Thanks in advance!!!
I will do my best to explain the situation and what I am trying to achieve.
My company provides live data during sports events and with hiring more data entry employees comes more locks on our database. We have a team that enters data as the sporting event is happening and another team that "publishes" this data onto a website. Problem is during busy times during the "publishing" important tables get locked and slow down the saving of events done by the data entry team.
We have determined that maybe there are too many hands in the pot and we will replicate between two databases so the data entry team saves on DB1, that is replicated to DB2 and the "publishing" hits DB2. Which could help but I feel that during the replication process the tables will still be locked and I still have the same problems.
I have more then capable hardware and open to all suggests and what the best practice might be. Is this my best option and hope for the best?
We have a dev environment that needs to be refreshed from time to time on demand. I thought that snapshot replication would be the best way to go. From my understanding when you first set it up you have a snapshot of the environment as it is at that time. Then when you need to refresh it you just run it again and it will give you all the changes between when you first set it up and now. Any ideas on the best way to refresh a dev environment would be. There are two databases that are over 1 terabyte.
how can data replication using SQL.