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

Merge replication (MS SQL Web Edition)

$
0
0

Hi,

I have MS SQL Server 2008 R2 Standard Edition and MS SQL Web Edition (also 2008 R2) installed in our business, we currently use merge replication to ship information to the Web but I am trying to now move information from the Web to our Internal servers.  I want to stick with merge replication but I know that the Web Edition supports 'Subscription Only' merge replication, therfore if an update occurs on the web, will it propogate back to my main server?

If this doesn't work can I use 'Updatable Subscriptions for Transactional Replication?  I know this is being deprecated but is this my only option?

Thanks in advance

Craig


The merge process was unable to deliver the snapshot to the Subscriber

$
0
0

I'm getting the following errors in a pull merge replication setup on SQL 2008 Enterprise 64 bit on Windows Server 2008 64 bit:

I have verified that the subscriber's account appears to have the appropriate permissions to access the replication data share.

Can anyone help?


AMWild



Error messages:

The merge process was unable to deliver the snapshot to the Subscriber. If using Web synchronization, the merge process may have been unable to create or write to the message file. When troubleshooting, restart the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147201001

The process could not read file '\\SGCMCSA031\SQLReplication-F\unc\SGCMCSA031_SUCCESSOR_MERGE\20121019093442\tbl_Menu_Security_2.cft' due to OS error 3. (Source: MSSQL_REPL, Error number: MSSQL_REPL21017)

SQL 2008R2 - The merge process could not set the status of the subscription correctly??

$
0
0

Hi Everyone,

I have SQL Server 2008 R2 with push subscriptions enabled to 10 computers. It was all working and replicating fine till yesterday when out of no where I have been receving the following errors for each of the subscriptions :

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Error messages:

  • The merge process could not set the status of the subscription correctly. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147200963)
    Get help: http://help/MSSQL_REPL-2147200963
  • Could not find stored procedure 'dbo.sp_MScheckIsPubOfSub'. (Source: MSSQLServer, Error number: 2812)
    Get help: http://help/2812

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I have tried a lot of searching on various SQL Server forums but have not been able to find out the exact cause for it and how to solve it.

Any help would be greatly appreciated.

Thanks

SELECT failed because the following SET options have incorrect settings: ANSI_PADDING

$
0
0

I come across the following error message quite frequently whenever I have to reinitialize any of the subscribers. Even though I know how to resolve it but always wondered why it would be produced at the first place as offending script is auto-generated by snapshot agent.

 

Error messages:

SELECT failed because the following SET options have incorrect settings: 'ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. (Source: MSSQLServer, Error number: 1934)
Get help: http://help/1934

SELECT failed because the following SET options have incorrect settings: 'ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. (Source: MSSQLServer, Error number: 1934)
Get help: http://help/1934

As a resolution what I have to do is to go to snapshot folder and update sch file for the offending table; i.e; change SET ANSI_PADDING from OFF to ON in sch file and it resolves the error message. What I have observed, though, that ANSI_PADDING is always off for those tables which contain only numeric data types. That is how I suppose it should be as I see that setting is only relevant to char, varchar, binary, and varbinary data types.

 

BOL: We recommend that ANSI_PADDING always be set to ON. In a future version of SQL Server ANSI_PADDING will always be ON and any applications that explicitly set the option to OFF will produce an error.

 

That explains why replication insist for having it ON but what I don't understand is that why Snapshot agent generated script have it as off?

 

I have enabled ANSI_PADDING from database properties but it would make no difference whatsoever.

SQL Server 2008 R2 Express Sync

$
0
0
Hello 

I have been tasked with finding a method of synchronizing offsite branches to the HQ. 

It will be one-way synchronization of certain tables from the remote branches databases to the HQ database. The databases from the remote sites and HQ have the same schema. 

The data will require to be synchronized every minute and the data size is less than 100KB. 

Ideally what should only be synchronized are the differentials (new data in the specified tables).

Finally the branches and the HQ are running Server 2008 R2 Express. 

My questions are: 

Can this be achieved with the Express edition? 
If not, will I have to implement some powershell, export, import thing? (Guessing here) Or upgrade to full edition?
What type of replication would it be best suited for this?
Or are there any 3rd party utilities out there than can achieve the required result?
 

Error durring intial syncronization. The schema script 'f_CINARelatedParties_377.sch' could not be propagated to the subscriber.

$
0
0

Merge push (also tried pull, same error). MS server 2008 R2 and SQL server 2008 R2.

Full error from job is below followed by f_CINARelatedParties Function. this Function has not changed and I do this configuration evey couple of weeks. I did not write the Function.

2012-09-25 22:05:08.167 The schema script 'f_CINARelatedParties_377.sch' could not be propagated to the subscriber.

2012-09-25 22:05:08.978 Category:NULL

Source:  Merge Replication Provider

Number:  -2147201001

Message: The schema script 'f_CINARelatedParties_377.sch' could not be propagated to the subscriber.

2012-09-25 22:05:08.983 Category:NULL

Source:  Microsoft SQL Server Native Client 10.0

Number:  421

Message: The text data type cannot be selected as DISTINCT because it is not comparable.

drop Function [dbo].[f_CINARelatedParties]

go

SET QUOTED_IDENTIFIER ON

go

SET ANSI_NULLS ON

go

/*

Author:  Sophus Consulting

Date:    March 2012

Purpose: Called by calc in CINA doc types to return names of parties related to children selected as Addressees in Recipients grid.

                                Also returns related party relationship and address (or date of birth) if specified in calc.

*/

CREATE FUNCTION [dbo].[f_CINARelatedParties](@Events varchar(36),@SelectList varchar(1000),@Relationship varchar(20),@Address varchar(20))

RETURNS VARCHAR(8000) AS

BEGIN

                declare @delim char(1)

                set @delim=','

                SET @SelectList=rtrim(ltrim(replace(replace(@selectlist,' ,',','),', ',',')))

                IF charindex('paternal',@selectlist)=0 and charindex('maternal',@selectlist)=0

                BEGIN

                                set @selectlist=replace(@selectlist,'grandfather','maternal grandfather,paternal grandfather')

                                set @selectlist=replace(@selectlist,'grandmother','maternal grandmother,paternal grandmother')

                END

                DECLARE @list varchar(8000)

                DECLARE @CINA_List TABLE (RelatedParty varchar(70), Relationship varchar(40), Children varchar(1000), Address varchar(1000), DOB datetime)

                IF @SelectList='all'

                BEGIN

                                --NOTE: IF IT IS DECIDED THAT RELATED PARTIES SHOULD ONLY BE INCLUDED IF THEY ARE ADDRESSEES,

                                --THEN UNCOMMENT THE PORTIONS BELOW REFERRING TO EC2 AND DR2

                                insert into @CINA_List

                                select c2.fullname, case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end, coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end),''), coalesce(c2.addrlines,''), coalesce(c2.qdateofbirth,'')

                                from contacts c1, matterscontacts mc, contacts c2, contactsqrelationships q, contactsqrelations1 q1, eventmatters em, eventscontacts ec1, documentrecipients dr1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and q.contacts=c1.contacts

                                and q.contactsqrelationships=q1.contactsqrelationships

                                and q1.qcontactname=c2.contacts

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                --and (q1.qserviceparty='Y' or q1.qcontactrelatio = 'mother' or q1.qcontactrelatio like 'father%' or q1.qcontactrelatio like '%grandfather%' or q1.qcontactrelatio like '%grandmother%') -- per VG 3/29: include only service parties unless mother, father or grandparent

                                and q1.qserviceparty='Y' -- per VG 4/19: include mother and father in All and Service By lists only if ServiceBy=Y

                                --and ec2.contacts=c2.contacts

                                --and ec2.events=@Events

                                --and dr2.documentrecipients=ec2.eventscontacts and dr2.isaddressee='Y'

                END

                ELSE

                IF @SelectList='service' -- this is basically the same as All, above, except it groups by service type and prefaces each group with its service type

                BEGIN

                                --NOTE: IF IT IS DECIDED THAT RELATED PARTIES SHOULD ONLY BE INCLUDED IF THEY ARE ADDRESSEES,

                                --THEN UNCOMMENT THE PORTIONS BELOW REFERRING TO EC2 AND DR2

                                insert into @CINA_List

                                --sub CINA Service By for Replationship; omit list of children

                                --select c2.fullname, case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end, coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end),''), cast(coalesce(c2.addrlines,'') as varchar(1000)) + case when coalesce((select min(phoneno) from phone p where p.contacts=c2.contacts and phonetype='fax'),'')<>'' then char(13)+char(10)+'Fax: '+coalesce((select min(phoneno) from phone p where p.contacts=c2.contacts and phonetype='fax'),'') else '' end, coalesce(c2.qdateofbirth,'')

                                select c2.fullname, coalesce(q1.qcinaserviceby,'Via N/A'), '', cast(coalesce(c2.addrlines,'') as varchar(1000)) + case when coalesce((select min(phoneno) from phone p where p.contacts=c2.contacts and phonetype='fax'),'')<>'' then char(13)+char(10)+'Fax: '+coalesce((select min(phoneno) from phone p where p.contacts=c2.contacts and phonetype='fax'),'') else '' end, ''

                                from contacts c1, matterscontacts mc, contacts c2, contactsqrelationships q, contactsqrelations1 q1, eventmatters em, eventscontacts ec1, documentrecipients dr1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and q.contacts=c1.contacts

                                and q.contactsqrelationships=q1.contactsqrelationships

                                and q1.qcontactname=c2.contacts

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                and q1.qserviceparty='Y'

                                --and ec2.contacts=c2.contacts

                                --and ec2.events=@Events

                                --and dr2.documentrecipients=ec2.eventscontacts and dr2.isaddressee='Y'

                END

                ELSE

                BEGIN

                                declare @listTable table(ListValue varchar(50))

                                DECLARE @DelimPosition INT

                                SET @DelimPosition = CHARINDEX(@delim, @SelectList)

                                WHILE @DelimPosition > 0

                                BEGIN

                                                INSERT INTO @listTable(ListValue)

                                                                VALUES(ltrim(rtrim(LEFT(@SelectList, @DelimPosition - 1))))

                                                SET @SelectList = right(@SelectList, len(@SelectList) - @DelimPosition)

                                                SET @DelimPosition = CHARINDEX(@delim, @SelectList)

                                END

                                IF len(@SelectList) > 0

                                BEGIN

                                                insert into @listTable(ListValue)

                                                values(@SelectList)

                                END

                                insert into @CINA_List

                                select c2.fullname, case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end, coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,case when q1.qcontactrelatio like 'father%' then 'Father' else coalesce(q1.qcontactrelatio,'Missing Relationship') end),''), coalesce(c2.addrlines,''), coalesce(c2.qdateofbirth,'')

                                from contacts c1, matterscontacts mc, contacts c2, contactsqrelationships q, contactsqrelations1 q1, eventmatters em, eventscontacts ec1, documentrecipients dr1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and q.contacts=c1.contacts

                                and q.contactsqrelationships=q1.contactsqrelationships

                                and q1.qcontactname=c2.contacts

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                and (q1.qserviceparty='Y' or q1.qcontactrelatio = 'mother' or q1.qcontactrelatio like 'father%' or q1.qcontactrelatio like '%grandfather%' or q1.qcontactrelatio like '%grandmother%') -- per VG 4/19 (old: VG 3/29): include only service parties unless mother, father or grandparent

                                --and ec2.contacts=c2.contacts

                                --and ec2.events=@Events

                                --and dr2.documentrecipients=ec2.eventscontacts and dr2.isaddressee='Y'

                                and case when left(q1.qcontactrelatio,6)='father' then 'father' else q1.qcontactrelatio end in((select ListValue from @listTable))

                                                UNION

                                select c2.compname, 'Tribe', coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,'tribe'),''), coalesce(c2.addrlines,''), coalesce(c2.qdateofbirth,'')

                                from contacts c1, matterscontacts mc, contacts c2, eventmatters em, eventscontacts ec1, documentrecipients dr1, contactsqicwa cq, contactsqicwa1 cq1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                and cq1.contactsqicwa=cq.contactsqicwa

                                and cq.contacts=c1.contacts

                                and cq1.QIFYESCHILDTRIB=c2.contacts

                                and 'tribe' in((select ListValue from @listTable))

                                                UNION

                                select c2.compname, 'Tribe of Mother', coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,'mother tribe'),''), coalesce(c2.addrlines,''), coalesce(c2.qdateofbirth,'')

                                from contacts c1, matterscontacts mc, contacts c2, eventmatters em, eventscontacts ec1, documentrecipients dr1, contactsqicwa cq, contactsqicwa1 cq1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                and cq1.contactsqicwa=cq.contactsqicwa

                                and cq.contacts=c1.contacts

                                and cq1.QIFYESPARENTTRI=c2.contacts

                                and 'tribe of mother' in((select ListValue from @listTable))

                                                UNION

                                select c2.compname, 'Tribe of Father', coalesce(dbo.f_ListCINAChildren(@Events,c2.contacts,'father tribe'),''), coalesce(c2.addrlines,''), coalesce(c2.qdateofbirth,'')

                                from contacts c1, matterscontacts mc, contacts c2, eventmatters em, eventscontacts ec1, documentrecipients dr1, contactsqicwa cq, contactsqicwa1 cq1--, eventscontacts ec2, documentrecipients dr2

                                where em.events=@Events

                                and mc.matters=em.matters

                                and mc.contacts=c1.contacts

                                and mc.mtocclass='cina child'

                                and ec1.contacts=c1.contacts

                                and ec1.events=@Events

                                and dr1.documentrecipients=ec1.eventscontacts and dr1.isaddressee='Y'

                                and cq1.contactsqicwa=cq.contactsqicwa

                                and cq.contacts=c1.contacts

                                and cq1.QIFYESFATHERTRI=c2.contacts

                                and 'tribe of father' in((select ListValue from @listTable))

                END

                IF @SelectList='service'

                BEGIN

                                declare @ServiceBy varchar(40)

                                declare @PrevServiceBy varchar(40)

                                declare @Name varchar(70)

                                declare @Addr varchar(1000)

                                DECLARE CursorList CURSOR FOR

                                                select distinct relationship, relatedparty, address -- relationship is being used for Service Type

                                                from @cina_list

                                                order by relationship

                                OPEN CursorList

                                FETCH NEXT FROM CursorList INTO @ServiceBy, @Name, @Addr

                                set @PrevServiceBy='x'

                                set @List=''

                                WHILE @@FETCH_STATUS = 0

                                BEGIN

                                                IF @ServiceBy<>@PrevServiceBy

                                                BEGIN

                                                                set @List = @List + @ServiceBy+':' + char(13)+char(10)

                                                                set @PrevServiceBy=@ServiceBy

                                                END

                                                set @List = @List + char(9) + @Name + char(13)+char(10)+char(9) + replace(@Addr,char(13)+char(10),char(13)+char(10)+char(9)) + char(13)+char(10)+char(13)+char(10)

                                                FETCH NEXT FROM CursorList INTO @ServiceBy, @Name, @Addr

                                END

                                CLOSE CursorList

                                DEALLOCATE CursorList

                END

                ELSE

                BEGIN

                                DECLARE @CINA_List_Distinct TABLE (RelatedParty varchar(70), Relationship varchar(40), Children varchar(1000), Address varchar(1000), DOB datetime)

                                insert into @CINA_List_Distinct

                                select * from

                                (select top 100 * from

                                (select distinct * from @CINA_List) x

                                order by relationship) y

                                order by case relationship

                                                when 'mother' then 1

                                                when 'father' then 2

                                                when 'maternal grandmother' then 3

                                                when 'maternal grandfather' then 4

                                                when 'paternal grandmother' then 5

                                                when 'paternal grandfather' then 6

                                                else 7

                                                end

                                --the commented out line lists children for all parties EXCEPT mother:

                                --SELECT @list=COALESCE(@list+char(13),'')+relatedparty + ', ' + relationship + case when relationship<>'mother' then case when relationship like '%worker%' then ' for' when relationship like '%representative%' then ' for' when relationship like '%guardian ad litem%' then ' for' else ' of' end + ' ' + children else '' end + case when @Address='address' then char(13)+char(10)+@Address else '' end

                                --the following version lists children only for father:

                                --SELECT @list=COALESCE(@list+char(13),'')+relatedparty + ', ' + case when relationship like 'father%' then + 'Father of ' + children else relationship end + case when @Address='address' then char(13)+char(10)+address else '' end

                                SELECT @list=

                --                             case when @Address='noaddress'

                --                                             then COALESCE(@list+char(13),'')+relatedparty + ', ' + case when relationship like 'father%' then + 'father of ' + children else relationship end

                --                                             else COALESCE(@list+char(13)+char(13),'')+relatedparty + ', ' + case when relationship like 'father%' then + 'father of ' + children else relationship end + char(13) + coalesce(Address,'')

                --                             end

                                                case @Address

                                                                when 'noaddress' then COALESCE(@list+char(13),'')+relatedparty + case when @Relationship='relationship' then ', ' + case when relationship like 'father%' then + 'Father of ' + children else case when relationship = 'tribe of father' then + 'Tribe of Father of ' + children else case when relationship = 'tribe' then + 'Tribe of ' + children else relationship end end end else '' end

                                                                when 'address' then COALESCE(@list+char(13)+char(13),'')+relatedparty + case when @Relationship='relationship' then ', ' + case when relationship like 'father%' then + 'Father of ' + children else case when relationship = 'tribe of father' then + 'Tribe of Father of ' + children else case when relationship = 'tribe' then + 'Tribe of ' + children else relationship end end end else '' end + char(13) + coalesce(Address,'')

                                                                when 'address,' then COALESCE(@list+char(13)+char(13),'')+relatedparty + case when @Relationship='relationship' then ', ' + case when relationship like 'father%' then + 'Father of ' + children else case when relationship = 'tribe of father' then + 'Tribe of Father of ' + children else case when relationship = 'tribe' then + 'Tribe of ' + children else relationship end end end else '' end + ', ' + replace(coalesce(Address,''),char(13)+char(10),', ')

                                                                when 'addressonly' then COALESCE(@list+char(13)+char(13),'') + coalesce(Address,'')

                                                                when 'addressonly,' then COALESCE(@list+char(13)+char(13),'') + replace(coalesce(Address,''),char(13)+char(10),', ')

                                                                when 'dob' then COALESCE(@list+char(13)+char(13),'') + coalesce(convert(varchar(10),DOB,101),'')

                                                                when 'dobl' then COALESCE(@list+char(13)+char(13),'') + datename(month,dateadd(dd,datediff(dd,0,DOB),0)) + ' ' + cast(datepart(day,dateadd(dd,datediff(dd,0,DOB),0)) as varchar(2)) + ', ' + cast(datepart(year,dateadd(dd,datediff(dd,0,DOB),0)) as char(4))

                                                end

                                FROM @CINA_List_Distinct

                END

                RETURN @list

