473,788 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

Oct 17 '07
36 5110
On Oct 18, 4:42 am, "Greg D. Moore \(Strider\)"
<mooregr_delete t...@greenms.co mwrote:
"DA Morgan" <damor...@psoug .orgwrote in message

news:11******** *******@bubblea tor.drizzle.com ...
Given that this is Windows reboot the machine. Then delete the files.

And what exactly is that supposed to do other than waste the poster's time?
Well, I would hope most chefs consider flies something to be deleted,
unless maybe they're trying to get in the new Michelin Guide for
Frogs.

So, why was it this was posted to cdos?

jg
--
@home.com is bogus.
"KRMTLGS" - vanity plate, couldn't see if driver was green.
http://www.amazon.com/Michelin-Guide.../dp/2067129902

Oct 18 '07 #21
DA Morgan (da******@psoug .org) writes:
Fix the problem. Half the time, with Windows, the correct solution to a
problem is a reboot. This is one of those times.
Maybe. If SQL Server is not set to auto-start it will work, in so far that
you will get rid of the files. But since the databases will still be in
master.sys.data bases, it's not a very pretty solution. And in most cases,
SQL Server is set to auto-start, in which case rebooting the box is not
going to help at all.

But your answer is interesting. I take it that to get rid of database
files with Oracle, DROP DATABASE is not the way to go, or at least it is
not sufficient. But do you really have to reboot to get Oracle to let go
of the files?
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 18 '07 #22
On Thu, 18 Oct 2007 19:35:59 +0100, "Tony Rogerson"
<to**********@t orver.netwrote:
>
Totally clueless.

If you don't know then just keep quiet instead of posting totally misleading
advice that may (probably) cause business outage to the OP.
It was crossposted to an Oracle Usenet group, was it.
By the way, if you are such an eminent sqlserver guru why don't you
just post the correct answer instead of this useless flame?
Could it be you don't know the correct answer?

Why sqlserver 'gurus' promote sqlserver by flaming Oracle users?
Is this the most recent Microsoft sqlserver promotion campaign, or is
this just the personal lack of ethics of an arrogant self-apporinted
sqlserver 'guru'?
Because on the other hand Oracle users aren't visiting sqlserver
Usenet groups to bash sqlserver!

--
Sybrand Bakker
Senior Oracle DBA
Oct 18 '07 #23
On Thu, 18 Oct 2007 13:25:45 -0400, "Greg D. Moore \(Strider\)"
<mo************ ****@greenms.co mwrote:
>No, this is clearly one of those times when that would almost certainly NOT
work.
If it doesn't work, acknowledging the OP crossposted this to a
sqlserver AND an Oracle forum. why flame an Oracle DBA instead of
posting the correct response?
Because you don't know the correct response?

--
Sybrand Bakker
Senior Oracle DBA
Oct 18 '07 #24
On Thu, 18 Oct 2007 21:15:21 +0000 (UTC), Erland Sommarskog
<es****@sommars kog.sewrote:
>But your answer is interesting. I take it that to get rid of database
files with Oracle, DROP DATABASE is not the way to go, or at least it is
not sufficient. But do you really have to reboot to get Oracle to let go
of the files?
Unix (you know the OS people blinded by Microsoft know nothing about)
will keep the inode of the file open, even if you deleted the file.

--
Sybrand Bakker
Senior Oracle DBA
Oct 18 '07 #25
Tony Rogerson wrote:
>Given that this is Windows reboot the machine. Then delete the files.

Totally clueless.
I don't see you offering a solution to the original poster.

Go ahead ... here's your chance ... if you don't like my answer then
by all means tell everyone, including the person asking for help how
to solve the problem.

I've never seen a Windows problem yet solved by cross-posting to an
irrelevant usenet group followed up with an insult.

If you have a solution ... why are you incapable of posting it?
--
Daniel A. Morgan
University of Washington
da******@x.wash ington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Oct 19 '07 #26
DA Morgan wrote:
Tony Rogerson wrote:
>>Given that this is Windows reboot the machine. Then delete the files.

Totally clueless.

I don't see you offering a solution to the original poster.

Go ahead ... here's your chance ... if you don't like my answer then
by all means tell everyone, including the person asking for help how
to solve the problem.

I've never seen a Windows problem yet solved by cross-posting to an
irrelevant usenet group followed up with an insult.

If you have a solution ... why are you incapable of posting it?
He probably chose not to post it, because a couple of adequate
solutions have already been posted. However, they've been a bit
scattered and lacking context, so here's a comprehensive answer:

The files are presumably in use by MS SQL. They may or may not be
needed by the users. If not, then you can get rid of them in any
of the following ways:

1) SQL CHUI (Query Analyzer or Enterprise Manager for SQL 2000,
Management Studio for SQL 2005) - execute a DROP DATABASE
command, e.g.

DROP DATABASE foobar

