Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Friday, March 30, 2012

Merge Snapshot execution does not create any BCP files for data tables.

Good Day,
After running Merge Snapshot Subscription Job No BCP files are created
for the data tables:
here is my code for the Merge Articles:
Dim lbResult As Boolean
Dim lobjMArt As MergeArticle2
Dim lbHasIdentity As Boolean
Set lobjMArt = New MergeArticle2
lobjMArt.Name = asTableName
lobjMArt.SourceObjectName = asTableName
lobjMArt.SourceObjectOwner = "dbo"
UpdateLog "CreationScriptOptions Default Value is: " &
lobjMArt.CreationScriptOptions
If abHasIdentity Then
lobjMArt.AutoIdentityRange = True
lobjMArt.PublisherIdentityRangeSize = 1000000
lobjMArt.SubscriberIdentityRangeSize = 1000000
lobjMArt.IdentityRangeThreshold = 85
End If
pobjSQLDMOMerge.MergeArticles.Add lobjMArt
Set lobjMArt = Nothing
lbResult = True
The Job History Shows:
bulk copying snapshot data for article [TableName] (0 rows).
This is shown for all tables. 90 % of my tables contain records. For
Example the Patient Table has 675 records.
What am i Missing?
Thanks In Advance.
Brian
The agent just ran and created the bcp files.
The agent is scheduled to run @. 12:00 am. Why did it work through
scheduled execution and not through code.
Am I missing something from this code:
Dim lbResult As Boolean
Dim lsErrSource As String
Dim lsJobID As String
Dim liX As Long
Dim lobjDis As SQLDMO.Distributor2
Dim lobjDisPubs As SQLDMO.DistributionPublishers
Dim lobjDisPub As SQLDMO.DistributionPublication2
Dim lobjJobs As SQLDMO.Jobs
Dim lobjJob As SQLDMO.Job
Dim loJobHis As SQLDMO.JobHistoryFilter
Dim loQR As SQLDMO.QueryResults2
Dim liY As Integer 'Rows
UpdateLog "Refresh Snapshot Function"
'===Load an Default Vars
lsErrSource = "clsPublisher.RefreshSnapShot"
'===Parse the Connection String:
If ParseConnectionString(asConnect) Then
If ConnectToServer() Then
'pobjSQLServer now equals the Sever object.
'We need to get a copy of the Publication DB.
Set lobjDis = pobjSQLServer.Replication.Distributor
Set lobjDisPubs = lobjDis.DistributionPublishers
'Set lobjDisPub =
lobjDis.DistributionPublishers(psPubServer).Distri butionPublications.Item("Promise:Promise")
Set lobjDisPub =
lobjDisPubs(psPubServer).DistributionPublications. Item(1)
UpdateLog ("DisPub Name: " &
lobjDisPubs(psPubServer).DistributionPublications. Item(1).Name)
lsJobID = lobjDisPub.SnapshotJobID
psJobName = lobjDisPub.SnapshotAgent
Set lobjDisPub = Nothing
Set lobjDisPubs = Nothing
Set lobjDis = Nothing
Set lobjJobs = pobjSQLServer.JobServer.Jobs
'Get the Job to Start it.
UpdateLog ("Job Info: ID:" & lsJobID & " Name: " &
psJobName)
Call SaveSetting("Horizon Healthware Inc", "Promise",
"ReplicationJobName", psJobName)
Set lobjJob = lobjJobs.Item(psJobName)
UpdateLog ("Job: Starting Job.")
lobjJob.Invoke
liX = 0
lobjJob.Refresh
Do While lobjJob.CurrentRunStatus <>
SQLDMOJobExecution_Idle
liX = liX + 1
If liX = 200000 Then
lobjJob.Refresh
DoEvents
liX = 0
End If
Loop
' loJobHis.JobName = asJobName
' loJobHis.OldestFirst = False
'
' Set loQR =
pobjSQLServer.JobServer.EnumJobHistory(loJobHis)
'
' liX = 1
'
'
' For liX = 1 To loQR.Columns
' 'UpdateLog ("Job History ColumnName :" &
loQR.ColumnName(liX) & " Value:" & loQR.GetColumnString(1, liX))
'
' Next
Set loQR = Nothing
Set loJobHis = Nothing
Set lobjJob = Nothing
Set lobjJobs = Nothing
Call DisconnectFromServer
lbResult = True
Else
Err.Raise hhwErrorNum.lErrUnableToConnectToServer,
lsErrSource, ptErrorDesc.sErrParsingConnectionString
End If
Else
lbResult = False
Err.Raise hhwErrorNum.lErrParsingConnectionString, lsErrSource,
ptErrorDesc.sErrUnableToConnectToServer
End If
Thanks
Brian
sql

Friday, March 23, 2012

Merge replication sync fails with error code 80040E19 on handheld

Hi;

We are performing merge replication between SQL Server 2005 and SQL Server Mobile with more than 1100 handheld, and recently replications are terminating with eror code 80040E19.
We can only avoid the problem by deleting the related user's partition directory and reruning the related user's dynamic snapshot.

Any advice on this issue would be appreciated

Thanks,
Hakan Gümüs

I feel your pain. We only have 300 handhelds in the field but receive this error after every couple of weeks or so. We have not found much information on it at all. It seems to be a client side error, ie no error shows up in the server logs. What we do to alleviate the error is to right click on the publication in SQL Server and Reinitialize All Subscriptions, selecting the Use a new snapshot option with Generate now checked. Once the snapshot is done (monitor with View Snapshot Agent Status) the device replicates again just fine.

Due to the cyclic affect of when it occurs, it seems it may correlate to Retention period of the publication. This is difficult to say as we don't fully understand what happens when the expiration period is reached. The only thing we do know is that Reinitializing the subscriptions works every time.

It is also a guess that it may have something to do with the number of simultaneous replications occuring. Possibly some data at some point gets corrupted or out of sync. We did not see the error during our pilot when we only had a couple of dozen units in the field. Our users by the way replicate twice a day - morning and night, so there are periods of high activity.

Please, if you find out any additional information to this issue, let me know. It has plagued us now for over 6 months. I'll be happy to share whatever information that I can to help solve this issue for good.

Regards,
Santino Lamberti

|||

Hi Santino;

We have opened a case about this issue, I'll inform you about the result.

Thanks for your reply.

Hakan Gümü?

|||The Investigation about the case is still going on. The only workaround that we could find is dropping the related user's merge partition with below command and resync it.

sp_dropmergepartition 'TESTPUB',NULL,'THOSTNAME'

|||Thanks for sharing this. I'll try it next time we run across the error. It seems that I've tried doing this via the UI once before with no effect, but I'll give this a whirl anyway. I also plan on looking at the snapshot data (schema and bcp files) for the failing user and the master snapshot. The error seems to occur after all the schemas are applied and possibly when the data is being copied in.

Merge replication sync fails with error code 80040E19 on handheld

Hi;

We are performing merge replication between SQL Server 2005 and SQL Server Mobile with more than 1100 handheld, and recently replications are terminating with eror code 80040E19.
We can only avoid the problem by deleting the related user's partition directory and reruning the related user's dynamic snapshot.

Any advice on this issue would be appreciated

Thanks,
Hakan Gümüs

I feel your pain. We only have 300 handhelds in the field but receive this error after every couple of weeks or so. We have not found much information on it at all. It seems to be a client side error, ie no error shows up in the server logs. What we do to alleviate the error is to right click on the publication in SQL Server and Reinitialize All Subscriptions, selecting the Use a new snapshot option with Generate now checked. Once the snapshot is done (monitor with View Snapshot Agent Status) the device replicates again just fine.

Due to the cyclic affect of when it occurs, it seems it may correlate to Retention period of the publication. This is difficult to say as we don't fully understand what happens when the expiration period is reached. The only thing we do know is that Reinitializing the subscriptions works every time.

It is also a guess that it may have something to do with the number of simultaneous replications occuring. Possibly some data at some point gets corrupted or out of sync. We did not see the error during our pilot when we only had a couple of dozen units in the field. Our users by the way replicate twice a day - morning and night, so there are periods of high activity.

Please, if you find out any additional information to this issue, let me know. It has plagued us now for over 6 months. I'll be happy to share whatever information that I can to help solve this issue for good.

Regards,
Santino Lamberti|||

Hi Santino;

We have opened a case about this issue, I'll inform you about the result.

Thanks for your reply.

Hakan Gümü?

|||The Investigation about the case is still going on. The only workaround that we could find is dropping the related user's merge partition with below command and resync it.

sp_dropmergepartition 'TESTPUB',NULL,'THOSTNAME'

|||Thanks for sharing this. I'll try it next time we run across the error. It seems that I've tried doing this via the UI once before with no effect, but I'll give this a whirl anyway. I also plan on looking at the snapshot data (schema and bcp files) for the failing user and the master snapshot. The error seems to occur after all the schemas are applied and possibly when the data is being copied in.

Saturday, February 25, 2012

Merge Replication Code Example - Where Can I Find One?

Hi,
I'm trying to program (c#) merge replication with one publisher DB
(SQL2000) and many subscribers (MSDE). I'm trying to find info and
examples online, but it seems pretty scarce. If you can recommend a
site, please let me know.
Thanks,
JJ
try this
http://support.microsoft.com/default...b;en-us;319646
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"JJ" <joe.jabour@.gmail.com> wrote in message
news:1118069995.044129.200820@.g47g2000cwa.googlegr oups.com...
> Hi,
> I'm trying to program (c#) merge replication with one publisher DB
> (SQL2000) and many subscribers (MSDE). I'm trying to find info and
> examples online, but it seems pretty scarce. If you can recommend a
> site, please let me know.
> Thanks,
> JJ
>
|||Looks good, Thanks!