Showing posts with label filters. Show all posts
Showing posts with label filters. Show all posts

Friday, March 30, 2012

Merge Repliction - Run Stored Procedure when merge agent starts

I have database on SQL Server 2000 set up with a merge publication.
This publication is configured with a number of dynamic filters to
reduce the amount of data sent to each client. Each client has an
anonymous pull subscription. The merge process can be triggered by the
windows sync manager and my application.

To improve performance I have created some helper tables to hold the
mapping between user login and primary keys of selected entities.

For the replicated data to be correct the contents of the helper tables
needs to be up to date.

I need to fire off a stored procedure on the publisher before
replication starts to verify that this data is up to date. I can not
see any documented way of doing this however I have been experimenting
with some unorthodox systems.

Firstly has anyone any ideas?

I have been considering adding a trigger to some of the tables used by
the Microsoft replication code - yes I know this is very nasty.

My problems arise because executing this stored procedure will cause
some data to be updated. In updating data we could create a new
generation in the database. I must therefore run my stored procedure
before any the Microsoft code makes any generation checks / updates.

Anyone done anything similar, Anyone have any better ideas?

Any comments would be gratefully received.(tedd_n_alex@.yahoo.com) writes:
> My problems arise because executing this stored procedure will cause
> some data to be updated. In updating data we could create a new
> generation in the database. I must therefore run my stored procedure
> before any the Microsoft code makes any generation checks / updates.
> Anyone done anything similar, Anyone have any better ideas?

Not being very good at replication, I can only recommend you to visit
microsoft.public.sqlserver.replication. There are some guys that knows
replicataion really well there.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Wednesday, March 28, 2012

Merge Replication with vertical Filters

Hello
it's possible to create a Merge-Publication with vertical Filter on an
Sql-Server 2000 with SP3?
in our developer System with SP4 i can make a replication, but in the Target
System i didn't.
Error 20009 add the article...
Thanks
Daniel
Yes it is, but ensure that you have defaults in place for the columns you
are not replicating or that they are nullable.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
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
"Dani Schwegler" <d.schwegler@.hispeed.ch> wrote in message
news:ezRNYPmUGHA.4956@.TK2MSFTNGP09.phx.gbl...
> Hello
> it's possible to create a Merge-Publication with vertical Filter on an
> Sql-Server 2000 with SP3?
> in our developer System with SP4 i can make a replication, but in the
> Target System i didn't.
> Error 20009 add the article...
> Thanks
> Daniel
>
sql

Merge replication with MSSQL/SQLCE using row filters

Hello everyone,
I'm new in replication, I have some - maybe trivial - question.
First of all, I'm using a MSSQL server as a publisher, the clients are
Pocket PC's, running SQLCE. All clients need only a subset of data, which
can be controlled via row filters, using SUSER_SNAME(). For the first
replication, it seems everything is correct, but.
I have 2 tables in the publication with a reference, eg. table X with
fields code,data and table Y with fields xcode,username. The row filters
looks like:
for table X: 'WHERE X.code IN (SELECT Y.xcode FROM Y WHERE Y.xcode=X.code
AND Y.username=SUSER_SNAME())'
for table Y: 'WHERE Y.username=SUSER_SNAME()'
If I add a row to table Y, the referrenced row from table X will not be
transferred through the next merge replication process, causing referential
integrity error. If I reinitialize the publication, it works again. It
seems, the expressions in the row filters has no effect after the first run
of the Snapshot Agent. I've tried JOIN FILTERS, the effect was that the join
filters worked _only_, not the row filters.
Any idea? The dynamic filters option is on. Am I need to create a dynamic
snapshot job for every single client? There are lot's of them .
Thanks for any help,
Nomad
Correct me if I am wrong, but I don't think that you can use SUSER_Sname()
on your pocket PC.
When I issue this command on isqlw on my pocket pc I get an: At least one
input table is required.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Nomad" <gfoyle@.freemail.hu> wrote in message
news:OGlIubKnEHA.3708@.TK2MSFTNGP10.phx.gbl...
> Hello everyone,
> I'm new in replication, I have some - maybe trivial - question.
> First of all, I'm using a MSSQL server as a publisher, the clients are
> Pocket PC's, running SQLCE. All clients need only a subset of data, which
> can be controlled via row filters, using SUSER_SNAME(). For the first
> replication, it seems everything is correct, but.
> I have 2 tables in the publication with a reference, eg. table X with
> fields code,data and table Y with fields xcode,username. The row filters
> looks like:
> for table X: 'WHERE X.code IN (SELECT Y.xcode FROM Y WHERE Y.xcode=X.code
> AND Y.username=SUSER_SNAME())'
> for table Y: 'WHERE Y.username=SUSER_SNAME()'
> If I add a row to table Y, the referrenced row from table X will not be
> transferred through the next merge replication process, causing
referential
> integrity error. If I reinitialize the publication, it works again. It
> seems, the expressions in the row filters has no effect after the first
run
> of the Snapshot Agent. I've tried JOIN FILTERS, the effect was that the
join
> filters worked _only_, not the row filters.
> Any idea? The dynamic filters option is on. Am I need to create a dynamic
> snapshot job for every single client? There are lot's of them .
> Thanks for any help,
> Nomad
>
|||I'm using the SUSER_SNAME function at the publication row/join filters, in a
publisher database. The publisher is a PC running MSSQL, the clients are
Pocket PC's using SQLCE. It seems, the function itself working correctly,
for the first time, I've found not the solution, but the description of this
problem, here:
http://support.microsoft.com/default...n-us%3Bq324362
So this is not a bug, it's a feature .
"Hilary Cotter" <hilary.cotter@.gmail.com> az albbiakat rta a kvetkezo
zenetben news:O4l1BwLnEHA.648@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> Correct me if I am wrong, but I don't think that you can use SUSER_Sname()
> on your pocket PC.
> When I issue this command on isqlw on my pocket pc I get an: At least one
> input table is required.
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
>
> "Nomad" <gfoyle@.freemail.hu> wrote in message
> news:OGlIubKnEHA.3708@.TK2MSFTNGP10.phx.gbl...
which[vbcol=seagreen]
Y.xcode=X.code[vbcol=seagreen]
> referential
> run
> join
dynamic
>
|||As the artice down below says, this kind of replication process (e.g. using
subqueries referencing other tables in a row filter) could not be executed
using row filters, because row filters won't be evaluated after the first
run of the snaphot agent. This was disappointing .
Now I have a question about JOIN FILTER-s. The behavoiur of the join filters
"cumulative" (or "transitive")? For example, I have a row filter for one
table, and a join filter for another - joined to the first table. So, I will
have only the joined rows from the second table after replication. Am I
right? Can I use row and join filters in cooperation?
"Nomad" <gfoyle@.freemail.hu> az albbiakat rta a kvetkezo zenetben
news:%23dAuB6LnEHA.2612@.TK2MSFTNGP15.phx.gbl...
> I'm using the SUSER_SNAME function at the publication row/join filters, in
a
> publisher database. The publisher is a PC running MSSQL, the clients are
> Pocket PC's using SQLCE. It seems, the function itself working correctly,
> for the first time, I've found not the solution, but the description of
this
> problem, here:
> http://support.microsoft.com/default...n-us%3Bq324362
> So this is not a bug, it's a feature .
|||Yes subset filters and join filters are intended to be used together. Yes
you will only get rows in the join filter table that meet the subset filter
in the parent table.
Philip Vaughn
Program Manager -SQL Server Replication
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!
"Nomad" <gfoyle@.freemail.hu> wrote in message
news:OA7wcVnnEHA.4084@.TK2MSFTNGP10.phx.gbl...
> As the artice down below says, this kind of replication process (e.g.
> using
> subqueries referencing other tables in a row filter) could not be executed
> using row filters, because row filters won't be evaluated after the first
> run of the snaphot agent. This was disappointing .
> Now I have a question about JOIN FILTER-s. The behavoiur of the join
> filters
> "cumulative" (or "transitive")? For example, I have a row filter for one
> table, and a join filter for another - joined to the first table. So, I
> will
> have only the joined rows from the second table after replication. Am I
> right? Can I use row and join filters in cooperation?
> "Nomad" <gfoyle@.freemail.hu> az albbiakat rta a kvetkezo zenetben
> news:%23dAuB6LnEHA.2612@.TK2MSFTNGP15.phx.gbl...
> a
> this
>

