Showing posts with label transactional. Show all posts
Showing posts with label transactional. Show all posts

Tuesday, March 27, 2012

Do I really need a snapshot (to initialize transactional replication, in SQL2000)?

I have a pretty big (350 gb) OLTP database that I want to replicate in its entirety. I'm concerned about the impact of taking a snapshot of it (it is processing at some level pretty much 24x7). I know on SQL2005 there is the option to initialize from backup, but unfortunately we won't be on 2005 in time.

I'm thinking of doing something like this:

Set up the distributor, publication, and subscription Turn off distribution agent Set the publisher to "sync with backup" Backup the publisher, full then log Truncate tables MSrepl_transactions and MSrepl_commands in the distribution db (I don't have any other replication going on) Turn off "sync with backup" Restore the full and tran log backups to new subscriber db Create subscriber stored procs in subscriber Start up distribution agent

I'm looking for opinions on whether it's worth going this route to avoid taking the snapshot. Data integrity is the number one priority -- if I have to do a snapshot to ensure that, I will do it.

Thanks in advance!

Mike

OK, I just did a search and came across this:

http://support.microsoft.com/default.aspx?scid=kb;en-us;320499

However this method still requires a brief time in single user mode (ie killing all connections), whereas my method doesn't. I just don't like that my method involves deleting the MSrepl_ tables...

Sunday, March 25, 2012

Do I need stop Agents during primary Server power down?

Hi,
Does anyone can tell that our production primary site need perform server
power down, and I have the databases transactional replication with push
setup on primary site? The secondary site will run all the time. Before,
primary site perform the power down, do I need stop the Log Reader and
Distribution Agents? What if I am not stopping those agents?
Regards,
Chen
You will be fine. Transactional replication replicates transactionally. So
if you power off in the middle of something, when it starts up again, it
will pick up where it left off.
Hilary Cotter
Looking for a SQL Server replication book?
Now available for purchase at:
http://www.nwsu.com/0974973602.html
"Chen" <Chen@.discussions.microsoft.com> wrote in message
news:D91896AE-5BF7-47FA-A0D7-D4BFC0CAF422@.microsoft.com...
> Hi,
> Does anyone can tell that our production primary site need perform server
> power down, and I have the databases transactional replication with push
> setup on primary site? The secondary site will run all the time. Before,
> primary site perform the power down, do I need stop the Log Reader and
> Distribution Agents? What if I am not stopping those agents?
> Regards,
> Chen
>
sql

Wednesday, March 7, 2012

Distriubtion Error on Stored Procedure

Setting up Transactional Replication.

Log Reader Agent successfull.

Snapshot Agent successfull.

Distribution Agent Error (Replication is failing because of this error. I don't know what is wrong with the stored procedure that causes it not to replicate):

Date 1/19/2007 10:28:13 AM
Log Job History (IS36-MMS_20061213-MMSRepTest-IS4-30)

Step ID 2
Server IS4
Job Name IS36-MMS_20061213-MMSRepTest-IS4-30
Step Name Run agent.
Duration 00:00:11
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0

Message
2007-01-19 16:28:24.700 Category:COMMAND
Source: Failed Command
Number:
Message: CREATE PROCEDURE "dbo"."spBTG_GetEventsSince"(@.EventMin datetime, @.BoatID int) AS

BEGIN
create table #TmpEvents
(
BoatHistoryID int null,
PositionID int null,
Event varchar(50) null,
EventDateTime datetime null,
Direction char(1) null,
River char(3) null,
Mile numeric(6,2) null
)

insert into #TmpEvents
select bh.BoatHistoryID, null, Event, EventDateTime, Direction, riverloc, mileloc
--jds 6/22/05 hardcoded index to fix it when you call it from vb
-- from
2007-01-19 16:28:24.700 Category:NULL
Source: Microsoft SQL Native Client
Number: 1018
Message: Incorrect syntax near 'index'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. See SQL Server Books Online for proper syntax.

Here is the entire source of the sp:

GO

CREATE PROCEDURE [dbo].[spBTG_GetEventsSince](@.EventMin datetime, @.BoatID int) AS

BEGIN
create table #TmpEvents
(
BoatHistoryID int null,
PositionID int null,
Event varchar(50) null,
EventDateTime datetime null,
Direction char(1) null,
River char(3) null,
Mile numeric(6,2) null
)

insert into #TmpEvents
select bh.BoatHistoryID, null, Event, EventDateTime, Direction, riverloc, mileloc
--jds 6/22/05 hardcoded index to fix it when you call it from vb
-- from mtsEventHistory eh (NOLOCK)
-- left join mtsBoatHistory bh (NOLOCK) on bh.EventID = eh.EventID
from mtsEventHistory eh (NOLOCK, index(PK_MtsEventHistory))
left join mtsBoatHistory bh (NOLOCK, index(IDX_MtsBoatHistory_BoatID)) on bh.EventID = eh.EventID
where EventDateTime > @.EventMin
and BoatID = @.BoatID
and voidflag = 0
And eh.Event IN ('Pickup','Drop','Log Exchange','Off-Layup','Off-Repair','On-Layup','On-Repair','Morning Log','Bt Trip Dir Chg','End Boat Charter Out', 'Begin Boat Charter Out', 'Begin Boat Charter In')
insert into #TmpEvents
select null,BoatPositionID, Description, PositionDateTime, Direction, river, mile
from mtsBoatPosition (NOLOCK)
where PositionDateTime > @.EventMin
and BoatID = @.BoatID
select * from #TmpEvents Order By EventDateTime
drop table #TmpEvents
END

Linda, you can either change the stored procedure definition in the script generated by the snapshot agent to the following:

CREATE PROCEDURE [dbo].[spBTG_GetEventsSince](@.EventMin datetime, @.BoatID int) AS

BEGIN
create table #TmpEvents
(
BoatHistoryID int null,
PositionID int null,
Event varchar(50) null,
EventDateTime datetime null,
Direction char(1) null,
River char(3) null,
Mile numeric(6,2) null
)

insert into #TmpEvents
select bh.BoatHistoryID, null, Event, EventDateTime, Direction, riverloc, mileloc
--jds 6/22/05 hardcoded index to fix it when you call it from vb
-- from mtsEventHistory eh (NOLOCK)
-- left join mtsBoatHistory bh (NOLOCK) on bh.EventID = eh.EventID
from mtsEventHistory eh with (NOLOCK, index(PK_MtsEventHistory))
left join mtsBoatHistory bh with (NOLOCK, index(IDX_MtsBoatHistory_BoatID)) on bh.EventID = eh.EventID
where EventDateTime > @.EventMin
and BoatID = @.BoatID
and voidflag = 0
And eh.Event IN ('Pickup','Drop','Log Exchange','Off-Layup','Off-Repair','On-Layup','On-Repair','Morning Log','Bt Trip Dir Chg','End Boat Charter Out', 'Begin Boat Charter Out', 'Begin Boat Charter In')
insert into #TmpEvents
select null,BoatPositionID, Description, PositionDateTime, Direction, river, mile
from mtsBoatPosition (NOLOCK)
where PositionDateTime > @.EventMin
and BoatID = @.BoatID
select * from #TmpEvents Order By EventDateTime
drop table #TmpEvents
END

Or, you can change the compatibility level of your subscriber database to 80 or lower.

-Raymond

|||

Raymond,

This sp currently runs on SQL2000. However, before we implement replication, it will be running on 2005. Is the change "adding with" something that will be required for SQL 2005 or does it have to do with replication?

Linda

|||

The use of the "with" keyword with query hints is a SQL2005 requirement that is not directly related to replication. As I mentioned before, you can always change the dbcmptlevel of your subscriber database to 80 or lower so the old syntax in your procedure can be accepted.

-Raymond

|||

Raymond,

On the subscriber database, do I run this command:

EXEC sp_dbcmptlevel MMS_20061213, 80;

to change the cmptlevel?

I did that and now I am getting this error:

Command attempted:

/* ============================================================ */
/* View: vMcsHeaders */
/* ============================================================ */

CREATE VIEW "dbo"."vMcsHeaders" AS

/* VIEW: vMcsHeaders
ABSTRACT: Used by the Contract System to work with contract headers
AUTHOR DATE
EJB 3/31/98 Created
SRM 4/8/98 - Added Customer_Code
EJB 5/1/98 - added filter for only contracts that are not deleteme = 1
EJB 6/10/98 - Ad
(Transaction sequence number: 0x00046CEA0000F21D005600000000, Command ID: 3385)

Error messages:

Invalid object name 'McsDemurrageSetUp'. (Source: MSSQLServer, Error number: 208)
Get help: http://help/208

Invalid object name 'McsDemurrageSetUp'. (Source: MSSQLServer, Error number: 208)
Get help: http://help/208

I notice the McsDemurrageSetUp is it referencing is spelled McsDemurrageSetup. How do I track down what kind of error this is? (Perhaps, I did not get the compatibility set correctly to 80?)

|||

It would appear that you are replicating from a case-insensitive database to a case-sensitive database, this is not a supported scenario.

|||

Raymond,

If I run the command: sp_server_info, both databases say "MIXED" under identifier case. However, I did figure out the problem. The storedprocedure is referencing a table that was not replicated because it did not have a primary key. I did not notice that initially when I noticed the case was different. The database I am working with needs a lot of work before it can successfully be replicated!

Thanks,

Linda

Distributor password in distributor Properties

I am using SQL2k with sp4 using push transactional replication.
When I select 'configure publishing, subscribers and Distribution' from the
SQL EM's tool menu\replication, under the distributor tab, there is the
administrator link password, what do they use for password? When I set up
replication for the first time, it doesn't ask me for it so it is unknown to
me. If I change the password, will it affect anything? I also noticed that
during replication setup, it also creates a SQL login for Distribution_Admin
and I also don't know what password it use. Any ideas for these two
passwords? Just curious, why do they set up the password behind the scene?
wingman
Wing
If you didn't set it (remote distributor) this means you have a local
distributor, and it is randomly generated. If you want to change it, you can
use sp_changedistributor_password.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||No, I didn't set it. I assume local distributor means it locates in the
same server as the publisher server.
The reason I ask for the password is that I tried to use the 'generating SQL
script' feature in replication to script the setup. But the script purposely
leaves out the passwrod for security reason so in order for me to run the
script, I need to know the password. So should I run the
sp_changedistributor_password and put the new password in the script to make
it work?
Or is there another way to script a replication setup?
Wing
"Paul Ibison" wrote:

> If you didn't set it (remote distributor) this means you have a local
> distributor, and it is randomly generated. If you want to change it, you can
> use sp_changedistributor_password.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
|||The 'old' password doesn't really need to be retained, and sp_adddistributor
can be fed any value you want for the administrative link password.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Distributor Lock Timeouts

I have transactional replication set up and running with a remote
distributor. Replication latency continues to be good (3 - 10 seconds) but
after we added several indexed views to the subscriber, we are seeing lock
timeouts on the distribution database. I haven't been able to tie the
timeouts to any specific activity or activity levels. When I do see the
timeouts I also see a spike in lock requests, but not lock escallations.
Through it all, replication latency seems to stay about the same.
Finally, whenever I fire up Replication Monitor the lock timeouts increase
quite a bit, but they still occur when replication monitor isn't running.
Any thoughts or ideas?
Replication applies the sync commands in a batch and holds a lock while
applying that batch. The locking you are seeing is probably a result of
this. If you are using SQL Server 2005, try using the snapshot isolation
model.
http://www.zetainteractive.com - Shift Happens!
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"DCPeterson" <sgtp_usmc@.hotmail.com> wrote in message
news:O76HbG3OIHA.3400@.TK2MSFTNGP03.phx.gbl...
>I have transactional replication set up and running with a remote
>distributor. Replication latency continues to be good (3 - 10 seconds) but
>after we added several indexed views to the subscriber, we are seeing lock
>timeouts on the distribution database. I haven't been able to tie the
>timeouts to any specific activity or activity levels. When I do see the
>timeouts I also see a spike in lock requests, but not lock escallations.
>Through it all, replication latency seems to stay about the same.
> Finally, whenever I fire up Replication Monitor the lock timeouts increase
> quite a bit, but they still occur when replication monitor isn't running.
> Any thoughts or ideas?
>

Distributor

Hi,
I have set a transactional replication by Interprise
Manager, but when I create a subscriber using "Pull
Subscription to ..." it creates it succesfuly and even
gives me this message that "you have created the
subscription successfully", but it doesn't start
replication and gives this message in "Last Action" column:
" 'XServer' is not Configured as a Distributor. The step
failed".
Thank you very much.
Mathew,
this could be a naming issue.
Please try:
Use Master
go
Select @.@.Servername
This should return your current server name but if it
returns NULL then try:
Use Master
go
Sp_DropServer 'XServer'
GO
Use Master
go
Sp_Addserver 'XServer', 'local'
GO
Stop and Start SQL Services
HTH,
Paul Ibison
|||can the subscriber ping Xserver? Is XServer a Publisher/Distributor or
Distributor?
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Mathew" <anonymous@.discussions.microsoft.com> wrote in message
news:2c7301c47e2b$46d95c00$a501280a@.phx.gbl...
> Hi,
> I have set a transactional replication by Interprise
> Manager, but when I create a subscriber using "Pull
> Subscription to ..." it creates it succesfuly and even
> gives me this message that "you have created the
> subscription successfully", but it doesn't start
> replication and gives this message in "Last Action" column:
> " 'XServer' is not Configured as a Distributor. The step
> failed".
> Thank you very much.
>
|||Paul,
Thank you so much. I have checked it, and it's correct.
Actually we have 2 servers in 2 different locations, and
both of them are called 'HAKIM-SERVER', so when I
run "Select @.@.ServerName" they answer 'HAKIM-SERVER'. I
have registered both of them in my "Enterprise
Manager",one by it's own name which is 'HAKIM-SERVER', and
the other one by it's IP address, as we have a VPN. It was
working until 2 weeks ago that our modem and router in the
other building were burned and we had to change them with
a brand new one. Our VPN is fine and there is nothing odd,
but when I go to to "Pull subscription
to 'xxx.xxx.xxx.xxx'... " on the server, which is in our
other location and I registered it with the IP address, to
create the subscribor, it gives me that error message
>--Original Message--
>Mathew,
>this could be a naming issue.
>Please try:
>Use Master
>go
>Select @.@.Servername
>This should return your current server name but if it
>returns NULL then try:
>Use Master
>go
>Sp_DropServer 'XServer'
>GO
>Use Master
>go
>Sp_Addserver 'XServer', 'local'
>GO
>Stop and Start SQL Services
>HTH,
>Paul Ibison
>
>.
>
|||Hi,
It's a Publisher/Distributor. I wrote a complete
explanation for the first respond from Paul. Whould you
please take a look at it?
Thnks again
>--Original Message--
>can the subscriber ping Xserver? Is XServer a
Publisher/Distributor or
>Distributor?
>--
>Hilary Cotter
>Looking for a book on SQL Server replication?
>http://www.nwsu.com/0974973602.html
>
>"Mathew" <anonymous@.discussions.microsoft.com> wrote in
message[vbcol=seagreen]
>news:2c7301c47e2b$46d95c00$a501280a@.phx.gbl...
column:
>
>.
>
|||Mathew,
can you try using an alias rather than an IP address.
Regards,
Paul Ibison
|||Dear Paul,
How can I assign an alias to a remote server when it has
the same name as the local server.
Thanks,

>--Original Message--
>Mathew,
>can you try using an alias rather than an IP address.
>Regards,
>Paul Ibison
>
>.
>
|||Matthew,
in the client network utility, you can add an alias with the TCP/IP network
library. The server alias is any name you choose, and the server name can be
the IP address you have been using.
HTH,
Paul Ibison

Distribution times out...

I have a transactional replication working fine till to date. I have
the publisher on ServerA and subscriber on ServerB. The transactional
replication is running fine...
I need to get a copy of the subscriber to another server and replicate
the Publisher to that serverC while the replication on ServerB is
running.
ServerA.Publisher --> ServerB.Subscriber (runs transactional
replication)
ServerA.Publisher --> ServerC.NewSuscriber (This need to run without
impacting ServerB.Subscription). I cannot resynch the databases as It
will take days to resynch and will also kill some of my data on the
ServerB.subscriber that is not in ServerA.publisher
I went with the way they had explained on MSKB 320499. I stoped the
transactions coming into the publisher and copied a full backup of
publisher to ServerC. I created the new subscription wihout re-synch
option to ServerC. I also copied all the sp's that are needed from
ServerB.Subscriber.
When i try to enable the distribution agent between ServerA and ServerC
i get the following error..
{call sp_MSget_repl_commands(11, ?, 0, 7500000)}
Timeout expired
Timeout expired
(Source: ODBC SQL Server Driver (ODBC); Error number: S1T00)
------
The replication agent from ServerA to ServerB is running fine..! (Thank
God..!)
Can anyone help me figure out how to fix this issue between
ServerA.Publisher to ServerC.Subscriber?
Thanks in advance...!
Please can you confirm that you have the latest service pack on each server
(there were issues with "sp_MSget_repl_commands" before).
If this is not a service pack issue, try increasing the -QueryTimeOut
parameter of the distribution agent and also enable logging:
http://support.microsoft.com/?id=312292 to trap any more details for us.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Thanks Paul,
I have SP4 Installed on both servers. SQL 2000 Standard Edition on a
Windows 2003 Enterprise server.
Paul Ibison wrote:
> Please can you confirm that you have the latest service pack on each server
> (there were issues with "sp_MSget_repl_commands" before).
> If this is not a service pack issue, try increasing the -QueryTimeOut
> parameter of the distribution agent and also enable logging:
> http://support.microsoft.com/?id=312292 to trap any more details for us.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||OK - it's not that then
In that case try increasing the QueryTimeout parameter and do some logging
if there are any issues.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Distribution server restore on standby server

Hi,
we have developed an application using transactional replication, with
several publication servers (push) and a distribution server (which is
the only subscriber too). It seems to work fine.
Now we would "protect" the distribution/subscriber server by using a
standby server (note: only the distribution/subscriver server must be
protected, not publication servers) which should replace the working
server in the case it crashes.
Could someone suggest us the best strategy to do this? Thanks in
advance...
Marco
You can manually set this up. Have a look at Strategies for Backing Up and
Restoring Transactional Replication in BOL.
The problem is that this adds to the latency. Transactions remain in your
tlog until the log is dumped. Then they are read from the tlog and written
to the distirbution database.
"Marco69" <marcosindona@.virgilio.it> wrote in message
news:ce7beb14.0403250541.5f374a8f@.posting.google.c om...
> Hi,
> we have developed an application using transactional replication, with
> several publication servers (push) and a distribution server (which is
> the only subscriber too). It seems to work fine.
> Now we would "protect" the distribution/subscriber server by using a
> standby server (note: only the distribution/subscriver server must be
> protected, not publication servers) which should replace the working
> server in the case it crashes.
> Could someone suggest us the best strategy to do this? Thanks in
> advance...
> Marco

Saturday, February 25, 2012

Distribution Server - Replication

What happens when Distributor Server goes down in Transactional
Replication, no corruption (power , hardware failure)??
Thanks,
JohnCan you bring the distributor back up or the distribution database is lost? Before you bring the distributor back up, you need to shut down all subscriptions. If you can restart the distributor, you need to stop the logreader right after you have started the SQL Agent on the distributor. Open the subscription first to see if they can be synced. If the subscription doesn't errored out, open the logreader. Good luck!

distribution db in suspect mode

Hi All !!!!
I clone sqlserver's files from one server(A) to another server(B), . On the
(A) server there were transactional replication from server(A) to subscriber
server(XX). There are ditributor and publiatio on same server(A).
After cloning sql files to server(B) i got the distribution and the
piblication databases in suspect mode. I can't perform anything while these
databases in suspecet mode. I can't also to disable distribution (this thing
will also help me.)
Any ideas??//
TNX in advance.
"Imagination is more important than knolwege" (Albert Einshtein)
Message posted via droptable.com
http://www.droptable.com/Uwe/Forums...ation/200509/1
These artivles should help:
http://www.karaszi.com/SQLServer/inf...suspect_db.asp
http://www.windowsitpro.com/Article/...D/492/492.html
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

Distribution db doesn't show up after enabling transactional repl

We are using SQL 2k with SP4. After I used the 'Create and Manage
publication wizard..' to create my transaction replication (I took the
default settings), it finished successfully. When I check the database
listing in EM, the 'distribution' database doesn't show up in the list but
the physical .mdf and .ldf files do exist. I thought this is strange, I
went ahead to disable the publication and thought I could start over again
but it gave me an error message " Eror 945: Database 'distribution' cannot be
opened dur to inaccessible files or insufficient memory or disk space'. We
are out out of space or memory. I stop by restart SQL service but it didn't
help. Can anyone help?
Wingman
Do you have the show system databases enabled? This could account for the
invisibility of it. I would clear up space on your machine and then try to
disable publishing.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Wingman" <Wingman@.discussions.microsoft.com> wrote in message
news:8A3D4193-03DC-4D43-A3D5-A7FE0D2E97CB@.microsoft.com...
> We are using SQL 2k with SP4. After I used the 'Create and Manage
> publication wizard..' to create my transaction replication (I took the
> default settings), it finished successfully. When I check the database
> listing in EM, the 'distribution' database doesn't show up in the list but
> the physical .mdf and .ldf files do exist. I thought this is strange, I
> went ahead to disable the publication and thought I could start over again
> but it gave me an error message " Eror 945: Database 'distribution' cannot
> be
> opened dur to inaccessible files or insufficient memory or disk space'.
> We
> are out out of space or memory. I stop by restart SQL service but it
> didn't
> help. Can anyone help?
> Wingman

Distribution DB constantly grows

Hi,
I have set up transactional replication for a database from one db
server to a second. The replication is working fine but the distribution
database constantly grows. The size of the replicated db is 524 MB, the
size of the distribution db is 24 GB, growing daily.
How can I shrink my distribution database and how can I limit the growth
without damaging the replication?
Markus
you need to maintain the tlog on the distribution database. Make sure it
using the full recovery and dump the tlog every 5 minutes or so. You might
want to backup the log with truncate_only, shrink the tlog, and then backup
the database.
Then check your transaction retention period, it should be 48 hours. Make
sure your distribution clean up job is enabled and running every 10 minutes.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Markus Renschler" <SP-news@.renschler.net> wrote in message
news:%23uv0qzXdFHA.2420@.TK2MSFTNGP12.phx.gbl...
> Hi,
> I have set up transactional replication for a database from one db server
> to a second. The replication is working fine but the distribution database
> constantly grows. The size of the replicated db is 524 MB, the size of the
> distribution db is 24 GB, growing daily.
> How can I shrink my distribution database and how can I limit the growth
> without damaging the replication?
> Markus
|||Hi Hilary,
thanks for the advice.

> you need to maintain the tlog on the distribution database. Make sure it
> using the full recovery and dump the tlog every 5 minutes or so. You might
> want to backup the log with truncate_only, shrink the tlog, and then backup
> the database.
The distribution database's backup model is set to simple. Is this a
problem (except the worse disaster recovery options)?

> Then check your transaction retention period, it should be 48 hours. Make
> sure your distribution clean up job is enabled and running every 10 minutes.
The transaction retention period has been set to the default value
(72h). I changed it to 48h. Then I checked the distribution cleanup job.
It is scheduled to run every 10 minutes. It had been started 5 hours ago
and was still running. I stopped it and started it again. Now it is
running since 15 Minutes. Is it possible that this job lasts more than 5
hours?
Markus
|||It is possible that it could run for more than 5 hours at first. Subsequent
runs should not take as long. Do you have anonymous subscribers? Metadata
hangs around a lot longer for them than for names subscribers.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Markus Renschler" <SP-news@.renschler.net> wrote in message
news:uzVIaOZdFHA.3488@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> Hi Hilary,
> thanks for the advice.
might[vbcol=seagreen]
backup[vbcol=seagreen]
> The distribution database's backup model is set to simple. Is this a
> problem (except the worse disaster recovery options)?
Make[vbcol=seagreen]
minutes.
> The transaction retention period has been set to the default value
> (72h). I changed it to 48h. Then I checked the distribution cleanup job.
> It is scheduled to run every 10 minutes. It had been started 5 hours ago
> and was still running. I stopped it and started it again. Now it is
> running since 15 Minutes. Is it possible that this job lasts more than 5
> hours?
> Markus
|||Hilary Cotter wrote:
> It is possible that it could run for more than 5 hours at first. Subsequent
> runs should not take as long.
It has been running 3:35. The next runs took less than a second, each.
After the cleanup the database was still 22GB in size. I tried to shrink
it, but without an effect.
For testing, I have set the transaction retention period to 1h. Then I
started a distribution database cleanup, but without an effect.

> Do you have anonymous subscribers? Metadata
> hangs around a lot longer for them than for names subscribers.
No, I just have one subscriber which had its subscription pushed from
the origin server (which acts as publisher and distributor).
Could it be helpful if I re-create the distribution database? Is there
any possibility to do this?
Thanks for helping,
Markus

Distribution database of Transaction Replication publication being marked SUSPECT by recov

Hi experts there,
I have a Publication created for Transactional Replication. All the
while working fine.
Now it failed and I am not able to access to the database at all. It
shows the following error message:
Error 926: Database 'distribution' cannot be opened. It has been
marked SUSPECT by recovery. See the SQLServer error log for more
information.
Tried to detach the database but getting the following error: -
"The database cannot be detached while it is being replicated"
Tried running DBCC CheckDB but cannot run with database still in
suspect mode
Basically I cannot perform backup on it, cannot detach it, cannot even
drop the publication.
Tried also the following method:
1) sp_resetstatus DISTRIBUTION
Prior to updating sysdatabases entry for database 'DISTRIBUTION', mode
= 0 and status = 24 (status suspect_bit = 0).
No row in sysdatabases was updated because mode and status are already
correctly reset. No error and no changes made.
2) DBCC CHECKDB ('DISTRIBUTION', REPAIR_REBUILD) WITH ALL_ERRORMSGS
Server: Msg 926, Level 10, State 1, Line 1
Database 'distribution' cannot be opened. It has been marked SUSPECT
by recovery. See the SQL Server errorlog for more information.
Anybody know what cause all this and how to resolve it? Please
help!!!!!
I need to make the Replication running back soonest possible.
Thanks/TewI have seen this behavior once before. The only way we could get it out of
suspect mode was to directly update the sysdatabases table and set the
status to 32768 (emergency bypass). After recycling SQL Server we were then
able to run Checkdb. You might find corruption in the database. If not you
can set the status back to 0 and see if it will recover normally.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Distribution Database Log File Growth

SQL Server 2000 | Transactional Replication

Suspected Problem: Distribution Database Transaction Log Not Checkpointing

I have a distributor with a distribution database that keeps growing and growing (About 40 GB in 7 days). The database is using the SIMPLE recovery model but the log continues to accumulate data. I have spent time looking at articles such as: "Factors that keep log records alive" (http://msdn2.microsoft.com/en-us/library/ms345414.aspx) and the one thing that stands out is the Checkpoint. I noticed that I can run a manual checkpoint and clear the log. If the log records were still active, the checkpoint would not allow the log to be truncated. This leads me to believe that the server is not properly initiating checkpoints in the Distribution database even though Recovery Model = SIMPLE and the server Recovery Interval = 0.

I found this: "FIX: Automatic checkpoints on some SQL Server 2000 databases do not run as expected" (http://support.microsoft.com/kb/909369/en-us) but I suspect this is a followup to a problem that may have been introduced with SP4 (since SP4 is a requirement for the hotfix). I am running SP3a (Microsoft SQL Server 2000 - 8.00.850) so I don't think that is the issue. I have several other nearly identical servers with the same version and configuration that have properly maintained log files.

SP4 is not a good option for me at this point - the next upgrade will be to SQL 2K5.

Any thoughts?

Jeff

I solved my own problem. The log file growth had nothing to do with it being the Distribution database. I stumbled upon a trace flag entry in the SQL Startup Parameters "-T3608" which is required to move certain system databases like Model (See article: http://support.microsoft.com/kb/224071/). The flag has been there for several months and was probably added the last time the server was rebuilt or storage was added. I removed the trace flag and checkpoints started occuring normally.

Distribution Database Log File Growth

SQL Server 2000 | Transactional Replication

Suspected Problem: Distribution Database Transaction Log Not Checkpointing

I have a distributor with a distribution database that keeps growing and growing (About 40 GB in 7 days). The database is using the SIMPLE recovery model but the log continues to accumulate data. I have spent time looking at articles such as: "Factors that keep log records alive" (http://msdn2.microsoft.com/en-us/library/ms345414.aspx) and the one thing that stands out is the Checkpoint. I noticed that I can run a manual checkpoint and clear the log. If the log records were still active, the checkpoint would not allow the log to be truncated. This leads me to believe that the server is not properly initiating checkpoints in the Distribution database even though Recovery Model = SIMPLE and the server Recovery Interval = 0.

I found this: "FIX: Automatic checkpoints on some SQL Server 2000 databases do not run as expected" (http://support.microsoft.com/kb/909369/en-us) but I suspect this is a followup to a problem that may have been introduced with SP4 (since SP4 is a requirement for the hotfix). I am running SP3a (Microsoft SQL Server 2000 - 8.00.850) so I don't think that is the issue. I have several other nearly identical servers with the same version and configuration that have properly maintained log files.

SP4 is not a good option for me at this point - the next upgrade will be to SQL 2K5.

Any thoughts?

Jeff

I solved my own problem. The log file growth had nothing to do with it being the Distribution database. I stumbled upon a trace flag entry in the SQL Startup Parameters "-T3608" which is required to move certain system databases like Model (See article: http://support.microsoft.com/kb/224071/). The flag has been there for several months and was probably added the last time the server was rebuilt or storage was added. I removed the trace flag and checkpoints started occuring normally.

Distribution Cleanup Job Fails

The distribution cleanup job that runs for our transactional replication on
sql server 2005 fails.
The job is:
EXEC dbo.sp_MSdistribution_cleanup @.min_distretention = 0,
@.max_distretention = 72
The Error is:
Msg 20015, Level 16, State 1, Procedure sp_MSreplremoveuncdir, Line 83
Could not remove directory
'\\sprs76\rysrepldata\unc\SPRS76_RYS_RYS_OPERATION ALTOREPLICAHIST\20060713140760\'.
Check the security context of xp_cmdshell and close other processes that may
be accessing the directory.
Replication-@.rowcount_only parameter must be the value 0,1, or 2. 0=7.0
compatible checksum. 1=only check rowcou: agent
RYSSprs76_distribution@.rowcount_only parameter must be the value 0,1, or 2.
0=7.0 compatible checksu scheduled for retry. Could not clean up the
distribution transaction tables.
If I remove this directory manually, would it cause the replication to
fail? I have tried this on a Test server and it seems that the replication
fails.
I tried to run this job in the Query window and it return this same error.
Our data file is growing and I cannot shrink it because of this issue.
What can i do to resolve this?
Thanks,
George Gopie
There's an MMC snapin to look at shared folders and their connections and
open files. This snapin could be used to drop the connections where needed.
If you have the folder open yourself locally, this snapin won't pick it up,
so you'd have to use the task manager to see what is likely to be accessing
it.
Another possibility is to drop the folder yourself then recreate it for the
distribution agent to later delete.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||No it would not cause replication to fail, only remove this portion
20060713140760
Make sure that xp_cmdshell is enabled and the SQL Serer agent account has
rights to list files and folders and delete files on the root of the
repldata directory and it subdirectories.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"georgeg" <ggg@.hotamil.com> wrote in message
news:DFE68859-01CF-4236-AC2A-F9CA596B9482@.microsoft.com...
> The distribution cleanup job that runs for our transactional replication
> on
> sql server 2005 fails.
> The job is:
> EXEC dbo.sp_MSdistribution_cleanup @.min_distretention = 0,
> @.max_distretention = 72
> The Error is:
> Msg 20015, Level 16, State 1, Procedure sp_MSreplremoveuncdir, Line 83
> Could not remove directory
> '\\sprs76\rysrepldata\unc\SPRS76_RYS_RYS_OPERATION ALTOREPLICAHIST\20060713140760\'.
> Check the security context of xp_cmdshell and close other processes that
> may
> be accessing the directory.
> Replication-@.rowcount_only parameter must be the value 0,1, or 2. 0=7.0
> compatible checksum. 1=only check rowcou: agent
> RYSSprs76_distribution@.rowcount_only parameter must be the value 0,1, or
> 2.
> 0=7.0 compatible checksu scheduled for retry. Could not clean up the
> distribution transaction tables.
>
> If I remove this directory manually, would it cause the replication to
> fail? I have tried this on a Test server and it seems that the replication
> fails.
> I tried to run this job in the Query window and it return this same error.
> Our data file is growing and I cannot shrink it because of this issue.
> What can i do to resolve this?
> Thanks,
> --
> George Gopie
>

distribution cleanup cannot clean up snapshot folder

We are using SQL Server 2005 SP2 to do transactional replication.

We and have a separate service account for the SQL Agents (sqladmin) vs. SQL Replication Agents (sqlrepadmin). It is my understanding this is a replication security best practice. The sqlrepadmin has full permissions on the snapshot share folder and it's subdirectories. The sqladmin account does not have permissions at all.

I have been getting an error message when we run the distribution clean up job.

Executed as user: PROD\sqladmin. Could not remove directory '\\Tes01box\Repldata\unc\qabox01_DB01_TO_ORACLE\20070905104896\'. Check the security context of xp_cmdshell

I have dropped the publication and recreated which is what appears to have caused the error.

From

http://technet.microsoft.com/en-us/library/ms151151.aspx

Note:

If a publication is dropped, replication attempts to remove the snapshot folder under the security context of the SQL Server service account. If this account does not have sufficient privileges, log in with an account that does have sufficient privileges and remove the folder manually. Removing a folder requires the Modify privilege if the folder is a local path or the Full Control privilege if the folder is a network path.

The note above implies that the SQL Server service account (sqladmin) needs permissions on the snapshot folder as well.

Finally my questions:

Is there a workaround that will allow the distribution cleanup job to run as sqlrepadmin and perform the delete?

If both sqlrepadmin and sqladmin need permissions to the snapshot what is the reasoning from a security perspective of separating them out?

open up your distribution clean up task job, and in the job step properties do the following:

setuser 'sqlrepadmin'
GO
EXEC dbo.sp_MSdistribution_cleanup @.min_distretention = 0, @.max_distretention = 72
GO|||


I did have to qualify the domain, as in DOMAIN\sqlrepadmin to get it to work. We have same login for 2 different domains.

What an amazingly simple and elegant solution. I feel silly that I did not think of this.

Thank you Hilary.

distribution cleanup cannot clean up snapshot folder

We are using SQL Server 2005 SP2 to do transactional replication.

We and have a separate service account for the SQL Agents (sqladmin) vs. SQL Replication Agents (sqlrepadmin). It is my understanding this is a replication security best practice. The sqlrepadmin has full permissions on the snapshot share folder and it's subdirectories. The sqladmin account does not have permissions at all.

I have been getting an error message when we run the distribution clean up job.

Executed as user: PROD\sqladmin. Could not remove directory '\\Tes01box\Repldata\unc\qabox01_DB01_TO_ORACLE\20070905104896\'. Check the security context of xp_cmdshell

I have dropped the publication and recreated which is what appears to have caused the error.

From

http://technet.microsoft.com/en-us/library/ms151151.aspx

Note:

If a publication is dropped, replication attempts to remove the snapshot folder under the security context of the SQL Server service account. If this account does not have sufficient privileges, log in with an account that does have sufficient privileges and remove the folder manually. Removing a folder requires the Modify privilege if the folder is a local path or the Full Control privilege if the folder is a network path.

The note above implies that the SQL Server service account (sqladmin) needs permissions on the snapshot folder as well.

Finally my questions:

Is there a workaround that will allow the distribution cleanup job to run as sqlrepadmin and perform the delete?

If both sqlrepadmin and sqladmin need permissions to the snapshot what is the reasoning from a security perspective of separating them out?

open up your distribution clean up task job, and in the job step properties do the following:

setuser 'sqlrepadmin'
GO
EXEC dbo.sp_MSdistribution_cleanup @.min_distretention = 0, @.max_distretention = 72
GO|||


I did have to qualify the domain, as in DOMAIN\sqlrepadmin to get it to work. We have same login for 2 different domains.

What an amazingly simple and elegant solution. I feel silly that I did not think of this.

Thank you Hilary.

Friday, February 24, 2012

distribution clean up not working

Using transactional replication and all my transactions and commands are
replicated to all my subscribers. There is nothing to be delivered from the
msdistributionstatus view , but yet when i run the distribution cleanup, the
commands and transactions are still in the msrepl_commands and trans table.
When would they get deleted ?
Do you have anonymous subscribers enabled? If so, the commands will hand
around until the transaction retention perios is reached.
Rgds,
Paul Ibison, SQL MVP
|||How do I find out ? And if they are enabled, how do i turn them off ? I know
making certain settings to a publication causes the whole publication to
initilaize and resnapshot.
It happened once to me when i changed it to concurrent snapshot while
replication was on and next thing i know it triggered a reinitialisation and
all my objects were being snapshot.
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:esOIyMDbFHA.2696@.TK2MSFTNGP09.phx.gbl...
> Do you have anonymous subscribers enabled? If so, the commands will hand
> around until the transaction retention perios is reached.
> Rgds,
> Paul Ibison, SQL MVP
>
|||sp_helppublication and look for allow_anonymous.
sp_changepublication can be used to alter.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Will this reinitialise all subscriptions to the publication ?
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OQYacdDbFHA.3840@.tk2msftngp13.phx.gbl...
> sp_helppublication and look for allow_anonymous.
> sp_changepublication can be used to alter.
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Also allow_anonymous = 0 .. So why is not cleaning up ?
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OQYacdDbFHA.3840@.tk2msftngp13.phx.gbl...
> sp_helppublication and look for allow_anonymous.
> sp_changepublication can be used to alter.
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||It's possible the cleanup agent is being blocked.
I have experienced a similar problem but only on databases with really huge
tables (50 million or so), and still have an open PSS on it. The
recommendation was to reduce the transaction retention period, which was not
ideal. Even when I stopped the logreader and distribution agents, the
cleanup still didn't remove the records, for some strange reason, until the
retention period was reached. So, I made sure my subscribers had
synchronized then really reduced the retention period to remove the backlog.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Where do you change the transaction retention period ?
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:uNdEoJEbFHA.2124@.TK2MSFTNGP14.phx.gbl...
> It's possible the cleanup agent is being blocked.
> I have experienced a similar problem but only on databases with really
huge
> tables (50 million or so), and still have an open PSS on it. The
> recommendation was to reduce the transaction retention period, which was
not
> ideal. Even when I stopped the logreader and distribution agents, the
> cleanup still didn't remove the records, for some strange reason, until
the
> retention period was reached. So, I made sure my subscribers had
> synchronized then really reduced the retention period to remove the
backlog.
> HTH,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
>
|||It's a distributor property, available from the replication monitor,
distributor properties, properties button of the distribution database.
Rgds,
Paul Ibison

distribution agent works for one db but timed out for another db

Hi friends,
Can someone help me on this? I have set up transactional repl between the
primary site and secondary site for 2 databases. Both transactional repls are
bi-directional. Now the publication for one db works file but it did not work
for another db. The distribution agent was saying "time out expired" during
the initialization. I had modified QueryTimeout from 300 to 4800 which made
the subscriber's transaction log dramatically increase. My question is why it
works on one database but did not work on another one (this is bigger size).
both dbs stay on the same machines. Publisher and Distributor are the same
machine but the Subscriber is running on a separate one.
Thanks in advances,
Perhaps modify the LoginTimeout as well.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"FYK" <FYK@.discussions.microsoft.com> wrote in message
news:3F2213CE-63A2-45B8-A267-8E370F7CCEFC@.microsoft.com...
> Hi friends,
> Can someone help me on this? I have set up transactional repl between the
> primary site and secondary site for 2 databases. Both transactional repls
are
> bi-directional. Now the publication for one db works file but it did not
work
> for another db. The distribution agent was saying "time out expired"
during
> the initialization. I had modified QueryTimeout from 300 to 4800 which
made
> the subscriber's transaction log dramatically increase. My question is why
it
> works on one database but did not work on another one (this is bigger
size).
> both dbs stay on the same machines. Publisher and Distributor are the same
> machine but the Subscriber is running on a separate one.
> Thanks in advances,