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

Monday, March 26, 2012

error 16389

Hello,
We have a active x script that has been running for weeks from sql server
agent and all of sudden last night we are receiving "ActiveScripting specific
error 16389 occurred" on the jobs. I have search both BOL and newsgroups but
not finding anything that is giving me any help on this. Has anyone seen
this before, is so what step are need to be performed to troubleshoot the
issue.
The sql server that we are running this from is central DBA sql server
connecting to both production and non-production servers via SQL-DMO trusted
connections and extracting scripts for object generation.
Stopping and starting SQL Agent has fixed the issue. What could have caused
this issue?
"Tom" wrote:

> Hello,
> We have a active x script that has been running for weeks from sql server
> agent and all of sudden last night we are receiving "ActiveScripting specific
> error 16389 occurred" on the jobs. I have search both BOL and newsgroups but
> not finding anything that is giving me any help on this. Has anyone seen
> this before, is so what step are need to be performed to troubleshoot the
> issue.
> The sql server that we are running this from is central DBA sql server
> connecting to both production and non-production servers via SQL-DMO trusted
> connections and extracting scripts for object generation.

error 16389

Hello,
We have a active x script that has been running for weeks from sql server
agent and all of sudden last night we are receiving "ActiveScripting specific
error 16389 occurred" on the jobs. I have search both BOL and newsgroups but
not finding anything that is giving me any help on this. Has anyone seen
this before, is so what step are need to be performed to troubleshoot the
issue.
The sql server that we are running this from is central DBA sql server
connecting to both production and non-production servers via SQL-DMO trusted
connections and extracting scripts for object generation.Stopping and starting SQL Agent has fixed the issue. What could have caused
this issue?
"Tom" wrote:
> Hello,
> We have a active x script that has been running for weeks from sql server
> agent and all of sudden last night we are receiving "ActiveScripting specific
> error 16389 occurred" on the jobs. I have search both BOL and newsgroups but
> not finding anything that is giving me any help on this. Has anyone seen
> this before, is so what step are need to be performed to troubleshoot the
> issue.
> The sql server that we are running this from is central DBA sql server
> connecting to both production and non-production servers via SQL-DMO trusted
> connections and extracting scripts for object generation.

error 16389

Hello,
We have a active x script that has been running for weeks from sql server
agent and all of sudden last night we are receiving "ActiveScripting specifi
c
error 16389 occurred" on the jobs. I have search both BOL and newsgroups bu
t
not finding anything that is giving me any help on this. Has anyone seen
this before, is so what step are need to be performed to troubleshoot the
issue.
The sql server that we are running this from is central DBA sql server
connecting to both production and non-production servers via SQL-DMO trusted
connections and extracting scripts for object generation.Stopping and starting SQL Agent has fixed the issue. What could have caused
this issue?
"Tom" wrote:

> Hello,
> We have a active x script that has been running for weeks from sql server
> agent and all of sudden last night we are receiving "ActiveScripting speci
fic
> error 16389 occurred" on the jobs. I have search both BOL and newsgroups
but
> not finding anything that is giving me any help on this. Has anyone seen
> this before, is so what step are need to be performed to troubleshoot the
> issue.
> The sql server that we are running this from is central DBA sql server
> connecting to both production and non-production servers via SQL-DMO trust
ed
> connections and extracting scripts for object generation.

Thursday, March 22, 2012

Error 15401 Adding Domain Group to SQL Server

I have tried rebooting the system, I have ran the script to look for duplicate sids and am still having the issue when trying to add a domain group to SQL. I get the Error 15401: Windows NT user or group'mi\Trust Legal' not found. Check the name again. Running SQL 2000 Std, with SP3a, and the collation is set to SQL_Latin1_General_CP850_BIN, which makes this instance case sensitive, and the group name is spelt right and am following the case sensitivity of the name as well.

This is most likely an issue due to using a different casing. You could use a tool like sid2name, to obtain the correct casing of the group name from Windows. Then use that same casing and the statement should succeed. You might want to quickly try and capitalize the domain name: MI instead of mi; if this doesn't work then look for a sid2name tool and use it to determine the correct casing. If you cannot find such tool, you could write one easily by calling the LookupAccountSid WinAPI. You could use this post as an example: http://blogs.msdn.com/lcris/archive/2005/09/26/474202.aspx.

Thanks
Laurentiu

|||

Most likely the cause of such failure is because the SQL Server cannot gather the information for this account from the domain controller.

Please make sure that the service account used to run SQL Server has permission to query the domain controller (in most cases being a member of the domain is sufficient to query the domain controller), and that the machine has access to the domain controller.

-Raul Garcia

SDE/T

SQL Server Engine

|||

