#StackBounty: #plugins #plugin-development #sql #core #optimization register_post_status – show_in_admin_all_list & show_in_admin_s…

Bounty: 100

In the register_post_status, I’ve already disabled
show_in_admin_all_list & show_in_admin_status_list for my custom status my_hidden_status

However, from the query log the post_status my_hidden_status it is still not being filtered out (when
loading edit.php)

e.g.

SELECT post_status, COUNT( * ) AS num_posts FROM st_posts WHERE
post_type = ‘my_cpt’ GROUP BY post_status;

The post_status I wanted to filter actually is over 90% of my CPT, so
if the query is rewritten as

SELECT post_status, COUNT( * ) AS num_posts FROM st_posts WHERE
post_type = 'my_cpt' AND post_status != 'my_hidden_status' GROUP BY
post_status;

It can greatly improve the performance.

It is a bug?


Get this bounty!!!

#StackBounty: #sql #regex #postgresql Regex in Hive or Impala to extract full DN in OpenLDAP

Bounty: 50

I have a program to pass a full string of groups a user in OpenLDAP to Postgres query. The string is exactly like this:

( 'cn=user1,ou=org1,ou=suborg1,o=myorg','cn=user2,ou=org2,ou=suborg1,o=myorg','cn=user3,ou=org1,ou=suborg1,o=myorg','cn=user4,ou=org1,ou=suborg2,o=myorg' )

In a query, I only want that to be this in Postgres:

'user1','user3'

Basically extract value of cn= when the rest of the string is ou=org1,ou=suborg1,o=myorg.

user2 has ou=org2,ou=suborg1,o=myorg which is org2 so it won’t match.
user4 won’t match on suborg2 ,… The variation is unlimited so I like to look for exact match ou=org1,ou=suborg1,o=myorg only.

I know how to do replace but it can’t handle unlimited scenarios. Is there a clean way to do this in regexp_replace or regexp_extract?


Get this bounty!!!

#StackBounty: #sql #excel #vba #excel-vba #excel-2010 Excel VBA – Stored Procedure (SQL Server)

Bounty: 50

I have a slight issue retrieving multiple recordsets (with column names) and pasting the data into an excel sheet, like the image below

enter image description here

The VBA code that I have just retrieves the first recordset but not the rest

Any help will be much appreciated , thank you

Sub CProcedure()

    Dim Conn As ADODB.Connection, RecordSet As ADODB.RecordSet
    Dim Command As ADODB.Command
    Dim ConnectionString As String, StoredProcName As String
    Dim range1 As ADODB.Parameter, range2 As ADODB.Parameter
    Dim SP_Param1 As String
    Dim SP_Param2 As String

    Application.ScreenUpdating = False

    Set Conn = New ADODB.Connection
    Set RecordSet = New ADODB.RecordSet
    Set Command = New ADODB.Command


    ServerName = "1111"
    DatabaseName = "dataReporting"
    UserId = "88888"
    Password = "88888"
    SP_Param1 = "StartDate"
    SP_Param2 = "EndDate"
    StoredProcName = "KPI_Report"


    ConnectionString = "PROVIDER=SQLOLEDB;DATA SOURCE=" & ServerName & _
                       ";INITIAL CATALOG=" & DatabaseName & "; User Id=" & _
                       UserId & "; Password=" & Password & ";"
    Conn.Open ConnectionString


    With Command
        .ActiveConnection = Conn
        .CommandType = adCmdStoredProc
        .CommandText = StoredProcName
        .CommandTimeout = 0
    End With

    Set range1 = Command.CreateParameter(SP_Param1, adDBDate, adParamInput, , DateSerial(2018, 1, 1))
    Command.Parameters.Append range1

    Set range2 = Command.CreateParameter(SP_Param2, adDBDate, adParamInput, , DateSerial(2018, 4, 1))
    Command.Parameters.Append range2

    Set RecordSet = Command.Execute
    Sheets("Sheet1").Range("A2").CopyFromRecordset RecordSet


    RecordSet.Close
    Conn.Close
    On Error GoTo 0
    Application.ScreenUpdating = True
    Exit Sub


End Sub

Update

I added the below loop but still no luck

'Loop through recordset and place values
RecordSet.MoveFirst
Do While RecordSet.EOF = False
    For i = 0 To RecordSet.Fields.Count - 1
        ActiveCell.Value = RecordSet.Fields(i).Value
        ActiveCell.Offset(0, 1).Activate
    Next i
    ActiveCell.Offset(1, -i).Activate
RecordSet.MoveNext
Loop

Proc Code below

 Sub storeproc()

Dim Conn As ADODB.Connection
Dim ADODBCmd As ADODB.Command
Dim rs As ADODB.RecordSet
Dim i As Integer
Dim sConnect As String

    ServerName = "1111"
    DatabaseName = "dataReporting"
    UserId = "88888"
    Password = "88888"
    SP_Param1 = "StartDate"
    SP_Param2 = "EndDate"
    StoredProcName = "KPI_Report"

 sConnect = "PROVIDER=SQLOLEDB;DATA SOURCE=" & ServerName & 
";INITIAL CATALOG=" & DatabaseName & "; User Id=" & UserId & 
"; Password=" & Password & ";"


'Establish connection
Set Conn = New ADODB.Connection
Conn.ConnectionString = sConnect
Conn.Open

'Open recordset
Set ADODBCmd = New ADODB.Command
ADODBCmd.ActiveConnection = Conn
ADODBCmd.CommandText = StoredProcName
ADODBCmd.CommandType = adCmdStoredProc
ADODBCmd.CommandTimeout = 0

Set range1 = ADODBCmd.CreateParameter(SP_Param1, adDBDate, adParamInput, , DateSerial(2018, 1, 1))
ADODBCmd.Parameters.Append range1

Set range2 = ADODBCmd.CreateParameter(SP_Param2, adDBDate, adParamInput, , DateSerial(2018, 4, 1))
ADODBCmd.Parameters.Append range2


Set rs = ADODBCmd.Execute()

'Loop through recordset and place values
rs.MoveFirst
Do While rs.EOF = False
    For i = 0 To rs.Fields.Count - 1
        ActiveCell.Value = rs.Fields(i).Value  
        ActiveCell.Offset(0, 1).Activate        
    Next i
    ActiveCell.Offset(1, -i).Activate           
rs.MoveNext
Loop


'Clean up
rs.Close
Set rs = Nothing

 End Sub


Get this bounty!!!

#StackBounty: #sql #database-design #ddl How to model a limited history of a table

Bounty: 50

Context

I have 3 entities (user, shop and car), a car can only have one regNum, one shopId and one ownerId at a time, that’s why they are embedded in the car table.

create table "user"
(
  id   bigint primary key,
  name varchar(40) not null
);

create table "shop"
(
  id   bigint primary key,
  name varchar(40) not null
);

create table "car"
(
  id      bigint primary key,
  ownerId bigint,
  regNum  varchar(8),
  shopId  bigint,
  price   numeric(10,2),
  constraint foreign key(ownerId) references "user",
  constraint foreign key(shopId) references "shop"
);

Problem

I want to keep history of the car’s regNum, ownerId, shopId and eventually other future fields (but not necessarily all of them).
What’s the best solution (scalability/performance/easeOfUse) ? I have found the ones below, maybe someone has faced the same problem, maybe there is another solution ?

Solution 1

I add as much history tables as I have fields to “watch”.
This seems to be a normalized way to do the job but it also looks pretty complex to maintain, it’s also more greedy as if I modify all fields at once (regNum, shopId and ownerId), I need to insert 3 records (one for each history and so on if I watch other fields later).

create table "carOwner"
(
  id        bigint primary key,
  carId     bigint not null,
  changedAt timestamp not null,
  ownerId   bigint,
  constraint foreign key(carId) references "car",
  constraint foreign key(ownerId) references "user"
);

create table "carShop"
(
  id        bigint primary key,
  carId     bigint not null,
  changedAt timestamp not null,
  shopId    bigint,
  constraint foreign key(carId) references "car",
  constraint foreign key(shopId) references "shop"
);

create table "carRegNum"
(
  id        bigint primary key,
  carId     bigint not null,
  changedAt timestamp not null,
  regNum    varchar(8),
  constraint foreign key(carId) references "car"
);

Solution 2

I keep history in a single table, which is a light snapshot of the car table at a given time. It seems easier to maintain but it’s not precise as I cannot directly see what changed if I don’t have previous record.

create table "carHistory"
(
  id        bigint primary key,
  carId     bigint not null,
  changedAt timestamp not null,
  ownerId   bigint,
  regNum    varchar(8),
  shopId    bigint,
  constraint foreign key(carId) references "car",
  constraint foreign key(shopId) references "shop",
  constraint foreign key(ownerId) references "user"
);


Get this bounty!!!

#StackBounty: #sql-server #sql #database-design #continuous-integration How can we manage cross-database dependencies across environmen…

Bounty: 150

I’ve put off asking this question for some time since it’s tricky to
encapsulate our situation and challenges without a wall of text, but the
situation is getting worse so I’ll do my best. I’m looking for some assistance in improving the way we develop and manage our application database and developer environments, particularly in regards to database dependencies across environments.

About us

We’re a medium-sized company with a fair amount of legacy code. To give an sense of what our current application database looks like, here are some ballpark numbers: 50gb, 450 tables, 200 views and 400 stored procedures. In addition, our production server runs approximately 15 databases, most of which needs or is needed by our application database.

To clarify: When I say “need”, I’m referring to database objects that will not
compile/will compile but not run without the dependency. Examples of these
objects are server objects like Linked Servers and Replication Subscriptions, or
database objects like Stored Procedures and Views.

Over the past year, we’ve made significant improvements to the way we develop
and deploy our database. Improvements so far include the introduction of
dedicated developer environments, version control of (nearly) all database code,
automated deployment from Git (trigger-based) and the transition to a SQL Server
cluster.

The issue

What we’re struggling with, and which I cannot seem to find suitable resources for, is how to deal with dependencies from our application database to other databases. These dependencies fall into two separate challenges:

1. Databases on the same server

At the moment of speaking, our application database depends upon 5 databases on the same server. These are databases with separate repositories, deployment pipelines, libraries and web projects. While bootstrapping developer environments, we must take care to create these in a particular order in order to successfully apply DDL and DML-scripts, lest we face dependency errors. This process alone is causing a lot of headache. In fact, it is causing so much headache that some of our developers have simply given up on local developer environments and do all of their development in a shared database.

2. Databases on a remote server only accessible to production

In our production environment, we import data from a handful of remote SQL Server instances. Some of this data is imported using stored procedures that reference remote servers using Linked Server objects. In order for the stored procedure to run, the Linked Server object needs to exist. In order for the Linked Server object to “successfully” exist, the remote server it references must be reachable. The remote servers are only accessible from our production server (and rightly so), but this causes our stored procedures not compile properly during deployment.

In the book “Continuous Delivery”, author Dave Farley emphasizes that in true Continuous Integration, every single resource required to assemble and run a project should reside in its repository. Additionally, he specifies that every environment should be identical (with the exception of configurations such as credentials and connection strings). Our application does not satisfy these principles, and I’m not even sure if it’s feasible to do so.

Our tools

  • Database server: Microsoft SQL Server 2017
  • Build server: Visual Team Services
  • Build tools: Redgate DLM Automation Suite

It feels like I’m missing out on some core architectural principles here. What can we do to alleviate these issues? Suggestions to relevant literature are also welcome.


Get this bounty!!!

#StackBounty: #sql #performance-tuning #aws #redshift #amazon-redshift Amazon Redshift Foreign Keys – Sort or Interleaved Keys

Bounty: 50

We plan to import OLTP Relational tables into AWS Redshift.
The CustomerTransaction table joins to multiple lookup tables. I only included 3, but we have more.

What should Sort Key be on Customer Transaction Table? In regular SQL server, we have nonclustered indexes on the foreign keys in CustomerTransaction table.
For AWS Redshift, Should I use compound sort keys or interleaved sort on foreign key columns in CustomerTransaction? What is the best indexing strategy for this table design.
Thanks,

create table.dbo CustomerTransaction
{
    CustomerTransactionId bigint primary key identity(1,1),
    ProductTypeId bigint,   -- foreign keys to Product Type Table
    StatusTypeID bigint         -- Foreign keys to StatusTypeTable
    DateOfPurchase date,
    PurchaseAmount float,
    ....
}

create table dbo.ProductType
{
    CustomerTransactionId bigint primary key identity(1,1),
    ProductName varchar(255),
    ProductDescription varchar(255)
    .....
}

create table dbo.StatusType
{
    StatusTypeId bigint primary key identity(1,1),
    StatusTypeName varchar(255),
    StatusDescription varchar(255)
    .....

}

Stack


Get this bounty!!!

#StackBounty: #mysql #sql Select max value on multiple tables, without counting them twice

Bounty: 350

I’m making a query that allows me to order recipes by score.

Tables structure

Structure is that a flyer contains one or many flyer_items, which can contain one or many ingredients_to_flyer_item (this table links ingredient to the flyer item). The other table ingredient_to_recipe links the same ingredients but to one or many recipes. Link to .sql file is included at the end.

Example query

I want to get recipe_id and a SUM of the MAX price weight of each ingredient that are part of the recipe (linked by ingredient_to_recipe), but if a recipe has multiple ingredients that belongs to the same flyers_item, it should be counted once.

SELECT itr.recipe_id,
       SUM(itr.weight),
       SUM(max_price_weight),
       SUM(itr.weight + max_price_weight) AS score
FROM
  ( SELECT MAX(itf.max_price_weight) AS max_price_weight,
           itf.flyer_item_id,
           itf.ingredient_id
   FROM
     (SELECT ifi.ingredient_id,
             MAX(i.price_weight) AS max_price_weight,
             ifi.flyer_item_id
      FROM flyer_items i
      JOIN ingredient_to_flyer_item ifi ON i.id = ifi.flyer_item_id
      WHERE i.flyer_id IN (1,
                           2)
      GROUP BY ifi.ingredient_id ) itf
   GROUP BY itf.flyer_item_id) itf2
JOIN `ingredient_to_recipe` AS itr ON itf2.`ingredient_id` = itr.`ingredient_id`
WHERE recipe_id = 5730
GROUP BY itr.`recipe_id`
ORDER BY score DESC
LIMIT 0,10

The query almost works fine, because most of the results are good, but for some lines, some ingredients are ignored and not counted from the score as they should.

Test cases

| recipe_id | 'score' with current query | what 'score' should be | explanation                                                                 |
|-----------|----------------------------|------------------------|-----------------------------------------------------------------------------|
| 8376      | 51                         | 51                     | Good result                                                                 |
| 3152      | 1                          | 18                     | Only 1 ingredient having a score of one is counted, should be 4 ingredients |
| 4771      | 41                         | 45                     | One ingredient worth score 4 is ignored                                     |
| 10230     | 40                         | 40                     | Good result                                                                 |
| 8958      | 39                         | 39                     | Good result                                                                 |
| 4656      | 28                         | 34                     | One ingredient worth 6 is ignored                                           |
| 11338     | 1                          | 10                     | 2 ingredients, worth 4 and 5 are ignored                                    |

I have a very difficult time finding an easy way to explain it. Let me know if anything else could help.

Here is a link to the demo database to run the query, test examples and test cases: https://nofile.io/f/F4YSEu8DWmT/meta.zip

Thank you very much.


Get this bounty!!!

#StackBounty: #sql-server #sql #sql-server-2012 SQL Server 2012 – Merge Replication error: You do not have permission to run 'SP_TR…

Bounty: 50

I have setup a merge replication. Server DUCKDUCK1-1 is distributor and publisher. Server DUCKDUCK-2 is subscriber.

I have only one small table replicated (this is a test).

The table is being replicated (but it’s empty on the subscriber).

The error shown says:

Error messages:
You do not have permission to run 'SP_TRACE_GENERATEEVENT'. (Source: MSSQLServer, Error number: 8189)
Get help: http://help/8189
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)
Get help: http://help/MSSQL_REPL-2147201001

The verbose log says the following:

2018-05-18 14:41:34.856 Microsoft SQL Server Merge Agent 11.0.5058.0
2018-05-18 14:41:34.866 Copyright (c) 2008 Microsoft Corporation
2018-05-18 14:41:34.870 Microsoft SQL Server Replication Agent: replmerg
2018-05-18 14:41:34.874 
2018-05-18 14:41:34.877 The timestamps prepended to the output lines are expressed in terms of UTC time.
2018-05-18 14:41:34.879 User-specified agent parameter values:
            -Publisher DUCKDUCK-1-1
            -PublisherDB mydatabase
            -Publication Replication2018
            -Subscriber DUCKDUCK-2
            -SubscriberDB mydatabase
            -Distributor DUCKDUCK-1-1
            -DistributorSecurityMode 1
            -Continuous
            -OutputVerboseLevel 2
            -Output \DUCKDUCK-1-1snapshot_replicacionsalida.txt
            -XJOBID 0x307666C42266374F956FDBF68CA326E6
            -XJOBNAME DUCKDUCK-1-1-mydatabase-Replication2018-DUCKDUCK-2-1
            -XSTEPID 2
            -XSUBSYSTEM Merge
            -XSERVER DUCKDUCK-1-1
            -XCMDLINE 0
            -XCancelEventHandle 0000058C
            -XParentProcessHandle 00000614
2018-05-18 14:41:34.922 Percent Complete: 0
2018-05-18 14:41:34.926 Connecting to Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:34.929 Connecting to OLE DB Distributor at datasource: 'DUCKDUCK-1-1', location: '', catalog: '', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:34.965 OLE DB Distributor: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: 
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:34.969 OLE DB Distributor 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:34.972 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_helpdistpublisher (N'DUCKDUCK-1-1') }
2018-05-18 14:41:34.977 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:34.983 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:34.987 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_merge_agentid (0,N'mydatabase',N'Replication2018',null,N'mydatabase',90,N'DUCKDUCK-2')}
2018-05-18 14:41:34.992 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_profile (1, 4, N'')}
2018-05-18 14:41:34.995 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_get_redirected_publisher(N'DUCKDUCK-1-1',N'mydatabase',0)}
2018-05-18 14:41:34.999 Percent Complete: 0
2018-05-18 14:41:34.999 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.002 Initializing
2018-05-18 14:41:35.008 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.010 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.014 Percent Complete: 0
2018-05-18 14:41:35.014 OLE DB Publisher 'DUCKDUCK-1-1': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.017 Validating publisher
2018-05-18 14:41:35.021 OLE DB Publisher 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.024 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.028 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.031 Percent Complete: 0
2018-05-18 14:41:35.034 Connecting to Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.036 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.037 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.051 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:35.055 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.072 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.077 OLE DB Subscriber 'DUCKDUCK-2': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.081 OLE DB Subscriber 'DUCKDUCK-2': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.085 Percent Complete: 0
2018-05-18 14:41:35.085 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.088 Connecting to Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.093 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.094 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.099 Percent Complete: 0
2018-05-18 14:41:35.102 Retrieving publication information
2018-05-18 14:41:35.104 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.110 Percent Complete: 0
2018-05-18 14:41:35.113 Retrieving subscription information.
2018-05-18 14:41:35.114 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.115 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.123 Percent Complete: 0
2018-05-18 14:41:35.127 Applying the snapshot to the Subscriber
2018-05-18 14:41:35.129 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.190 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:35.193 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_mergesubentry_indistdb (0,N'DUCKDUCK-1-1',N'mydatabase',N'Replication2018',N'DUCKDUCK-2',N'mydatabase',0,1,0,N'',?,90)}
2018-05-18 14:41:35.201 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.209 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.213 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.220 OLE DB Subscriber 'DUCKDUCK-2': sp_MSacquiresnapshotdeliverysessionlock
2018-05-18 14:41:35.223 OLE DB Subscriber 'DUCKDUCK-2': sp_MStrypurgingoldsnapshotdeliveryprogress
2018-05-18 14:41:35.231 OLE DB Subscriber 'DUCKDUCK-2': sp_MSissnapshotitemapplied @snapshot_session_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431', @snapshot_progress_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431provincias_2.sch'
2018-05-18 14:41:35.235 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.252 [18%] OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.258 Skipping file 'provincias_2.sch' because it has already been delivered for a previous article or by a previously interrupted snapshot.
2018-05-18 14:41:35.261 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.270 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.[18%] 
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.276 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.279 Preparing table 'provincias' for merge replication
2018-05-18 14:41:35.285 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.292 Percent Complete: 18
2018-05-18 14:41:35.295 You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.297 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.342 Percent Complete: 0
2018-05-18 14:41:35.345 Category:SQLSERVER
Source:  DUCKDUCK-2
Number:  8189
Message: You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.351 Percent Complete: 0
2018-05-18 14:41:35.354 Category:NULL
Source:  Merge Replication Provider
Number:  -2147201001
Message: 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.
2018-05-18 14:41:35.357 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.360 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.363 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.365 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.368 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.372 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.375 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.378 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.380 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.383 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.386 The merge process will restart after waiting 30 second(s)...

I read that I should go into Server Properties -> Permissions and add the Alter Trace permission. I’m not sure to which user I should give it so I gave it to ALL users that I have in the list. Still, it doesn’t work.


Get this bounty!!!

#StackBounty: #sql-server #sql #sql-server-2012 SQL Server 2012 – Merge Replication error: You do not have permission to run 'SP_TR…

Bounty: 50

I have setup a merge replication. Server DUCKDUCK1-1 is distributor and publisher. Server DUCKDUCK-2 is subscriber.

I have only one small table replicated (this is a test).

The table is being replicated (but it’s empty on the subscriber).

The error shown says:

Error messages:
You do not have permission to run 'SP_TRACE_GENERATEEVENT'. (Source: MSSQLServer, Error number: 8189)
Get help: http://help/8189
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)
Get help: http://help/MSSQL_REPL-2147201001

The verbose log says the following:

2018-05-18 14:41:34.856 Microsoft SQL Server Merge Agent 11.0.5058.0
2018-05-18 14:41:34.866 Copyright (c) 2008 Microsoft Corporation
2018-05-18 14:41:34.870 Microsoft SQL Server Replication Agent: replmerg
2018-05-18 14:41:34.874 
2018-05-18 14:41:34.877 The timestamps prepended to the output lines are expressed in terms of UTC time.
2018-05-18 14:41:34.879 User-specified agent parameter values:
            -Publisher DUCKDUCK-1-1
            -PublisherDB mydatabase
            -Publication Replication2018
            -Subscriber DUCKDUCK-2
            -SubscriberDB mydatabase
            -Distributor DUCKDUCK-1-1
            -DistributorSecurityMode 1
            -Continuous
            -OutputVerboseLevel 2
            -Output \DUCKDUCK-1-1snapshot_replicacionsalida.txt
            -XJOBID 0x307666C42266374F956FDBF68CA326E6
            -XJOBNAME DUCKDUCK-1-1-mydatabase-Replication2018-DUCKDUCK-2-1
            -XSTEPID 2
            -XSUBSYSTEM Merge
            -XSERVER DUCKDUCK-1-1
            -XCMDLINE 0
            -XCancelEventHandle 0000058C
            -XParentProcessHandle 00000614
2018-05-18 14:41:34.922 Percent Complete: 0
2018-05-18 14:41:34.926 Connecting to Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:34.929 Connecting to OLE DB Distributor at datasource: 'DUCKDUCK-1-1', location: '', catalog: '', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:34.965 OLE DB Distributor: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: 
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:34.969 OLE DB Distributor 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:34.972 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_helpdistpublisher (N'DUCKDUCK-1-1') }
2018-05-18 14:41:34.977 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:34.983 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:34.987 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_merge_agentid (0,N'mydatabase',N'Replication2018',null,N'mydatabase',90,N'DUCKDUCK-2')}
2018-05-18 14:41:34.992 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_profile (1, 4, N'')}
2018-05-18 14:41:34.995 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_get_redirected_publisher(N'DUCKDUCK-1-1',N'mydatabase',0)}
2018-05-18 14:41:34.999 Percent Complete: 0
2018-05-18 14:41:34.999 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.002 Initializing
2018-05-18 14:41:35.008 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.010 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.014 Percent Complete: 0
2018-05-18 14:41:35.014 OLE DB Publisher 'DUCKDUCK-1-1': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.017 Validating publisher
2018-05-18 14:41:35.021 OLE DB Publisher 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.024 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.028 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.031 Percent Complete: 0
2018-05-18 14:41:35.034 Connecting to Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.036 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.037 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.051 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:35.055 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.072 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.077 OLE DB Subscriber 'DUCKDUCK-2': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.081 OLE DB Subscriber 'DUCKDUCK-2': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.085 Percent Complete: 0
2018-05-18 14:41:35.085 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.088 Connecting to Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.093 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.094 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.099 Percent Complete: 0
2018-05-18 14:41:35.102 Retrieving publication information
2018-05-18 14:41:35.104 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.110 Percent Complete: 0
2018-05-18 14:41:35.113 Retrieving subscription information.
2018-05-18 14:41:35.114 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.115 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.123 Percent Complete: 0
2018-05-18 14:41:35.127 Applying the snapshot to the Subscriber
2018-05-18 14:41:35.129 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.190 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:35.193 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_mergesubentry_indistdb (0,N'DUCKDUCK-1-1',N'mydatabase',N'Replication2018',N'DUCKDUCK-2',N'mydatabase',0,1,0,N'',?,90)}
2018-05-18 14:41:35.201 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.209 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.213 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.220 OLE DB Subscriber 'DUCKDUCK-2': sp_MSacquiresnapshotdeliverysessionlock
2018-05-18 14:41:35.223 OLE DB Subscriber 'DUCKDUCK-2': sp_MStrypurgingoldsnapshotdeliveryprogress
2018-05-18 14:41:35.231 OLE DB Subscriber 'DUCKDUCK-2': sp_MSissnapshotitemapplied @snapshot_session_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431', @snapshot_progress_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431provincias_2.sch'
2018-05-18 14:41:35.235 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.252 [18%] OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.258 Skipping file 'provincias_2.sch' because it has already been delivered for a previous article or by a previously interrupted snapshot.
2018-05-18 14:41:35.261 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.270 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.[18%] 
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.276 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.279 Preparing table 'provincias' for merge replication
2018-05-18 14:41:35.285 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.292 Percent Complete: 18
2018-05-18 14:41:35.295 You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.297 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.342 Percent Complete: 0
2018-05-18 14:41:35.345 Category:SQLSERVER
Source:  DUCKDUCK-2
Number:  8189
Message: You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.351 Percent Complete: 0
2018-05-18 14:41:35.354 Category:NULL
Source:  Merge Replication Provider
Number:  -2147201001
Message: 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.
2018-05-18 14:41:35.357 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.360 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.363 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.365 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.368 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.372 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.375 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.378 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.380 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.383 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.386 The merge process will restart after waiting 30 second(s)...

I read that I should go into Server Properties -> Permissions and add the Alter Trace permission. I’m not sure to which user I should give it so I gave it to ALL users that I have in the list. Still, it doesn’t work.


Get this bounty!!!

#StackBounty: #sql-server #sql #sql-server-2012 SQL Server 2012 – Merge Replication error: You do not have permission to run 'SP_TR…

Bounty: 50

I have setup a merge replication. Server DUCKDUCK1-1 is distributor and publisher. Server DUCKDUCK-2 is subscriber.

I have only one small table replicated (this is a test).

The table is being replicated (but it’s empty on the subscriber).

The error shown says:

Error messages:
You do not have permission to run 'SP_TRACE_GENERATEEVENT'. (Source: MSSQLServer, Error number: 8189)
Get help: http://help/8189
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)
Get help: http://help/MSSQL_REPL-2147201001

The verbose log says the following:

2018-05-18 14:41:34.856 Microsoft SQL Server Merge Agent 11.0.5058.0
2018-05-18 14:41:34.866 Copyright (c) 2008 Microsoft Corporation
2018-05-18 14:41:34.870 Microsoft SQL Server Replication Agent: replmerg
2018-05-18 14:41:34.874 
2018-05-18 14:41:34.877 The timestamps prepended to the output lines are expressed in terms of UTC time.
2018-05-18 14:41:34.879 User-specified agent parameter values:
            -Publisher DUCKDUCK-1-1
            -PublisherDB mydatabase
            -Publication Replication2018
            -Subscriber DUCKDUCK-2
            -SubscriberDB mydatabase
            -Distributor DUCKDUCK-1-1
            -DistributorSecurityMode 1
            -Continuous
            -OutputVerboseLevel 2
            -Output \DUCKDUCK-1-1snapshot_replicacionsalida.txt
            -XJOBID 0x307666C42266374F956FDBF68CA326E6
            -XJOBNAME DUCKDUCK-1-1-mydatabase-Replication2018-DUCKDUCK-2-1
            -XSTEPID 2
            -XSUBSYSTEM Merge
            -XSERVER DUCKDUCK-1-1
            -XCMDLINE 0
            -XCancelEventHandle 0000058C
            -XParentProcessHandle 00000614
2018-05-18 14:41:34.922 Percent Complete: 0
2018-05-18 14:41:34.926 Connecting to Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:34.929 Connecting to OLE DB Distributor at datasource: 'DUCKDUCK-1-1', location: '', catalog: '', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:34.965 OLE DB Distributor: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: 
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:34.969 OLE DB Distributor 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:34.972 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_helpdistpublisher (N'DUCKDUCK-1-1') }
2018-05-18 14:41:34.977 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:34.983 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:34.987 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_merge_agentid (0,N'mydatabase',N'Replication2018',null,N'mydatabase',90,N'DUCKDUCK-2')}
2018-05-18 14:41:34.992 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_profile (1, 4, N'')}
2018-05-18 14:41:34.995 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_get_redirected_publisher(N'DUCKDUCK-1-1',N'mydatabase',0)}
2018-05-18 14:41:34.999 Percent Complete: 0
2018-05-18 14:41:34.999 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.002 Initializing
2018-05-18 14:41:35.008 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.010 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.014 Percent Complete: 0
2018-05-18 14:41:35.014 OLE DB Publisher 'DUCKDUCK-1-1': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.017 Validating publisher
2018-05-18 14:41:35.021 OLE DB Publisher 'DUCKDUCK-1-1': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.024 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.028 Connecting to OLE DB Publisher at datasource: 'DUCKDUCK-1-1', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.031 Percent Complete: 0
2018-05-18 14:41:35.034 Connecting to Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.036 OLE DB Publisher: DUCKDUCK-1-1
            DBMS: Microsoft SQL Server
            Version: 11.00.5058
            catalog name: mydatabase
            user name: dbo
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.037 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.051 OLE DB Distributor 'DUCKDUCK-1-1': {call sp_MShelp_repl_agent (N'DUCKDUCK-1-1', N'mydatabase', N'Replication2018', N'DUCKDUCK-2', N'mydatabase', 1)}
2018-05-18 14:41:35.055 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.072 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.077 OLE DB Subscriber 'DUCKDUCK-2': select SERVERPROPERTY ('ProductVersion') 
2018-05-18 14:41:35.081 OLE DB Subscriber 'DUCKDUCK-2': set nocount on declare @dbname sysname select @dbname = db_name() declare @collation nvarchar(255) select @collation = convert(nvarchar(255), databasepropertyex(@dbname, N'COLLATION')) select collationproperty(@collation, N'CODEPAGE') as 'CodePage', collationproperty(@collation, N'LCID') as 'LCID', collationproperty(@collation, N'COMPARISONSTYLE') as 'ComparisonStyle',cast(case when convert (int,databasepropertyex (@dbname,'comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as DB_CaseSensitive,cast(case when convert (int,serverproperty ('comparisonstyle')) & 0x1 = 0x1 then 0 else 1 end as bit) as Server_CaseSensitive set nocount off
2018-05-18 14:41:35.085 Percent Complete: 0
2018-05-18 14:41:35.085 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.088 Connecting to Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.093 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.094 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.099 Percent Complete: 0
2018-05-18 14:41:35.102 Retrieving publication information
2018-05-18 14:41:35.104 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.110 Percent Complete: 0
2018-05-18 14:41:35.113 Retrieving subscription information.
2018-05-18 14:41:35.114 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.115 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.123 Percent Complete: 0
2018-05-18 14:41:35.127 Applying the snapshot to the Subscriber
2018-05-18 14:41:35.129 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.190 OLE DB Distributor 'DUCKDUCK-1-1': select datasource, srvid from master..sysservers where upper(srvname) = upper(N'DUCKDUCK-1-1')
2018-05-18 14:41:35.193 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_mergesubentry_indistdb (0,N'DUCKDUCK-1-1',N'mydatabase',N'Replication2018',N'DUCKDUCK-2',N'mydatabase',0,1,0,N'',?,90)}
2018-05-18 14:41:35.201 Connecting to OLE DB Subscriber at datasource: 'DUCKDUCK-2', location: '', catalog: 'mydatabase', providerstring: '' using provider 'SQLNCLI11'
2018-05-18 14:41:35.209 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.213 OLE DB Subscriber: DUCKDUCK-2
            DBMS: Microsoft SQL Server
            Version: 11.00.6020
            catalog name: mydatabase
            user name: clientes
            API conformance: 0
            SQL conformance: 0
            transaction capable: 1
            read only: F
            identifier quote char: "
            non_nullable_columns: 0
            owner usage: 15
            max table name len: 128
            max column name len: 128
            need long data len: 
            max columns in table: 1000
            max columns in index: 16
            max char literal len: 131072
            max statement len: 131072
            max row size: 131072
2018-05-18 14:41:35.220 OLE DB Subscriber 'DUCKDUCK-2': sp_MSacquiresnapshotdeliverysessionlock
2018-05-18 14:41:35.223 OLE DB Subscriber 'DUCKDUCK-2': sp_MStrypurgingoldsnapshotdeliveryprogress
2018-05-18 14:41:35.231 OLE DB Subscriber 'DUCKDUCK-2': sp_MSissnapshotitemapplied @snapshot_session_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431', @snapshot_progress_token = N'\DUCKDUCK-1-1snapshot_replicacionuncDUCKDUCK-1-1_mydatabase_Replication201820180518112431provincias_2.sch'
2018-05-18 14:41:35.235 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.252 [18%] OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.258 Skipping file 'provincias_2.sch' because it has already been delivered for a previous article or by a previously interrupted snapshot.
2018-05-18 14:41:35.261 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.270 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.[18%] 
  Ƶ 騰Ā  ꌸƵ硦燠ꍜƵὀ Ἷ 姸gꍜƵPercent Complete: 18
2018-05-18 14:41:35.276 OLE DB Subscriber 'DUCKDUCK-2': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.279 Preparing table 'provincias' for merge replication
2018-05-18 14:41:35.285 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.292 Percent Complete: 18
2018-05-18 14:41:35.295 You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.297 OLE DB Distributor 'DUCKDUCK-1-1': {call sys.sp_MSadd_merge_history90 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
2018-05-18 14:41:35.342 Percent Complete: 0
2018-05-18 14:41:35.345 Category:SQLSERVER
Source:  DUCKDUCK-2
Number:  8189
Message: You do not have permission to run 'SP_TRACE_GENERATEEVENT'.
2018-05-18 14:41:35.351 Percent Complete: 0
2018-05-18 14:41:35.354 Category:NULL
Source:  Merge Replication Provider
Number:  -2147201001
Message: 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.
2018-05-18 14:41:35.357 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.360 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.363 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.365 Disconnecting from OLE DB Subscriber 'DUCKDUCK-2'
2018-05-18 14:41:35.368 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.372 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.375 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.378 Disconnecting from OLE DB Publisher 'DUCKDUCK-1-1'
2018-05-18 14:41:35.380 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.383 Disconnecting from OLE DB Distributor 'DUCKDUCK-1-1'
2018-05-18 14:41:35.386 The merge process will restart after waiting 30 second(s)...

I read that I should go into Server Properties -> Permissions and add the Alter Trace permission. I’m not sure to which user I should give it so I gave it to ALL users that I have in the list. Still, it doesn’t work.


Get this bounty!!!