Why is my database becoming suspect? Here is my situation: restored a known good backup (works fine on other machines) that originated on Sql Server 2012 onto a local 2012 install. Created DB as part of the restore. No errors reported.

I am accessing it through a Node.js app, using the Node-SqlServer driver (if that makes a difference). The first time that the app tries to access the db after restore, the db goes into Suspect mode. 

I tried deleting the Db restoring from scratch. Same thing. 

I was able to "fix" the db by running these commands. After that, the db runs fine (app can access and query the db witout issue). However, this seems like a less than ideal scenario.

Any ideas about what could be causing this and how I might be able to prevent it?

Computer is a laptop with a single SSD. I ran chkdsk and returned a clean bill of health. Note: this has happened with more than one db restore, specifically to this machine. So the circumstantial evidence points to the machine as being at fault here.
Knowing that a CHECKDB returns errors right after restoring a backup, as stated by Remus Rusanu, you have a corrupted backup. As fixing this afterwards is usually much more painful then before, you should plan (or ask your DBA) to check the consistency of your databases on a very regular basis. I remember having anxious moments waiting for the results of a first DBCC CHECKDB for databases that have been in production for a few years, long before I started my job.

If you want to know more about corruption and DBCC, have a look at:


How to corrupt a database, by Kendra Little: http://www.littlekendra.com/2011/01/24/corrupthexeditor/. I found it a great way to understand how things were working under the hood.
Paul Randal's articles, for example http://www.sqlskills.com/blogs/paul/category/checkdb-from-every-angle/ . He is THE authority on DBCC and you can also subscribe to their newsletter. The last one has a great introduction video on corruption and how to fix it.


So check (sorry for this one) the health before, try to restore a valid backup, and if you have no other choice, try DBCC REPAIR_ALLOW_DATA_LOSS. But as stated before, you'll lose data and that can even make your database unusable.