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

sql replication 2008 - how do i properly add a new table

$
0
0

we have sql server 2008.

I have replication successfully set up and working.

i need to add a new table (article) to the process.

Once I do this, do I right click on subscription and click on:  Renitialize all subscriptions?

if so, do i then click on "Generate the new snapshot now"?

then "Mark for Reinitialization"?

or can i leave the "generate the new snapshot now" and it will happen later? i tried that but i waited one day and it never happened?? how do i know what time this runs at?

or is there a better way to do all of this?

it seems when i click everything that it reruns the entire process for all tables & sucks up all the bandwidth of sql and wreaks havoc on my database.

thanks for your help.

 


sp_who2 shows number of sessions for replication under distribution database

$
0
0

Since I have multiple publications, I see all the time number of sessions when I run sp_who2. When server is idle the connection is still there but in sleeping status. Those sessions are mainly below for each publication. Can i get read of them or they have to be there? Since day shift is not running currently, why would these sessions appear? It is normal?

Replication Distribution History

Distribution Agent

Repl-LogReader

Queue Reader Main

Best location for replication database in 2-server setup

$
0
0

I have a single database I'd like to replicate to another server, to point Reporting Services to and take load off the primarly db server. Transactional replication seems like a great solution. However, I've seen conflicting information about where to put the Replication Database. I would like to avoid adding a third server dedicated to this task if possible. So given the two servers, where should I place the replication database - on the publisher or subscriber?

Thanks in advance,
Eric


Eric Hodges

Copy Databases, SQL jobs, SSIS Packages, etc...

$
0
0

Hello,

I am in the process of setting up another SQL Server in preparation for a new system we are implementing that will interact with the new SQL Server. I need to copy all the databases, SQL jobs, SSIS packages, users and permissions, etc…  from an existing SQL Server. We are using SQL Server 2005 on both the old and new machines. I don’t think I can simply use the copy database wizard. How can I accomplish this? Many of our SQL jobs trigger SSIS packages which do a variety of things like populate tables and create output files. Basically what I need is to have the new SQL server function exactly the same as our current SQL Server. Any help will be greatly appreciated.

Thank you,

Dave


David Young

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.

$
0
0

The following issue "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." has been addressed with a workaround that seems to do the trick. Updating column cleaned_unsent_change to false insysmergesubscriptions on the Subscriber does indeed allow replication to continue.  

However, we would like to know if this problem has been fixed in a Cumulative Update since SQL 2008 R2 SP2?  Servers with SP2 installed continue to have this problem.  Thanks so much!

Replication using seperate logins

$
0
0

Hi

I am new to Replication and wanted to ask a few questions in regard to this.

I have set up a single pub/single sub transactional replication job using the SQL Agent.  I would like to modify this using two new users set up on Active Directory - SQLSnap & SQLLog.

I understand that SQLSnap will need access to the UNC folder to write the initial snapshot file.  What other access features do both these users need?

I am assuming the following:

Publication - SQLSnap will need access to the distibution and source db.  What rights does this logon need for replication - db_owner etc?  Will SQLLog be needed on the publication server?  If so, what rights?

Subscription - SQLLog will need access to the destination db.  What access rights?

Anything else ive missed in regard to using Active Directory users?

Thanks in advance.

Merge Pull Subscription. How to get number of inserts, deletes, updates and conflicts before/after synchronization using RMO?

$
0
0

For a merge pull subscription. Is there any way of retrieving the number of inserts, deletes, updates and conflicts before or after synchronization using RMO?

How to automate the restart of failed log reader agent?

$
0
0

We have SQL Server 2000 transaction replication to SQL 2008 server. Often, log reader agent fail with error message "The process could not execute 'sp_replcmds". When we re-start it, it runs fine for few hours before it fail with same message. One resolution which I know is to re-start it. Now I would like to know if there is any way to automate the re-start of log reader agent if it fails with this message?

Please give your suggestion.

Thanks


Is peer-to-peer replication combinable with other types of replication?

$
0
0

