Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Error attaching database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-04-18 : 07:11:32
James W writes "Hi, I have been attaching and unattaching the same database for months now.

I unattached it the other day and tried to attach it again and I all of a sudden get this error:

error 5123: create file encountered operating system error 32(error not found) while attempting to open or create the physical file.

I tried attaching a different database of around the same size and it worked fine.

The database has amenity/schools data for the whole of the UK so is EXTREAMLY important - Please help me.......

Regards, James Wilkinson."

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2005-04-18 : 08:31:38
You might try using a single file attach. Here is an example from Books Online:

Examples
This example detaches pubs and then attaches one file from pubs to the current server.

EXEC sp_detach_db @dbname = 'pubs'
EXEC sp_attach_single_file_db @dbname = 'pubs',
@physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

Have you looked at the SQL Server error log and the server event viewer logs to see if there is more information there? Look at both the attach and detach events to see if there is more information.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

jason
Posting Yak Master

164 Posts

Posted - 2005-04-18 : 12:47:52
Have you checked to see if the actual file is where you expect it to be?
Go to Top of Page

jannie
Starting Member

2 Posts

Posted - 2006-08-29 : 05:52:49
quote:
Originally posted by AskSQLTeam

James W writes "Hi, I have been attaching and unattaching the same database for months now.

I unattached it the other day and tried to attach it again and I all of a sudden get this error:

error 5123: create file encountered operating system error 32(error not found) while attempting to open or create the physical file.

I tried attaching a different database of around the same size and it worked fine.

The database has amenity/schools data for the whole of the UK so is EXTREAMLY important - Please help me.......

Regards, James Wilkinson."

Go to Top of Page

jannie
Starting Member

2 Posts

Posted - 2006-08-29 : 05:56:38
Ok Let's try this again

James

Same thing happened to me.

I detached a DB, made a copy of the physical files. I then attached the copy db with the physical files still pointing to the original physical files. Afterwards when I tried to attach the original physical files (which is actually being used by the copy db) I got the error "error 5123: create file encountered operating system error 32(error not found) while attempting to open or create the physical file".

So I just detached the copy db and attached it with the copy physical files, and attached the original db with the original physical files and bob's your uncle and nellie's your aunt.

Jannie
Go to Top of Page

Hylmer
Starting Member

1 Post

Posted - 2010-01-14 : 06:05:13
Hello guys

I encoutered this problem.
I just modify the security properties of the .mdf and .log files.
I allow full access to Everybody, and it works.

Duco
Go to Top of Page

tripodal
Constraint Violating Yak Guru

259 Posts

Posted - 2010-01-15 : 11:15:57
You will probably want to adjust the permissions to the specific sql user instead of "everyone".
Or else i can come steal / delete them.

Also attaching / detaching databases is, not so good. Why would you need to detach a database except in an emergency?
Go to Top of Page

arame3333
Starting Member

1 Post

Posted - 2010-06-28 : 05:38:15
One way to get this error is to do something really stupid. I reinstalled SQL Server and I found I had to attach my databases back in SQL Management Studio. I tried to attach the Master database, forgetting it was in the System Database folder!
So this is how I got this error!

It has been said that man is a rational animal. All my life I have been searching for evidence which could support this.
- Bertrand Russell
Go to Top of Page
   

- Advertisement -