November 12, 2007 at 5:25 pm
Hello!
I have noticed that on one of SQL Servers (SQL 2000 SP4) after I run following script SQLDMO connections are not destroyed:
declare @objDMO int
declare @objDatabase int
declare @resultCode int
declare @dbname varchar(200)
declare @tablename varchar(200)
declare @cmd varchar(300)
declare @temp varchar(8000)
Set @dbname = 'PUBS'
Set @tablename = 'Authors'
EXEC @resultcode = sp_OACreate 'SQLDMO.SQLServer', @objDMO OUT
if @resultcode = 0
print 'Created Object'
Exec @resultcode = sp_OASetProperty @objDMO, 'loginsecure', 'true'
EXEC @resultcode = sp_OAMethod @objDMO, 'Connect', NULL, '(local)'
if @resultcode = 0
print 'connected'
Set @cmd = 'databases("' + @dbname + '").tables("' + @tablename + '").script'
Exec @resultcode = sp_OAMethod @objDMO, @cmd , @temp OUTPUT, 4
print @temp
EXEC @resultcode = sp_OADestroy @objDMO
if @resultcode = 0
Print 'destroyed object'
I do see 'destroyed object' message. But if I run following query I can see connections piling up:
select * from master..sysprocesses where spid>50 and program_name like 'SQLDMO%'
As a result, at some point SQL server is accumulating hundreds of SQLDMo connections. This is only happening on one server. I ran tests on others and everything was fine.
Any help is greately appreciated,
Igor
November 12, 2007 at 6:08 pm
I can't prove it, but apparently you have... I've heard that the sp_OA* procs have a "connection leak"...
Real key here is what do you think you need an sp_AO* string of events for? What is it that you're actually trying to do? I ask because there's usually a good ol' fashioned T-SQL equivelent... maybe with a little xp_CmdShell thrown in...
--Jeff Moden
Change is inevitable... Change for the better is not.
November 13, 2007 at 9:42 am
I am trying to script out my server/database objects: jobs, operators, etc. I was just providing a sample script that aslo reproduces the issue.
Thanks,
Igor
November 13, 2007 at 9:46 am
I think that's what describes my problem:
November 13, 2007 at 11:11 am
Although, Microsoft says problem should be fixed in SQL 2000 SP1. I am running SP4. I am puzzled.
January 25, 2008 at 12:00 pm
Make sure you disconnect from the server...
-- Disconnect from the server.
EXEC @hr = sp_OAMethod @object, 'DisConnect'
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
Your friendly High-Tech Janitor... 🙂
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply