title: SQL DTS Database Copy Fails
body: <p>Hey All, I have been working on this problem for a while and the usual google searches are not helping :(</p>
  
  <p>I have a production database in SQL 2000. I want to copy it over the top of a training database to refresh it. I want this to be something that is scheduled to happen once a week to keep the training database up-to-date.</p>
  
  <p>I have a DTS job created for doing this. Within that DTS job I have a single "Copy SQL Server Objects" task. That task is set up to:</p>
  
  <ul>
  <li>Create all copied objects
  
  <ul>
  <li>Drop destination objects first</li>
  </ul></li>
  <li>Copy data
  
  <ul>
  <li>Replace existing data</li>
  </ul></li>
  <li>Copy indexes, triggers, primary and foreign keys</li>
  <li>Copy all user tables, views, functions and stored procedures.</li>
  </ul>
  
  <p>When I run this DTS package (in pre-production for testing of course) it gets to 99% done and throws the following error:</p>
  
  <pre><code>Step Error Source: Microsoft SQL-DMO (ODBC SQLState: 42S02)
  Step Error Description:[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.vwEstAssetStationAddress'.
  Step Error code: 800400D0
  Step Error Help File:SQLDMO80.hlp
  Step Error Help Context ID:1131
  </code></pre>
  
  <p>My searches on the net didn't provide much help. There are reports of these errors getting hit, but none seem to match my circumstances. One suggestion I found was the the sysdepends table had become corrupted, making the DTS job run its scripts in the wrong order. Howeever, I ran the following script to correct that table and it still throws the same error:</p>
  
  <pre><code>USE master
  GO
  ALTER DATABASE [DATABASE NAME]
  SET SINGLE_USER
  GO
  
  USE [DATABASE NAME]
  GO
  
  DBCC CHECKTABLE('sysdepends',REPAIR_REBUILD )
  GO
  
  USE master
  GO
  ALTER DATABASE [DATABASE NAME]
  SET MULTI_USER
  GO
  </code></pre>
  
  <p>I have also seen that having different object owners can cause this error. But I have confirmed that the objects are all owned by the dbo user in this case.</p>
  
  <p>Any suggestions?</p>