title: Root cause of an "Invalid object name: dbo.etc" error?
body: <p>I'm doing some maintenance programming on a fairly large project, which was started by someone who's now left the company...</p>
  
  <p>I've just backed up one of the company's databases, and then reattached it to our test server. That much appears to be working okay.</p>
  
  <p>I then go through the program's usual login procedure, and that part also appears to work.</p>
  
  <p>However, once I get to a point in the program where it needs to execute a stored procedure, I get back an error telling me <code>Invalid object name 'Informix.dbo.customer'</code>.</p>
  
  <p>Running the same function on the original database works fine, and returns the data I expect to see.</p>
  
  <p>Explanations for similar errors I've found seem to refer to Schemas, but that's where things get a little odd. The original database doesn't obviously <em>have</em> any Schemas; In its "Security" folder it just has a "Users" folder, containing dbo, and a "Roles" folder, containing the "Database Roles" folder, with the usual db_owner, etc. stuff, and an empty folder named "Application Roles".</p>
  
  <p>The Security folder on the backed-up-and-restored database is full of all kinds of crap. Three users in addition to dbo, a "Schemas" folder, "Certificates" folder, two encryption key folders... I can't delete any of these.</p>
  
  <p>From my limited understanding of the SQL login system, the user I'm logging in as is getting non-dbo-permissions from this collection of random crap, and so is being denied access to the parts of the database owned by dbo.</p>
  
  <p>For my own understanding, what is the core of the problem that's throwing up these <code>Invalid object name</code> errors? And for practical matters, what can I do to rectify this situation and actually have the program I'm using work on the test database in the same way as it does on the live one?</p>