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

MSrepl_tran_version column in one table only?

$
0
0

I have a transactional publication containing hundred of articles(tables) with only one of those tables having a MSrepl_tran_version column.  I can't tell when it was added as when I run this query 

select [name], create_date, modify_date
from sys.tables
where name = 'tableWithMSRepl_tran_version_col'

It shows when the clustered index was last updated (last night).  Is this column just for updatable transactional replication and merge publications?  I have transactional and snapshot only.  I did try to google for the answer but I'm not really finding what I'm looking for.  Can someone please give me some guidance as to how to track down what's using this field for this one table or what circumstances would cause it be added?  The table does have a primary key.

Thanks!



Transactional replication between SQL Server 2008R2 and SQL 2012

$
0
0

Hi all,

is it possible to build a transactional replication that have:

publicator -> SQL Server 2008R2

subscriptor -> SQL Server 2012

distributor -> I can have SQL Server 2008R2 or 2012

Thanks

Merge Replication Article with JOIN *and* Parameterized Filter

$
0
0
I found a recent article by Paul Ibison that describes my requirements (point 7):
http://www.replicationanswers.com/MergeNonConvergence.asp

(7) Using Joins with Multiple Filters

I'm sure filters and joins are where the complication and confusion of merge lies. Here is another example for this article: if you have a join filter between 2 tables, and a different static table filter on each table in the join, the results are not filtered correctly, or at least not at all intuitively.

E.G. consider 2 tables: Customers and Orders. These are joined by a PK - FK relationship on CustomerID so that as we'd expect a customer can place several orders. If I create a join filter to link the tables, all 'ordering' Customers and their associated Orders are replicated. I then add a filter clause on the Customers table (parent) to restrict the output to a particular customer: CustomerID = 'Joe'. The resulting (automatically created) merge view for Orders restricts the results to the orders belonging to customer 'Joe'. So, on initialization one customer and his associated orders are replicated. However, what if I add another filter now to the Orders table: CustomerID = 'Harry'? Logically this should further restrict the replicated orders and we'd expect zero records returned. However, on initialization we find that more orders are now replicated! In this case the merge view is created which UNIONs the 2 clauses, rather than using a logical AND clause! This is quite different to the above scenarios - we now observe extra rows rather than seeing rows unexpectedly deleted.

This sounds like *exactly* what I need. 
(This is oversimplified, but an example).
I have 150 locations that are subscribers, all with a LocationId.  There are three tables involved, ClientLocation, Client, and Invoice.  Each client can have multiple ClientLocation records, that is used to determine where a Client record is replicated out to.  So, my filters are: ClientLocation is a parameterized filter on LocaitonId using the HOST_NAME() of the subscription (so each location gets their own ClientLocation records).  The Client table is then a JOIN filter to ClientLocation so that each Client record gets replicated out to wherever the matching ClientLocation records do.  The Invoice table is then a JOIN filter on Client so that each Invoice gets replicated out to wherever the Client records do.  This is simple enough, and works no problem.

The wrench in my system is that each of the 150 locations can look up clients from other locations other than their own.  They can then create an invoice for that Client, even though that Client isn't a record at their local database.  So, the Invoice table also contains a "CreatedAtLocationId" that matches the location that created the invoice.  So, the Invoice table needs two filters, it needs to be sent out anywhere that the Client record is (JOIN filter), and it also needs to be sent out to any location that matches CreatedAtLocationId (Parameterized filter), even though the Client record may not be in that subscription location, the Invoice has to be.

In my situation, I need exactly what Paul Ibison describes, a UNION of two filters (even though he was expecting an AND condition).  I have tested this scenario and it works exactly as I would expect (so far, with very very limited testing).

My problem is what I found in MSDN:
http://msdn.microsoft.com/en-us/library/ms152478.aspx

The article should only have one parameterized filter or join filter. Having a parameterized filter and being the parent in a join filter is allowed. Having a parameterized filter and being the child in a join filter is not allowed. Having more than one join filter is also not allowed.

In my situation, Invoice is a parameterized filter, as well as the child in a join filter (to Client).  So, what Paul Ibison's article describes, and what I'm doing seems to be 'not allowed'.  If I go ahead with this, and I need this replication logic in about 6 articles out of 60, it seems risky if behaviour changes in a newer sql release or patch.  Is anyone familiar with this rule? Have they done it before? Am I headed for doom?

