天天看點

記一次SQL server 2005 到SQL server 2008 資料庫遷移

    最近周末完成了一個從SQL server 2005更新到SQL server 2008的更新遷移,其實質是一個伺服器遷移的過程。比較複雜的是這個伺服器上的複制關系,自身既作為釋出伺服器,又作為訂閱伺服器,是以整個遷移同時需保證這些複制關系依舊可用。這個主伺服器是供ERP使用,涉及到的子產品也比較相對多,是以從遷移到驗證整個過程還是比較長。記下本文以示慶賀。

一、主要的步驟

    1、檢查現有資料庫的備份完整性(含釋出及訂閱資料庫)及存在的複制關系  

    2、停止原伺服器所有服務(含agent),複制所有需要遷移的資料檔案到新伺服器

    3、導出原伺服器上的釋出對象

    4、将資料庫附加到新伺服器

    5、建立/配置分發伺服器

    6、新伺服器釋出文章(3份)

    7、在新伺服器上删除之前的訂閱

    8、在釋出伺服器TK456/KSERP上重新初始化指向新伺服器的訂閱

二、遷移過程中碰到的錯誤及解決辦法

    在新環境配置好了複制之後,收到如下錯誤提示:

    Invalid column name ‘originator_id’. (Microsoft SQL Server, Error: 207)

    Create replication fails on database which is migrated from SQL Server 2005 with error

    -- Author : Leshami

    -- Blog   : http://blog.csdn.net/leshami

    Error:

    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ——————————

    Invalid column name ‘originator_id’. (Microsoft SQL Server, Error: 207)

    解決方案

    Resolution:

    1.  Add originator_id  column to syspublications table in publication db. Run below query in your publication DB.

        ALTER TABLE dbo.syspublications ADD [originator_id] [int] NULL;

    2. Add a column originator_id  into the view dbo.syspublications inside distribution database

    3. Add a originator_id  column into IHpublications table in distribution database

三、現場花絮

記一次SQL server 2005 到SQL server 2008 資料庫遷移
記一次SQL server 2005 到SQL server 2008 資料庫遷移