Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Could not find database ID

Author  Topic 

gongxia649
So Suave

344 Posts

Posted - 2007-09-21 : 22:19:39
I dropped a DB and restored it from last nights backup.
Now getting a job failure that has this msg. Any ideas?

Msg 913, Sev 16: Could not find database ID 7. Database may not be activated yet or may be in transition. [SQLSTATE 42000]

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-21 : 23:27:50
Sounds like the ID changed, run sp_helpdb and see what ID is associated with the database.



Future guru in the making.
Go to Top of Page

gongxia649
So Suave

344 Posts

Posted - 2007-09-21 : 23:56:47
now it has id 6.
how do i change it back.?
is there any impact if i change it back?
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-22 : 00:30:33
quote:
Originally posted by gongxia649

now it has id 6.
how do i change it back.?
is there any impact if i change it back?



If you change it back you also have to change all related tables, and I am sure it is unsupported. When you restored the DB did you restore or attach? Did you recently remove a database that occupied DBID 6?



Future guru in the making.
Go to Top of Page

gongxia649
So Suave

344 Posts

Posted - 2007-09-22 : 00:39:12
i did restore on Query analyzer.
no i didnt removed any database that occupied dbid 6. cause all the databases are still there.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-22 : 00:39:24
Ok, I did some research. Your jobs have cached the DB_ID from before, all you should need to do is either restart or run DBCC FREEPROCCACHE to clear the procedure cache.





Future guru in the making.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-09-22 : 22:09:15
What kind of job? Restore db statement will not cache db id.
Go to Top of Page

Zoroaster
Aged Yak Warrior

702 Posts

Posted - 2007-09-22 : 22:56:51
quote:
Originally posted by rmiao

What kind of job? Restore db statement will not cache db id.



I assume from the OP's original remarks about job failures that he was talking about some existing jobs.



Future guru in the making.
Go to Top of Page
   

- Advertisement -