Unable to attached a database that has been opened on another instance

  • We have a database that was attached to an instance of sql 2000. To cut to the chase, we have now installed sql 2008 but are not able to attached this database because it has already been attached and not detached. The MDF is ok.

    Becase this MDF is locked we can neither utilise it restore or create a new database.

    Unfortunately I can not get back to the sql 2000.

    Can someone help us restore this locked MDF to a new database?

  • What do you mean by locked? Are you getting an error?

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Hi, thanks for giving my issue your attention.

    I get an error 5 or not have the proper security when I tried to attach or restore, not sure which is which,

    the MDF that was never detached.

    What happened was we removed the hard drive that had sql 2000 running. The DB was never detach. We installed sql 2008. Now we cant get to the db because it was attached on another instance. I understand that when a db is attached the db is secured/locked from other access. How can I now free up the db so I can use it in sql 2008?

    Goin back to the 2000 is not an option. Please shed light on the matter.

  • Error 5 is an access denied on the file. Make sure the user running SQL Server has full rights on the folder where the file exists.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • It sounds as though you did not stop SQL 2000. You could either detach this db on SQL 2000 or shut SQL 2000 down. Also, be sure that security is correct. Once you have the file not-in-use from SQL 2000, you can copy it to the database folders that SQL 2008 uses, or you would need to make sure the SQL 2008 database service account has read/write access to the current folder. There is a group for this account that you can see in your Windows groups on that machine to which you can assign rights.

  • What did u mean by " or you would need to make sure the SQL 2008 database service account has read/write access to the current folder. There is a group for this account that you can see in your Windows groups on that machine to which you can assign rights."

    How can I get to this property and make the setting.

    Cant go back to sql 2000 the disk has already been formatted with windows 7.

    Thanks again.

  • I think they are right about the permissions.

    The ID SQL Service is running as needs full permissions to the directory where you have the mdf and ldf files.

    It almost sounds like you physically took the disk out of one machine, then put in another machine.

    So the permissions likely are those of the old machine.

    Note the difference in some of the local groups for SQL - they include instance specific names-

    $machine, $machine/instance

    Greg E

  • Service accounts are used when you install SQL Server. There are also Windows groups created, with these accounts in these groups. Rights are assigned to the group NOT the user.

    The groups are listed in this document: http://msdn.microsoft.com/en-us/library/ms143504.aspx#Use_startup_accounts

  • We tried to get to the DB by way of the security suggestion but to no avail. We then installed a version of 2000 and trtied to access the db. In our attempt to attached, we somehow freed up the DB. We were able to move the DB to another compouter, there we were able to attached and finally access our DB.

    Thank you for your assistance,your attention was very comforting.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply