From: likong on
Env: 32-bit SQL 2005 SP1 (9.00.2047.00), running under x64 Win2003 SP1.

I have two databases, X and Y. Here is the sequence of what I did:
1. From SQL Management Studio, under Object browser, I renamed database
X to X.old, and then renamed Y to X.
2. I ran some queries via DMO, I got the Error 904, "Database 16 cannot
be autostarted during server shutdown or startup."

"SELECT db_name(16)" tells me that database 16 is database X (the
original db name is Y).

I restarted the SQL server and then re-ran the same DMO script, same
error.

I have run the same SQL queries via DMO many times before without any
error. Therefore I do not think the error is related to queries. This
error seems to be related to DB renaming.

Also this error message does not exist in SQL 2000. It seems to be
introduced in SQL 2005.

Any idea how to resolve this issue? and what exactly is the cause of
error 904?

Thanks.

Kong