Showing posts with label sp2. Show all posts
Showing posts with label sp2. Show all posts

Tuesday, March 20, 2012

Run sp_resyncmergesubscription to solve un-sync data problem between subscribers and Publisher

Hello,

I have set up a merge replication with 4 subscribers and a publisher on SS05 sp2 on 5 window servers. After running my application on the replication with big data for a while, the data in some of tables of subscriber are out of sync from the publisher. I tried to run sp_resyncmergesubscription to fix the problem according to http://doc.ddart.net/mssql/sql2000/html/replsql/replmon_9pwh.htm. The procedure run successfully. However, the problem is still exist.

Does anyone else have this problem. Please help!

Did you try @.resync_type = 0

When you ran sp_resyncmergesubscription procedure and @.resync_type = 0 is intense operation...

|||

I tried with @.resync_type = 2.

Here is the script I have run at the Publisher:

exec sp_resyncmergesubscription NULL, NULL, 'ds3263a', 'red-dalmssql103', 'ds3263c',2, '2007-04-06 10:00:00.000'

|||

What tables are out of sync?

Do you have filtering? Is the data same for all subscribers?

Do you have any user triggers on tables?

|||

It might have more than one table out of sync. However, I know for sure one user table is out of sync between subscribers. The data in the table, rn_schedule_task, is in sync status between publisher and owning subscriber. For example,

Table – rn_schedule_task:

TaskID

Status

1

succeeded

2

running

3

failed

The status of task 1 showing as “succeeded” on publisher and owning subscriber, but showing as “running” on other subscriber(s).

We do not have any user triggers on the table that I know.

|||

I am not sure how you have gotten into this situation.

But for the rows that are different, you could dummy update these rows.

You could do: update m_schedule_task set Status=Status where TaskID=<task ID of the row that is out of sync>

Then run the merge agent and hopefully it should converge this time.

Run sp_resyncmergesubscription to solve un-sync data problem between subscribers and Publisher

Hello,

I have set up a merge replication with 4 subscribers and a publisher on SS05 sp2 on 5 window servers. After running my application on the replication with big data for a while, the data in some of tables of subscriber are out of sync from the publisher. I tried to run sp_resyncmergesubscription to fix the problem according to http://doc.ddart.net/mssql/sql2000/html/replsql/replmon_9pwh.htm. The procedure run successfully. However, the problem is still exist.

Does anyone else have this problem. Please help!

Did you try @.resync_type = 0

When you ran sp_resyncmergesubscription procedure and @.resync_type = 0 is intense operation...

|||

I tried with @.resync_type = 2.

Here is the script I have run at the Publisher:

exec sp_resyncmergesubscription NULL, NULL, 'ds3263a', 'red-dalmssql103', 'ds3263c',2, '2007-04-06 10:00:00.000'

|||

What tables are out of sync?

Do you have filtering? Is the data same for all subscribers?

Do you have any user triggers on tables?

|||

It might have more than one table out of sync. However, I know for sure one user table is out of sync between subscribers. The data in the table, rn_schedule_task, is in sync status between publisher and owning subscriber. For example,

Table – rn_schedule_task:

TaskID

Status

1

succeeded

2

running

3

failed

The status of task 1 showing as “succeeded” on publisher and owning subscriber, but showing as “running” on other subscriber(s).

We do not have any user triggers on the table that I know.

|||

I am not sure how you have gotten into this situation.

But for the rows that are different, you could dummy update these rows.

You could do: update m_schedule_task set Status=Status where TaskID=<task ID of the row that is out of sync>

Then run the merge agent and hopefully it should converge this time.

Run script on Instance Startup

Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!Put it in a stored procedure and mark the proc as an autostart proc (sp_procoption).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> Is there a way I can set up a SQL script to run when the instance
> starts up?
> SQL Server 2005 SP2
> thanks!
>|||Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
instead of the database engine. (Of course, if one only start the engine and not Agent, then the
script will not be executed.)
Good thinking. :-)
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
> Alternatively you can create a job to run your stuff which starts when SQL Server Agent starts...
> (may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
> --
> Ekrem Önsoy
>
> "traceable1" <thhamlin@.gmail.com> wrote in message
> news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
>> Is there a way I can set up a SQL script to run when the instance
>> starts up?
>> SQL Server 2005 SP2
>> thanks!
>|||Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Actually, one can claim that your alternative, Ekrem, is a cleaner soluti=on than mine. I.e., it
> might feel better to have a client app (Agent) execute whatever TSQL comm=ands you want to run
> instead of the database engine. (Of course, if one only start the engine =and not Agent, then the
> script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asp=
http://sqlblog.com/blogs/tibor_karaszi
> "Ekrem =D6nsoy" <ek...@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>
> > Alternatively you can create a job to run your stuff which starts when =SQL Server Agent starts...
> > (may not be as good as Tibor's suggestion :) but I already said, it's j=ust an alternative)
> > --
> > Ekrem =D6nsoy
> > "traceable1" <thham...@.gmail.com> wrote in message
> >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> >> Is there a way I can set up a SQL script to run when the instance
> >> starts up?
> >> SQL Server 2005 SP2
> >> thanks!- Hide quoted text -
> - Show quoted text -|||Create an Agent job with one or several job steps containing your TSQL (or whatever) code. Schedule
this job to be executed when Agent starts.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192739683.702442.18160@.k35g2000prh.googlegroups.com...
Thank you so much for your feedback!
So how exactly would I set up the script to run when the Agent starts?
On Oct 18, 1:27 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Actually, one can claim that your alternative, Ekrem, is a cleaner solution than mine. I.e., it
> might feel better to have a client app (Agent) execute whatever TSQL commands you want to run
> instead of the database engine. (Of course, if one only start the engine and not Agent, then the
> script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server
> MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs/tibor_karaszi
> "Ekrem Önsoy" <ek...@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>
> > Alternatively you can create a job to run your stuff which starts when SQL Server Agent
> > starts...
> > (may not be as good as Tibor's suggestion :) but I already said, it's just an alternative)
> > --
> > Ekrem Önsoy
> > "traceable1" <thham...@.gmail.com> wrote in message
> >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> >> Is there a way I can set up a SQL script to run when the instance
> >> starts up?
> >> SQL Server 2005 SP2
> >> thanks!- Hide quoted text -
> - Show quoted text -|||Excellent! Thank ya'll so much!!
On Oct 18, 3:59 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> Create an Agent job with one or several job steps containing your TSQL (o=r whatever) code. Schedule
> this job to be executed when Agent starts.
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asp=
http://sqlblog.com/blogs/tibor_karaszi
> "traceable1" <thham...@.gmail.com> wrote in message
> news:1192739683.702442.18160@.k35g2000prh.googlegroups.com...
> Thank you so much for your feedback!
> So how exactly would I set up the script to run when the Agent starts?
> On Oct 18, 1:27 pm, "Tibor Karaszi"
>
> <tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> > Actually, one can claim that your alternative, Ekrem, is a cleaner solu=tion than mine. I.e., it
> > might feel better to have a client app (Agent) execute whatever TSQL co=mmands you want to run
> > instead of the database engine. (Of course, if one only start the engin=e and not Agent, then the
> > script will not be executed.)
> > Good thinking. :-)
> > --
> > Tibor Karaszi, SQL Server
> > MVPhttp://www.karaszi.com/sqlserver/default.asphttp://sqlblog.com/blogs=
/=2E..
> > "Ekrem =D6nsoy" <ek...@.btegitim.com> wrote in message
> >news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
> > > Alternatively you can create a job to run your stuff which starts whe=n SQL Server Agent
> > > starts...
> > > (may not be as good as Tibor's suggestion :) but I already said, it's= just an alternative)
> > > --
> > > Ekrem =D6nsoy
> > > "traceable1" <thham...@.gmail.com> wrote in message
> > >news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> > >> Is there a way I can set up a SQL script to run when the instance
> > >> starts up?
> > >> SQL Server 2005 SP2
> > >> thanks!- Hide quoted text -
> > - Show quoted text -- Hide quoted text -
> - Show quoted text -|||*** Sent via Developersdex http://www.developersdex.com ***|||Alternatively you can create a job to run your stuff which starts when SQL
Server Agent starts... (may not be as good as Tibor's suggestion :) but I
already said, it's just an alternative)
--
Ekrem Önsoy
"traceable1" <thhamlin@.gmail.com> wrote in message
news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
> Is there a way I can set up a SQL script to run when the instance
> starts up?
> SQL Server 2005 SP2
> thanks!
>|||:-)
--
Ekrem Önsoy
http://www.ekremonsoy.net , http://ekremonsoy.blogspot.com
MCBDA, MCTS: SQL Server 2005, MCITP:DBA, MCSD.Net, MCSE, MCT
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:B15F3A8E-AAFF-44D1-9BEB-CFA9845E2DEE@.microsoft.com...
> Actually, one can claim that your alternative, Ekrem, is a cleaner
> solution than mine. I.e., it might feel better to have a client app
> (Agent) execute whatever TSQL commands you want to run instead of the
> database engine. (Of course, if one only start the engine and not Agent,
> then the script will not be executed.)
> Good thinking. :-)
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "Ekrem Önsoy" <ekrem@.btegitim.com> wrote in message
> news:1890C2B6-7DD2-40AE-AF10-01981F3ABD51@.microsoft.com...
>> Alternatively you can create a job to run your stuff which starts when
>> SQL Server Agent starts... (may not be as good as Tibor's suggestion :)
>> but I already said, it's just an alternative)
>> --
>> Ekrem Önsoy
>>
>> "traceable1" <thhamlin@.gmail.com> wrote in message
>> news:1192722595.538697.92480@.y27g2000pre.googlegroups.com...
>> Is there a way I can set up a SQL script to run when the instance
>> starts up?
>> SQL Server 2005 SP2
>> thanks!
>>
>

Wednesday, March 7, 2012

Run all .sql files (scripts) in project (SQL Server 2005 SP2)

Hello,

I've run as many keyword combinations searching for this as I can
think of, but cannot find a simple answer.

The situation: I have a database that is mid-conversion/redevelopment.
I frequently rebuild my dev copy from the production version, which
requires a bunch of DDL script, and then adding in all the stored
procedures necessary to the new version only. Each sp may have changed
since the last time it was run, so I can't exactly keep them all
concatenated in a single file or anything like that.

So the only way I can see to execute each and every one of these saved
script files is to open it up in SSMS and hit F5 for execute. This is
a silly waste of time, it seems to me, and hardly foolproof. Is there
not some simple way to run every script in a project? What purpose
does a project serve, otherwise?

(Worth mentioning that the tool I found here
http://www.codeproject.com/useritem...criptRunner.asp does not
seem to work.)

Thanks in advance.downwitch (downwitch@.gmail.com) writes:

Quote:

Originally Posted by

I've run as many keyword combinations searching for this as I can
think of, but cannot find a simple answer.
>
The situation: I have a database that is mid-conversion/redevelopment.
I frequently rebuild my dev copy from the production version, which
requires a bunch of DDL script, and then adding in all the stored
procedures necessary to the new version only. Each sp may have changed
since the last time it was run, so I can't exactly keep them all
concatenated in a single file or anything like that.
>
So the only way I can see to execute each and every one of these saved
script files is to open it up in SSMS and hit F5 for execute. This is
a silly waste of time, it seems to me, and hardly foolproof. Is there
not some simple way to run every script in a project? What purpose
does a project serve, otherwise?


SQL code should be kept under source control, just likely any other code,
and deployment should be done from the version-control system.

Having said that, there are a couple of options you consider. One is
SQL Compare from Red Gate, although they currently have no direct support
for Source Control. The latest version supports comparing a database to
folder structure on disk, though.

A much more simple-minded way is to get a list of all stored procedures
you need to load. Put that in a text file, and then use a text editor
with good find-replace capabilities to transform the list to a BAT
file that runs SQLCMD to load the files. Just make sure that you run
SQLCMD with the -I option, so that you run with QUOTED_IDENTIFIER ON.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On Aug 22, 5:52 pm, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

downwitch (downwi...@.gmail.com) writes:

Quote:

Originally Posted by

I've run as many keyword combinations searching for this as I can
think of, but cannot find a simple answer.


>

Quote:

Originally Posted by

The situation: I have a database that is mid-conversion/redevelopment.
I frequently rebuild my dev copy from the production version, which
requires a bunch of DDL script, and then adding in all the stored
procedures necessary to the new version only. Each sp may have changed
since the last time it was run, so I can't exactly keep them all
concatenated in a single file or anything like that.


>

Quote:

Originally Posted by

So the only way I can see to execute each and every one of these saved
script files is to open it up in SSMS and hit F5 for execute. This is
a silly waste of time, it seems to me, and hardly foolproof. Is there
not some simple way to run every script in a project? What purpose
does a project serve, otherwise?


>
SQLcode should be kept under source control, just likely any other code,
and deployment should be done from the version-control system.
>
Having said that, there are a couple of options you consider. One isSQLComparefrom Red Gate, although they currently have no direct support
for Source Control. The latest version supports comparing a database to
folder structure on disk, though.
>
A much more simple-minded way is to get a list of all stored procedures
you need to load. Put that in a text file, and then use a text editor
with good find-replace capabilities to transform the list to a BAT
file that runs SQLCMD to load the files. Just make sure that you run
SQLCMD with the -I option, so that you run with QUOTED_IDENTIFIER ON.
>
--
Erland Sommarskog,SQLServerMVP, esq...@.sommarskog.se
>
Books Online forSQLServer2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online forSQLServer2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Hide quoted text -
>
- Show quoted text -


downwitch - we have a new product that will be released in the next
few days, xSQL Builder that allows you to create a database deployment
package which between other things allows you to specify a folder
where you can have all the scripts you want to run before the database
synchronization takes place and also you can specify a folder where
all your post synchronization scripts are. The application will run
all those scripts on one big transaction and log everything.

Email us at our support address @. xsqlsoftware.com and we will send
you the pre-release build so you can give it a try.

Thanks,
JC
xSQL Software
http://www.xsqlsoftware.com|||On Aug 22, 11:24 am, downwitch <downwi...@.gmail.comwrote:

Quote:

Originally Posted by

Hello,
>
I've run as many keyword combinations searching for this as I can
think of, but cannot find a simple answer.
>
The situation: I have a database that is mid-conversion/redevelopment.
I frequently rebuild my dev copy from the production version, which
requires a bunch of DDL script, and then adding in all the stored
procedures necessary to the new version only. Each sp may have changed
since the last time it was run, so I can't exactly keep them all
concatenated in a single file or anything like that.
>
So the only way I can see to execute each and every one of these saved
script files is to open it up in SSMS and hit F5 for execute. This is
a silly waste of time, it seems to me, and hardly foolproof. Is there
not some simple way to run every script in a project? What purpose
does a project serve, otherwise?
>
(Worth mentioning that the tool I found herehttp://www.codeproject.com/useritems/SSMSScriptRunner.aspdoes not
seem to work.)
>
Thanks in advance.


Hello downwitch,

xSQL Software has just released a free utility, xSQL Script Executor,
that allows you to run multiple T-SQL scripts at once - you can choose
individual scripts or whole folders and run them all. You can choose
to wrap all scripts in one big transaction or not, you can call it
from the command line etc. Check it out at:
http://www.xsqlsoftware.com/Product...torDetails.aspx
Thanks,
JC
xSQL Software
http://www.xsqlsoftware.com