At this page (http://msdn.microsoft.com/en-us/library/ms152553%28v=sql.105%29.aspx) it is said, that transactional and merge replication are combinable. But it looks like transactional stands there for "transactional replication with read only subscribers".

I would like to know whether it is possible to combine peer-to-peer replication with other types of replication (transactional with r/o subscribers, transactional with r/w subscribers and merge) and if yes, then what are sequences/limitations of such combination?

replication 'Initialize with backup' option

$
0
0

Using 'initialize subscription with backup' option,  I do have all the steps involved to make it happen.  Am I correct in assuming that the data in the publishing database involved can be modified by users while I am doing the 'initialize with backup' process.   As I understand, the backup file (full backup and tranlog backup) I do after the publication is set up will contain info such as LSN to tell replication what data change need to be sync'ed to subscription when i finish setting up the subscription.   Can someone confirm this?

 OD


Ocean Deep

Replication to Oracle using custom stored procedures failing

$
0
0

I'm having trouble using custom stored procedures to ins/upd/del to an Oracle subscriber using SQL Server 2008 R2 SP2 with transactional replication.

My custom 'create procedures' are located at the end of the creation script. However, it appears that during the Distributor to Subscriber process, it may be attempting to create the procedures also, even though the stored procedures already exist on the Oracle database. This results in an error ORA-00900 'invalid SQL statement' while attempting to do:

if object_id(N'[dbo].[sp_ins_a_test_msrepl_ccs]', 'P') > 0
    drop proc [dbo].[sp_ins_a_test_msrepl_ccs]

I know this code is not from my creation script because I have removed '[dbo].' entirely from my script.

I must use custom stored procedures because some of the column names in the SQL Server table are longer than 30 characters and I needed to change them in the create table statement. Without the custom stored procedures, we will be unable to replicate updates for columns for which the name has changed.

Here is my sp_addarticle:

exec sp_addarticle
@publication = N'test5',
@article = N'a_test',
@source_owner = N'dbo',
@source_object = N'a_test',
@type = N'logbased',
@description = N'',
@creation_script = N'c:\test\a_test.sql',
@pre_creation_cmd = N'drop',
@schema_option = 0x00,
@identityrangemanagementoption = N'none',
@destination_table = N'a_test',
@status = 0,
@vertical_partition = N'false',
@ins_cmd = N'CALL sp_ins_a_test',
@del_cmd = N'CALL sp_del_a_test',
@upd_cmd = N'CALL sp_upd_a_test'

If you can help, thank you!

Default snapshot location

$
0
0

I've searched a long time, but haven't found the answer that I like to hear....

Am I right that you cannot change the default location of the snapshots?

I've searched the registry, but the key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\Replication" is pointing to "D:\SQLData\MSSQL11.MSSQLSERVER\MSSQL\repldata" and that folder is empty.

My test server is using the folder "D:\SQLData\ReplData", but I cannot find a way to change this for all Replications at once....

So you'll have to change the location per publisher.

Now I'm hoping someone is proofing me not to be right.... :)


Kind regards, Henk

Deferred Updates happed even if the value does not change in SQL Server 2012

$
0
0

I am not sure if this was an intentional compatibility break for SQL Server 2012, but I have not been able to find any docs on it, so I am going to post it here to see.

We upgraded our SQL Server that publishes reference data to other servers.  The upgrade moved us from SQL Server 2008 R2 to SQL Server 2012.

After the upgrade we noticed that some of our replications would break because tables that were designed to never delete rows were trying to replicate deletes.

After a lot of research I found that my SSIS package that populates the source table every night was starting the chain of events that lead to the deletes.  This SSIS package fills a stage table, then does a MERGE to the "live" data.  (The idea is that any changes to data will then be replicated to the subscribing databases.  This all worked perfectly with SQL Server 2008 R2.)

The SSIS Package is very careful to never delete any rows.  Any NOT MATCHED on Source rows have an IsActive column set to false (not a DELETE).

However, after upgrading to SQL Server 2012, this merge statement would cause  every row in the table to try to publish a delete and an insert statement to the subscribers.

In an attempt to get to the point of this issue I need to define a scenario that can cause a Deferred Update:

If a MERGE statement has the clustered key in an UPDATE statement (in the MATCHED clause) then every row affected will post as a Deferred Update (Causing a Delete and an Insert to be published to subscribers).

However, new in SQL Server 2012, is the fact that even if the value of the clustered keyDOES NOT CHANGE it will still replicate as a Deferred Update.  Infact, even ifnothing in the row has changed at all, the row will still replicate a delete and an insert.

I tested this with traces an found it to be true and totally reproduceable every time.

So, I have 3 questions:

  1. Has anyone else seen this?  (Can it be reproed by more than just me?)
  2. Is it a Bug?
  3. Is there a way around it (besides using a compatibility mode)? 
    (NOTE: Trace Flag 8207 will only work if you are updating a single row, my merge statement affects the whole table.)

For now we removed the Clustered Key (Primary Key) from the update part of the merge statement.  (It never, ever, changes, so we did not need it there anyway.)  But I would still like to know what is going on here.



what is the max value which we can set for commitbatchsize parameter in distribution agent profile

$
0
0

what is the max value which we can set for commitbatchsize parameter in distribution agent profile? Default value is 100. Can we set it to 5000 or 10000?

Is there any article from Microsoft which suggests the max value?

Thanks

Can i clear the content of "MSmerge_past_partition_mappings" ?

$
0
0

What will happen if i deleted the content of "MSmerge_past_partition_mappings" metadata table ?

I think it should be fine, since it stores old tracking data.

Thanks,


Snapshot replication pull model

$
0
0

Hi, 

Can we put the snapshot agent on the subscriber ?  or it must be defined on the publisher ?


Regards, Asi Pesa

Setting up replication via Backup...

$
0
0

I setup up an replication from backup.
Existing Tables where replicated fine.
http://msdn.microsoft.com/en-us/library/ms147834.aspx

However, if I create a new table this is not replicated.
I created a snapshot Agent, but when I start the Agent it tells me that's nothing to do.

Someone an idea?

Thx

Christian

The log reads:

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

Error messages:
Table '[dbo].[tab02]' not found in 'sp_addsynctriggers'. (Source: MSSQLServer, Error number: 20507)
Get help: http://help/20507
Table '[dbo].[tab02]' not found in 'sp_addsynctriggers'. (Source: MSSQLServer, Error number: 20507)
Get help: http://help/20507
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0. (Source: MSSQLServer, Error number: 266)
Get help: http://help/266

something wrong with replication auto identity management

$
0
0

Hi All,

I am facing a problem on the publication database, where updating identity check constraints fails on the publisher.

I have two tables in my publication database  --> BOOK , BOOK_LOG , where BOOK table has insert/update/delete log triggers to BOOK_LOG, both have identity(1,1) PKs.

And all users access the server are db_owner.

Occasionally the below error happens:

The insert failed. It conflicted with an identity range check constraint in database 'Library', replicated table 'dbo.BOOK_LOG', column 'BOOK_LOGID'. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentityrange; for the Subscriber, run the Distribution Agent or the Merge Agent. The statement has been terminated. Source: .Net SqlClient Data Provider TargetSite: Void OnError(System.Data.SqlClient.SqlException, Boolean) HelpLink.ProdName: Microsoft SQL Server HelpLink.ProdVer: 10.50.4000 HelpLink.EvtSrc: MSSQLServer HelpLink.EvtID: 548 HelpLink.BaseHelpUrl: http://go.microsoft.com/fwlink HelpLink.LinkId: 20476 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

My question is, does this have something to do with sql triggers execution context ?

Also I am not able to reproduce this error on my Dev environment but it happens on production systems from time to time.



Thanks,

CDC issue cannot modify column name even is not being tracked

$
0
0

I am having this error in my test database, which is a restore from the main that has cdc enable for that table :

TITLE: Microsoft SQL Server Management Studio
------------------------------

Unable to rename RefRangfe. (ObjectExplorer)

------------------------------
ADDITIONAL INFORMATION:

Rename failed for Column 'RefRange'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500.0+((KJ_PCU_Main).110617-0038+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Rename+Column&LinkId=20476

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

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

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

Cannot alter column 'RefRange' because it is 'REPLICATED'.
A severe error occurred on the current command.  The results, if any, should be discarded.
Caution: Changing any part of an object name could break scripts and stored procedures. (Microsoft SQL Server, Error: 4928)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=4928&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

The database where  I am trying to modify the columna is not being tracked ...

Error while Copying Log file from Primary Database Server in Log Shipping in SQL Server 2008

$
0
0

Hello Experts,

I need help in SQL Server 2008 R2 Enterprise Edition while doing Log Shipping.

After Completion of all procedure of the Log shipping. I get the error in Copy Job in Secondary Database Server.

Error is "Executed as user : server name The Step Failed." 

Thank You in Advance.

Warm Regards,

Dhaval Dave

Viewing all 4054 articles
Browse latest View live