This requires knowing the name of the database, which is usually
identical or at least similar to the filenames, e.g. database
foobar may have filenames foobar.mdf and foobar.ldf

2) SQL GUI (Enterprise Manager or Management Studio) - find the
database in the Explorer-style tree on the left, right-click
and select "Delete Database". This deletes the physical files.

Detaching the database (via CHUI or GUI) does not delete the physical
files, but makes SQL forget about the database until/unless you
re-attach them. You can then delete the physical files in the usual
fashion, which accomplishes the same as the above, but in a more
roundabout fashion.

You can also delete the physical files in the usual fashion while the
SQL service is stopped (or before it starts). Rebooting is insufficient
if the service auto-starts. In addition, SQL will complain about the
files being missing; this probably won't interfere with its other
databases, but why do it the messy way when the clean way is easier?
Oct 19 '07 #27
By the way, if you are such an eminent sqlserver guru why don't you
just post the correct answer instead of this useless flame?
Could it be you don't know the correct answer?
I replied in the ms-sqlserver group and gave the correct reply to the OP
instead of this useless unprofessional diatribe.

--
Tony Rogerson, SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]
http://sqlserverfaq.com
[UK SQL User Community]
Oct 19 '07 #28
I don't see you offering a solution to the original poster.

I posted the answer in the ms-sqlserver group where it belonged - go check.
FYI LDF/MDF's are related to the databases on a SQL Server instance and as
such he obviously has SQL Server running and a database using those files
that is online.

To solve the problem drop the database - there, wasn;t difficult being
polite was it.

A bit far from a reboot / warm start the OS which woudl do absolutely
nothing except ccost the OP's business outage while the box reboots and
things come back online, and he would still have the problem.

--
Tony Rogerson, SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]
http://sqlserverfaq.com
[UK SQL User Community]

Oct 19 '07 #29
On 18 Okt., 18:23, sybra...@hccnet .nl wrote:
On Thu, 18 Oct 2007 19:35:59 +0100, "Tony Rogerson"

<tonyroger...@t orver.netwrote:
Totally clueless.
If you don't know then just keep quiet instead of posting totally misleading
advice that may (probably) cause business outage to the OP.

It was crossposted to an Oracle Usenet group, was it.
By the way, if you are such an eminent sqlserver guru why don't you
just post the correct answer instead of this useless flame?
Could it be you don't know the correct answer?

Why sqlserver 'gurus' promote sqlserver by flaming Oracle users?
Is this the most recent Microsoft sqlserver promotion campaign, or is
this just the personal lack of ethics of an arrogant self-apporinted
sqlserver 'guru'?
Because on the other hand Oracle users aren't visiting sqlserver
Usenet groups to bash sqlserver!

--
Sybrand Bakker
Senior Oracle DBA

Thank you all for the various suggestions.
I decided not to delete the files.

And I am sorry for having posted my question in the oracle forum but I
just hoped someone at all could help me.

Regards
Pearl

Oct 19 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8906
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB automatically deletes also all those rows in the child table whose foreign key values are equal to the referenced key value in the parent row. However:
5
13278
by: Raj | last post by:
Hi all, Can anyone help me with a script which would delete files or move them to a different folder at some scheduled time..! Please.....!!! Thanks in advance...
2
8807
by: Ryan | last post by:
I have a table in my database on SQL Server which holds a file name that refers to a file that is stored on the server. I would like to create a trigger to delete this file from the server if the row in the table is deleted. I have been trying to use this command in a trigger (<filename> is the name and path of the file): xp_cmdshell "delete <filename>" If some one could please help I would appreciate it very much. I would love a...
16
17020
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
6
2586
by: I am Sam | last post by:
I keep getting this error and I don't know why: The path is too long after being fully qualified. Make sure path is less than 260 characters. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.PathTooLongException: The path is too long
3
2102
by: John Rivers | last post by:
Hello, I think this will apply to alot of web applications: users want the ability to delete a record in table x this record is related to records in other tables and those to others in other tables etc. in other words we must use cascade delete to do
1
2364
by: nasirmajor | last post by:
dear all, Please any urgent help regarding following code. i have the following code ================================================================= public void Delete(Object sender, DataGridCommandEventArgs e) { 1 int Sid2 = (int)l.DataKeys;
6
3859
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
4
25181
by: Sailor1877 via AccessMonster.com | last post by:
I've been reading all the threads about problems with LDB files but my specific problem doesn't seem to be addressed. I have a back end database on a server that I'm unable to run Compact and Repair on because the LDB file is still present. It tells me it is being used by a user "Admin" on my machine (a fact that is echoed when I open the LDB file in Notepad.) Unfortunately there is no username "Admin" on the network. When I try to...
7
2532
by: marce1972 | last post by:
Hi to all, that's my question I have mysql database and a web page to upload files to my webpage, I know how to delete them from the database, but didnt find the code to delete them from the web server. Please help me with this code. Regards Marcelo Fabiani
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.