January 12, 2009 at 1:04 am
Hi,
I have restored a .bak file to find that it has a .mdf,ndf and 2x .ldf files.
Since this is the first time i have encountered this i have searched the web on how to attach these files. I have used the following code to attach these files to the database:
use master
GO
EXEC sp_attach_db @dbname = N'SNovaSABC',
@filename1 = N'F:\SABC\Pack_Database\snova_data.mdf',
@filename2 = N'F:\SABC\Pack_Database\snova_log.ldf',
@filename3 = N'F:\SABC\Pack_Database\snova_data1.ndf'
The script ran successfully, But when i tried to run the following query on this database:
Delete from smdr where calltime>='20081201'
I got the following error:
Msg 208, Level 16, State 1, Procedure trDelete_smdr, Line 30
Invalid object name 'dba.dbo.tblAuditSMDR'
It looks like the primary file is not able to access the secondary file?
Does anyone have any suggestions on how i can resolve this?
Thanks.
January 12, 2009 at 1:46 am
I'm a bit confused about whay you were doing.
You say you restored from a .bak file and then attached the files? Normaaly when you restore from a .bak file there's no need for attaching afterwards.
About the error you get it looks like there's Trigger on the table smdr which tries to insert an audit record into the dba database. Since the audit table is in a different database than the one you attached, I don't think it has anything to do with a file not being accessible.
Did you restore the database to another server?
Check if you have a database called dba and that it contains the audit table(s).
[font="Verdana"]Markus Bohse[/font]
January 12, 2009 at 2:01 am
Hi,
Originally i did just restore the files but when i started getting that error i thought that the problem might have been that the primary file was not able to find the secondary and thats why i tried to attach the files.
I have never worked with primary and secondary files and i'm also newish to SQL Server.
I got this database from a client so they probably have the dba database setup on their side and i don't. Disabling the trigger will solve the problem. Thank you for your help 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply