主頁 > 知識庫 > 附加到SQL2012的數(shù)據(jù)庫就不能再附加到低于SQL2012的數(shù)據(jù)庫版本的解決方法

附加到SQL2012的數(shù)據(jù)庫就不能再附加到低于SQL2012的數(shù)據(jù)庫版本的解決方法

熱門標簽:外呼系統(tǒng)的話術(shù) 競圣地圖標注服務(wù) 貴州外呼回撥系統(tǒng)是什么 陽光創(chuàng)信ai外呼獲客系統(tǒng)助力 衛(wèi)星地圖標注距離 云南全自動外呼系統(tǒng)公司 智能外呼系統(tǒng)需要多少錢 安陽天音防封電銷卡 智能語音車載電話機器人

昨天我只是將數(shù)據(jù)庫附加到SQL2012,然后各個數(shù)據(jù)庫都做了收縮事務(wù)日志的操作

兼容級別這些都沒有改

再附加回SQL2005的時候就報錯

在SQL2012里附加,確實是90級別,但是在SQL2005死活附加不上

備份數(shù)據(jù)庫再還原也是一樣

重建事務(wù)日志也是一樣

然后我做了一個實驗,檢查一下附加到SQL2012的數(shù)據(jù)庫和附加到SQL2005的數(shù)據(jù)庫,兩個數(shù)據(jù)庫的文件頭有什么不同

注意:兩個數(shù)據(jù)庫的兼容級別都是90,附加到SQL2012之后我也沒有動過兼容級別!!

我們用同一個數(shù)據(jù)庫,分別附加到SQL2005上和SQL2012上,看一下附加之后數(shù)據(jù)庫的文件頭有沒有改變

這個數(shù)據(jù)庫的兼容級別是90的

附加到SQL2012之后,我也不改變他的兼容級別

查看文件頭的SQL語句如下,實際上就是數(shù)據(jù)庫的第0頁:

復(fù)制代碼 代碼如下:

DBCC TRACEON(3604,-1)
DBCC PAGE(dlgpos,1,0,3)


在SQL2012里和SQL2005里都執(zhí)行一下

將結(jié)果復(fù)制粘貼到一個新建的記事本里,命名好

復(fù)制代碼 代碼如下:

DBCC 執(zhí)行完畢。如果 DBCC 輸出了錯誤信息,請與系統(tǒng)管理員聯(lián)系。
PAGE: (1:0)

BUFFER:

BUF @0x035D7380
bpage = 0x05BC0000                   bhash = 0x00000000                   bpageno = (1:0)
bdbid = 5                            breferences = 0                      bUse1 = 8142
bstat = 0xc00009                     blog = 0x59ca2159                    bnext = 0x00000000
PAGE HEADER:

