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

Detaching a replicated database

$
0
0

SQL Server 2005 - We want to detach a replicated database in order to move the files to different disks.  The database is a publisher.  According to BOL, "Before you can detach the database, you must disable publishing by running sp_replicationdboption".

Planned steps -
1) EXEC sp_replicationdboption @dbname= 'db_name'
        , @optname= 'publish'
        , @value= 'false'

2) Detach the database

3) Copy the database files to new locations

4) Attach the database

5) EXEC sp_replicationdboption @dbname= 'db_name'
        , @optname= 'publish'
        , @value= 'true'



Will these steps suffice, or am I missing something?

Is there anything that needs to be done to the subscriber?


"The Merge Agent failed after detecting that retention-based metadata cleanup has deleted metadata at the Subscriber for changes not yet sent to the Publisher. (MSSQL_REPL-2147199402)" - Error reappearing in SQL Server 2008 SP1

$
0
0

I have replication setup between a Publisher and a Subcriber with a nominal production load on the system. The replication between the servers has been running successfully for few days. However, after 5-6 days, the replication between the servers stopped with the below error message:

"The Merge Agent failed after detecting that retention-based metadata cleanup has deleted metadata at the Subscriber for changes not yet sent to the Publisher. You must reinitialize the subscription (without upload)."

When i browsed through the MS forums, I found that the issue was observed in SQL Server 2005 and has been fixed as part of the hotfix available under the link below:

http://support.microsoft.com/kb/919929

I am currently using SQL Server 2008 SP1 Standard Edition and the same issue is reproducible in it now.

Hence, can anyone please let me know if the above hotfix (of SQL Server 2005) is available for the SQL Server 2008 SP1 Standard Edition version also? Please help.

Thanks in advance.

SQL 2012 Transactional Replication: The distribution agent failed to create temporary files

$
0
0
We are on 2012 Enterprise with a 1 publisher, 1 distributor & 5 subscribers. We are frequently getting the warning "The distribution agent failed to create temporary files in 'C:\Program Files\Microsoft SQL Server\110\COM' directory. System returned errorcode 5."

Steps taken so far: The agent account & repl admin accounts have been given full access to the folder on publisher, distributor & 5 subscribers.

Whats is noticed is we receive this warning, however the Replication is healthy & does not seem to be effected.

long running initial snapshot on existing merge replication after change to partitions

$
0
0

Hi all-- I have a SQL 2008 (sp1) DB that has 400+ subscribers using merge replication to SQL CE on embedded Windows devices.

I cleaned up several hundred thousand records in a filtered table (none of which should be getting replicated to the devices), removed ~100 unused data partitions, then ran sp_mergemetadataretentioncleanup, restarted SQL, updated all indexes (including msmerge indexes) and noticed that many of the remote devices had very long sync times.  I thought perhaps that recreating all the snapshots might help.

Subscription expiration is currently set to 3 days, and I have stopped all other jobs that connect to this DB.

I attempted to recreate the initial subscription, but received timeouts:

Error messages:

<dir>

Message: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Command Text: exec sp_MSmakegeneration

Parameters:

Stack:    at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)

   at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)

   at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)

   at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()

   at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()

   at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()

   at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()

   at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: -2)

Get help: http://help/-2

Server SDFSQL01\SQL2008, Level 11, State 0, Procedure , Line 0

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (Source: MSSQLServer, Error number: -2)

Get help: http://help/-2

</dir>

As a result of this, I turned up the querytimeout to 3600 seconds, but it still failed-- last update before timeout

[0%] The process is running and is waiting for a response from the server.

Using sp_whoisactive, I was seeing that the process ran the following two things repeatedly:

query--

update top (@median_changes_per_gen) dbo.MSmerge_tombstone with (rowlock)

                set generation = @target_gen

                where generation = @gen and tablenick = @art_nick

update ppm set generation = @target_gen

                from dbo.MSmerge_past_partition_mappings ppm inner join dbo.MSmerge_tombstone ts

                on ppm.tablenick = ts.tablenick

                and ppm.rowguid = ts.rowguid

                and ts.generation = @target_gen

                and ppm.generation = @gen

                and ppm.tablenick = @art_nick

                and ts.tablenick = @art_nick

 


Obviously, with this many data partitions, I would rather not have to recreate DBs on all devices.  Any suggestions would be GREATLY appreciated.
query--

Project solution architecture

$
0
0

Hi,

I am working on ASP.NET project which includes layers like WEB, APP and Database. APP is WCF service hosted in a windows service.

1. APP and database are very tightly coupled layers which means anything changed at database end (for example returning new parameter in SP) triggers same to consumed at APP layer end.

On the top of this, we need to work in a switchover mode where we need to deploy the code on production 15 days prior to go live date and switch the functionalities turn ON after 15 days of deployment and this should be an automatic switchover. This can include WEB changes or updating or adding new functionalities to the system. Our system is sort of a transactional system and the database is similar to sort of banks.

