Showing posts with label failure. Show all posts
Showing posts with label failure. Show all posts

Sunday, March 11, 2012

DLL initialization failure using CDOSYS mail

We have a SQL 2000 stored procedure to send notification emails using CDOSYS and OLE Automation. It has been happily sending out emails for quite a while now from both of our dev and prod machines.

The other day I added a line of code to format the message body variable. I tested the change in a T-SQL script in dev, then added the line into the procedure and recompiled it in dev using an ALTER PROC script. I then called the dev proc and everything is still good. The change has no impact to the sp_OA* commands.

So then I used the same ALTER PROC script and pointed it to production. There is no difference between the dev and prod procs so this was OK. The script ran OK and the proc was updated with the change. However, now only the prod proc doesn't work. Further, the same code in a T-SQL script also fails. But everything remains fine in the dev environment.

We restored the database that had the email SP to a point prior to the change, but the problem persists. It is as if recompiling the proc has disabled the CDOSYS capability from SQL server. CDOSYS still works from VBscript on the server.

The error message:

Msg 50000, Level 18, State 3, Procedure usp_SendEmail, Line 154

Error in Email Object: Source: CDO.Configuration.1 . Description: A dynamic link library (DLL) initialization routine failed.

(EOLIAN.Tools.dbo.usp_SendEmail)

Here's a bit of the code:

DECLARE @.iMsg int,

@.hr int

EXEC @.hr = sp_OACreate 'CDO.Message', @.iMsg OUT

IF @.HR <> 0 GOTO Error_Handling

EXEC @.hr = sp_OASetProperty @.iMsg, 'Configuration.fields("http://schemas.microsoft.com/cdo/configuration/sendusing").Value','2'

IF @.HR <> 0 GOTO Error_Handling

I encountered a similar problem a few months ago when we collocated our DB server (Win2K, SQL 2005) and changed the domain it was in. At the time, granting the login that runs the SQL Server service access to the System32/InetSrv directory fixed the problem (seemed to be a metabase access issue). The one difference is that we use the Pickup directory (SendUsing=1).

A few weeks later, things stopped working again. Like you, I've tested using a VBScript logged in as the same account that's running the SQL Server service and the emails gets generated without difficulty. But using the stored proc or a pared-down SQL script generates the same DLL initialization error in CDO.Configuration.1.

This proc has been in use since we converted to SQL 2000 and has not been altered for some time (>12mo). The only change is the domain change which clearly introduced a number of security implications. However, that doesn't explain why it worked and then just stopped working.

If I figure out the problem, I'll post again. If you figure out hte problem, please post as well as we may be chasing the same issue.

|||Moving to the T-SQl group.|||The problem is resolved, although not understood. We rebooted the server and restarted SQL and all is well again. Not sure what caused the problem, or what the problem was.|||The solution was short lived. The DLL initialization failure message is back. :-(

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!

Friday, February 17, 2012

distributed transaction failure

Im attempting to insert the result set from a remote query into a local table and Im getting the following error:

Msg 8501, Level 16, State 1, Line 1
MSDTC on server 'REMOTESVR' is unavailable.
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d01c].
Msg 7391, Level 16, State 1, Line 1

The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.

MSDTC is running on both servers. Has anyone ever seen this or have any insight into the cause?


The code that Im trying to run is:

create table msver
(
[Index] int,
[Name] varchar(30),
Internal_Value varchar(20),
Character_Value varchar(512)
)

insert into msver
exec ('exec [REMOTESVR].master.dbo.xp_msver')

Note that the remote query works fine.

Thanks!
EricMake sure MSDTC is started on both the servers.|||I might be wrong, but I don't think you're going to get xp_msver to work this way. Run it as:

insert msver
exec [REMOTESVR].sp_executesql 'exec master.dbo.xp_msver'

See if that works. I don't have my laptop hooked up, or I would test it really quick at the lab. :)|||Check on the 'remoteserver' SQL server error log for #
"... server Attempting to initialize Distributed Transaction Coordinator..."