Unix Technical Forum

delete database file on server -> sharing violation

This is a discussion on delete database file on server -> sharing violation within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I have some database files (.MDF, .LDF,...) on the server. When I try to delete them, the warning ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:42 PM
pearl146@hotmail.com
 
Posts: n/a
Default delete database file on server -> sharing violation

Hi,

I have some database files (.MDF, .LDF,...) on the server. When I try
to delete them, the warning "Cannot delete file: There has been a
sharing violation. The source or destination file may be in use."
appears.

Since I am new to the environment I don't know where the files come
from and where they might be used.

Can anybody tell me what to do to delete those files?

Thank you.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:42 PM
Ed Murphy
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

pearl146@hotmail.com wrote:

> I have some database files (.MDF, .LDF,...) on the server. When I try
> to delete them, the warning "Cannot delete file: There has been a
> sharing violation. The source or destination file may be in use."
> appears.
>
> Since I am new to the environment I don't know where the files come
> from and where they might be used.
>
> Can anybody tell me what to do to delete those files?


Assuming this is MS SQL (I don't know what extensions Oracle uses), you
need to detach the database from SQL. Can be done via GUI or CHUI. For
a GUI, use Enterprise Manager (SQL 2000) or Management Studio (2005).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:43 PM
DA Morgan
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

pearl146@hotmail.com wrote:
> Hi,
>
> I have some database files (.MDF, .LDF,...) on the server. When I try
> to delete them, the warning "Cannot delete file: There has been a
> sharing violation. The source or destination file may be in use."
> appears.
>
> Since I am new to the environment I don't know where the files come
> from and where they might be used.
>
> Can anybody tell me what to do to delete those files?
>
> Thank you.


Oracle is not a Microsoft product.

Given that this is Windows reboot the machine. Then delete the files.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:43 PM
astalavista
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

see sqlservr.exe

<pearl146@hotmail.com> a écrit dans le message de news:
1192646183.822289.234660@e34g2000pro.googlegroups. com...
> Hi,
>
> I have some database files (.MDF, .LDF,...) on the server. When I try
> to delete them, the warning "Cannot delete file: There has been a
> sharing violation. The source or destination file may be in use."
> appears.
>
> Since I am new to the environment I don't know where the files come
> from and where they might be used.
>
> Can anybody tell me what to do to delete those files?
>
> Thank you.
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-01-2008, 03:43 PM
pearl146@hotmail.com
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

On Oct 17, 3:02 pm, Ed Murphy <emurph...@socal.rr.com> wrote:
> pearl...@hotmail.com wrote:
> > I have some database files (.MDF, .LDF,...) on the server. When I try
> > to delete them, the warning "Cannot delete file: There has been a
> > sharing violation. The source or destination file may be in use."
> > appears.

>
> > Since I am new to the environment I don't know where the files come
> > from and where they might be used.

>
> > Can anybody tell me what to do to delete those files?

>
> Assuming this is MS SQL (I don't know what extensions Oracle uses), you
> need to detach the database from SQL. Can be done via GUI or CHUI. For
> a GUI, use Enterprise Manager (SQL 2000) or Management Studio (2005).


Thanks Ed,
but what do I need to do in Enterprise Manager? How can I delete the
file from there?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-01-2008, 03:43 PM
EdStevens
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

On Oct 17, 1:36 pm, pearl...@hotmail.com wrote:
> Hi,
>
> I have some database files ... on the server. When I try
> to delete them. . .
>
> Since I am new to the environment I don't know where the files come
> from and where they might be used.
>

<snip>

Let's see, you have files that you don't know where they come from,
you don't know where they might be used, and yet you are still trying
to delete them . . . .

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-01-2008, 03:43 PM
bdbafh
 
Posts: n/a
Default Re: delete database file on server -> sharing violation


pearl...@hotmail.com wrote:
> Hi,
>
> I have some database files (.MDF, .LDF,...) on the server. When I try
> to delete them, the warning "Cannot delete file: There has been a
> sharing violation. The source or destination file may be in use."
> appears.
>
> Since I am new to the environment I don't know where the files come
> from and where they might be used.
>
> Can anybody tell me what to do to delete those files?
>
> Thank you.


If you were running on Linux, the operating system would dutifully
obey your command.
The files would remain accessible to existing processes which already
had handles.
After the last handle on the file(s) has been released, the file(s)
would no longer exist.

Be glad that the OS that you are using has training wheels.

There are utilities from SysInternals (since acquired by Microsoft)
for locating processes holding handles on files. Handle.exe would be
one, process monitor is another.

try here:
http://www.microsoft.com/technet/sys...s/default.mspx
http://www.microsoft.com/technet/sys...t.svl=featured

You have backups of the databases of interest on this server, right?

hth.

-bdbafh

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-01-2008, 03:43 PM
pearl146@hotmail.com
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

On Oct 17, 4:22 pm, EdStevens <quetico_...@yahoo.com> wrote:
> On Oct 17, 1:36 pm, pearl...@hotmail.com wrote:> Hi,
>
> > I have some database files ... on the server. When I try
> > to delete them. . .

>
> > Since I am new to the environment I don't know where the files come
> > from and where they might be used.

>
> <snip>
>
> Let's see, you have files that you don't know where they come from,
> you don't know where they might be used, and yet you are still trying
> to delete them . . . .


Yes, because my chef wants me to delete them and I don't know how.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-01-2008, 03:43 PM
Ed Murphy
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

pearl146@hotmail.com wrote:

> On Oct 17, 3:02 pm, Ed Murphy <emurph...@socal.rr.com> wrote:
>> pearl...@hotmail.com wrote:
>>> I have some database files (.MDF, .LDF,...) on the server. When I try
>>> to delete them, the warning "Cannot delete file: There has been a
>>> sharing violation. The source or destination file may be in use."
>>> appears.
>>> Since I am new to the environment I don't know where the files come
>>> from and where they might be used.
>>> Can anybody tell me what to do to delete those files?

>> Assuming this is MS SQL (I don't know what extensions Oracle uses), you
>> need to detach the database from SQL. Can be done via GUI or CHUI. For
>> a GUI, use Enterprise Manager (SQL 2000) or Management Studio (2005).

>
> Thanks Ed,
> but what do I need to do in Enterprise Manager? How can I delete the
> file from there?


Find the database on the left-hand side, generally like so:

Console Root
+ Microsoft SQL Servers
+ SQL Server Group
+ (name of database server)
+ Databases
+ (name of database)

then right-click on the database -> All Tasks -> Detach Database

What is your company using SQL for? Is there anyone else there
who is familiar with it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-01-2008, 03:43 PM
Ruud de Koter
 
Posts: n/a
Default Re: delete database file on server -> sharing violation

pearl146@hotmail.com wrote:
> On Oct 17, 4:22 pm, EdStevens <quetico_...@yahoo.com> wrote:


>> Let's see, you have files that you don't know where they come from,
>> you don't know where they might be used, and yet you are still trying
>> to delete them . . . .

>
> Yes, because my chef wants me to delete them and I don't know how.
>


At some moment during this operation you might have had an inkling it is
not a good idea to delete files that are apparently in use. You might
consider discussing this with your chef: is it sound approach to just do
away with files even when they are being used?

Regards,

Ruud de Koter.

PS. I am from a very liberal culture, nobody will be surprised if I
question my chef's ideas. I know it doesn't work that way everywhere,
but in cases like this it seems worth the trouble.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com