Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Friday, March 30, 2012

Replication error thrown during normal T-SQL processing

Dear All,
During a long running piece of SQL script I received the following error:
Error Number: 2601
Error: "The job name '%s' was not generated for this replication agent,
delete the job manually when it is no longer in use."
There is no replication set up on this server at all, and the T-SQL is pure
with no calls to system stored or extended procedures.
Has anybody experience this before? A search of Google and MSDN has
returned no results at all for the assosiated message!
Spec:
Microsoft SQL Server 2000 - 8.00.760
Developer Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
HP ProLiant dual 3ghz HT Zeon
4gb ram
Thanks
Phil StandenOn my server,
SELECT *
FROM master..sysmessages
WHERE Error = 2601
returns:
Cannot insert duplicate key row in object '%.*ls' with unique index
'%.*ls'.
and
SELECT *
FROM master..sysmessages
WHERE Error = 21695
returns:
The job name '%s' was not generated for this replication agent, delete
the job manually when it is no longer in use.
Do you get the same results on your box?
Hope this helps.
Dan Guzman
SQL Server MVP
"Phil Standen" <PhilStanden@.discussions.microsoft.com> wrote in message
news:BEE3ED3E-FA80-4D98-A85D-36B4E37B374A@.microsoft.com...
> Dear All,
> During a long running piece of SQL script I received the following error:
> Error Number: 2601
> Error: "The job name '%s' was not generated for this replication agent,
> delete the job manually when it is no longer in use."
> There is no replication set up on this server at all, and the T-SQL is
> pure
> with no calls to system stored or extended procedures.
> Has anybody experience this before? A search of Google and MSDN has
> returned no results at all for the assosiated message!
> Spec:
> Microsoft SQL Server 2000 - 8.00.760
> Developer Edition on Windows NT 5.0 (Build 2195: Service Pack 4)
> HP ProLiant dual 3ghz HT Zeon
> 4gb ram
> Thanks
> Phil Standen

replication error on script

I am trying to replicate a database between 2 servers...I
have others running fine between these servers so I know
user and password are fine...I get this error everytime I
try
Error:
The schema script '\\CORPSQL\C$\Program Files\Microsoft
SQL
Server\MSSQL\ReplData\unc\CORPSQL_IRIMSAdmin_IRIMSAdmin\200
30923132049\ChangeUserPassword_316.sch' could not be
propagated to the subscriber. The step failed.
Here is the code:
SET QUOTED_IDENTIFIER ON
GO
drop procedure [dbo].[ChangeUserPassword]
GO
CREATE PROCEDURE [dbo].[ChangeUserPassword]
@.UserID int,
@.NewPassword varchar(50)
AS
DECLARE @.PasswordHistory int
DECLARE @.PasswordCount int
DECLARE @.Password varchar(50)
DECLARE @.DuplicateFlag bit
DECLARE @.ErrorMessage varchar(200)
DECLARE Password_Cursor CURSOR FOR
SELECT Password
FROM tblHistoryPasswords
WHERE UserRef = @.UserID
ORDER BY CreatedDateTime DESC
--SELECT @.USERID=USERID FROM USERDATA WHERE NTLOGON LIKE
@.NTLogon
SET @.DuplicateFlag=0
SET @.PasswordCount=0
SELECT @.PasswordHistory = CAST (varvalue AS int) FROM
tblsystemvariables WHERE varid = 'PasswordHistory'
OPEN Password_Cursor
FETCH NEXT FROM Password_Cursor
INTO @.Password
WHILE @.@.FETCH_STATUS = 0 AND @.DuplicateFlag = 0
BEGIN
SET @.PasswordCount = @.PasswordCount + 1
IF @.PasswordCount <= @.PasswordHistory
BEGIN
IF @.Password = @.NewPassword
SET @.DuplicateFlag=1
END
IF @.DuplicateFlag=0
BEGIN
IF @.PasswordCount = @.PasswordHistory
BEGIN
UPDATE tblHistoryPasswords
SET Password = @.NewPassword, CreatedDateTime=GetDate()
WHERE CURRENT OF Password_Cursor
END
IF @.PasswordCount > @.PasswordHistory
BEGIN
DELETE FROM tblHistoryPasswords
WHERE CURRENT OF Password_Cursor
END
FETCH NEXT FROM Password_Cursor
INTO @.Password
END
END
CLOSE Password_Cursor
DEALLOCATE Password_Cursor
IF @.DuplicateFlag=1
BEGIN
--raise error
SET @.ErrorMessage = "IRIMS Admin DB: User password has to
be different from last " + CAST(@.PasswordHistory AS varchar
(2)) + " passwords."
RaisError (@.ErrorMessage,16,1)
RETURN 1
END
ELSE
IF @.PasswordCount < @.PasswordHistory OR @.PasswordHistory
= 0
INSERT INTO tblHistoryPasswords (UserRef,Password)
VALUES (@.UserID,@.NewPassword)
RETURN 0
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GOHi Jamie,
Thanks for your feedback. Providing definite problem and detailed
description of the problem helps us troubleshoot the issue more
efficiently. As I understand, the SQL Server version is SQL Server 2000 Sp1
and you have a merge replication with 2 machines. One is as publication and
distribution, the other is as pull subscription. Do you mean the error
occurs when you configure the subscription? In other words, you did not
finish setting up your subscription, or was it that applying a snapshot to
a subscriber failed with this error?
What is your type of your pull subscription, named subscription or
anonymous subscription? You can check it in the General tab in the property
dialog of the subscription.
What is the kind of snapshot, FTP or UNC? You can check it in the Snapshot
file location tab in the property dialog of the subscription.
Based on my research, this can occur if the publication includes a stored
procedure that references fields that do not exist in the underlying table.
Please check to see who the owner of the stored procedure is and who the
underlying tables tblsystemvariables and tblHistoryPasswords are. If they
are different, please specifying the owner of the underlying table in the
stored procedure. Please try to run the snapshot agent for the publication
by right-clicking it and then clicking Start on the shortcut menu.
Please let me know if this solves your problem, or if you would like
further assistance.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.|||work around...I am only merging the tables...the sp are
not neccessary on this database...merging the tables seem
to be working fine....
Quick question
when setting up the merge part it ask if you want to
do vertical or horizontal, is it best practices to select
both or just one of them..if one of them, which one?|||Hi Jamie,
Thanks for your feedback. I am glad to hear that this problem has been
resolved.
Regarding your further question, horizontal and vertical enable you to
create partitions of data to be published. The selection of them depends on
you requirements. By filtering the published data, you can:
1. Minimize the amount of data sent over the network.
2. Reduce the amount of storage space required at the Subscriber.
3. Customize publications and applications based on individual Subscriber
requirements.
4. Avoid or reduce conflicts because the different data partitions can be
sent to different Subscribers (no two Subscribers will be updating the same
data values).
Row and column filters can be used with snapshot, transactional, and merge
publications. Row filters use the WHERE clause of a SQL statement and
restrict the rows included in a publication based on specific criteria.
Column filters restrict the columns that are included in a publication.
For more information regarding this issue, please refer to the following
articles on SQL Server Books Online.
Topic:" Filtering Published Data"
Topic:" Filter Data"
Thank for using MSDN newsgroup.
Regards,
Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Replication Error in Store Procedure that is not in Articles list

