Solved

I recieve an error  message "Create Database failed." How do I delete other files assoicated with previously deleted database?

Posted on 2007-12-04
9
1,163 Views
Last Modified: 2008-06-26
I had previously dropped a database thinking I wasn't going to use the database name. Now, I decided to create a database using the same previous name. In Object Explorer, I right clicked on the folder Database and selected the New Database function and then, typed the name of the Database. The message says the file already exists. What else do I need to do to ensure dropping a database encompassses every other relative file is deleted with it (example the log files).? Doesn't "Drop Database" cover deletion of all relative files? Did my administrator only allow certain privileges? Please advise.

Thank you for your assistance.
0
Comment
Question by:5532
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20404154
DROP DATABASE should delete the physical files too unless the database was offline when you issued the DROP.
0
 

Author Comment

by:5532
ID: 20404260
Should I run it again?

The complete error message reads:

"CREATE DATABASE failed. Some file names listed could not be created. Check related error.
Cannot create file 'L:\SQL\_Logs\MSSQL\Data\Customers_log.ldf' because it already exists.
Change the file path or the file name, and retry the operation. (Microsoft SQL Server, Error: 1802)"
0
 

Author Comment

by:5532
ID: 20404325
I executed "DROP DATABASE Customer" again. I recieved this message:

"Cannot drop the database 'BusinessServices', because it does not exist or you do not have permission."

I'm thinking I don't have the permission but Is there a way I can tell I don't have the proper permissions to drop a database?

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:5532
ID: 20404378
Sorry, I meant 'Cannot drop the database Customer...." I've got a lot on my mind. Thanks
0
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20404538
When you issued the first DROP DATABASE you should have been denied if you didn't have permission.

I would simply delete the old physical files, unless you need them, and then just create your new database.

Alternatively, you could attach the existing files and then try the DROP DATABASE again.
0
 

Author Comment

by:5532
ID: 20404599
How do I delete the physical files? Shouldn't DROP DATABASE take care of these files as previously mentioned in prior post?
0
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 500 total points
ID: 20404893
Yes, it should have deleted them, depending on the status of the database when you issued the DROP.

To delete the physical files you will need to delete L:\SQL\_Logs\MSSQL\Data\Customers_log.ldf and L:\SQL\_Logs\MSSQL\Data\Customers.mdf from your server.
0
 

Author Comment

by:5532
ID: 20405250
Sounds like I have to go to the location L: and delete the physical files from this location. Is there a way I can at least view the location with these files from within Management Studio?
0
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20405878
Yes, you can query:

Exec master.dbo.xp_cmdshell 'Dir L:\SQL\_Logs\MSSQL\Data'
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question