473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Copy 2000 database to 2005 - cannot detach/attach

I am trying to copy a database from a SQL 2000 SP3 Windows 2000 server
to a 2005 SP2 Windows 2003 server.
I am trying to use detach and attach method (have tried both within
Management Studio and T-SQL) and experience an error when attaching to
the 2005 server:
"CREATE FILE encountered operating system error 5 (error not found)
while attempting to open or create the physical file
'xxxxxxxxxxxx' (Microsoft SQL Server, Error: 5123)"
I have specified the correct file, location, etc. Permissions look ok.

I looked further into this and heres the answer as far as I
understand:
To move a database from 2000 to 2005 you CANNOT detach/attach. You
must backup/restore.
Even ensuring the file locations are exactly the same on both source
and destination does not work for detach/attach.
You can only detach/attach within the same version itself, i.e. within
2005 itself.
The following KB states:
"If you are using SQL Server 2005, you can only attach databases of
SQL Server 2005 to an instance."
http://support.microsoft.com/kb/224071/
I know I can use backup/restore but I wanted to avoid this because for
large databases there is more overhead (i.e. the backup file size, and
time taken to backup and restore, compared to detaching/attaching
which takes seconds).
So as far as I understand the above is true, and in my opinion its a
bit limiting that this has not been allowed. Any further comments or
perhaps anyone who proves me wrong (!) are very welcome.
Oct 8 '08 #1
9 7787
I have not tried this, but Books Online says it is possible.

In SQL Server 2005 Books Online (September 2007), on the page titled
How to: Upgrade a Database Using Detach and Attach (Transact-SQL), it
says in part: "In SQL Server 2005, you can use detach and attach to
upgrade a user database from SQL Server version 7.0 or SQL Server
2000."

Note that there are restrictions so you should read the whole article.
It includes step by step instructions.

Roy Harvey
Beacon Falls, CT

On Wed, 8 Oct 2008 03:08:14 -0700 (PDT), dp******@gmail.com wrote:
>I am trying to copy a database from a SQL 2000 SP3 Windows 2000 server
to a 2005 SP2 Windows 2003 server.
I am trying to use detach and attach method (have tried both within
Management Studio and T-SQL) and experience an error when attaching to
the 2005 server:
"CREATE FILE encountered operating system error 5 (error not found)
while attempting to open or create the physical file
'xxxxxxxxxxxx' (Microsoft SQL Server, Error: 5123)"
I have specified the correct file, location, etc. Permissions look ok.

I looked further into this and heres the answer as far as I
understand:
To move a database from 2000 to 2005 you CANNOT detach/attach. You
must backup/restore.
Even ensuring the file locations are exactly the same on both source
and destination does not work for detach/attach.
You can only detach/attach within the same version itself, i.e. within
2005 itself.
The following KB states:
"If you are using SQL Server 2005, you can only attach databases of
SQL Server 2005 to an instance."
http://support.microsoft.com/kb/224071/
I know I can use backup/restore but I wanted to avoid this because for
large databases there is more overhead (i.e. the backup file size, and
time taken to backup and restore, compared to detaching/attaching
which takes seconds).
So as far as I understand the above is true, and in my opinion its a
bit limiting that this has not been allowed. Any further comments or
perhaps anyone who proves me wrong (!) are very welcome.
Oct 8 '08 #2
Thanks, I consulted the BOL article you mention and followed the
instructions.
Again I receive the error when trying to attach onto the 2005
database:
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "E:\MSSQL\DATA\IMKB_Data.MDF".
Operating system error 5: "5(error not found)".
I tried this using both the Management Studio and T-SQL (i.e. CREATE
DATABASE...FOR ATTACH).

I think there is something I am missing, e.g. permissions but can't
see it. For the moment I will use backup/restore.
Oct 8 '08 #3
On Wed, 8 Oct 2008 06:14:53 -0700 (PDT), dp******@gmail.com wrote:

Error 5 means file not found. You *are* attaching both the MDF and the
LDF in the same statement, right?

-Tom.

>Thanks, I consulted the BOL article you mention and followed the
instructions.
Again I receive the error when trying to attach onto the 2005
database:
Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "E:\MSSQL\DATA\IMKB_Data.MDF".
Operating system error 5: "5(error not found)".
I tried this using both the Management Studio and T-SQL (i.e. CREATE
DATABASE...FOR ATTACH).

I think there is something I am missing, e.g. permissions but can't
see it. For the moment I will use backup/restore.
Oct 8 '08 #4
Yes I am attaching both files in the same statement:
CREATE DATABASE IMKB ON
(FILENAME = 'E:\MSSQL\DATA\IMKB_Data.MDF')
LOG ON (FILENAME = 'l:\mssql\logs\imkb_log.ldf')
FOR ATTACH

