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
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 db associations..log file is f*****

Author  Topic 

jhermiz

3564 Posts

Posted - 2008-07-14 : 08:01:01
I'm not a db admin...so bare with me :).
Came in this morning...db is gone...I dont see it in EM / Query Analzyer. Tried to reattach it and SQL Server 2k complained...
So I tried doing the following:

EXEC sp_attach_single_file_db @dbname = 'JTESv1',
@physname = 'D:\Program Files\Microsoft SQL Server\MSSQL\Data\JTESv1_Data.MDF'

And I get:

Server: Msg 5173, Level 16, State 1, Line 1
Cannot associate files with different databases.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'JTESv1'. CREATE DATABASE is aborted.
Log file 'd:\Progra~1\Micros~1\MSSQL\data\JTESv1_log.LDF' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.


I know its got something to do with the log file....but not sure how to fix it. I also tried renaming the db and recreating a new one and then tried reattaching the old one back and no luck.

Any db admins have any recommendations on getting this sucker back up?

Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-07-14 : 08:30:56
You got last nights backup? If so, then what changes would have occured?

Restore that as a different name and just make sure that the .MDF file is really your primary.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2008-07-14 : 09:32:43
quote:
Originally posted by RickD

You got last nights backup? If so, then what changes would have occured?

Restore that as a different name and just make sure that the .MDF file is really your primary.



I ended up restoring from 4am..thank god!

Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-14 : 11:11:05
quote:
Originally posted by jhermiz

I'm not a db admin...so bare with me :).
Came in this morning...db is gone...I dont see it in EM / Query Analzyer. Tried to reattach it and SQL Server 2k complained...
So I tried doing the following:

EXEC sp_attach_single_file_db @dbname = 'JTESv1',
@physname = 'D:\Program Files\Microsoft SQL Server\MSSQL\Data\JTESv1_Data.MDF'

And I get:

Server: Msg 5173, Level 16, State 1, Line 1
Cannot associate files with different databases.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'JTESv1'. CREATE DATABASE is aborted.
Log file 'd:\Progra~1\Micros~1\MSSQL\data\JTESv1_log.LDF' does not match the primary file. It may be from a different database or the log may have been rebuilt previously.


I know its got something to do with the log file....but not sure how to fix it. I also tried renaming the db and recreating a new one and then tried reattaching the old one back and no luck.

Any db admins have any recommendations on getting this sucker back up?

Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]



How did it happen? Did you track out what happened?
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-07-14 : 17:28:01
quote:
Originally posted by jhermiz

I'm not a db admin...so bare with me :).



I dont think anyone here would want to "bare" "with you"...

just teasing..

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-07-15 : 01:50:34
quote:
Originally posted by jhermiz

I ended up restoring from 4am..thank god!

Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]


This is when you find the real worth of backups.
Go to Top of Page
   

- Advertisement -