Page @0x05BC0000
m_pageId = (1:0)                     m_headerVersion = 1                  m_type = 15
m_typeFlagBits = 0x0                 m_level = 0                          m_flagBits = 0x208
m_objId (AllocUnitId.idObj) = 99     m_indexId (AllocUnitId.idInd) = 0    Metadata: AllocUnitId = 6488064
Metadata: PartitionId = 0            Metadata: IndexId = 0                Metadata: ObjectId = 99
m_prevPage = (0:0)                   m_nextPage = (0:0)                   pminlen = 0
m_slotCnt = 1                        m_freeCnt = 7636                     m_freeData = 2844
m_reservedCnt = 0                    m_lsn = (132:328:1)                  m_xactReserved = 0
m_xdesId = (0:0)                     m_ghostRecCnt = 0                    m_tornBits = 1431739479
Allocation Status
GAM (1:2) = ALLOCATED                SGAM (1:3) = NOT ALLOCATED           PFS (1:1) = 0x44 ALLOCATED 100_PCT_FULL
DIFF (1:6) = CHANGED                 ML (1:7) = NOT MIN_LOGGED           
File Header Data:
Record Type = PRIMARY_RECORD         Record Attributes =  NULL_BITMAP VARIABLE_COLUMNS
Memory Dump @0x5D95C952
00000000:   30000800 00000000 2d000000 00000000 ?0.......-.......        
00000010:   2c007a00 7a007c00 7e008200 86008a00 ?,.z.z.|.~.......        
00000020:   8e009800 a200ac00 ac00b000 b400b800 ?................        
00000030:   bc00c600 e200ec00 f6000001 10011a01 ?................        
00000040:   2a012e01 38013801 44015401 54015401 ?*...8.8.D.T.T.T.        
00000050:   54015401 54015401 64016401 64016e01 ?T.T.T.T.d.d.d.n.        
00000060:   78019401 9e01ae01 ca019eb2 1d7874c9 ?x............xt.        
00000070:   5d4d85b9 d1422e77 c1620100 01008002 ?]M...B.w.b......        
00000080:   0000ffff ffff8000 00000000 00000000 ?................        
00000090:   00000000 00000000 00000000 00000000 ?................        
000000A0:   00000000 00000000 00000000 80010000 ?................        
000000B0:   00000000 ffffffff 00020000 7e000000 ?............~...        
000000C0:   c6000000 01007e00 0000c600 00000100 ?......~.........        
000000D0:   0000355a f94bc493 9149ac29 044140d0 ?..5Z.K...I.).A@.        
000000E0:   3b1f7e00 0000b100 00002500 00000000 ?;.~.......%.....        
000000F0:   00000000 00008400 00003601 00002500 ?..........6...%.        
00000100:   0567c9fb b5520346 853c86ad b3f47661 ?.g...R.F.....va        
00000110:   00000000 00000000 0000018e a4cb618f ?..............a.        
00000120:   414c90c3 68f1a4fd 0d810800 00007e00 ?AL..h.........~.        
00000130:   0000c600 00000100 44004c00 47005000 ?........D.L.G.P.        
00000140:   4f005300 cf6c06e9 4b9b3649 a11c2b70 ?O.S..l..K.6I..+p        
00000150:   dbebb977 355af94b c4939149 ac290441 ?...w5Z.K...I.).A        
00000160:   40d03b1f 00000000 00000000 00000000 ?@.;.............        
00000170:   00000000 00000000 00000000 00000000 ?................        
00000180:   00000000 00000000 00000000 00000000 ?................        
00000190:   00000000 7e000000 b1000000 25003804 ?....~.......%.8.        
000001A0:   48829a28 104c95f3 4b9d6a91 ab480000 ?H..(.L..K.j..H..        
000001B0:   00000000 00000000 00000000 00000000 ?................        
000001C0:   00000000 00000000 0000???????????????..........              
BindingID = 781db29e-c974-4d5d-85b9-d1422e77c162                          FileGroupId = 1
FileIdProp = 1                       Size = 640                           MaxSize = 65535
Growth = 128                         Perf = 0                             BackupLsn = (0:0:0)
MaxLsn = (126:198:1)                 FirstLsn = (126:177:37)              OldestRestoredLsn = (0:0:0)
FirstUpdateLsn = (0:0:0)             FirstNonloggedUpdateLsn = [NULL]     CreateLsn = (0:0:0)
DifferentialBaseLsn = (132:310:37)   DifferentialBaseGuid = fbc96705-52b5-4603-853c-86adb3f47661
MinSize = 384                        Status = 0                           UserShrinkSize = 65535

DBCC 執(zhí)行完畢。如果 DBCC 輸出了錯誤信息,請與系統(tǒng)管理員聯(lián)系。

SQL2012文件頭

復(fù)制代碼 代碼如下:

DBCC 執(zhí)行完畢。如果 DBCC 輸出了錯誤信息,請與系統(tǒng)管理員聯(lián)系。
PAGE: (1:0)

BUFFER:

BUF @0x0456ACA8
bpage = 0x187CA000                  bhash = 0x00000000                  bpageno = (1:0)
bdbid = 9                           breferences = 0                     bcputicks = 0
bsampleCount = 0                    bUse1 = 8145                        bstat = 0x9
blog = 0x21215a7a                   bnext = 0x00000000                 
PAGE HEADER:

Page @0x187CA000
m_pageId = (1:0)                    m_headerVersion = 1                 m_type = 15
m_typeFlagBits = 0x0                m_level = 0                         m_flagBits = 0x208
m_objId (AllocUnitId.idObj) = 99    m_indexId (AllocUnitId.idInd) = 0   Metadata: AllocUnitId = 6488064
Metadata: PartitionId = 0           Metadata: IndexId = 0               Metadata: ObjectId = 99
m_prevPage = (0:0)                  m_nextPage = (0:0)                  pminlen = 0
m_slotCnt = 1                       m_freeCnt = 7636                    m_freeData = 3302
m_reservedCnt = 0                   m_lsn = (141:733:159)               m_xactReserved = 0
m_xdesId = (0:0)                    m_ghostRecCnt = 0                   m_tornBits = 426768658
DB Frag ID = 1                     
Allocation Status
GAM (1:2) = ALLOCATED               SGAM (1:3) = NOT ALLOCATED          PFS (1:1) = 0x44 ALLOCATED 100_PCT_FULL
DIFF (1:6) = CHANGED                ML (1:7) = NOT MIN_LOGGED          
File Header Data:
Record Type = PRIMARY_RECORD        Record Attributes =  NULL_BITMAP VARIABLE_COLUMNS
Record Size = 458                  
Memory Dump @0x1019CB1C
00000000:   30000800 00000000 2d000000 00000000 2c007a00  0.......-.......,.z.
00000014:   7a007c00 7e008200 86008a00 8e009800 a200ac00  z.|.~...............
00000028:   ac00b000 b400b800 bc00c600 e200ec00 f6000001  ....................
0000003C:   10011a01 2a012e01 38013801 44015401 54015401  ....*...8.8.D.T.T.T.
00000050:   54015401 54015401 64016401 64016e01 78019401  T.T.T.T.d.d.d.n.x...
00000064:   9e01ae01 ca019eb2 1d7874c9 5d4d85b9 d1422e77  .........xt.]M...B.w
00000078:   c1620100 01000003 0000ffff ffff8000 00000000  .b..................
0000008C:   00000000 00000000 00000000 00000000 00000000  ....................
000000A0:   00000000 00000000 00000000 80010000 00000000  ....................
000000B4:   ffffffff 00020000 7e000000 c6000000 01007e00  ........~.........~.
000000C8:   0000c600 00000100 0000355a f94bc493 9149ac29  ..........5Z.K...I.)
000000DC:   044140d0 3b1f7e00 0000b100 00002500 00000000  .A@.;.~.......%.....
000000F0:   00000000 00008400 00003601 00002500 0567c9fb  ..........6...%..g..
00000104:   b5520346 853c86ad b3f47661 00000000 00000000  .R.F.....va........
00000118:   0000018e a4cb618f 414c90c3 68f1a4fd 0d810800  ......a.AL..h.......
0000012C:   00007e00 0000c600 00000100 44004c00 47005000  ..~.........D.L.G.P.
00000140:   4f005300 cf6c06e9 4b9b3649 a11c2b70 dbebb977  O.S..l..K.6I..+p...w
00000154:   355af94b c4939149 ac290441 40d03b1f 00000000  5Z.K...I.).A@.;.....
00000168:   00000000 00000000 00000000 00000000 00000000  ....................
0000017C:   00000000 00000000 00000000 00000000 00000000  ....................
00000190:   00000000 7e000000 b1000000 25003804 48829a28  ....~.......%.8.H..(
000001A4:   104c95f3 4b9d6a91 ab480000 00000000 00000000  .L..K.j..H..........
000001B8:   00000000 00000000 00000000 00000000 0000      ..................
BindingID = 781db29e-c974-4d5d-85b9-d1422e77c162                         FileIdProp = 1
FileGroupId = 1                     Size = 768                          MaxSize = 65535
Growth = 128                        Perf = 0                            BackupLsn = (0:0:0)
FirstUpdateLsn = (0:0:0)            OldestRestoredLsn = (0:0:0)         FirstNonloggedUpdateLsn = [NULL]
MinSize = 384                       Status = 0                          UserShrinkSize = 65535
SectorSize = 512                    MaxLsn = (126:198:1)                FirstLsn = (126:177:37)
CreateLsn = (0:0:0)                 DifferentialBaseLsn = (132:310:37) 
DifferentialBaseGuid = fbc96705-52b5-4603-853c-86adb3f47661              FileOfflineLsn = (0:0:0)
FileIdGuid = cba48e01-8f61-4c41-90c3-68f1a4fd0d81                        RestoreStatus = 8
RestoreRedoStartLsn = (126:198:1)   RestoreSourceGuid = e9066ccf-9b4b-4936-a11c-2b70dbebb977
HardenedSkipLsn = [NULL]            ReplTxfTruncationLsn = [NULL]       TxfBackupLsn = [NULL]
FstrContainerSize = [NULL]          MaxLsnBranchId = 4bf95a35-93c4-4991-ac29-044140d03b1f
SecondaryRedoStartLsn = [NULL]      SecondaryDifferentialBaseLsn = [NULL]
ReadOnlyLsn = (0:0:0)               ReadWriteLsn = (0:0:0)             
RestoreDifferentialBaseLsn = (126:177:37)                               
RestoreDifferentialBaseGuid = 82480438-289a-4c10-95f3-4b9d6a91ab48      
RestorePathOrigin
hex (dec) = 0x00000000:00000000:0000 (0:0:0)                            
m_guid = 00000000-0000-0000-0000-000000000000                           
DatabaseEncryptionFileState = [NULL]FCBFileDEK = [NULL]                

DBCC 執(zhí)行完畢。如果 DBCC 輸出了錯誤信息,請與系統(tǒng)管理員聯(lián)系。



可以用Beyond Compare這個軟件比較一下兩者的文件頭的差異

Beyond Compare這個軟件會把兩個txt文件中的相同點用藍色標記出來,不同點用紅色標記出來

當附加到SQL2012之后,數(shù)據(jù)庫的文件頭已經(jīng)走樣了,就算你沒有動過兼容級別,這也是造成曾經(jīng)附加到SQL2012的數(shù)據(jù)庫

再也附加不上SQL2005上的原因

可以看到SQL2012的數(shù)據(jù)庫記錄的信息比SQL2005詳細多了,多了很多內(nèi)容


也可以用下面的SQL語句看文件頭的內(nèi)容,不過信息比較少

1 DBCC fileheader('DLGPOS')


總結(jié)

上面的實驗證明了,當你將一個SQL2005的數(shù)據(jù)庫附加到SQL2012上的時候,SQL2012馬上改變數(shù)據(jù)庫的文件頭

就算你不動數(shù)據(jù)庫兼容級別,實際上數(shù)據(jù)庫的信息已經(jīng)改變了(這里指文件頭信息)

所以你死活附加不回去SQL2005了

以后不要輕易附加數(shù)據(jù)庫到SQL2012上,不然的話。。。。。。

 

補充一下

您可能感興趣的文章:
  • 用sql語句實現(xiàn)分離和附加數(shù)據(jù)庫的方法
  • SQLServer 附加數(shù)據(jù)庫后出現(xiàn)只讀或失敗的解決方法
  • mssql server 數(shù)據(jù)庫附加不上解決辦法分享
  • sql2008 附加數(shù)據(jù)庫時出現(xiàn)錯誤5123提示的解決方法
  • SQL SERVER 2008 無法附加數(shù)據(jù)庫的解決方法
  • SQL2008 附加數(shù)據(jù)庫提示5120錯誤解決方法
  • SQL Server 數(shù)據(jù)庫分離與附加(圖文教程)
  • Sqlserver 2005附加數(shù)據(jù)庫時出錯提示操作系統(tǒng)錯誤5(拒絕訪問)錯誤5120的解決辦法
  • sql server2012附加數(shù)據(jù)庫問題解決方法
  • SQL附加數(shù)據(jù)庫失敗問題的解決方法

標簽:寧夏 營口 欽州 鄂爾多斯 河源 湘潭 預(yù)約服務(wù) 周口

巨人網(wǎng)絡(luò)通訊聲明:本文標題《附加到SQL2012的數(shù)據(jù)庫就不能再附加到低于SQL2012的數(shù)據(jù)庫版本的解決方法》,本文關(guān)鍵詞  附,加到,SQL2012,的,數(shù)據(jù)庫,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《附加到SQL2012的數(shù)據(jù)庫就不能再附加到低于SQL2012的數(shù)據(jù)庫版本的解決方法》相關(guān)的同類信息!
  • 本頁收集關(guān)于附加到SQL2012的數(shù)據(jù)庫就不能再附加到低于SQL2012的數(shù)據(jù)庫版本的解決方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章