I have tried only attaching the mdf (because apparently a log file is
automatically created) but still get the error.
Btw none of the restrictions which are mentioned in the BOL article
above apply to my case.
Oct 8 '08 #5
On Wed, 08 Oct 2008 07:03:22 -0700, Tom van Stiphout
<to*************@cox.netwrote:
>On Wed, 8 Oct 2008 06:14:53 -0700 (PDT), dp******@gmail.com wrote:

Error 5 means file not found. You *are* attaching both the MDF and the
LDF in the same statement, right?
And if E: is not a physical drive on the server it will not work.

Roy Harvey
Beacon Falls, CT
Oct 8 '08 #6
Both the data and log filenames are correct, and both E and L drives
are local on the server.
I assume this is what you mean?
Oct 8 '08 #7
On Wed, 8 Oct 2008 08:04:07 -0700 (PDT), dp******@gmail.com wrote:
>Both the data and log filenames are correct, and both E and L drives
are local on the server.
I assume this is what you mean?
Yes that is what I meant. I think you have to get into permissions at
this point. Remember the account needing the permissions is the one
under which the SQL Server service runs.

Roy Harvey
Beacon Falls, CT
Oct 8 '08 #8
Tom van Stiphout (to*************@cox.net) writes:
Error 5 means file not found. You *are* attaching both the MDF and the
LDF in the same statement, right?
No. NET HELPMSG 5 will tell you: "Access is denied". File not found is
error 2. (And 3 means that the folder is wrong.)

So dpatel75 needs to look into permissions. I will have to admit that
I'm a little foggy, but I believe that:

* If you log in as sa, it is the permissions of the service account
that applies.
* If you log in with Windows Authentication, your own permissions applies.

But I could wrong there. It could also depend on whether you have
sysadmin rights or not.


--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Oct 8 '08 #9
No. NET HELPMSG 5 will tell you: "Access is denied".

And "Access is denied" can mean either that that the file is exclusively
locked by another process or may also indicate a permissions issue. One
easy way to rule out another process is to move the file to another folder.
If that succeeds, it must be service account permissions.

--
Hope this helps.

Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn**********************@127.0.0.1...
Tom van Stiphout (to*************@cox.net) writes:
>Error 5 means file not found. You *are* attaching both the MDF and the
LDF in the same statement, right?

No. NET HELPMSG 5 will tell you: "Access is denied". File not found is
error 2. (And 3 means that the folder is wrong.)

So dpatel75 needs to look into permissions. I will have to admit that
I'm a little foggy, but I believe that:

* If you log in as sa, it is the permissions of the service account
that applies.
* If you log in with Windows Authentication, your own permissions
applies.

But I could wrong there. It could also depend on whether you have
sysadmin rights or not.


--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Oct 9 '08 #10

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

Similar topics

3
by: Andy Visniewski | last post by:
How would I copy an entire database to another (using a different name, of course) on the same server? I am new with working with databases, so any help would be appreciated. Thanks.
2
by: OakRogbak_erPine | last post by:
My company is considering purchasing MS SQL Server to run an application on (SASIxp). I am mainly familiar with Oracle, so I was wondering how long it would take to copy a database. Basically we...
1
by: Anand | last post by:
We needed to replace our Motherboard on a server running win 2K Adv. Server with SQL server 2000. After replacing, we could not bring the system back with the previous OS. So, we have decided to...
2
by: Loane Sharp | last post by:
Hi there Please help! I'm at my wits' end... I am using the System.Data.SQLClient namespace in an ASP.NET web application to connect to a local instance of SQL Server 2005 Express. Using...
1
by: Paolo | last post by:
I have been following a few walkthroughs that came with VS 2005, and they work fine (I had to change the machine.config files to work with my SQL 2005 Pro version, instead of the SQL 2005 Express)....
11
by: HC | last post by:
I posted this in one of the VB forums but I'm starting to think it might be more appropriate to have it here, since it really seems to be a SQL server (MSDE/Express 2005) problem: Hey, all, I...
5
by: Steve | last post by:
Hi; I thought I would rephrase a question I asked in another post to more quickly get to the heart of the matter. My apologies for anyone who is offended by what appears to be a repetition. ...
1
vanc
by: vanc | last post by:
Anyone know the best way to attach a database that is created with SQL Server Studio as a database file in Visual Studio? I created a database with Studio and now decided to copy it to local folder...
0
by: peridian | last post by:
Hi, Apparently, even if you set the database type to 2000, when you create a database in 2005, it is marked as 2005 regardless, and you cannot then mount the files on a 2000 installation. This...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.