We are open to short term as well as long term solution to this problem. We are even considering changing the code architecture to support this switchover.

Thanks,

Samagra

Trying to recover replication after a corrupt 'distribution' database

$
0
0

On a production server [SQL Server 2088 R2 RTM] I started to get alerts stating:

‘Replication-Replication Transaction-Log Reader Subsystem: agent ******* failed. Possible schema corruption. Run DBCC CHECKCATALOG.’

and,

‘Replication-Replication Distribution Subsystem: agent *******  failed. The provided statistics stream is corrupt.’

I ran DBCC CHECKCATALOG on the distribution database and this didn’t seem to work. So I ran CHECKDB and it failed complaining of corruption.

There is no backup of the distribution database, and I tried to create new distribution database with instdist.sql but this did not work. I tried attaching a clean distribution database.  I tried the repair utility on SQL Installation Center, and I also tried uninstalling then re-installing replication feature.

I’m now stuck with a production server that is not replicating.  The replication was a simple merge replication so I can easily set it up again. Is there any way to reset replication on this server?

Transactional Replication Error

$
0
0

We have a transactional replication and it has an error as given below.

Incorrect syntax near '*'.

if @@trancount > 0 rollback tran
(Transaction sequence number: 0x000209C200006B28000100000000, Command ID: 1)

I used the below query

use distribution
GO
exec sp_browsereplcmds '0x000209C200006B28000100000000'
It returns all the pending command around 1 lakh records.

How do I find which replicated command is causing the error so that I can delete it from the distribution database.

Please advice.

Replication - SQL Server 2012

$
0
0

I have a task to replicate data changes from one server (A) to another server (B) and then in the event of server A failing to use B as the main server and replicate back to A when its live again. I would need the replication to be in real time . . . 

whats the best method for this and how do i go about setting it up?

I've been reading through transactional and merge technologies, could someone please guide me to the best and most practical solution and guide me through the settings.

Greatly appreciated folks 


Difference between Transcational Replication & Marge replication?

$
0
0

hi.,

Difference between Transcational Replication & Marge replication?

Tell me 6 points

Help me?

How can I find date/time a merge subscription was last initialilzed

$
0
0

I am running merge replication and would like to know the last time a subscription was initialized. I can find the date the last snapshot was created but can't find this information for the subscription.

Thanks,

Kim

compression lost after snapshot replication

$
0
0

Hello

i've set up 2 SqlServer 2008 R2 Enterprise environments to test replication and compression with snapshots.

On one of them i'm publishing a single partitionned table that has compression level=PAGE.

On the subscriber environment the compression level is lost when the table is replicated. 

Is there a way to keep the compression at this stage ?

thanks

  

Replicating image data in merge replication

$
0
0

HI,

i am planning to replicate images through merge replication(2 way)..i am using varbinary datatype for image column.

is it recommended to do this way..any issues replicating image data\varbinary column?

Thanks

Unable to validate replication with sys.sp_validate_replica_hosts_as_publishers for Availability Group

$
0
0

Im getting error the following error when trying to run the above SP to validate my replication schema:

Msg 21892, Level 16, State 1, Procedure sp_hadr_validate_replica_hosts_as_publishers, Line 60

Unable to query sys.availability_replicas at the availability group primary associated with virtual network name 'MyAGListener' for the server names of the member replicas: error = 18456, error message = Error 18456, Level 14, State 1, Message: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'..',

I've already tried to manually register the AG listener name with setSPN, and confirmed that the name, all the AG replicas, and the replication distributor and subscribers have registered SPNs against the SQL Service Account (going so far as checking ADSIEdit.msc on my domain controller), but I'm still getting the error even though I'm running the query under the same account (which is SA on all instances, as well as domain admin on all boxes), and when I check the connection with "SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@SPID" on the primary node and AG listener, it still shows as connecting using NTLM instead of KERBEROS.

Funnily, before I ran setSPN on the AG listener name, only the AG listener and primary AG replica (where WSFC and AG were set-up from) returning NTLM.  All other replicas, subscribers, and distributor were returning KERBEROS.  If I failed over my AG group to a replica running with KERBEROS, connecting as the AG listener name still reported NTLM.  I failed back to my primary replica and after I ran setSPN, I still go the same result, except when I failed over to a secondary replica with KERBEROS, AG listener also returned KERBEROS.  However running the above validate replica hosts SP still gave me the same error.

By the way, regardless of the error, I still get the first result back from the validate replica hosts SP returning the correct AG listener name.  Also failing over is still automatically failing over transactional replication, so whatever is happening doesn't seem to be detrimental to the process.

Am I missing something?


Diane



Subscriptions database is showing 0 record counts for all tables

$
0
0
Hello All,

Have completed configuring the push transactional replication, but when I went to the subscriptions database and did a table counts on all the replicated tables all was 0, except for the MSsubscription_* tables. Does anyone know what is wrong with my setup?

Thanks.

MSSQL 2008 R2 Merge Replication issue

