Restore database from SQL Server 2012 to SQL Server 2008 R2

  • Hi,

    I initially took backup from SQL Server 2012 (database compatibility mode was set to SQL Server 2008 (100)) but when I try to restore that backup on SQL Server 2008 R2 it is giving me error as "Specified cast is not valid".

    I would appreciate if anyone can help me or if there is any alternate solution to backup from SQL Server 2012 and successfully restore it on SQL Server 2008 R2, please let me know.

    Thank you.

  • As far as I know, there is no way to do a backward restore, even if the database was in a compatibility mode that matched the lower version. The compatibility mode impacts how certain sql constructs behave on a database but it doesn't mean that the database is actually internally structured as a database on that native version would be. A 2012 database, no matter what the compatibility mode, is still a 2012 database internally, so a 2008 server wouldn't understand that internal structure or be able to restore it.

    Best advice is to script out all the objects, create them on the older database, then copy the data.


    And then again, I might be wrong ...
    David Webb

  • David Webb-200187 (1/9/2013)


    As far as I know, there is no way to do a backward restore, even if the database was in a compatibility mode that matched the lower version. The compatibility mode impacts how certain sql constructs behave on a database but it doesn't mean that the database is actually internally structured as a database on that native version would be. A 2012 database, no matter what the compatibility mode, is still a 2012 database internally, so a 2008 server wouldn't understand that internal structure or be able to restore it.

    Best advice is to script out all the objects, create them on the older database, then copy the data.

    +1

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • David Webb-200187 (1/9/2013)


    As far as I know, there is no way to do a backward restore, even if the database was in a compatibility mode that matched the lower version. The compatibility mode impacts how certain sql constructs behave on a database but it doesn't mean that the database is actually internally structured as a database on that native version would be. A 2012 database, no matter what the compatibility mode, is still a 2012 database internally, so a 2008 server wouldn't understand that internal structure or be able to restore it.

    Best advice is to script out all the objects, create them on the older database, then copy the data.

    +1, couldnt of said it better myself.

  • +1

    Scripts (create table and etc) out with comptiable to SQL 2008.

  • David Webb-200187 (1/9/2013)


    As far as I know, there is no way to do a backward restore, even if the database was in a compatibility mode that matched the lower version. The compatibility mode impacts how certain sql constructs behave on a database but it doesn't mean that the database is actually internally structured as a database on that native version would be. A 2012 database, no matter what the compatibility mode, is still a 2012 database internally, so a 2008 server wouldn't understand that internal structure or be able to restore it.

    Best advice is to script out all the objects, create them on the older database, then copy the data.

    Have to agree 100%.

  • Right-click the database in SQL 2012...Tasks..."Generate Scripts". Choose the "Advanced" button under "Set scripting options" and set the "script for server version" to the required database format. For "Types of data to script" choose "Schema and data".

  • How do you run the sql file on the destination server? My file is not small - 13Gb - and when I try to open it in SSMS 2008R2 I get the error below. The file was created in 2012.

    Error HRESULT E_FAIL has been returned from a call to a COM component

  • george25 (11/27/2014)


    How do you run the sql file on the destination server? My file is not small - 13Gb - and when I try to open it in SSMS 2008R2 I get the error below. The file was created in 2012.

    Error HRESULT E_FAIL has been returned from a call to a COM component

    You may need to run the file using SQLCMD.

  • Don't script the data unless your database is under a couple hundred MB.

    Script the schema, use bcp to export the data to flat files.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply