SQL Server Performance

database mirror job changed to use wmi escape macro - still got error

Discussion in 'SQL Server 2005 General DBA Questions' started by Trev256b, Nov 21, 2011.

  1. Trev256b Member

    i have setup database mirror job and changed the job to use an escape macro - and i have selected the option to 'Replace tokens for all job responses to alerts' - The error I get is this: 'Unable to start execution of step 1 (reason: Variable WMI(StartTime) not found). The step failed.'

    The job is:

    INSERT

    INTO dbo.[DB Mirroring State Changes]

    (

    [Event Time]

    ,

    [Event Description]

    ,

    [New State]

    ,

    [Database]

    )
    VALUES
    (

    $(ESCAPE_SQUOTE(WMI(StartTime))),
    '$(ESCAPE_SQUOTE(WMI(TextData)))'
    ,

    $(ESCAPE_SQUOTE(WMI(State))),
    '$(ESCAPE_SQUOTE(WMI(DatabaseName)))'
    )
    Does anyone know how to fix this???????????????????
  2. Trev256b Member

    The job code was this:

    INSERT

    INTO dbo.[DB Mirroring State Changes]

    (

    [Event Time]

    ,

    [Event Description]

    ,

    [New State]

    ,

    [Database]

    )
    VALUES
    (

    $(ESCAPE_SQUOTE(WMI(StartTime))),
    '$(ESCAPE_SQUOTE(WMI(TextData)))'
    ,

    $(ESCAPE_SQUOTE(WMI(State))),
    '$(ESCAPE_SQUOTE(WMI(DatabaseName)))'
    )
  3. Trev256b Member

    ok - keeps getting truncated - here is the job code again:

    INSERT
    INTO dbo.[DB Mirroring State Changes]
    ([Event Time],[Event Description],[New State],[Database] )
    VALUES($(ESCAPE_SQUOTE(WMI(StartTime))), '$(ESCAPE_SQUOTE(WMI(TextData)))',
    $(ESCAPE_SQUOTE(WMI(State))),
    '$(ESCAPE_SQUOTE(WMI(DatabaseName)))')
  4. satya Moderator

    Is this your own code or obtained from anyone else?
    Can you see any warnings or errors about WMI on the server?

Share This Page