END

go


David Young

Find articles that do not match in Peer-to-Peer topology

$
0
0

I recently had a situation where in a Peer-to-Peer topology, one of the articles was alterd (a column was added).  Of course this started causing the Error

Peer-To-Peer topologies require identical articles in publications at all nodes prior to synchronizing. Articles in publication [Server1].[DB1].[MyPub] do not match articles in [Server2].[DB2].[MyPub].

After lots of searching, I was able to find which table had been altered (on Server1), and make the same change on the Peer-to-Peer partner (Server2), so both table definitions were identical.  However, I continued to receive the "Peer-to-Peer topolgies require identical articles..." error.  Finally I dropped the article from both publications, then added the article back to both publications and that solved the problem.

My Questions:

1)  Is it correct that the error continued after Altering the table on Server2 because there were pending tranactions that had the "Old" table definition, and so dropping the article removes these pending transactions?

2) How can I find which artcile is the one that doesn't match, or the command that is failing?  In the error information that is logged, it simply says "Articles in publication [xxx] do not match articles in [xxx].  It does not specify which article specifically.

thanks,


Matt

Advice Needed on updating db online

$
0
0

Hi,

Looking for some advice...

I have a local Windows application using SQL Server 2012 Express. I wish to (auto FTP) transfer (once a day) the database to my web server (VPS) and have it available there for my ASP.NET web application.  I've guessed at a few options, but I'm really not sure what to do.

1. Detach and then Attach to the new uploaded file?

2. Replication

3. Synchronize databases by using Microsoft Sync Framework

Hopefully I can use the ASP.NET app to trigger whatever process I'd need to update/access the data/file.  I do have VPS hosting, so I could also have a regular Win app running to perform the process.

thanks for any help you can offer.


Adding a Article without a snapshot

$
0
0

Dear All

I know the general rule is that if you add an article to an existing subscription then it needs a snapshot, however I would like to know if its possible to do it without one. The reason is that the table we will be replicating is about 800GB in size and 99.9999% of the data already exists on the Subscriber. Basically someone (not me) accidently removed the Article.

We use traditional transaction replication with a distributer and one subcriber.

The alternative is to create another publication with just that subscription however its not something we really want to do.

Thanks

Peter

Can't delete bogus subscription

$
0
0

I created a subscription from a backup file / publisher, but something went wrong along the way. 

Now I've got a subscription that I want to remove (to clean up), but when I try to remove the subscription either via SSMS or try to generate a script, I get the following error: 



any ideas with this? IT's not urgent, but would like to remove the bogus subscriptions from SSMS.

Thanks,

Chris

Create separate account for snapshot agent

$
0
0

Do I have to create separate user for each database in the security setting while creating snapshot agent. I am having issues running the job manually for some database SQLServerAgent Error:Request to run job. Servername-database name (from user username) refused because the job is already running from a request by start sequence 0. Microsoft Sql server, Error 22022). Is this an issue?

Also the Distribution clean up job error:

Message
Executed as user: NT AUTHORITY\NETWORK SERVICE. Could not remove directory 'D:\ReplData\unc\DEVWINSQL4_ABRAHRMS_LIVE_ABRHRMS_LIVE\20120918050314\'. Check the security context of xp_cmdshell and close other processes that may be accessing the directory. [SQLSTATE 42000] (Error 20015).  The step failed.

Please advice how I can resolve this issue. I have done quiet a bit of search but cannot resolve this.

Comparison Of Replication Technologies

$
0
0

Is there a good comparison of the various SQL server 2008 replication technologies on the Internet somewhere.

I want to try and make a chart of the comparisons and then choose one.

Minimally, I'm looking facts on Transactional and Mergre replication.

If I can't find a complete comparison I would take and accept a list of features for each replication technology.

Thank you,




Machine names too long, can't setup replication!

$
0
0

We have two database servers, let's say the machine names are

SOMECOMPANY-CS003-DB1  and SOMECOMPANY-CS003-DB2

I want to publish the databases from SOMECOMPANY-CS003-DB1 to SOMECOMPANY-CS003-DB2. The issue is, when I run @@Servername on the machines, they both return SOMECOMPANY-CS0, since SQL seems to truncate the name. 

I renamed the 2nd server (SOMECOMPANY-CS003-DB2) in SQL, but I still can't setup replication, because of the  "

SQL Server replication requires the actual server name to make a connection to the server" error. 

any ideas with how I can work around this? Has anyone encountered this issue before?

Thanks,
Chris

Peer tp Peer Replicated Stored Proc

$
0
0

Unable to drop a stored procedure article when I use 'Execution of the stored procedure' or 'Execution in a serialized transaction of the SP' as the Replicate type in a Peer to Peer replication setup. When I use 'Stored procedure definition only', it works. Question, is this a bug or am I doing something incorrect?

SQL Server 2008 R2 SP2 CU3. I tried SP2 alone, CU1, CU2 and CU3, none worked.

Thanks,

schedule for merge replication

$
0
0

We're replicating a database between London and Hong Kong using SQL Server 2005 Merge replication. The replication is set to synchronise every one minute and it works just fine. There is however the option to set the synchronisation to be "Continuous". Is there any real difference between replication every one minute and continuously?

The only reason for us doing every one minute rather than continuous in the first place was that it recovered better if the line went down for a few minutes, but this experience was all from SQL Server 2000 so it might not be applicable any more...


Details Wanted: Conflict Resolution with Transactional Replication

$
0
0

All the videos that "I've seen" show via the wizard how to set up the publisher, publication, adding articles, distributor, subscriber, and the synchronization schedule using the Object Explorer when you login into the SQL Server Management Studio, but nothing is said about conflict resolution.

Question: How do you set up automatic and do manual conflict resolution with SQL server 2008. What are the missing details. Do you have a detailed step by step example how to do conflict resolution.

Thank you,


Problem to run job on subscriber machine : the process could not read file .... due to os error 5

$
0
0

Hi

i'have a merge replication. i've configured my publisher successfully.

after configuring subscriber, when i run the subscriber job, i'm facing this error :

The process could not connect to subscriber 'mySubscriberMachineName'

Login failed for user x

i've changed my subscriber job>Run as to sql server agent job service account and now im facing this error :

the process could not read file MyUNCPathOnTheServer due to OS error 5.

i've test my share snapshot folder on the server without any problem (it shared to everyone), but i don't know why subscription agent account can not read this folder!!!

can anybody help me ?

thanks in advance


http://www.codeproject.com/KB/codegen/DatabaseHelper.aspx

Replication between Sql2k5 Sql2k?

$
0
0

hi all of you,

is it possible? Can I make a subscriptor one Sql2k for my Sql2k5 publisher?

Thanks a lot!!!!


Enric

Why is Replication Throwing Error 3930 When Insert, and Update Triggers are added to the Subscriber Tables? Help Please!

$
0
0

Message Message:

2012-10-22 15:18:07.143 Copyright (c) 2008 Microsoft Corporation
2012-10-22 15:18:07.143 Microsoft SQL Server Replication Agent: distrib
2012-10-22 15:18:07.143 
2012-10-22 15:18:07.143 The timestamps prepended to the output lines are expressed in terms of UTC time.
2012-10-22 15:18:07.143 User-specified agent parameter values:
-Subscriber WAUSQL42\WAUSQL42
-SubscriberDB PM_Warehouse
-Publisher WAUSQL42\WAUSQL42
-Distributor WAUSQL42\WAUSQL42
-DistributorSecurityMode 1
-Publication pm_warehouse_publication
-PublisherDB Oracle_Replication
-Continuous
-XJOBID 0x471EF961AB4A1E4F88CB0C4577F22CB7
-XJOBNAME WAUSQL42\WAUSQL42-Oracle_Replication-pm_warehouse_publicat-WAUSQL42\WAUSQL42-3
-XSTEPID 2
-XSUBSYSTEM Distribution
-XSERVER WAUSQL42\WAUSQL42
-XCMDLINE 0
-XCancelEventHandle 0000000000000900
-XParentProcessHandle 0000000000000B54
2012-10-22 15:18:07.143 Startup Delay: 3244 (msecs)
2012-10-22 15:18:10.393 Connecting to Distributor 'WAUSQL42\WAUSQL42'
2012-10-22 15:18:10.456 Parameter values obtained from agent profile:
-bcpbatchsize 2147473647
-commitbatchsize 100
-commitbatchthreshold 1000
-historyverboselevel 1
-keepalivemessageinterval 300
-logintimeout 15
-maxbcpthreads 1
-maxdeliveredtransactions 0
-pollinginterval 5000
-querytimeout 1800
-skiperrors 
-transactionsperhistory 100
2012-10-22 15:18:10.456 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:18:10.549 Initializing
2012-10-22 15:18:10.690 
42000 The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction. 3930
2012-10-22 15:18:10.690 
42000 Uncommittable transaction is detected at the end of the batch. The transaction is rolled back. 3998
2012-10-22 15:19:32.410 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:19:32.410 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:19:32.426 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:20:56.256 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:20:56.256 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:20:56.256 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:22:33.007 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:22:33.007 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:22:33.007 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:24:11.338 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:24:11.338 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:24:11.338 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:26:07.887 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:26:07.887 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:26:07.902 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:28:12.983 Disconnecting from Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:28:12.983 Connecting to Subscriber 'WAUSQL42\WAUSQL42'
2012-10-22 15:28:12.998 Error executing a batch of commands. Retrying individual commands.
2012-10-22 15:29:32.359 Agent message code 3998. Uncommittable transaction is detected at the end of the batch. The transaction is rolled back.
2012-10-22 15:29:32.391 Category:COMMAND
Source:  Failed Command
Number:  
Message: if @@trancount > 0 rollback tran
2012-10-22 15:29:32.391 Category:NULL
Source:  Microsoft SQL Server Native Client 10.0
Number:  3998
Message: Uncommittable transaction is detected at the end of the batch. The transaction is rolled back.

Sample Insert and Update Triggers

ALTER TRIGGER [dbo].[TRG_SHIP_WAVE_PARM_Insert] 
ON [dbo].[SHIP_WAVE_PARM]
AFTER INSERT
AS 
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE 
@SHIP_WAVE_PARM_ID decimal(5),
@REC_TYPE nvarchar(8),
@WHSE nvarchar(24),
@SHIP_WAVE_NBR nvarchar(96),
@WAVE_DESC nvarchar(320),
@WAVE_PARM_ID decimal(5),
@PERF_PICKNG_WAVE nvarchar(8),
@PICK_WAVE_NBR nvarchar(96),
@PERF_RTE nvarchar(8),
@PERF_PKT_CONSOL nvarchar(8),
@PERF_PULLDOWN_FROM_PNH nvarchar(8),
@CREATE_DATE_TIME datetime,
@MOD_DATE_TIME datetime,
@USER_ID nvarchar(120),
@STAT_CODE decimal(5),
@PNH_PARM_ID decimal(5),
@RTE_WAVE_PARM_ID decimal(5),
@SQLError_ID int,
@Action_Type char(3) = 'TIN'
 
SET @SQLError_ID = error_number()

--assign inserted values to local variables
SELECT 
@SHIP_WAVE_PARM_ID = i.SHIP_WAVE_PARM_ID,
@REC_TYPE = i.REC_TYPE,
@WHSE = i.WHSE,
@SHIP_WAVE_NBR = i.SHIP_WAVE_NBR,
@WAVE_DESC = i.WAVE_DESC,
@WAVE_PARM_ID = i.WAVE_PARM_ID,
@PERF_PICKNG_WAVE = i.PERF_PICKNG_WAVE,
@PICK_WAVE_NBR = i.PICK_WAVE_NBR,
@PERF_RTE = i.PERF_RTE,
@PERF_PKT_CONSOL = i.PERF_PKT_CONSOL,
@PERF_PULLDOWN_FROM_PNH = i.PERF_PULLDOWN_FROM_PNH,
@CREATE_DATE_TIME = i.CREATE_DATE_TIME,
@MOD_DATE_TIME = i.MOD_DATE_TIME,
@USER_ID = i.[USER_ID],
@STAT_CODE = i.STAT_CODE,
@PNH_PARM_ID = i.PNH_PARM_ID,
@RTE_WAVE_PARM_ID = i.RTE_WAVE_PARM_ID
FROM inserted i;

--delete record based on primary key value
DELETE 
FROM PM_Warehouse_Reporting.dbo.SHIP_WAVE_PARM
WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID

--insert new record to the reporting table
INSERT INTO PM_Warehouse_Reporting.dbo.SHIP_WAVE_PARM(
[SHIP_WAVE_PARM_ID],
[REC_TYPE],
[WHSE],
[SHIP_WAVE_NBR],
[WAVE_DESC],
[WAVE_PARM_ID],
[PERF_PICKNG_WAVE],
[PICK_WAVE_NBR],
[PERF_RTE],
[PERF_PKT_CONSOL],
[PERF_PULLDOWN_FROM_PNH],
[CREATE_DATE_TIME],
[MOD_DATE_TIME],
[USER_ID],
[STAT_CODE],
[PNH_PARM_ID],
[RTE_WAVE_PARM_ID]

VALUES (
@SHIP_WAVE_PARM_ID,
@REC_TYPE,
@WHSE,
@SHIP_WAVE_NBR,
@WAVE_DESC,
@WAVE_PARM_ID,
@PERF_PICKNG_WAVE,
@PICK_WAVE_NBR,
@PERF_RTE,
@PERF_PKT_CONSOL,
@PERF_PULLDOWN_FROM_PNH,
@CREATE_DATE_TIME,
@MOD_DATE_TIME,
@USER_ID,
@STAT_CODE,
@PNH_PARM_ID,
@RTE_WAVE_PARM_ID
)

--update the duplicate date in the PM_Warehouse_Reporting table
IF NOT EXISTS (SELECT 1 FROM PM_Warehouse.del.DELETES_SHIP_WAVE_PARM WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID)
BEGIN
UPDATE PM_Warehouse_Reporting.dbo.SHIP_WAVE_PARM
SET [DUPLICATE_DATE] = GETDATE()
WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID
END
ELSE
BEGIN
UPDATE PM_Warehouse.del.DELETES_SHIP_WAVE_PARM
SET [ACTION] = 'UPD'
WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID
UPDATE PM_Warehouse.err.ERROR_SHIP_WAVE_PARM
SET [ACTION] = 'UPD'
WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID
END
END

ALTER TRIGGER [dbo].[TRG_SHIP_WAVE_PARM_Update]
   ON [dbo].[SHIP_WAVE_PARM]
   AFTER UPDATE
AS 
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

    -- Insert statements for trigger here
DECLARE 
@SHIP_WAVE_PARM_ID decimal(5),
@REC_TYPE nvarchar(8),
@WHSE nvarchar(24),
@SHIP_WAVE_NBR nvarchar(96),
@WAVE_DESC nvarchar(320),
@WAVE_PARM_ID decimal(5),
@PERF_PICKNG_WAVE nvarchar(8),
@PICK_WAVE_NBR nvarchar(96),
@PERF_RTE nvarchar(8),
@PERF_PKT_CONSOL nvarchar(8),
@PERF_PULLDOWN_FROM_PNH nvarchar(8),
@CREATE_DATE_TIME datetime,
@MOD_DATE_TIME datetime,
@USER_ID nvarchar(120),
@STAT_CODE decimal(5),
@PNH_PARM_ID decimal(5),
@RTE_WAVE_PARM_ID decimal(5),
@Error_ID int,
@Action_Type char(3) = 'TUP'

SET @Error_ID = error_number()

SELECT 
@SHIP_WAVE_PARM_ID = i.SHIP_WAVE_PARM_ID,
@REC_TYPE = i.REC_TYPE,
@WHSE = i.WHSE,
@SHIP_WAVE_NBR = i.SHIP_WAVE_NBR,
@WAVE_DESC = i.WAVE_DESC,
@WAVE_PARM_ID = i.WAVE_PARM_ID,
@PERF_PICKNG_WAVE = i.PERF_PICKNG_WAVE,
@PICK_WAVE_NBR = i.PICK_WAVE_NBR,
@PERF_RTE = i.PERF_RTE,
@PERF_PKT_CONSOL = i.PERF_PKT_CONSOL,
@PERF_PULLDOWN_FROM_PNH = i.PERF_PULLDOWN_FROM_PNH,
@CREATE_DATE_TIME = i.CREATE_DATE_TIME,
@MOD_DATE_TIME = i.MOD_DATE_TIME,
@USER_ID = i.[USER_ID],
@STAT_CODE = i.STAT_CODE,
@PNH_PARM_ID = i.PNH_PARM_ID,
@RTE_WAVE_PARM_ID = i.RTE_WAVE_PARM_ID
FROM inserted i;

UPDATE  PM_Warehouse_Reporting.dbo.SHIP_WAVE_PARM
SET [SHIP_WAVE_PARM_ID]=@SHIP_WAVE_PARM_ID,
[REC_TYPE]=@REC_TYPE,
[WHSE]=@WHSE,
[SHIP_WAVE_NBR]=@SHIP_WAVE_NBR,
[WAVE_DESC]=@WAVE_DESC,
[WAVE_PARM_ID]=@WAVE_PARM_ID,
[PERF_PICKNG_WAVE]=@PERF_PICKNG_WAVE,
[PICK_WAVE_NBR]=@PICK_WAVE_NBR,
[PERF_RTE]=@PERF_RTE,
[PERF_PKT_CONSOL]=@PERF_PKT_CONSOL,
[PERF_PULLDOWN_FROM_PNH]=@PERF_PULLDOWN_FROM_PNH,
[CREATE_DATE_TIME]=@CREATE_DATE_TIME,
[MOD_DATE_TIME]=@MOD_DATE_TIME,
[USER_ID]=@USER_ID,
[STAT_CODE]=@STAT_CODE,
[PNH_PARM_ID]=@PNH_PARM_ID,
[RTE_WAVE_PARM_ID]=@RTE_WAVE_PARM_ID
WHERE [SHIP_WAVE_PARM_ID] = @SHIP_WAVE_PARM_ID
END


tae yang

Please Critique/Improve A Document About Choosing A Replication Strategy

$
0
0

Transactional Replication:

Changes are sent to subscribers as they are actually occurring. There is a log reader agent that runs on the distributor. It connect-up to the publication database and it scans through the transaction log of the publication database looking for commit to transactions. It changes those transactions from physical log records into logical operations. Those logical operations are entered into the distribution database. The distribution agent will push or pull the changes to the subscription database and apply them there. The good thing about Transactional replication is you do get to see all the changes. So, if you want to consume all of those this is the technique you have to use.

Subscribers use subscriptions for read only purposes!

The latency can vary depending on the network connectivity between the publisher and the distributor and the distributor and the subscriber. Many people use a separate server as the distributor and not have the distributor be on the same server as the publisher. It also can vary by how many subscribers you have, how many distribution agents there are, and the hardware speed on the distributor.

You can also replicate on systems that are not running SQL Server such as Oracle.

Because the Transactional Replication Log reader agent (moves transactions into the distribution database) job scans the transactional log of the publication database, it is possible that the log on the publication database may have to grow. If the log reader agent job cannot process the log records fast enough, or the periodicity of the log reader agent job has changed. The log records in that database cannot be cleared or truncated until they’ve been processed by the log reader agent job. This is even if those log records have nothing to do with the transactional publication. This all means you can run into log growth problems.

If a subscriber goes offline its transactions are held in the distribution database till the subscriber comes online. Data loss can occur if the publisher fails. Transactional replication only protects the data in the publication.

To track changes, transactional replication with queued updating subscriptions must be able to uniquely identify every row in every published table.

When to use Transactional replication:

(1)    You want to send changes to the subscriber(s) when they occur.

(2)    Low latency is desired between the publisher and subscriber.

(3)    The application requires all the intermediate states of the database.

(4)    The publishers use many INSERT, UPDATE, and DELETE statements.

Transactional replication with Updatable Subscriptions:

This is like transactional replication but subscribers can also update the published articles.

  • This feature will be removed in a future version of Microsoft SQL Server.

Transactional Replication with Database Mirroring:

This adds redundancy and more availability to the replication stream if a server fails etc.

Merge Replication:

All the subscribers can change their subscription data. You do not see the intermediate changes.

The idea is a set of changes happens on the publication, a set of changes happens on the subscriber(s), and they connect-up every so often through the merge agent. The merge agent looks at all the changes and merges them together. It does conflict detection.

This is good for making many changes and having the systems to occasionally connect-up, merge the changes, get all the changes everyone else has done, and then disconnect. This means you do not need to have permanent network connectivity. You do not send the changes as they occur.

If you have a high volatility of changes at the various site, but you do not want to consume all those changes then use Merge replication. Example: Company with one data center and many branches throughout the country. Every so often the branches connect up through the data center and the merge agent merges all the changes together.

To track changes, merge replication must be able to uniquely identify every row in every published table.

You can specify that conflicts be detected at the column-level, so that only changes to the same row and column are considered a conflict.

The drawback is the way change tracking occurs. Change tracking is done through triggers. So, when something changes on the publication it fires a trigger, and the trigger body has to process the change. This can have a detrimental performance effect on a system if there are a lot of changes going on.

When to use Merge replication:

(1)    Subscribers update the same data,

(2)    Each subscriber requires different data,

(3)    Conflicts might occur, or

(4)    Intermediate data is not required.

Snapshot Replication:

This will create a snapshot of the publication at a point in time. You drop the old snapshot. You can take a portion of the database and publish it. How often snapshot is applied to the subscription. You will not see intermediate changes. You see the net effect of what has occurred over time. Example: Small amount of data but volatility is high.

Peer-to-Peer Transactional Replication:   

This is a special case of Transactional Replication. This allows you to set up a topology of nodes and have changes from all nodes to be replicated automatically to all other nodes. Each server (node) acts as a publisher and a subscriber for the same data. For example, if you have three nodes and one goes down the other two nodes can carry on processing. When that third node comes back on line, it can automatically sync-up all the changes that came from the other two nodes. This adds redundancy and ability to recover from various nodes being off line. You also have read and write query scale out.

  • Peer-to-peer replication is available only in SQL Server 2005 Enterprise Edition.

Metrics For Replication:

(1)    Read versus read/write capability:

(2)    What kind of bandwidth available: sending entire table or not

(3)    Latency between servers: dependent on how schedule agents (how often publish to other nodes) and connectivity (how often connect up) between servers

(4)    Schema (table) changes at publisher: No plain Transactional, Yes Merge

(5)    Schema changes at subscriber: Possibly

(6)    Supports automatic failover: No

(7)    System data transferred: No

(8)    Can you select individual articles: Yes

(9)    Subscriber database protected: No

(10)  Subscriber server can be used as a reporting server: Yes

(11)  Can we tolerate loss of data

(12)  Volatility (how often it changes/number of transactions) of Data: If have many transactions it may be taxing on a Transactional replication system

(13)  Amount of Data published

(14)  Kind of data involved

(15)  Scalability of capacity and topology in a flexible way to respond to load

(16)  Reliability

(17)  Consistency

(18)  Load balancing to use more servers to lessen load on other servers

(19)  Conflict resolution: Automatic resolution

(20)  With Peer to Peer replication it’s easy to do reads/writes and push to all other nodes

(21)  With Transactional replication with updatable subscriptions, it’s harder (than P2P) to get all the nodes making changes and publishing and publishing back to all the other nodes

(22)  With Merge replication, you can coalesce all the changes made at the servers

Terminology:

(A)    Publisher: database source

(B)    Publication: collection of articles to be published

(C)    Article: data that is to be replicated

(D)   Subscriber: receiver of publication

(E)    Subscription: publication received

(F)    Agents:

(F1) Snapshot copies initial snapshot (schema and data) to subscriber

(F2) Log reader monitors transaction logs on published databases

(F3) Merge syncs all the changes together

(F4) Distribution moves transaction to subscribers

(F5) Queue reader agent updates replication

Tips:

(1)    Beware of large UPDATE statements such as global updates to the entire table

(2)    Use small blocks of records when you can

(3)    Replicate often to avoid conflicts

(4)    Use automatic conflict resolution polices (default behavior)  when possible

(5)    Use reliable primary keys to prevent duplicates

(6)    Avoid summary tables at each site

(7)    Design applications to reduce possibility of conflicts

(8)    A challenge of trigger-based replication is record-bouncing where a change (trigger) at a site propagates to the server where it (fires a trigger which) propagates back down to site, and gets into an endless loop.

(9)    Design for resilience so you do not have to monitor the system constantly: (a) log errors, (b) databases may be inconsistent due to failed statements, (c) tolerate network loss, …






Viewing all 4054 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>