OK, so you've got two suggestions. To quickly discern between these, try to ACL something to the group, on the machine on which the server is installed. If you can, then the issue is not with reaching the DC; if you cannot, then it is a DC issue.

Thanks
Laurentiu

|||

Apprciate all the great advice, but nothing seemed to help.

1) I am able to login into server using the account in which sql is running under, and am able to add the group to a folder on the box

2) ran the groups sid up against sid2name, and found the following:

MI\Trust Legal, is a group

enter the username just like that when adding another user to SQL and get the same message?

|||

What command are you executing? sp_addlogin or sp_adduser?

Thanks
Laurentiu

|||

Neither actually:

use IMCEXCLUSIVE
exec sp_grantlogin 'MI\Trust Legal'

since its a domain group, from what I read grantlogin was the proper SP to use, am I wrong?

|||

No, you're right. sp_grantlogin is the right command.

You're using the right command and what appears to be the correct group name. So the issue is probably elsewhere. Does the command work for other groups or users in the same domain or does it consistently fail? What about users or groups from another domain? Does it work for local accounts? We need to try to identify the extent of this issue - it might hopefully lead us to its cause. If this is a blocking issue for you, I suggest to contact customer support as well.

Thanks
Laurentiu

|||Interesting idea, now when I try to add a user MI\15451a it works fine, when I try to add another group MI\Trust Technology Services it works just fine, just an issue so far with this one group MI\Trust Legal, arrgghhhhh this sucks. @. this point, if I cant get it fixed, I might just create a new group and go that route.|||

The group must be different in some way from the others. You might want to try downloading SQL Server 2005 Express SP1 and trying this command out on it, to see if you get the same issue.

Thanks
Laurentiu

Sunday, March 11, 2012

Error 1203

I am running a script on a schedule and I get this error quite often:

Unspecified error occurred on SQL Server. Connection may have been terminated by the server. [SQLSTATE HY000] (Error 0) Process ID ## attempted to unlock a resource it does not own: OBJECT: ## . Retry the transaction, because this error may be caused by a timing condition. If the problem persists, contact the database administrator. [SQLSTATE HY000] (Error 1203)

If I keep rerunning the transaction, it will eventually succeed. I am running SQL Server 2005 with SP1 installed. Does anyone know what this means and what would cause it to fail sometimes and succeed other times?

Thanks

This often indicates some sort of corruption in your database. See BOL topic below for more details:

http://msdn2.microsoft.com/en-us/library/aa337285.aspx

|||

It does not appear to be any sort of corruption. The DBCC CHECKDB returned no errors. Are there any other things that could cause this besided database corruption?

Thanks.

|||In that case, you will have to contact PSS to open a case so they can investigate further. This can also be due to a bug in SQL Server lock manager code caused by your workload/configuration. Btw, if you haven't applied the latest service pack of SQL Server (SP1) and the cumulative hotfix please do that first to see if you can repro the problem.

Friday, February 24, 2012

Error "Cannot resolve the collation conflict between"

I'm getting the following errors when trying to execute the following script on the server, its part of the standard asp.net membership and roles, anybody have any ideas how I get get round this?

Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 50
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 58
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 84
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.
Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 92
Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation.

/****** Object: StoredProcedure [dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles] Script Date: 05/20/2007 11:23:33 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles]') AND type in (N'P', N'PC'))
BEGIN
EXEC dbo.sp_executesql @.statement = N'
CREATE PROCEDURE [dbo].[aspnet_UsersInRoles_RemoveUsersFromRoles]
@.ApplicationName nvarchar(256),
@.UserNames nvarchar(4000),
@.RoleNames nvarchar(4000)
AS
BEGIN
DECLARE @.AppId uniqueidentifier
SELECT @.AppId = NULL
SELECT @.AppId = ApplicationId FROM aspnet_Applications WHERE LOWER(@.ApplicationName) = LoweredApplicationName
IF (@.AppId IS NULL)
RETURN(2)

DECLARE @.TranStarted bit
SET @.TranStarted = 0

IF( @.@.TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @.TranStarted = 1
END

DECLARE @.tbNames table(Name nvarchar(256) NOT NULL PRIMARY KEY)
DECLARE @.tbRoles table(RoleId uniqueidentifier NOT NULL PRIMARY KEY)
DECLARE @.tbUsers table(UserId uniqueidentifier NOT NULL PRIMARY KEY)
DECLARE @.Num int
DECLARE @.Pos int
DECLARE @.NextPos int
DECLARE @.Name nvarchar(256)
DECLARE @.CountAll int
DECLARE @.CountU int
DECLARE @.CountR int

SET @.Num = 0
SET @.Pos = 1
WHILE(@.Pos <= LEN(@.RoleNames))
BEGIN
SELECT @.NextPos = CHARINDEX(N'','', @.RoleNames, @.Pos)
IF (@.NextPos = 0 OR @.NextPos IS NULL)
SELECT @.NextPos = LEN(@.RoleNames) + 1
SELECT @.Name = RTRIM(LTRIM(SUBSTRING(@.RoleNames, @.Pos, @.NextPos - @.Pos)))
SELECT @.Pos = @.NextPos+1

INSERT INTO @.tbNames VALUES (@.Name)
SET @.Num = @.Num + 1
END

INSERT INTO @.tbRoles
SELECT RoleId
FROM dbo.aspnet_Roles ar, @.tbNames t
WHERE LOWER(t.Name) = ar.LoweredRoleName AND ar.ApplicationId = @.AppId
SELECT @.CountR = @.@.ROWCOUNT

IF (@.CountR <> @.Num)
BEGIN
SELECT TOP 1 N'''', Name
FROM @.tbNames
WHERE LOWER(Name) NOT IN (SELECT ar.LoweredRoleName FROM dbo.aspnet_Roles ar, @.tbRoles r WHERE r.RoleId = ar.RoleId)
IF( @.TranStarted = 1 )
ROLLBACK TRANSACTION
RETURN(2)
END

DELETE FROM @.tbNames WHERE 1=1
SET @.Num = 0
SET @.Pos = 1

WHILE(@.Pos <= LEN(@.UserNames))
BEGIN
SELECT @.NextPos = CHARINDEX(N'','', @.UserNames, @.Pos)
IF (@.NextPos = 0 OR @.NextPos IS NULL)
SELECT @.NextPos = LEN(@.UserNames) + 1
SELECT @.Name = RTRIM(LTRIM(SUBSTRING(@.UserNames, @.Pos, @.NextPos - @.Pos)))
SELECT @.Pos = @.NextPos+1

INSERT INTO @.tbNames VALUES (@.Name)
SET @.Num = @.Num + 1
END

INSERT INTO @.tbUsers
SELECT UserId
FROM dbo.aspnet_Users ar, @.tbNames t
WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = @.AppId

SELECT @.CountU = @.@.ROWCOUNT
IF (@.CountU <> @.Num)
BEGIN
SELECT TOP 1 Name, N''''
FROM @.tbNames
WHERE LOWER(Name) NOT IN (SELECT au.LoweredUserName FROM dbo.aspnet_Users au, @.tbUsers u WHERE u.UserId = au.UserId)

IF( @.TranStarted = 1 )
ROLLBACK TRANSACTION
RETURN(1)
END

SELECT @.CountAll = COUNT(*)
FROM dbo.aspnet_UsersInRoles ur, @.tbUsers u, @.tbRoles r
WHERE ur.UserId = u.UserId AND ur.RoleId = r.RoleId

IF (@.CountAll <> @.CountU * @.CountR)
BEGIN
SELECT TOP 1 UserName, RoleName
FROM @.tbUsers tu, @.tbRoles tr, dbo.aspnet_Users u, dbo.aspnet_Roles r
WHERE u.UserId = tu.UserId AND r.RoleId = tr.RoleId AND
tu.UserId NOT IN (SELECT ur.UserId FROM dbo.aspnet_UsersInRoles ur WHERE ur.RoleId = tr.RoleId) AND
tr.RoleId NOT IN (SELECT ur.RoleId FROM dbo.aspnet_UsersInRoles ur WHERE ur.UserId = tu.UserId)
IF( @.TranStarted = 1 )
ROLLBACK TRANSACTION
RETURN(3)
END

DELETE FROM dbo.aspnet_UsersInRoles
WHERE UserId IN (SELECT UserId FROM @.tbUsers)
AND RoleId IN (SELECT RoleId FROM @.tbRoles)
IF( @.TranStarted = 1 )
COMMIT TRANSACTION
RETURN(0)
END
'
END
GO

ThanksThis is because the collations are not consistent across the database tables and the tables that have been created.

Try adding the COLLATE to your insert queries.

something like
INSERT INTO @.tbUsers
SELECT UserId COLLATE SQL_Latin1_General_CP1_CI_AS
FROM dbo.aspnet_Users ar, @.tbNames t
WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = @.AppId
or
INSERT INTO @.tbUsers
SELECT UserId COLLATE Latin1_General_CI_AS
FROM dbo.aspnet_Users ar, @.tbNames t
WHERE LOWER(t.Name) = ar.LoweredUserName AND ar.ApplicationId = @.AppId

coz i really dont know which one is conflicting.....i mean which collation|||Yes your right the db and the table fields have different collation values but I don't understand how to change this as this was installed by .net, Can I change this and will it have any impact, Its funny because I've scripted the db from my dev machine and its working fine and now that I'm trying to create it on my host .. Wierd