The database ‘file.mdf’ cannot be opened because it is version 655

| December 28, 2010 | 0 Comments

Problem:

This was weird & probably first problem I faced related to Sql Server version(s). I was trying to learn Asp MVC with the help of sample application MvcMusicStore. I open it in VS 2010 and debug. On debugging it throw runtime exception:

System.Data.EntityException was unhandled by user code.
Message=The underlying provider failed on Open.
Source=System.Data.Entity
…………….
InnerException: System.Data.SqlClient.SqlException
Message=The database ‘X:\MVCMusicStore\App_Data\MvcMusicStore.MDF’ cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.
Could not open new database ‘X:\MVCMusicStore\App_Data\MvcMusicStore.MDF’. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file X:\SomeFolder\MVC Music Store COMPLETE\MvcMusicStore-Completed\MvcMusicStore\App_Data\MvcMusicStore.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Source=.Net SqlClient Data Provider
ErrorCode=-2146232060
Class=20
LineNumber=65536
Number=948
Procedure=””
Server=\\.\pipe\9CEF06E2-A18C-41\tsql\query
State=1

Solution:

The reason for exception was that MvcMusicStore application’s database files (.mdf) were created with Sql Server 2008 (version 655). While the application was trying to attach database file with Sql Server 2005 (version 611) instance. And since there is compatibility issues in these two versions so the exception was raised.

To solve this problem you can follow either of the steps:
    1. Upgrade Sql Server 2005 to Sql Server 2008 and create same database files in Sql Server 2008 (as Sql Server 2008 adds metadata to the resulting .mdf files).
    2. Or you can install fresh version of Sql Server 2008 along with Sql Server 2005. BUT since you are (now) having two versions of Sql Server you would need to modify DataSource in connectionString with SqlServer 2008 instance name (.\VSS is instance name I created for… it could be any except sa as it is already there in system)in web.config as follows:



Tags: ,

Category: Error and Solution

Leave a Reply