$
0
0

Hello all,

I want to set up a Merge replication between a master and a slave server. The master server is the publisher and the distributor and the slave the subscriber.

I have a very large database of 500GB. When I setup the publication on the publisher server, everything seems ok so far. But, as soon as I start the snapshot agent, it keeps saying "The process is running and is awaiting a response from the server" after a few minutes. Then, after half an hour, it gives me the following timeout message: "The timeout period elapsed prior to completion of the operation or the server is not responding".

Then only a few seconds later, it displays the following error: "Another snapshot agent for the subscriptions is running, or the server is working on a previous request by the same agent"

I read somewhere on the internet that the "The process is running and is awaiting a response from the server" message is because the server has to process alot of data if your tables are very big (that sounds very logical to me while my database is over 500gb). So I set the Timeout value of the snapshot agent to about 10 hours. After retrying that, it still fails saying  "Another snapshot agent for the subscriptions is running, or the server is working on a previous request by the same agent" after the timeout message.

However, during those 10 hours of "waiting for a response from the server", my LDF file of the database became over 1.5TB... I don't get it at all what is going wrong here.

I have 2 other databases setup for merge replication and those work fine, no problems at all. But those 2 databases are only 50mb each.

Any help would be much appreciated.

Thank you in advance.



Configuring replication and database mirroring

$
0
0

Dear all,

Last week i have got assignment to configuring replication and database mirroring. but unfortunately i did not performed following steps

Configure the mirror to use the same Distributor as the principal.

Configure replication agents for failover.

How can i rectify this?

Can i add these things now?

Help appreciated.

Thanks in advance

SQL Server 2008 R2 Transactional Replication Through A Firewall

$
0
0

I have set up a SQL Server 2008 R2 transactional replication on my network.  When I attempted to add a new subscriber, I could not get a connection.  The error I received is:

A network-related or instance -specific error has occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interface, error: 26 - Error Locating Server/ Instance Specified) (Microsoft SQL Server).

I checked to see if I could connect between the two servers on 1433 (using the ip address).  I was able to connect using SQL Server Management Studio between both servers.  I also checked port 1433 between both servers and that was open.  I had scanned the ports while attempting to add a subscriber and it returned that it was using port 1433 and udp 1434.  UDP 1434 is not open between the two servers.

Does any know how I can add subscribers through a firewall without opening UDP 1434?  Is it possible?  Any help or advice is appreciated.  

replication issue (log reader agent is not running)

$
0
0
We have upgraded the SQL server from 2000 to 2005. After upgrade, the replication is not working with the following symptoms:

1. Subscription status always show 'Not running, performance critical'.
2. When I try to re-sychronize with option "Start Synchronziing" , error is encounter as below :

Replication montior could not start the job '..................'
Additional informtion :

SQL server Agent error : request to run job STX-T01-STL_NEwCC
(from User sa) refused because the job is already running from a request by User sa. (Microsoft SQL Server , Error: 22022)

Anyone could kindly help ?
Or any idea to further troubleshoot this issue ?

Thanks and best regards,

Entity Framework 5.1, Code First Approach + Merge Replication

$
0
0

Hi All,

Our company has been using Merge Replication as a standard for a couple of years now in all of our live websites which are mostly asp classic and MVC based. All of our live databases are running on merge replication and all of the development has been centered towards it.

Recenly, there is a need for us to use Entity Framework 5.1 using code first approach. I'm worried that I can't seem to find enough information about the compatibilities of the 2 technologies and how they can work with each other.

My questions are

  1. Is EF 5.1 and Merge Replication easily compatible?
  2. What are the things we need to do either with the dev side or DB side to make it work?
  3. Code First sometimes requires that tables and objects be deleted (re-created). Will this work with Merge Replication?
  4. Merge Replication does not include propagation of indexes. Does this mean we have to manually run all of the index creation statements of EF Code first?

Thanks in advance for any thoughts.

Regards,

Joseph


MCP, MCSD, MCDBA (ANXA)

Why in merge replication, tables at the publisher have identity range constraints ?

$
0
0

Hi All,

In merge replication what is the value of putting identity check constraints on the publisher tables ?

What is the risk if the publisher identity range is assigned at the end not the beginning, even it shouldn't care about the identity range for the server or the publisher ?

I know the identity ranges assignment is like this :

Range Range Server Minimum Maximum ------------------ ---------- ---------- Publisher 1 100 Subscriber1 101 200 Subscriber2 201 300

but what if it like below ? and after each sync allocate new identity range for the subscribers, start with the maximum id from the publisher and allocate identity ranges for the subscribers that are bigger than the publisher maximum id

Range Range Server Minimum Maximum ------------------ ---------- ---------- Publisher infinite infinite Subscriber1 101 200 Subscriber2 201 300

My question is: Any idea why replication team implemented it this way not the other way (i.e. with no constraints on the publisher) ?

Viewing all 4054 articles
Browse latest View live




Latest Images