Restore SQL Server 2008 data to 2005

First reprint a file:

Reprint link: http://hahha2003.blog.163.com/blog/static/248577920123106129711/

Reprinted content:

Error 3154 occurs when Sql Server 2008 restores the 2005 database (the second method found on the Internet has been verified and passed, leaving it as a backup)

 

Solution 1: Don't right-click on the database name and select restore, but if you right-click on the word "database" in the root directory and select restore, and then select the database, the problem can be solved. If it doesn't work, refer to Method 2

 

Solution 2: Write sql statement processing:

RESTORE DATABASE [databaseName] 
FROM DISK = N'X:\Database Backup\database.bak' with replace,     
NOUNLOAD, STATS = 10

GO

-------------------------------------------------- ---------End of reprint --------------------------------------- --------------------

I have tested both of the above methods, but neither can solve the problem . Both methods will give an error: The structure of the media family on device "X:\XXX" is incorrect. SQL Server cannot process this media family. And whether the "Compatibility Level" of the SQL Server 2008 database is "SQL Server 2005" will fail.

 

The following is the method I used to restore successfully.

What is used is not the method of backup and restoration, but the method of generating SQL scripts . It is recommended to use when the data is relatively small, and I have no good solution for big data.

 

Step 1: Generate a script on the server side :

1. Select the database to generate the script, right-click, task ---- "Generate script ;

2. Introduction: the next step (this step is to tell you what to do later, you don't need to look at it, just go directly to the next step);

3. Select the database object to be scripted: Check "Script the entire database and all database objects" , the next step;

4. Set scripting options: mainly modify two places ( emphasis )

a. File name: that is, the name of the script file and the place where it is saved, it is best to change it to a place we know

b. "Advanced" button: Clicking the "Advanced" button will pop up the "Advanced Scripting Options" dialog box, modify the following options, other defaults or modify as needed.

Write trigger script: true (default is false, trigger script will be generated after modification to true, and the corresponding trigger will be in the new table)

Writing DROP and CREATE scripts: Writing CREATE scripts

Scripting for server version: SQL Server 2005 ( critical )

Type of data to script: schema and data ( key )

After setting, click OK to close the option box.

5. Next step, next step, finish.

 

Step 2: Client-side restore : Execute the script directly in SQL Server 2005.

If the client does not have a database with the same name as the database, it can be executed directly.

If so, you need to modify the name of the database in the script, otherwise an error will be reported.

 

I don't know how to restore the big data. If you know, leave a message, thank you!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326397253&siteId=291194637