简体   繁体   English

SQL Server 2005备份和还原

[英]SQL Server 2005 backup and restore

I have two backup files 我有两个备份文件

1) is named 'backup.sql' with a bunch of SQL defining TABLES 1)被命名为“ backup.sql”,其中包含一堆定义表的SQL

2) is named 'backup' with a bunch of encoded data, which I believe are the ROWS 2)被命名为“备份”,其中包含一堆编码数据,我相信这是ROWS


I need to restore these TABLES + ROWS, but all I am able to figure out is how to restore the tables. 我需要还原这些表+行,但是我能弄清楚的是如何还原表。

Any tips on dealing with these files? 有关处理这些文件的任何提示? It's the first time I ever deal with SQL Server. 这是我第一次使用SQL Server。

The backup process would not create a file with actual SQL statements, it would create a binary file. 备份过程不会使用实际的SQL语句创建文件,而是会创建一个二进制文件。 So #1 is not a backup file (it's probably a script someone saved to re-create the schema). 因此,#1不是备份文件(它可能是有人保存来重新创建架构的脚本)。

I would try to use SQL Server Management Studio to restore the second file and see what happens. 我将尝试使用SQL Server Management Studio还原第二个文件,看看会发生什么。 I don't think it will allow you to restore an invalid file, but I would take some basic precautions like backing up the system first. 我认为它不会允许您还原无效的文件,但我会采取一些基本的预防措施,例如先备份系统。

What is the extension for the 'backup' file? “备份”文件的扩展名是什么? Is the filename backup.bak? 文件名是backup.bak吗? If you have a backup file created by sql server then it 'should' contain the logic to create both the tables and restore the data, but it could depend on how the backup was created. 如果您有一个由sql server创建的备份文件,则它“应该”包含创建表和还原数据的逻辑,但是这可能取决于备份的创建方式。

---Edit - -编辑

It is possible for a .SQL file to contain data values as well as the logic to create the tables/columns for a database. .SQL文件可能包含数据值以及为数据库创建表/列的逻辑。 I used to run backups of a MySql database in this way a long time ago...it just is not seen very often with SQL server since it has built in backup/restore funcationality. 很久以前,我曾经以这种方式运行MySql数据库的备份...由于SQL Server具有内置的备份/还原功能,因此在SQL Server中很少见到。

Seems unlikely they would export all the rows from all tables into CSV file, and given you said it looks encrypted, it's making me think that's your actual backup file. 似乎他们不太可能将所有表中的所有行都导出到CSV文件中,并且正如您所说的那样,它看起来已经加密了,这让我认为这是您的实际备份文件。

try this, save a copy of the "backup" file, rename it to backup.bak and run this from SQL Server Management Studio 尝试此操作,保存“备份”文件的副本,将其重命名为backup.bak,然后从SQL Server Management Studio运行它

restore filelistonly from disk='C:\\backup.bak' 从disk ='C:\\ backup.bak'恢复filelistonly

(assuming your file is saved on the root of the C: drive) (假设您的文件保存在C:驱动器的根目录中)

Any results/errors? 有结果/错误吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM