| Business Application Development with: SQL Server, C#, VB, VB.Net, ASP, ASP.Net, and XML |
| N | S |
Novick Software Management • Design • Programming • Training • Consulting |
|
|
News Links Schedule Site Map Contact |
|
Tips and Tricks for: SQL Server, VB, VB.Net, C#, COM, COM+, IIS, XML, etc.
The Problem: Error 2801 was recorded in a SQL Agent JobThe following text was stored in the job history for a step in a SQL Server Agent job that had been running successfully for quite a long time: Executed as user: BGEC\sql2ksvc. The
definition of object 'usp_AppSession_Trace' has changed since it was
compiled. [SQLSTATE 42000] (Error 2801) Associated statement is not
prepared [SQLSTATE HY007] (Error 0) RC=0 SessionID = 4740 [SQLSTATE
01000] (Message 0). I'm not sure what caused this although I think a replication subscription was being deleted at the time this happened. Solution: Recompile all stored procedures..This job is important to the success of our application and must be running at all times. To get it back up and running I used sp_recompile on all the stored procedures invoked by the job. I then sat down and wrote this stored procedure to recompile all stored procedures any time that I ran into a similar problem.
CREATE PROCEDURE
dba_Proc_Recompile_All
DECLARE
@Owner nvarchar(776) SELECT @NumP = 0 , @NumE = 0
OPEN
ProcCur
WHILE
(@@fetch_status <> -1) BEGIN
FETCH NEXT FROM ProcCur
INTO @Owner, @Proc
CLOSE
ProcCur
|
|
|
Copyright © 2003-2008 Novick Software, Inc. | Terms of Use | Privacy Policy | Nice Things People Say| |