Why does randomly a call to sp_dropdevice cause a SQL Server error?

Posted on 2008-11-15
Last Modified: 2012-05-05
I have a SQL Server Agent job that runs every 20 minutes and it's used for a custom log shipping solution. One of the job steps is responsible for checking if we already have a backup device and if we do drop it. It then creates a new backup device.

What is happening is that randomly throughout the day the drop device stored procedure call is causing the following error.

Message for the database fundmgmtdev from RBDPGPSQL1 to CHIBGPSQL1. Executed as user: RBDPGPSQL1\datarite. Logical device 'fundmgmtdev_logDump' already exists. [SQLSTATE 42000] (Error 15026)  Device dropped. [SQLSTATE 01000] (Error 15463).  The step failed.

Keep in mind that every time the job runs, we always drop the device and recreate it but for some reason a handful of times throughout the day sp_dropdevice causes a SQL Server error and our job step fails. Another weird thing is that the job step continues to execute all of the way until the end (I know because I have messages that are written to the table) so it's not until the job step completes that the error message is shown and causes the job to fail.
Question by:nyphalanx
    1 Comment
    LVL 2

    Accepted Solution

    See the following knowledge base article.  This is precisely what you are describing.

    sp_dropdevice gives redundant and incorrect information:

    The job is actually completing correctly, because the information being reported by sp_dropdevice is incorrect.  The SQL Server Agent reports a failure because sp_dropdevice incorrectly reports a failure, but your home made job log tells the real story.  The job is completing correctly.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now