Saturday, March 24, 2012

Problem attaching Wiki Database

I'm running SQL Server 2005 Developer edition. I've attempted to attach the MDF file as a database but I get an error that the LDF file doesn't exist. How can I get the Wiki working with SQL Server 2005 Developer Edition?
Regards,
John GriebI have the same problem with attachdatabase too,where is the ldf file?
who had the same problem,tell me a answer please

John Grieb wrote:

I'm running SQL Server 2005 Developer edition. I've attempted to attach the MDF file as a database but I get an error that the LDF file doesn't exist. How can I get the Wiki working with SQL Server 2005 Developer Edition?


I too had the same problems, when you are attaching the mdf file there are a couple things that you need to do:
1. Click "Add" and browse to the MDF file in need
2. In the "Databases to Attach Box", you'll want to modify the "Attach As" field from "D:\WEBSITES\ATLAS\MAIN\APPS\ATLASWIKI\APP_DATA\ATLASWIKI.MDF" to "atlaswiki" (note that you don't add the .mdf extention, you can also change it to whatever you want, incase you have multiple instances running, ie "atlaswiki2")
3. In the Box below "Databases to attach:", there should be two records, one for the mdf and one for the ldf, and the ldf should say "not found" under the "message" column. Highlight the ldf record and click the remove button.
You should be able click ok and attach now, and SQL Server will create the ldf for you. I tried creating a blank ldf file in an appropriate location, but that bombs too, this way is simpler anyway.
Repeat this process for the aspnetdb.mdf, as you'll need this for your user login/authentication stuff.
You'll also have to modify your web.config and change:

<addname="defaultSqlServer"connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|AtlasWiki.mdf" />
<addname="LocalSqlServer"connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />

to:

<addname="defaultSqlServer"connectionString="Data Source=(local);Initial Catalog=atlaswiki;Integrated Security=True" />
<addname="LocalSqlServer"connectionString="Data Source=(local);Initial Catalog=aspnetdb;Integrated Security=True" />
I hope this works for you, good luck! Please post back if it doesn't work.
-von


Worked like a charm.
Who da man....You da man!!!!!!
Thanx,
John Grieb

I have tried the above method, but I run into the following error.

Could not open new database 'atlaswiki'. CREATE DATABASE is aborted.
File activation failure. The physical file name "D:\WebSites\Atlas\main\apps\AtlasWiki\App_Data\atlaswiki_log.ldf" may be incorrect.
The log cannot be rebuilt when the primary file is read-only. (.Net SqlClient Data Provider)

The problem seems to be that the mdf file is showing up as read-only, but when i view the properties on it, it does not show up as read-only, only the file folder holding it does. When i try to change that folder, it seems to work, but next time i go to view it is back to read only. I have tried closing all of the applications and rebooting the machine. Thanks for your help.

-Dan


Had the same problem. This worked:

For some reason a connection cannot be made using the default connection strings on my computer (it's an installation problem specific to this computer, the installation worked right away on another -virtual- computer).

I changed the connection strings (there are 2) to something like"Data Source=localhost;Persist Security Info=True;User ID=sa;Password=******;AttachDBFilename=c:\WikiAtlasWebSite1\app_data\aspnetdb.mdf" and the same for atlaswiki.mdf.

If the wiki works, read the article on enabling searching to find out that one can actualy attach databases without logfiles, you just cannot do it with the SQL Server Management Studio attach wizard.


Can you tell me what you would use to attach without the SQL Server Management Studio or link to the other post? I can't find it.

Thanks.


What I meant was that attaching using the wizard (right click databases en select 'Attach') in SQL Server Management Studio won't work if the logfile is missing. It can however be done by running the query ( in the Management Studio):

sp_attach_single_file_db N'atlaswiki', N'C:\WikiAtlasWebSite1\App_Data\atlaswiki.mdf' (or where the file is located on your computer)

The article I referred to is an article in the Wiki itself which cannot be viewed unless the Wiki is running (a catch 22 situation).


I get this error now. I try setting the properties of the file to be not read only, and they don't show up that way, but the folder containing it shows up as read only even after i check it off and set it to propagate to subfolders.

File activation failure. The physical file name "D:\WebSites\Atlas\main\apps\AtlasWiki\App_Data\atlaswiki_log.ldf" may be incorrect.

The log cannot be rebuilt when the primary file is read-only.

Msg 1813, Level 16, State 2, Line 1

Could not open new database 'atlaswiki'. CREATE DATABASE is aborted.


Folders always show up as read-only in XP, 2000 or 2003. It doesn't mean anything.

Make sure that the service account that is doing the actual work (ASPNET) has sufficient rights.


I am getting the following error now.

Msg 1813, Level 16, State 2, Line 1

Could not open new database 'atlaswiki'. CREATE DATABASE is aborted.

Msg 602, Level 21, State 50, Line 1

Could not find row in sysindexes for database ID 18, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Any ideas?

No comments:

Post a Comment