Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Visual Studio 2010
This is the forum to discuss the Wrox book Professional Visual Studio 2010 by Nick Randolph, David Gardner, Chris Anderson, Michael Minutillo; ISBN: 9780470548653
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Studio 2010 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 11th, 2012, 02:40 AM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default Chapter 23 - Unable to Add a database file

I am on the bottom of page 487. I am having trouble when I try to add the existing item, AdventureWorksLT2008_Data.mdf. It keeps saying "The file can not be opened because it is being used by another process. Please close all applications that might access this file and try again." I have no applications open that would be accessing this file. In fact, even after I reboot and try to add the file, it still gives me the same message. Any idea how to get past this?

  #2 (permalink)  
Old February 11th, 2012, 04:28 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default the file is in use

Hi my friend.
I think your file is attached to SqlServer. you can stop sqlServer service and copy file to new location, then start sqlServer.

Start -> Control Panel -> Administrative Tools -> Services ->
find Sql Server service and stop it. and after coping file to new location, start the service
__________________
happy every time, happy every where

Reza Baiat
  #3 (permalink)  
Old February 11th, 2012, 06:22 PM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2011
Posts: 16
Thanks: 0
Thanked 1 Time in 1 Post
Default

Thank you for your quick response.

Ok, I stopped my SQL Server, then I was able to add the database, then I restarted my SQL Server. Is this the normal way to do it? This sounds like it would be too much trouble to stop the server on a production system during the day. Are we supposed to begin all our projects at night when nobody is on?
  #4 (permalink)  
Old February 13th, 2012, 12:53 AM
Friend of Wrox
Points: 742, Level: 10
Points: 742, Level: 10 Points: 742, Level: 10 Points: 742, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2009
Location: Tehran, Iran
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Default not the only way

Hi Drogil
to do this you can open sql server management studio and backup old database. then create a new database and restore backup files over this new db. (in the restore database window, select Options from left side and tick 'Overwrite the existing database'. )
this makes a new copy of your database for test or other purposes.
__________________
happy every time, happy every where

Reza Baiat


Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 2 page 23 youngbones BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 April 15th, 2011 01:35 PM
Unable to startup database - Chapter 3 michaeltan80 BOOK: Beginning Spring Framework 2 ISBN: 978-0-470-10161-2 2 April 22nd, 2008 01:02 PM
Chapter -4, page 117 Unable to add User savitur BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 6 October 18th, 2007 06:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.