January 20, 2009 at 5:49 am
I have orphaned mdf and ldf files i would like to delete, but whenever i use the delete function, i get an access denied, even though i am logged in as server admin.
I have tried recreating the database to point to those files, but it wont let me.
It also will not let me rename the files.
When i try to do a detach or sp_helpfile, it errors, due to not finding the database name.
Any ideas
Thanks
January 20, 2009 at 5:59 am
if you can't delete them they probably are not orphaned.
[font="Comic Sans MS"]The GrumpyOldDBA[/font]
www.grumpyolddba.co.uk
http://sqlblogcasts.com/blogs/grumpyolddba/
January 20, 2009 at 6:15 am
So how do i delete them ?
January 20, 2009 at 6:25 am
Check the permissions on the file. Sometimes when you detach a database file, it looses all permissions. No idea why. Take ownership and then add permissions for the administrators back.
If it's not permissions on the file, then getting an access denied means that the files are in use by SQL, which means they are not orphaned database files, which means if you want to delete you'll have to drop the database from within SQL.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 20, 2009 at 6:35 am
Please run this command and post the result, I think I have the same problem here...
select * from sysfiles
select * from sys.sysaltfiles where [dbid] = 'your db id'
Regards
Edu
January 20, 2009 at 6:43 am
I took back ownership and the delete worked fine!
Thanks 🙂
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply