Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Attaching a database in SQL 2012


Attaching a database in SQL 2012

Author
Message
GF
GF
SSC-Addicted
SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)

Group: General Forum Members
Points: 470 Visits: 985
Greetings,

I have a database in SQL 2000 that I need to migrate to SQL 2012.

I detached from the SQL 2000 server using sp_detach_db.
I copied the MDF and the LDF files to a SQL 2005 machine and used

sp_attached_db MyDatabase,
Filename1='E:\path to the file.mdf',
Filename2='E:\path to the file.ldf'

This worked fine.

I detached the database from the SQL 2005 server and attached it to a SQL 2008 server without any problems.
I detached the databse from SQL 2008 and copied the files to a SQL 2012 server and tried to attach the database.

Use Master
GO
Create Database MyDatabase
ON
(Filename='E:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Data\MyDatabase.mdf'),
(Filename='E:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Data\MyDatabase.ldf')
For Attach;

I received this error

Msg 5120 Level 16, State 5, Line 1
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\ftrow_CompanyKeyword.ndf". Operating System error 2: "2(the system cannot file the file specified.)".

CompanyKeyword is a full text catalog and there are 7 catalogs in this database.

So my question is how do I attach this database and include the catalogs or exclude the catalogs.
I will need to rebuild the catalogs one the database is attached anyway.

Thanks for the help.

Gary



GF
GF
SSC-Addicted
SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)SSC-Addicted (470 reputation)

Group: General Forum Members
Points: 470 Visits: 985
To close the loop on this, so to say.

This error:
Msg 5120 Level 16, State 5, Line 1
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\ftrow_CompanyKeyword.ndf". Operating System error 2: "2(the system cannot file the file specified.)".

is a result of full text catalogs not being copied over to the new server, hence not being available.

I have always used sp_attach_db to attach a database and never had a problem with full text catalogs. I just simply rebuilt them once the database was attached.

With SQL 2012 apparently that is not the way it works.

The error message complains that this file does not exist at the location specified in the error.
"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\ftrow_CompanyKeyword.ndf".

When I looked in C:\Program Files\Microsoft SQL Server, I did not see a folder named MSSQL.1
So I searched for it and nothing was found.

So I created the entire directory structure \MSSQL.1\MSSQL\FTData

I went back to the SQL 2008 machine and rebuilt all the catalogs. I detached the database once again and I copied from the FTData directory all the catalog files from the SQL 2008 machine to the SQL 2012 machine and placed them in the directory I created earlier.

I ran this again
Use Master
GO
CREATE DATABASE MyDatabase
ON
(Filename ='E:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Data\MyDatabase_Data.MDF'),
(Filename ='E:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER2012\MSSQL\Data\MyDatabase_Log.LDF')
For Attach;
go


and the database was upgraded successfully.

This leaves me with questions.
1.) Why wasn't the directory structure created in the first place?
2.) Did I miss something during installation?
3.) Why was it looking on C drive instead of the E drive where the installation is?

My suspicion is, had the directory structure been created in the first place, the catalogs would have been rebuilt as part of the upgrade process.

Hope this helps someone else.

Regards

Gary



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search