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 Administration
 Foreign Key Gone Missing

Author  Topic 

waterduck
Aged Yak Warrior

982 Posts

Posted - 2011-09-09 : 12:13:06
Dear All,

Any idea what causes all the foreign key went missing??The only thing i done was restore the same database with a different database name....

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-09-09 : 12:22:13
Someone dropped them.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2011-09-15 : 02:30:51
Errrr.....no ppl logged into the database other den me....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-15 : 02:42:05
how did you backup restore the db?did you take scripts and did it?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2011-09-15 : 04:47:13
Nah....manual backup and restore as another name( both mdf n ldf) at other drive...weird huh?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-15 : 05:26:09
then no chance of it getting dropped unless someone did it intentionally

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2011-09-16 : 08:39:23
Had to define tat someone is a ghost den....>.<
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-09-16 : 09:13:33
Two options:
1) The backup that you restored didn't have the foreign keys in
2) Someone or some app dropped them after the restore

SQL doesn't just remove objects. I've had 3 other threads like this in the last week (view going missing, index going missing, table going missing). In all cases the OP swore that there were no drop statements and no one was manually dropping the objects. In all three they later found that there were unexpected drop statements in code (in procedure or trigger) that were dropping the objects

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2011-09-18 : 03:54:03
If you have transaction log backups you could go back and see when the objects were dropped, which could then help you diagnose the cause.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-09-18 : 08:58:44
The default trace will show this -- unless you've modified or disabled it.
Go to Top of Page
   

- Advertisement -