Merge Replication with filters throwing error

I'm synchronizing SQL Mobile 2005 with SQL Server 2005 using Merge
Replication. I've filtered a table like this:
WHERE HOST_NAME() = convert(nvarchar(100), patientId)
"patientId" is uniqueidentifier type column, the primary key of
"Patient" table.
The error when synchronizing is the following:
"The row operation cannot be reapplied due to an integrity violation.
Check the Publication filter. [ Table = Appointment,Operation =
Insert/Update,RowGuid = {F64E1023-01AD-DA11-8ED9-0004E2B45615} ]}"
Table Patient is joined with table Appointment but I don't understand
the error.
I think this sentence worked in SQL Server 2000 and SQL Server E 2.0.
I would appreciate any help on this.
Regards.
I've also tried same filter for Appointment database, and here I don't
receive any error, but the filtering is not correctly done.
Can anybody tell me if the following filtering is correct: WHERE
HOST_NAME() = convert(nvarchar(100), patientId)
Be sure this filtering has correctly worked in the past.
Any ideas please?
Regards.

merge replication with filters

I have a merge replication the last weekend, these fail and send me the
message error "you would reinitialice the snapshot because the snapshot was
obsolete", but whe I try rerun the snapshot, it send me another error like
"i couldn't find the jobid @. x x x x x x x x x ".
whatever I made a new subscription and restore my 26 subscribers, and now my
central store fail because the range of the identity is full and don't want
renew the range I used sp_adjustpublisheridentityrange but nothing happends
some body heard somthing like that , I'm gonna crazy now and doesn't work
I check the MSrepl_identity_range and it is updated but not my subcribers
Regards, David
Sounds like your subscriptions have expired and have been dropped. When you
set your retention period (right click on your publication, select
publication properties, and note the value in teh Subscription expiration
section. This should be something small, but large enough that it will be
longer than a long weekend. So try 5 days.
Then make sure your history is also retained for this period. Right click on
replication monitor, select distributor properties, click on properties, and
then retain the history for 5 days also.
Now your challenge is to make sure your agents run and connect with the
subscriber at least once every 5 days. Put your replication agents in
infinite loops so that they will retry on failure.
That's the good news. The bad news is that you are going to have to redeploy
the snapshot to all of your subscribers again.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"David" <davbarquero@.hotmail.com> wrote in message
news:uLTDI$xwEHA.392@.TK2MSFTNGP12.phx.gbl...
> I have a merge replication the last weekend, these fail and send me
the
> message error "you would reinitialice the snapshot because the snapshot
was
> obsolete", but whe I try rerun the snapshot, it send me another error
like
> "i couldn't find the jobid @. x x x x x x x x x ".
> whatever I made a new subscription and restore my 26 subscribers, and now
my
> central store fail because the range of the identity is full and don't
want
> renew the range I used sp_adjustpublisheridentityrange but nothing
happends
> some body heard somthing like that , I'm gonna crazy now and doesn't work
> I check the MSrepl_identity_range and it is updated but not my subcribers
>
> Regards, David
>

Wednesday, March 21, 2012

Merge Replication Problem

We have a merge replication database with a publisher server and a distribution server. We made and publication with dynamic filters. We are using a pull suscriptor wich was installed with a backup from the publisher database.
First time we made it works we had no errors and no conflicts. However, later we had troubles with the suscriptor, it was trying to delete rows from some tables that we didn't modified, and it produced some conflicts because referential integrity on the
publisher database stopped it.
We didn't apply a initial snapshot because it had the same data of the publisher and we are using @.pre_creation_cmd = truncate but the suscription doesn't ignore it (suscription has the schema and data).
Deletes on this tables are imposible however the suscriptor always try to do them
What can I do to prevent this problem?
Is it necessary to apply always the initial snapshot and how can I do it if there is referential integrity among the tables into the publication?
Thanks.
you should put the NFR option on all constraints and relationships on the
publisher and subscriber.
This should solve most of the problems related to DRI relationships.
What is happening is that DRI is enforced on the Publisher as two (or more
statements). These changes are then replicated to the Subscriber. The
initiating transaction is executed on the Subscriber where the DRI
relationship is applied. Then the next statement where DRI was enforced on
the publisher makes its way to the subscriber where it is attempted to be
applied again. This is typically where your conflict occurs.
"Heiner Morales" <anonymous@.discussions.microsoft.com> wrote in message
news:5CDDA4F6-C4AD-4A33-A426-0AA554A54DD7@.microsoft.com...
> We have a merge replication database with a publisher server and a
distribution server. We made and publication with dynamic filters. We are
using a pull suscriptor wich was installed with a backup from the publisher
database.
> First time we made it works we had no errors and no conflicts. However,
later we had troubles with the suscriptor, it was trying to delete rows from
some tables that we didn't modified, and it produced some conflicts because
referential integrity on the publisher database stopped it.
> We didn't apply a initial snapshot because it had the same data of the
publisher and we are using @.pre_creation_cmd = truncate but the suscription
doesn't ignore it (suscription has the schema and data).
> Deletes on this tables are imposible however the suscriptor always try to
do them
> What can I do to prevent this problem?
> Is it necessary to apply always the initial snapshot and how can I do it
if there is referential integrity among the tables into the publication?
> Thanks.
>
sql

Monday, March 19, 2012

Merge replication performance problems

Hi,
I have a merge replication between MSSQL2005 as a server, and SQLExpress
as the clients. The publication contains dynamic filters, ~190 tables and
~300 joins (the longest path in a "join tree" is 12), currently I'm testing
on database that contains ~2GB of data. If I use a precomputed partitions
- it seems to work, but it just kills the performance of the back-end application;
If I don't use precomputed partitions it constantly fails (during subscriber's
synchronization) with "The merge process failed to enumerate changes in articles
with parameterized row filters... Query timeout expired..." error. The problem
is that there's no additional info - so I don't even know what was the problematic
query... Please help
I would consider trying to use static filters if you have a smallish number
of subscribers. You'll need a separate publication for each subscriber but
the performance is much improved. Apart from that you can increase the
querytimeout value as a possibility and use logging if this doesn't work.
Cheers,
Paul Ibison
|||Hello Paul,
Thanks for the answer, I'd like to clarify couple of things:
1. What do you mean by smallish number? less than 10? or less than 100 is
OK too?
2. I've increased the querytimeout for the agent (which didn't help). Can
you please provide me the details for the logging part? With the highest
-HistoryVerboseLevel I still can't see the exact sqls that are executed,
so I have no idea where the timeout error is coming from; and in SQLProfiler
all I see is the calls to sp_setupbelongs procedure...
Thanks again,
Vladimir Kofman