Thanks,

Kevin

Replication: Why can't a PULL subscription be initialized from backup, whereas a PUSH subscription could be initialized?

$
0
0

Hi everyone,

I am facing a strange problem and can't figure out why is it happening and could not find any related thread or documents that could provide me with answers.

So here is the problem:

1. I am initializing a subscription from backup. For which, I have first disabled and stooped (if running) the Distribution cleanup agent, because it was causing problem by making my backups out-dated and had to take another differential backup or transaction log backup to execute the sp_addsubscription procedure.

2. After disabling the distribution cleanup agent, I took a backup (full, differential or transaction log as required) from the publisher database and restored them on the subscriber sequentially so that the LSNs are in sequence.

3. After the restoration of the backups were completed on the subscriber (distribution agent still disabled and not running), I executed sp_addsubscrition with the T-SQL shown below:

use [PUBLISHER_DB]
exec sp_addsubscription 
@publication = N'PUBLICATION_NAME'
, @subscriber = N'SQL_INSTANCE_NAME_OF_THE_SUBSCRIBER'
, @destination_db = N'SUBSCRIBER_DB_NAME'
, @subscription_type = N'Pull'
, @sync_type = N'initialize with backup'
, @backupdevicetype='disk'
, @backupdevicename='PATH_OF_THE_BACKUP'
, @update_mode = N'read only'
GO

The procedure executed successfully with message "Command(s) completed successfully."

4. After that I executed the "sp_addpullsubscription" and "sp_addpullsubscription_agent" on the subscriber with the following T-SQL:

USE [SUBSCRIBER_DB]
GO

EXEC sp_addpullsubscription
@publisher = N'PUBLISHER_SQL_INSTANCE_NAME', 
@publication = N'NAME_OF_THE_PUBLICATION', 
@publisher_db = N'PUBLISHER_DB_NAME', 
@independent_agent = N'True', 
@subscription_type = N'pull', 
@description = N'', 
@update_mode = N'read only', 
@immediate_sync = 0
GO

EXEC sp_addpullsubscription_agent
@publisher =N'PUBLISHER_SQL_INSTANCE_NAME', 
@publisher_db = N'PUBLISHER_DB_NAME', 
@publication = N'NAME_OF_THE_PUBLICATION', 
@distributor = N'SV0D2-MSQLCL6-10', 
@distributor_security_mode = 1, 
@distributor_login = N'', 
@distributor_password = null, 
@enabled_for_syncmgr = N'False', 
@frequency_type = 64, 
@frequency_interval = 0, 
@frequency_relative_interval = 0, 
@frequency_recurrence_factor = 0, 
@frequency_subday = 0, 
@frequency_subday_interval = 0, 
@active_start_time_of_day = 0, 
@active_end_time_of_day = 235959, 
@active_start_date = 20120805, 
@active_end_date = 99991231, 
@alt_snapshot_folder = N'', 
@working_directory = N'',
@use_ftp = N'False', 
@job_login = N'AGENT_LOGIN_USER_NAME', 
@job_password = N'AGENT_LOGIN_PASSWORD', 
@publication_type = 0
GO

This was also executed successfully with the following messages:


'AGENT_LOGIN_USER_NAME' is a member of sysadmin server role and cannot be granted to or revoked from the proxy. Members of sysadmin server role are allowed to use any proxy.
Job 'AUTOMATICALLY_GENERATED_JOB_NAME' started successfully.

So at this point I expect my subscription to show the status "Running" if I see it in the replication monitor. However, it shows me "Uninitialized subscription". Then I thought that the backup is out-dated for some strange reason, so I repeated the steps 1-4 above, but just dropped the subscriptions before doing the steps. Same problem. It executes successfully, but shows the status to be "Uninitialized subscription" and does not sync anything. All jobs are piled up in the undistributed commands. I was getting frustrated, because I thought there was something wrong with the backups.

However, just out curiosity, I tried executing "sp_addsubcription" with the same command as shown above, but just changing @subscription_type from 'pull' to 'push' so that a PUSH subscription is initialized and it was running successfully, which implicates that my backups are completely fine.

My questions are:

1. Why could a PUSH subscription be added and initialized successfully and not the PULL?

2. What am I doing wrong (if anything) and how can I get it working (I do not want a PUSH subscription as the server is a high-availability server)? 

SYSTEM SPECS (TO AVOID FURTHER QUERIES):

OS: Windows Server 2003 Enterprise x64 Edition Service Pack 2
SQL SERVER 2005 (Version 9.0) ENTERPRISE EDITION (both Publisher and Subscriber)

Please provide me with some solution as soon as possible.
Thanks in advance.

Regards,

Ashik

Troubleshooting Replication Issue

$
0
0

Is there any way i can get the number of transactions delivered 'From specific Publisher' to subscriber in last couple of hours for each article ?  Also, if possible time it took to commit these transactions on subscriber.

Replication and Remote Access option.

$
0
0

Hi there, due to hardening requirement, we've disabled Remote Access option in our SQL Server 2012 instances. Now we have a new requirement to setup transactional replication between two SQL Server 2012 instances, I've seen some threads in forums stated that Remote Access option is a prerequisite for setting up/running SQL Server replication. Hence, we would like to have some advice on following: -

a) is Remote Access option a prerequisite for setting up/running SQL Server replication??

b) if it is a prerequisite, where should it be enabled (publisher/distributor/subscriber)??

Thank you!!

How to transfer database from a remote SQL server to main SQL server ?

$
0
0

Hello,

I  am searching for the best way to connect remote SQL servers to a main server.The problem is the majority of time the remote servers will be disconnected (offilne),So i need to Synchronize the remote databases to transfer the data to the main server at the moment of connection.

I am new database developer and administrator.I found many ways to do this, some are at the application layer and some at the database layer.

I am totally lost in choosing the best method especially that i need a strong method that works offline and sync the data and I prefer to use a database method such as SSIS or replication.

Would you pleas help me in this.What's the differences between SSIS and replication and witch one is the best for this scenario.

Best regards,

Differences xact_id, xact_seqno, xact_seqno_start, xact_seqno_end

$
0
0

Could someone clarify the difference among the following fields in SQL replication.

I'm new to replication stuff. Appreciate if detailed info is provided.

xact_id,
xact_seqno,
xact_seqno_start,
xact_seqno_end,

Thanks,


Merge replication

$
0
0
When I add a subscription to a merge replication, even I do not initialize data. The publisher is still publish data to subscriber. Is it normal? 

Transactional Replication - Slow running sp_MSget_repl_commands

$
0
0
We are running transaction replication, with a publisher and a single subscriber located in different data centres. The distribution database is located with the subsciber.

We get high replication latency regularly, and during those times I have identified the bottleneck as the execution of sp_MSget_repl_commands by the distribution reader. Monitoring this thread in the DMV dm_exec_requests, it is consistently getting long waits for wait_type ASYNC_NETWORK_IO.

Why would distribution reader by waiting on network? The thread and distribution database are all located on the same server. Is there something else that the distribution reader thread does that requires accessing the publisher?

Pull Transaction Replication over non trusted domain

$
0
0
I go the following error when subscribe to run. I have look at Hilary Cotter thread but I can't seem to figure this one out.

thanks...


(Transaction sequence number: 0x00022B9900032F92003500000000, Command ID: 10)

Error messages:
The process could not read file '\\ncn1-db1\repldata\unc\ncn1-DB1_table_PUBLISHER\20071212100089\WbContact_7.pre' due to OS error 1326. (Source: MSSQL_REPL, Error number: MSSQL_REPL20024)
Get help: http://help/MSSQL_REPL20024
Logon failure: unknown user name or bad password.
 (Source: MSSQL_REPL, Error number: MSSQL_REPL1326)
Get help: http://help/MSSQL_REPL1326

Transaction Replication - Please Help!!!

$
0
0
Hi I am setting up Transaction replication between 2 SQL servers

Server1-SQL Server 2000 - Publisher
Server2-SQL Server 2005 - Subscriber

Creating Publication:
Local Publication -> New Publication
Select Database
Publication Type - Transactional Publication
Select Table
Create Snapshot immediately - Create Publication

Creating Subscription:
Right click on Publication - Create New Subscription
Select Publisher and publication
Distribution Agent Location - Run each agent at its Subscribers (pull subscriptions)
Select Subscriber and Connect
Distribution Agent Security - I provide a Domain Service Account with password say: domain\service
Set Syncheronisation Schedule - run every 5 minutes
Initialise immediatley

The Snapshot is created without any issues. But i am getting the below message in Replication Monitor. Please advice what i need to do to get rid of this error message

PS: I have given the domain account FULL access to the F Drive on Publisher plus also created it as Login with sysadmin permissions on both Publisher and subscriber


....................................

Command attempted:

\\SERVER1\F$\SQL Replication Snapshot Folder\unc\SERVER7Z_DocControl_Srv7zTest\20091103091934\Drawings_1.sch
(Transaction sequence number: 0x00007FBA000008A5000E00000000, Command ID: 5)

Error messages:

The process could not read file '\\SERVER1\F$\SQL Replication Snapshot Folder\unc\SERVER7Z_DocControl_Srv7zTest\20091103091934\Drawings_1.sch' due to OS error 5. (Source: MSSQLServer, Error number: 20024)
Get help: http://help/20024

Access is denied.
(Source: MSSQLServer, Error number: 5)
Get help: http://help/5







Adding the secondary data file to 4 ndf file on destination server which has pull subscription should not affect or remove the replicication

$
0
0

Hi,

I have an requirement to add secondary data files under the same primary file group but span across 4 different disk, once this done i have to run rebuild index and ensure SQL distributes data evenly.

This server and the database hosted is  destination for the transactional replication which is running.

The source server still has only one DATA and ONE LOG file and there is no plan to add secondary files on Source server.

Question is when i am adding new files under the primary file group on the destination database that has the Pull subscription will that affect the destination subscription agent replication jobs and cause Replication disconnectivity.

Are there any precautions i have to take on replication end before i start with the adding secondary files on the destination server?

SQL server 2008R2-SP2 on windows2008R2 server - both source and destination servers are Clustered

Sql 2008R2 instllation on Windeows 2008R2 - Service Account Error in log after installing

$
0
0

Hi,

I have installed sqlserver 2008R2 on new m/c as a part of migrating from sql
2005 to sql 2008.
Next day I was looking the log and found the error
message:

Login failed for user 'MSSqlDB2K8\sqlsrvAcct'. Reason: Failed to
open the explicitly specified database. [CLIENT: <local machine>]

I have created this account during installation but didn't add account int
oadministrator group.
I have also tried to login using same credential in
SSMS and I can't connect.
When tried to sto pand start the service i can do
it.

I have added user into Administer group but still not working.
I
have also assigned account in Sysadmin server Role into Security.

Thank
you!

Merging databases without replication

$
0
0


I have a production database (PROD) and an Archive database (ARCH). There is a sql job executed every weekend to delete a portion of historical data from PROD and Insert them into ARCH. Now, the users want to setup a Reporting environment (REPORT) which should have data from both PROD + ARCH.

I did setup the reporting environment using replication but any change in schema breaks the replication process. 

Note: The schema between PROD and ARCH are same. The Identity column values between PROD & ARCH are not duplicated. Environment: SQL Server 2008.

Any advice is greatly appreciated. 


Ideal Log File Size Set up in Sql 2008

$
0
0

I would like to know what will be the ideal setting for Log file set up?

I have Data File, Log File and Temp DB on seperate Disk drive.
I have set up the Data File Initial Size: 100 GB - Growth - 5 GB as total Daat File Drive has 1 TB Capacity.
I am little confused for Log file as We have Replication Subscription will be running on that DB and it will total size of the DB is 300 GB Plus.
Replication will run frequently as well as couple batch job running.
If I set up Log File: 50 GB - Growth - 1 GB as my total Log file drive is configured - 100 GB.

Thanks and appreciate your response!

How to configure two way replication in SQL server 2008 R2

$
0
0

Hi,

I have two servers S1 having database D1 and S2 having database D2. Both database D1 and D2 are identical (D2 is D1's backup only). Both the servers are live and connected to applications in diffrent countries. I want to replicate any chnage in D1 to D2 and vice versa.

After searching on internet I found few options and tried Peer to peer transactional replication, Merge replication and bi-directional transactional replication, they seem to be configured without any error but no data changes are reflecting in the peer server.

Also, in P2P replication Once the topology is created and finished, the second peer goes invisible.

any help in this is appreciated. Please help in achieving this.

Thank you

SQl Server 2012 an d Bi-directional transactional replication

$
0
0

Hello all,

I've read that SQL Server 2012 does not support bi-directional replication.  We are currently running SQL Server 2008 and our replication topolgy utilizes bi-directional replication between two different SQL Server instances, with merge replication existing on one of those instances.  To be more specific:

  • On Server/DB X, records are inserted, which are replicated via transactional replication to Server/DB Y
  • Server/DB Y has merge replication set up, which subscrbers connect to over the web
  • Any records created by the subscribers to Server/DB Y merge replication are uploaded, then replicated back to Server/DB X via transactional replication

We are looking to upgrade to 2012 by then end of this year, and I am trying to find out how to preserve, or improve, our repliction topology.  If anyone has any suggestions or comments, please let me know.

Thanks in advance,

Clint


Clint

SQL 2008R2 Tranactional - Pull rep - table data not transfering to subscriber...

$
0
0


Hi-

We are having issues replicating data(table data - not schema) from a pull subscription.

1.
Status..

--> Snapshot Agent Status:

[100%] A snapshot of 925 article(s) was generated.


--> Log Reader Agent Status:

3 transaction(s) with 3 command(s) were delivered.

40 transaction(s) with 45 command(s) were delivered.

--> Number of Commands waiting in Distrib DB waiting to be applied to this subscriber: 59579

 

2.
Error(s):

--> Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL20164)
Get help: http://help/MSSQL_REPL20164

--> Invalid object name 'dbo.mnuweb'. (Source: MSSQLServer, Error number: 208)
Get help: http://help/208

--> Unable to replicate a view or function because the referenced objects or columns are not present on the Subscriber. (Source: MSSQL_REPL, Error number: MSSQL_REPL)


--> The concurrent snapshot for publication 'MDN-PROD' is not available because it has not been fully generated or the Log Reader is not running to activate it.


--> Sync Status of Subscriber: Job 'MDNQLDB1-prod3-MDN-PROD-CDRQLDB1-prod3-40440C46-6DDF-43AB-85BD-9F7F84BA3CC4' started successfully.


--> The replication agent encountered and error and is set to restart within the job step retry interval....

--> From the SQL Server Log:
2013-08-14 15:17:56.69 spid757     Error: 14151, Severity: 18, State: 1.

2013-08-14 15:17:56.69 spid757     Replication-Replication Distribution Subsystem: agent CDRQLDB1-prod2-CDR-PROD-MDNQLDB1-21 failed. The subscription(s) have been marked inactive and must be reinitialized. NoSync subscriptions will need to be dropped and recreated.


Should we try push replication instead?
Thanks,

-P

SQL 2008 merge replication snapshot agent fails

$
0
0
Hi All,

I am in the procoess of setting up merge replicaiton on sql 2008 that invloves 3 servers. Publisher (P), Subscriber (S) and distributor (D). I have successfully created all tyhe steps witha a domain user with SQL sysadmin access on all three servers so no permission issue. When I run the snapshot I can the folder ReplData\unc\dataDB_MERGE\20091007105412 created but empty although I can see the activity in Repl Monitor but it seems to stop at one table which is kind of big about 20 million records and failed with transaction log full on publisher. I am wondering why transaction log is getting used to this extent that it is getting full. I do have limited space on these test vm servers but its well enough for databases invloved. the database size is 17GB and 5GB log and after snapshot failed, i can see it tried to take all space on the drive and grew the log to 20GB and failign with space error.

Both subscirber and publisher are set for full recovery model for merge replication. Is there any setting or configuration I am missing, In sql 2000 and 2005 you could see the snapshot being created by seeing the unc folder with table and schema scripts but here it remains empty although repl monitor show sactivitiy for abotu 20 tables for 10 minutes than waiting on one table ( the big one) and failed in the end.

Any help is greatly appreciated.

Thanks!
dba60
Viewing all 4054 articles
Browse latest View live




Latest Images