Hello,
I have a replication error related to the schema script of a procedure that
is
not longer on the list of articles to replicate from the publisher and also
it is
not part of the replicated store procedures in the replicas.
I someone has an idea what could it be the problem. Please let me know.
Thanks,
Car.
What is the error message you are getting.
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
"Car" <Car@.discussions.microsoft.com> wrote in message
news:ECA4299C-6D87-4F2B-B4C5-93039FCC0165@.microsoft.com...
> Hello,
> I have a replication error related to the schema script of a procedure
> that
> is
> not longer on the list of articles to replicate from the publisher and
> also
> it is
> not part of the replicated store procedures in the replicas.
> I someone has an idea what could it be the problem. Please let me know.
> Thanks,
> Car.
|||I delete the subscriptions and recreate them and I don't have any more this
message It was something like comErrorException(0x80004005). However when I
delete an article from the publisher. It does not work. it is not letting me
to do the schema changes I used to do before.
"Hilary Cotter" wrote:

> What is the error message you are getting.
> --
> 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
>
> "Car" <Car@.discussions.microsoft.com> wrote in message
> news:ECA4299C-6D87-4F2B-B4C5-93039FCC0165@.microsoft.com...
>
>

Wednesday, March 7, 2012

Replication

Hi
I have setup transaction replication, I defined publisher. Now I have new
server
Where I run create script for database and table from publisher server.
First time on my subscriber server's table has rows, I can’t restore from
backup because of time (it took about 8 hrs. to restore).
After setting up replication, my new subscriber got no rows, how tried
tranactional,snapshot replication data is populated on subscriber.
Advice me how to proceed with restoring db on my subscriber m/c.
Thanks
Kalyan
Advice me how to proceed without restoring db on my subscriber m/c.
"Kalyan" wrote:

> Hi
> I have setup transaction replication, I defined publisher. Now I have new
> server
> Where I run create script for database and table from publisher server.
> First time on my subscriber server's table has rows, I can’t restore from
> backup because of time (it took about 8 hrs. to restore).
> After setting up replication, my new subscriber got no rows, how tried
> tranactional,snapshot replication data is populated on subscriber.
>
> Advice me how to proceed with restoring db on my subscriber m/c.
> Thanks
> Kalyan
>

Saturday, February 25, 2012

Replication

does anyone know if it's possible to run a replication task with a script, and how (is there ans sp_ for this ?)

thanks,

What task are you asking about?|||yeah , sorry for unprecisions. I was talking about merge agent. I'd like to control it "on-demand", instead of a plannification. i'm running sql 2000.|||

dont know the script..but u can use replmerg.exe to run it from command prompt... its in the com folder of sqlserver..u shud know the parameters for the agent which u can get from sysjobsteps(in msdb)

|||

it's an idea. i'm going to try this.

thanks.

Monday, February 20, 2012

Replicating stored procedure/trigger permissions to another database

I need to come up with a script that when executed it will create a stored procedure and trigger along with permissions. Is there a way to make this into a package. Any ideas?So you want to take a stored procedure that is in the current database, and somehow "automagically project" that procedure intact to another (subscriber) database?

That's a novel thought.. It could be done, and it wouldn't be terribly hard.

-PatP|||There is no "automagic" in it, just use SQL-DMO object model. Just one method is involved. Examples are in BOL.|||things to automate
-add a user to master table
-add Permissions to xp_cmdshell
-create trigger in table
-create stored procedure in needed database
-uncheck Non-SysAdmin job setup Proxy Account box and create proxy account

I image that I could write this all out by using a T-SQL stored procedure. But, some things that I don't know is: where it should be stored? or what would be the most efficient way of going about this?

Don't know where to start but to create the procedure and then I'll figure out what to do from there.