> I would consider trying to use static filters if you have a smallish
> number
> of subscribers. You'll need a separate publication for each subscriber
> but
> the performance is much improved. Apart from that you can increase the
> querytimeout value as a possibility and use logging if this doesn't
> work.
> Cheers,
> Paul Ibison
|||This'll help for logging: http://support.microsoft.com/Default.aspx?id=312292
The reason I mentioned a smallish number of subscribers as a distinction was
purely practical. If you have the time to set up 100 publications with static
filters then I'd definitely recommend this over dynamic filters.
HTH,
Paul Ibison

Saturday, February 25, 2012

Merge Replication Conditional Filter with UDF Problem

I'm performing Merge Replication between SQL Server 2000/SQL CE using Dynamic Filters.
I would like a conditional filter based on the Host_Name(). I've written and tested a UDF
in Query Analyzer called SELECT_Stores_RepID. In the Dynamic Filters properties for the
Stores Table I've tried many different things such as:
SELECT <published_columns> FROM [dbo].[Stores] WHERE dbo.SELECT_Stores_RepID (HOST_NAME())
All them give me errors. My question is what is the correct syntax to use my UDF? The documentation
on this is very poor.
Cheers
it should be something like this
select <punished_columns> from <<Table>> where au_id in (select au_id from dbo.Authors_filter('CA'))
There may be more efficient ways of doing this.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
|||Hi Hilary,
Thanks for the help. I tried to apply it to my Dynamic Filter...
SELECT <published_columns> FROM [dbo].[Stores] WHERE
Stores.StoreID IN (SELECT StoreID FROM dbo.SELECT_Stores_RepID(HOST_NAME())
but I'm receiving the following error...
Incorrect Syntax near '('
Once again, I can't see where the problem is with this statment ?
|||Sorry typo in my post ...
(SELECT StoreID FROM dbo.SELECT_Stores_RepID(HOST_NAME())
Should be (extra bracket)...
(SELECT StoreID FROM dbo.SELECT_Stores_RepID(HOST_NAME()))
Still getting the same problem as before.
-- Cube wrote: --
Hi Hilary,
Thanks for the help. I tried to apply it to my Dynamic Filter...
SELECT <published_columns> FROM [dbo].[Stores] WHERE
Stores.StoreID IN (SELECT StoreID FROM dbo.SELECT_Stores_RepID(HOST_NAME())
but I'm receiving the following error...
Incorrect Syntax near '('
Once again, I can't see where the problem is with this statment ?
|||can you post your UDF.
BTW - I should warn you that UDF's don't always offer the best performance. Also Host_Name() is evaluated where the merge agent is run. If you kick it off on EM runing it on your desktop it will evaluated to your machine name.
If you kick if off on the subscriber as a pull subscription it will resolve correctly.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
|||I'm still getting this error in Replication. Does anyone know if its a known issue?
The error is that when I call my UDF below in my Dynamic Filter and pass in
HOST_NAME() I get an incorrect syntax near '(' error.
Ciaran
-- Cube wrote: --
Hi Hilary,
Please find below my UDF. The RepID in my table is an int, which I CAST so I can
compare it to my Host_Name(). I'm interested to know your opinion. Also, if UDF's
don't offer best performance, do I have other options apart from creating a seperate
publication?
ALTER FUNCTION dbo.SELECT_Stores_RepID
(
@.inRepIDchar(4)
)
RETURNS @.Stores TABLE (StoreID int)
AS
BEGIN
IF (@.inRepID = '8')
INSERT INTO @.Stores
SELECTStoreID FROM Stores
ELSE
INSERT INTO @.Stores
SELECTStoreID
FROM Stores
WHERE CAST(Stores.RepID AS char(4)) = @.inRepID
RETURN
END
BTW - Some history behind all this. I have some HandHeld Devices deployed with my custom app.
The Replication depends on the RepID, which is set through the Host_Name() on the device, pulling
back the users specified data. Now, there is a requirement to pull back all data in some cases
e.g. management, without modifying the software on the client. Henece, the reasons for the
IF RepID = X conditional filter.

Merge replication between two publishers with dynamic filters

Hello,
I am working on a distributed database system in which each site is a
publisher of a filtered set of data. It is necessary that a publisher can
subscribe to another publisher.
I am using merge replication, dynamic filters and push subscriptions. Each
site publishes the same tables with another filter.
When I test this scenario, I notice that the merge agent replicates only the
changes of the publisher to the subscriber. A change on the subscriber (thas
has also a publication on the same tables) is not replicated to the publisher.
Does someone know a solution for this?
Is it possible to have (bidirectional) merge replication between two
publishers with dynamic filters?
I hope someone can help me with this.
thanks in advance!
Marco Broenink
Could you please describe in more detail your publisher subscriber
configurations and the filters.
If the table has a column that you are using to filter from Publisher to
Subscriber and then make this subscriber a republisher and then try to use
the same column as the filter column, there is only set of data at the
republisher/subscriber.
I am not clear on your setup. Could you please repost with more elaborate
setup steps?
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
news:CD4D84B8-A940-46BF-AC9A-5FF5098D2200@.microsoft.com...
> Hello,
> I am working on a distributed database system in which each site is a
> publisher of a filtered set of data. It is necessary that a publisher can
> subscribe to another publisher.
> I am using merge replication, dynamic filters and push subscriptions. Each
> site publishes the same tables with another filter.
> When I test this scenario, I notice that the merge agent replicates only
the
> changes of the publisher to the subscriber. A change on the subscriber
(thas
> has also a publication on the same tables) is not replicated to the
publisher.
> Does someone know a solution for this?
> Is it possible to have (bidirectional) merge replication between two
> publishers with dynamic filters?
> I hope someone can help me with this.
> thanks in advance!
> Marco Broenink
|||Thanks for your response!
I am using a dynamic filter. This filter uses a function. This function
needs the hostname and a filter-column to dermine if the row needs to be
filtered. The filter looks like:
SELECT <published_columns> FROM [dbo].[PublishedTable]
WHERE 1 = [dbo].[fn_DynamicFilter]([FilterColumn], HOST_NAME())
The filterfunction uses a mapping table that maps the contents of the
[FilterColumn] to hostnames.
With this mapping table, each publisher publishes its own part of all data.
So the publications of two publishers do not overlap. But the publications
are on the same tables.
Problem with this configuration is that changes of a subscriber are not
replicated to the publisher. It looks like that the subscriber's own
publication is blocking this.
I hope you can help me with this.
greetings, Marco.
"Mahesh [MSFT]" wrote:

> Could you please describe in more detail your publisher subscriber
> configurations and the filters.
> If the table has a column that you are using to filter from Publisher to
> Subscriber and then make this subscriber a republisher and then try to use
> the same column as the filter column, there is only set of data at the
> republisher/subscriber.
> I am not clear on your setup. Could you please repost with more elaborate
> setup steps?
> Hope that helps
> --Mahesh
> [ This posting is provided "as is" with no warranties and confers no
> rights. ]
> "Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
> news:CD4D84B8-A940-46BF-AC9A-5FF5098D2200@.microsoft.com...
> the
> (thas
> publisher.
>
>
|||I have used 'global' subscriptions in stead of 'local' and this problem is
solved.
Now the changes are also replicated from subscriber to publisher.
Unfortunately, I have a new problem.
I use replication with dynamic filters. In my system it is possible that
data is added to the subscriber that doesnot pass the filter. When
replicating, this data is deleted at the subscriber and added to the
publisher.
How can I prevent this delete & insert ?
thanks in advance, Marco
"Marco Broenink" wrote:
[vbcol=seagreen]
> Thanks for your response!
> I am using a dynamic filter. This filter uses a function. This function
> needs the hostname and a filter-column to dermine if the row needs to be
> filtered. The filter looks like:
> SELECT <published_columns> FROM [dbo].[PublishedTable]
> WHERE 1 = [dbo].[fn_DynamicFilter]([FilterColumn], HOST_NAME())
> The filterfunction uses a mapping table that maps the contents of the
> [FilterColumn] to hostnames.
> With this mapping table, each publisher publishes its own part of all data.
> So the publications of two publishers do not overlap. But the publications
> are on the same tables.
> Problem with this configuration is that changes of a subscriber are not
> replicated to the publisher. It looks like that the subscriber's own
> publication is blocking this.
> I hope you can help me with this.
> greetings, Marco.
> "Mahesh [MSFT]" wrote:
|||Glad that you could work around your first problem, though to be frank, I am
still unclear of the setup.
Regarding your new problem,
If each subscriber inserts data that corresponds to only its subset of data
then you could try using a default of some kind to the tables. Like hostname
or something that will map appropriately to the filter condition and make it
pass. So everytime an insert happens at the subscriber, the filter condition
is met and then is successfully propagated to the publisher and does not get
deleted at the subscriber in turn.
Please note that this can work only if the subscriber always makes
"good" inserts, that is to say that the subscriber never expects to insert
data (that does not satisfy the filter) and then in turn expects the data to
be deleted by the publisher.
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
news:664513B1-B610-453F-B033-6FD1B8720BE1@.microsoft.com...[vbcol=seagreen]
> I have used 'global' subscriptions in stead of 'local' and this problem is
> solved.
> Now the changes are also replicated from subscriber to publisher.
> Unfortunately, I have a new problem.
> I use replication with dynamic filters. In my system it is possible that
> data is added to the subscriber that doesnot pass the filter. When
> replicating, this data is deleted at the subscriber and added to the
> publisher.
> How can I prevent this delete & insert ?
> thanks in advance, Marco
>
> "Marco Broenink" wrote:
data.[vbcol=seagreen]
publications[vbcol=seagreen]
to[vbcol=seagreen]
use[vbcol=seagreen]
elaborate[vbcol=seagreen]
message[vbcol=seagreen]
a[vbcol=seagreen]
publisher can[vbcol=seagreen]
subscriptions. Each[vbcol=seagreen]
only[vbcol=seagreen]
subscriber[vbcol=seagreen]
|||thanks again for the response.
In my topology, I have different publishers of the same table. These
publishers use different filters. A subscriber can be subscribed to different
publishers.
For example:
Site A publishes table1
Site B publishes table1
Site C is subscribed to Site A table1. This subscribtion is filtered with a
dynamic filter F1.
Site C is also subscribed to Site B table1. This subscribtion is filtered
with another dynamic filter F2.
The different dynamic filters make sure that the subscription to Site A do
not overlap the subscription to Site B.
Thus: The table1 of C contains a subset of table1 of A and a subset of
table1 of B.
So: table1 of C contains two types of data:
- data that meets filtercondition F1 and doesnot meet filtercondition F2.
- data that meets filtercondition F2 and doesnot meet filtercondition F1.
So the problem is: The subscriber will contain data that doesnot meet one of
the filterconditions. When replicating to Site A (filter F1), data of filter
F2 is deleted. When replicating to Site B (filter F2), data of filter F1 is
deleted.
So in this scenario, I think it is not possible to make only 'good' inserts
because it violates always one of the two filtersconditions.
I hope you know a solution. Or am I trying to do something impossible?
greetings, Marco Broenink
"Mahesh [MSFT]" wrote:

> Glad that you could work around your first problem, though to be frank, I am
> still unclear of the setup.
> Regarding your new problem,
> If each subscriber inserts data that corresponds to only its subset of data
> then you could try using a default of some kind to the tables. Like hostname
> or something that will map appropriately to the filter condition and make it
> pass. So everytime an insert happens at the subscriber, the filter condition
> is met and then is successfully propagated to the publisher and does not get
> deleted at the subscriber in turn.
> Please note that this can work only if the subscriber always makes
> "good" inserts, that is to say that the subscriber never expects to insert
> data (that does not satisfy the filter) and then in turn expects the data to
> be deleted by the publisher.
> Hope that helps
> --Mahesh
> [ This posting is provided "as is" with no warranties and confers no
> rights. ]
> "Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
> news:664513B1-B610-453F-B033-6FD1B8720BE1@.microsoft.com...
> data.
> publications
> to
> use
> elaborate
> message
> a
> publisher can
> subscriptions. Each
> only
> subscriber
>
>
|||Hi Marco,
Please correct me if I understood wrong:
So what you are saying is SiteA and SiteB are publishing the same tables,
but are not replicating to each other. Is that right?
But in turn are replicating that table to SiteC.
This is not supported.
In the first place, When SiteC subscribed to SiteA, it gets the table from
SiteA. Now when you configure SiteC to subscribe from SiteB, how did you
configure? Did you configure a no-sync subscription? If not, and you used
all the default settings then actually you will not even be able to complete
the subscription because the table at SiteC (got from SiteA) will be
attempted to drop and recreate with the scripts from SiteB which will fail.
If you want to do what you are trying to do, one solution is to have table1
at SiteA and replicate it to SiteC with the proper filter. Have table2 at
SiteB and replicate that to SiteC with the proper filter.
On the subscriber you can have a view on those two tables that will give you
a combined view for the results. But you may not be able to make DMLs on the
view directly. You will still need to do the DMLs on the actual tables.
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
news:BADB7E44-D9C9-4333-B69E-9F5B33314BEF@.microsoft.com...
> thanks again for the response.
> In my topology, I have different publishers of the same table. These
> publishers use different filters. A subscriber can be subscribed to
different
> publishers.
> For example:
> Site A publishes table1
> Site B publishes table1
> Site C is subscribed to Site A table1. This subscribtion is filtered with
a
> dynamic filter F1.
> Site C is also subscribed to Site B table1. This subscribtion is filtered
> with another dynamic filter F2.
> The different dynamic filters make sure that the subscription to Site A do
> not overlap the subscription to Site B.
> Thus: The table1 of C contains a subset of table1 of A and a subset of
> table1 of B.
> So: table1 of C contains two types of data:
> - data that meets filtercondition F1 and doesnot meet filtercondition F2.
> - data that meets filtercondition F2 and doesnot meet filtercondition F1.
> So the problem is: The subscriber will contain data that doesnot meet one
of
> the filterconditions. When replicating to Site A (filter F1), data of
filter
> F2 is deleted. When replicating to Site B (filter F2), data of filter F1
is
> deleted.
> So in this scenario, I think it is not possible to make only 'good'
inserts[vbcol=seagreen]
> because it violates always one of the two filtersconditions.
> I hope you know a solution. Or am I trying to do something impossible?
> greetings, Marco Broenink
>
> "Mahesh [MSFT]" wrote:
I am[vbcol=seagreen]
data[vbcol=seagreen]
hostname[vbcol=seagreen]
make it[vbcol=seagreen]
condition[vbcol=seagreen]
get[vbcol=seagreen]
insert[vbcol=seagreen]
data to[vbcol=seagreen]
message[vbcol=seagreen]
problem is[vbcol=seagreen]
that[vbcol=seagreen]
function[vbcol=seagreen]
to be[vbcol=seagreen]
the[vbcol=seagreen]
all[vbcol=seagreen]
not[vbcol=seagreen]
Publisher[vbcol=seagreen]
try to[vbcol=seagreen]
the[vbcol=seagreen]
no[vbcol=seagreen]
in[vbcol=seagreen]
is[vbcol=seagreen]
replicates[vbcol=seagreen]
the[vbcol=seagreen]
two[vbcol=seagreen]
|||thanks for the help!
Marco
"Mahesh [MSFT]" wrote:

> Hi Marco,
> Please correct me if I understood wrong:
> So what you are saying is SiteA and SiteB are publishing the same tables,
> but are not replicating to each other. Is that right?
> But in turn are replicating that table to SiteC.
> This is not supported.
> In the first place, When SiteC subscribed to SiteA, it gets the table from
> SiteA. Now when you configure SiteC to subscribe from SiteB, how did you
> configure? Did you configure a no-sync subscription? If not, and you used
> all the default settings then actually you will not even be able to complete
> the subscription because the table at SiteC (got from SiteA) will be
> attempted to drop and recreate with the scripts from SiteB which will fail.
> If you want to do what you are trying to do, one solution is to have table1
> at SiteA and replicate it to SiteC with the proper filter. Have table2 at
> SiteB and replicate that to SiteC with the proper filter.
> On the subscriber you can have a view on those two tables that will give you
> a combined view for the results. But you may not be able to make DMLs on the
> view directly. You will still need to do the DMLs on the actual tables.
> Hope that helps
> --Mahesh
> [ This posting is provided "as is" with no warranties and confers no
> rights. ]
> "Marco Broenink" <MarcoBroenink@.discussions.microsoft.com> wrote in message
> news:BADB7E44-D9C9-4333-B69E-9F5B33314BEF@.microsoft.com...
> different
> a
> of
> filter
> is
> inserts
> I am
> data
> hostname
> make it
> condition
> get
> insert
> data to
> message
> problem is
> that
> function
> to be
> the
> all
> not
> Publisher
> try to
> the
> no
> in
> is
> replicates
> the
> two
>
>

Monday, February 20, 2012

Merge replication and dynamic filters question

Hi!
I have a schema that looks like this, on my main server:
tableFiles:
FileID (PK)
FileName
table FileProperties
PropertyID
FileID (FK Files.FileID) (PK)
PropertyName (PK)
PropertyValue
table Hosts_Files
HostName (PK)
FileID (PK)
Now what I want to achieve is this:
There are many clients that use this database. Sometimes they go
offline and take some of the files with them to work offline.
When this occurs, I want to replicate the entire table Files, and only
the rows from FileProperties that have to do with the files they
downloaded to their computer (marked so in Hosts_Files).
Can I make this work with merge replication? I tried but the dynamic
filters I can write are either JOIN or WHERE (or am I wrong?) so I
couldn't manage to do a join between FileProperties and Hosts_Files
only where Hosts_Files.HostName = host_name().
Thanks in advance for answering,
Zzzbla
You could join these tables in the merge publication. Filtering in this case
is a bit tricky as it looks as though you want to change the filter
effectively dynamically. I'm assuming that there is a typo somewhere, as
this doesn't seem to make logical sense: "I want to replicate the entire
table Files, and only the rows from FileProperties that have to do with the
files they downloaded to their computer" - this would seem to imply all
FileProperties. The way I read your requirements are that you want users to
select certain files and have just associated details downloaded? If this is
the case, you can have a further table which relates fileids to hostnames.
Selecting to download a file will cause an insert of a record in this new
table. All tables would be joined on fileid, and the dynamic filter would be
solely to the new table.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Hi Paul,
I forgot to mention that the rows in the files table correlate to
physical files. So what I wanted is to have some *physical* files
downloaded to the client's computer, all of the rows in the files table
(the client may have to see or use data about files that he didn't
download) and only the rows in the fileproperties table that are
related to the few rows in files table that are related to the physical
files the user downloaded.
I know I can join the tables - FileProperties and the table that
associates the fileid to the hostname - but when I also need to use
WHERE Hosts_Files.HostName = host_name(). I tried to do it but the
replication wizard doesn't let me.
If you could provide me with a script or an example solution (or is it
just a view that I have to write in order to combine JOIN and WHERE
filters?), I'll be grateful.
Thanks in advance,
Zzzbla
Paul Ibison wrote:

> You could join these tables in the merge publication. Filtering in
> this case is a bit tricky as it looks as though you want to change
the
> filter effectively dynamically. I'm assuming that there is a typo
> somewhere, as this doesn't seem to make logical sense: "I want to
> replicate the entire table Files, and only the rows from
> fileProperties that have to do with the files they downloaded to
their
> computer" - this would seem to imply all FileProperties. The way I
> read your requirements are that you want users to select certain
files
> and have just associated details downloaded? If this is the case,
you
> can have a further table which relates fileids to hostnames.
Selecting
> to download a file will cause an insert of a record in this new
table.
> All tables would be joined on fileid, and the dynamic filter would be
> solely to the new table.
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
|||Some additions:
The real problem I'm facing is that the table I want to filter by
(Hosts_Files) is only related to the table I want to filter
(FileProperties) via the table Files - which I want to leave unfiltered.
If I let it filter the files table, I get the FileProperties I wanted,
but I also get only the selected rows from files and not the whole
table as required.
I wouldn't want to create a Hosts_FileProperties unless there's no
better solution...
|||Please post up the schema of hte tables involved and I'll have a look. A
(denormalized) linking table will work (maintained by triggers) but there
might be an alternative.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Hi,
I attached a script to create tables and relationships.
Thank you for your time and effort!
begin 444 replication test.sql
M__YI`&8`(`!E`'@.`:0!S`'0`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T`',`7P!&`&D`;`!E`',`7P!&`&D`;`!E`',`70`@.`$8`3 P!2`$4`20!'
M`$X`(`!+`$4`60`@.``T`"@.`)`"@.`#0`*``D`"0!;`$8`:0!L` &4`20!$`%T`
M#0`*``D`*0`@.`%(`10!&`$4`4@.!%`$X`0P!%`%,`(`!;`&0`8 @.!O`%T`+@.!;
M`$8`:0!L`&4`<P!=`"``*``-``H`"0`)`%L`1@.!I`&P`90!)`$0`70`-``H`
4"0`I``T`"@.!'`$\`#0`*``T`"@.``
end
|||As far as I can see, removing the Files properties out of the equation
satisfies these requirements:
Filter:
SELECT <published_columns> FROM [dbo].[Hosts_Files] WHERE
hostname = HOST_NAME()
Join:
SELECT <published_columns> FROM [dbo].[Hosts_Files] INNER JOIN
[dbo].[FileProperties] ON [FileProperties].[FileID] =
[FileProperties].[FileID]
(publication script attached).
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
begin 666 replication test.sql
M__XM`"T`( !!`&0`9 !I`&X`9P`@.`'0`: !E`" `;0!E`'(`9P!E`" `< !U
M`&(`; !I`&,`80!T`&D`;P!N``T`"@.!E`'@.`90!C`" `<P!P`%\`80!D`&0`
M;0!E`'(`9P!E`' `=0!B`&P`:0!C`&$`= !I`&\`;@.`@.`$ `< !U`&(`; !I
M`&,`80!T`&D`;P!N`" `/0`@.`$X`)P!8`%@.`6 !4`&4`<P!T`"<`+ `@.`$ `
M9 !E`',`8P!R`&D`< !T`&D`;P!N`" `/0`@.`$X`)P!-`&4`<@.!G`&4`( !P
M`'4`8@.!L`&D`8P!A`'0`:0!O`&X`( !O`&8`( !8`%@.`6 `@.`&0`80!T`&$`
M8@.!A`',`90`@.`&8`<@.!O`&T`( !0`'4`8@.!L`&D`<P!H`&4`<@.`@.`%@.`6 !8
M`"X`)P`L`" `0 !R`&4`= !E`&X`= !I`&\`;@.`@.`#T`( `Q`#0`+ `@.`$ `
M<P!Y`&X`8P!?`&T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!&`&D`; !E
M`$D`1 !=`" `/0`@.`%L`1@.!I`&P`90!0`'(`;P!P`&4`<@.!T`&D`90!S`%T`
M+@.!;`$8`:0!L`&4`20!$`%T`)P`L`" `0 !J`&\`:0!N`%\`=0!N`&D`<0!U
C`&4`7P!K`&4`>0`@.`#T`( `P``T`"@.!'`$\`#0`*``T`"@.``
`
end
|||Hi Paul,
Thank you. That's what I've been trying to do, but the enterprise
manager kept telling me that Hosts_Files and FileProperties are not
related...
I ran the script you attached but unfortunatly - it still doesn't work.
The subscriber still gets the whole FileProperties table and not only
the properties for the files in Hosts_Files.
Have you got any idea why this isn't working?
Thank you again.
Paul Ibison wrote:

> As far as I can see, removing the Files properties out of the
> equation satisfies these requirements:
> Filter:
> SELECT <published_columns> FROM [dbo].[Hosts_Files] WHERE
> hostname = HOST_NAME()
> Join:
> SELECT <published_columns> FROM [dbo].[Hosts_Files] INNER JOIN
> [dbo].[FileProperties] ON [FileProperties].[FileID] =
> [FileProperties].[FileID]
> (publication script attached).
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
|||I don't know why you get this error message from EM but the script runs. As
far as the publication I posted up goes you're quite right - I just tested
this and only the table directly related to the host_name() function is
filtered. Interesting! The other option is to use the host_name function on
the file_properties table as well. I know that this isn't related to host
names, but we can make it related by using a UDF.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thank you for your fast and helpful replies.
Well, in this case now when the obvious fails, I'm left with two
options:
- FILTER FileProperties with a user defined function, or
- JOINing FileProperties with a new table that has hostname and
FilePropertyID.
The first one probably has a cost in querying, and the second one in
inserting. Which one in your opinion is better? Also, if I use a user
defined function, should I pass HOST_NAME() as a parameter to it in the
filter, or simply use HOST_NAME() in the function itself (i.e. not as a
parameter)?

Merge Replication and Dynamic filters

Hi,

I would like to setup a merge replication from a main database (publisher), to around 100 client databases (subscribers), that contain only subset information for each distinct client: each client has then its own database to view and modify its own data (Filtered on rows and columns). The client databases will initially be hosted on the same SQL server Instance.

I don't want to setup manually 100 publications with static filters, and more may come in the future: a pain to setup and maintain because I have to configure the tables, the columns and the row filters (and joins) each time.

I would like then to setup one publication with a dynamic filter, to filter in a way or another on a specific client. Creating subscribers becomes then a piece of cake. The dynamic filter would apply based on a property specific to the client, but... HOW?

Filtering on HOST_NAME() will not work because several subscribers are on the same server.

Filtering on SUSER_SNAME() will not work because merge agent will always use the same user name for connecting to the publisher (using push subcription, all merge agents are on the same server), and I have not find out how it can be configured by merge agent: even if the merge agent jobs have different owner, it is always the SQL Server Agent login that is used to connect to the publisher (I am using windows authentication).

I was thinking about using DB_NAME(), and have specific db name for each client DB, but DB_NAME() provides the name of the publisher DB, not the subscriber DB. etc ...

What could I use in this case to dynamically filter on client data without having to fall into heavy replication administration and setup.

Thanks for your help,

Best regardsThink about using pull subscriptions - you'll have more flexibility, including accounts for every agent.|||I have found the way to filter on each subscriber by forcing a different host name for each subscriber:
In the job that launch the merge agent, I add a parameter -HostName [CustomizedName]
My publisher filters then on a different host name for each subscriber.

Merge Replication and Dynamic Filters

Hi.
I am developing an Windows Mobile 5.0 Application for the MotoQ. It
uses merge replication and everything works fine. The DB has a
dynamic filter on it so that it only sends the data that matches the
SUSER_SNAME(). The problem arises when a user, other than the inital
user for the program, wants to login using that device.
I want to have it drop the old subscription and start a new one with
the new user. I have coded it exactly as I want it, the thing is, it
still sends data for the first user. The only way for me to use the
program with a new, different, user is to reinstall it. I highly
doubt this is the only solution...
Any ideas are greatly welcome.
Thanks,
SmP
I wish I could help you, but I am having the same trouble. I would love to
see an answer.
"smp9737@.gmail.com" wrote:

> Hi.
> I am developing an Windows Mobile 5.0 Application for the MotoQ. It
> uses merge replication and everything works fine. The DB has a
> dynamic filter on it so that it only sends the data that matches the
> SUSER_SNAME(). The problem arises when a user, other than the inital
> user for the program, wants to login using that device.
> I want to have it drop the old subscription and start a new one with
> the new user. I have coded it exactly as I want it, the thing is, it
> still sends data for the first user. The only way for me to use the
> program with a new, different, user is to reinstall it. I highly
> doubt this is the only solution...
>
> Any ideas are greatly welcome.
> Thanks,
> SmP
>

Merge replication and dynamic filters

Hi,
I would like to setup a merge replication from a main database (publisher), to around 100 client databases (subscribers), that contain only subset information for each distinct client: each client has then its own database to view and modify its own data (Filtered on rows and columns). The client databases will initially be hosted on the same SQL server Instance.
I don't want to setup manually 100 publications with static filters, and more may come in the future: a pain to setup and maintain because I have to configure the tables, the columns and the row filters (and joins) each time.
I would like then to setup one publication with a dynamic filter, to filter in a way or another on a specific client. Creating subscribers becomes then a piece of cake. The dynamic filter would apply based on a property specific to the client, but... HOW?
Filtering on HOST_NAME() will not work because several subscribers are on the same server.
Filtering on SUSER_SNAME() will not work because merge agent will always use the same user name for connecting to the publisher (using push subcription, all merge agents are on the same server), and I have not find out how it can be configured by merge agent: even if the merge agent jobs have different owner, it is always the SQL Server Agent login that is used to connect to the publisher (I am using windows authentication).
I was thinking about using DB_NAME(), and have specific db name for each client DB, but DB_NAME() provides the name of the publisher DB, not the subscriber DB. etc ...
What could I use in this case to dynamically filter on client data without having to fall into heavy replication administration and setup.
Thanks for your help,
Best regards

Quote:

Originally posted by jj.lequeux
Hi,
I would like to setup a merge replication from a main database (publisher), to around 100 client databases (subscribers), that contain only subset information for each distinct client: each client has then its own database to view and modify its own data (Filtered on rows and columns). The client databases will initially be hosted on the same SQL server Instance.
I don't want to setup manually 100 publications with static filters, and more may come in the future: a pain to setup and maintain because I have to configure the tables, the columns and the row filters (and joins) each time.
I would like then to setup one publication with a dynamic filter, to filter in a way or another on a specific client. Creating subscribers becomes then a piece of cake. The dynamic filter would apply based on a property specific to the client, but... HOW?
Filtering on HOST_NAME() will not work because several subscribers are on the same server.
Filtering on SUSER_SNAME() will not work because merge agent will always use the same user name for connecting to the publisher (using push subcription, all merge agents are on the same server), and I have not find out how it can be configured by merge agent: even if the merge agent jobs have different owner, it is always the SQL Server Agent login that is used to connect to the publisher (I am using windows authentication).
I was thinking about using DB_NAME(), and have specific db name for each client DB, but DB_NAME() provides the name of the publisher DB, not the subscriber DB. etc ...
What could I use in this case to dynamically filter on client data without having to fall into heavy replication administration and setup.
Thanks for your help,
Best regards

I have found the way to filter on each subscriber by forcing a different host name for each subscriber:
In the job that launch the merge agent, I add a parameter -HostName [CustomizedName]
My publisher filters then on a different host name for each subscriber.