%d bloggers like this:
N t.term_id = tt.term_id WHERE tt.taxonomy = 'nav_menu' AND t.term_id = 32 LIMIT 1 66 | 0.0003 | enabled | not cached | 897 | SELECT tr.object_id FROM wp_term_relationships AS tr INNER JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('nav_menu') AND tt.term_id IN ('32') ORDER BY tr.object_id ASC 67 | 0.0005 | enabled | not cached | 11135 | SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (225,226,227,228,229) AND wp_posts.post_type = 'nav_menu_item' AND ((wp_posts.post_status = 'publish')) ORDER BY wp_posts.menu_order ASC 68 | 0.0003 | enabled | not cached | 2087 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (226) ORDER BY meta_id ASC 69 | 0.0002 | enabled | not cached | 2087 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (229) ORDER BY meta_id ASC 70 | 0.0002 | enabled | not cached | 2087 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (227) ORDER BY meta_id ASC 71 | 0.0002 | enabled | not cached | 2087 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (225) ORDER BY meta_id ASC 72 | 0.0003 | enabled | not cached | 2087 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (228) ORDER BY meta_id ASC 73 | 0.0003 | enabled | not cached | 4495 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category') AND t.term_id IN ( 4,8,9,2,3 ) ORDER BY t.name ASC 74 | 0.0001 | enabled | cached | 735 | SELECT t.term_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (4) ORDER BY t.name ASC 75 | 0.0003 | enabled | not cached | 529 | SELECT option_value FROM wp_options WHERE option_name = 'text_direction' LIMIT 1 76 | 0.0007 | enabled | not cached | 3802 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (4) ORDER BY t.name ASC 77 | 0.0005 | enabled | not cached | 3587 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (4) ORDER BY t.name ASC 78 | 0.0004 | enabled | not cached | 4902 | SELECT * FROM wp_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4 ORDER BY comment_date_gmt ASC 79 | 0.0003 | enabled | not cached | 631 | SELECT p.ID FROM wp_posts AS p WHERE p.post_date < '2010-12-28 20:38:00' AND p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_date DESC LIMIT 1 80 | 0.0002 | enabled | not cached | 13870 | SELECT * FROM wp_posts WHERE ID = 5 LIMIT 1 81 | 0.0002 | enabled | not cached | 630 | SELECT p.ID FROM wp_posts AS p WHERE p.post_date > '2010-12-28 20:38:00' AND p.post_type = 'post' AND p.post_status = 'publish' ORDER BY p.post_date ASC LIMIT 1 82 | 0.0002 | enabled | not cached | 12689 | SELECT * FROM wp_posts WHERE ID = 3 LIMIT 1 83 | 0.0012 | enabled | not cached | 3089 | SELECT p.ID AS 'id', p.post_title AS 'title', p.post_date AS 'date', p.post_author AS 'uid', ( SUM(v.pageviews)/(IF ( DATEDIFF('2017-07-27 11:45:47', DATE_SUB('2017-07-27 11:45:47', INTERVAL 1 WEEK)) > 0, DATEDIFF('2017-07-27 11:45:47', DATE_SUB('2017-07-27 11:45:47', INTERVAL 1 WEEK)), 1) ) ) AS 'avg_views' FROM wp_popularpostssummary v LEFT JOIN wp_posts p ON v.postid = p.ID WHERE 1 = 1 AND p.post_type IN('post','page') AND v.last_viewed > DATE_SUB('2017-07-27 11:45:47', INTERVAL 1 WEEK) AND p.post_password = '' AND p.post_status = 'publish' GROUP BY v.postid ORDER BY avg_views DESC LIMIT 5; 84 | 0.0002 | enabled | not cached | 11898 | SELECT * FROM wp_posts WHERE ID = 1 LIMIT 1 85 | 0.0003 | enabled | not cached | 16352 | SELECT * FROM wp_posts WHERE ID = 38 LIMIT 1 86 | 0.0002 | enabled | not cached | 11572 | SELECT * FROM wp_posts WHERE ID = 353 LIMIT 1 87 | 0.0002 | enabled | not cached | 12716 | SELECT * FROM wp_posts WHERE ID = 36 LIMIT 1 88 | 0.0004 | disabled (query) | not cached | 0 | SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish') ORDER BY wp_posts.post_date DESC LIMIT 0, 5 89 | 0.0001 | disabled (query) | not cached | 0 | SELECT FOUND_ROWS() 90 | 0.0002 | enabled | not cached | 13704 | SELECT wp_posts.* FROM wp_posts WHERE ID IN (339,2) 91 | 0.0007 | enabled | not cached | 5333 | SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (2, 339) ORDER BY t.name ASC 92 | 0.0005 | enabled | not cached | 5913 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (2,339) ORDER BY meta_id ASC 93 | 0.0025 | enabled | not cached | 7381 | SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,100) AS com_excerpt FROM wp_comments LEFT OUTER JOIN wp_posts ON (wp_comments.comment_post_ID = wp_posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT 5 94 | 0.0004 | enabled | not cached | 10061 | SELECT * FROM wp_posts WHERE ID = 15 LIMIT 1 95 | 0.0002 | enabled | not cached | 14705 | SELECT * FROM wp_posts WHERE ID = 42 LIMIT 1 96 | 0.0004 | enabled | not cached | 2074 | SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC 97 | 0.0002 | enabled | cached | 4714 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category') ORDER BY t.name ASC 98 | 0.0006 | enabled | not cached | 8853 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('post_tag') AND tt.count > 0 ORDER BY tt.count DESC LIMIT 200 99 | 0.0004 | enabled | not cached | 3470 | SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'nav_menu' AND t.term_id = 33 LIMIT 1 100 | 0.0003 | enabled | not cached | 946 | SELECT tr.object_id FROM wp_term_relationships AS tr INNER JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('nav_menu') AND tt.term_id IN ('33') ORDER BY tr.object_id ASC 101 | 0.0005 | enabled | not cached | 11910 | SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (231,232,234,244,289,306) AND wp_posts.post_type = 'nav_menu_item' AND ((wp_posts.post_status = 'publish')) ORDER BY wp_posts.menu_order ASC 102 | 0.0003 | enabled | not cached | 2109 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (234) ORDER BY meta_id ASC 103 | 0.0002 | enabled | not cached | 2092 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (231) ORDER BY meta_id ASC 104 | 0.0002 | enabled | not cached | 2086 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (232) ORDER BY meta_id ASC 105 | 0.0002 | enabled | not cached | 2086 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (289) ORDER BY meta_id ASC 106 | 0.0002 | enabled | not cached | 2086 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (244) ORDER BY meta_id ASC 107 | 0.0002 | enabled | not cached | 2086 | SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (306) ORDER BY meta_id ASC 108 | 0.0006 | enabled | not cached | 26613 | SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (207,209,279,239,301) AND wp_posts.post_type = 'page' AND ((wp_posts.post_status = 'publish')) ORDER BY wp_posts.post_date DESC 109 | 0.0001 | enabled | cached | 735 | SELECT t.term_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (4) ORDER BY t.name ASC 110 | 0.0001 | enabled | cached | 559 | select meta_key from wp_postmeta where meta_key like '_wp_page_template' and meta_value like 'page-youtube.php' 111 | 0.0001 | enabled | cached | 625 | select meta_key from wp_postmeta where meta_key like '_wp_page_template' and meta_value like 'page-portfolio.php' -->