简体   繁体   English

如何导出SQL数据库?

[英]How to export SQL database?

I am a beginner in learning SQL and i am just wondering if i happen to build a database for let's say a customer.我是学习 SQL 的初学者,我只是想知道我是否碰巧为客户构建了一个数据库。 How would i actually give the completed database to the customer ?我实际上如何将完整的数据库提供给客户?

For example, the customer is a school and i made a database of their students and teachers in SQL then in what ways i could give the completed database to the school authority.例如,客户是一所学校,我用 SQL 创建了他们学生和老师的数据库,然后我可以通过什么方式将完成的数据库提供给学校当局。

Thank you in advance !先感谢您 !

The easiest way is to take a backup of the database.最简单的方法是备份数据库。 The backup file can then be passed to the customer and restored in their environment.然后可以将备份文件传递给客户并在他们的环境中恢复。

Depending on your SQL flavour the backup and restore commands may differ.根据您的 SQL 风格,备份和恢复命令可能会有所不同。

However if you are just intending to pass data from the school hosted database to the local authority, then you would want to export the data to a format that the LA can support (eg CSV or XML).但是,如果您只是打算将数据从学校托管的数据库传递到地方当局,那么您可能希望将数据导出为 LA 可以支持的格式(例如 CSV 或 XML)。

Not sure I completely understand the problem but if this is for an application with a small database, and by small I mean about a dozen table, I build would it using an embedded database such as SQLite.不确定我是否完全理解这个问题,但如果这是针对具有小型数据库的应用程序,并且小我的意思是大约十几个表,我会使用嵌入式数据库(如 SQLite)构建它。 That way you your application will come complete with a built-in database all developed into one executable file.这样,您的应用程序将带有一个内置数据库,所有这些数据库都被开发成一个可执行文件。 I have worked with SQLite in the past and it is a very robust database that can store and retrieve very large data sets.我过去曾使用过 SQLite,它是一个非常强大的数据库,可以存储和检索非常大的数据集。 It also interfaces quite well with other languages such as Perl, C++, Java, etc. You may be surprise to find out how many of your current phone apps come complete with a backend database embedded in them.它还可以很好地与其他语言(如 Perl、C++、Java 等)交互。您可能会惊讶地发现,您当前的手机应用程序中有多少内置了后端数据库。

here is for sql server steps for you .这是为您准备的 sql server 步骤。 After step 6 you have 2 more finalization steps to confirm all you have done.在第 6 步之后,您还有 2 个完成步骤来确认您所做的一切。 Your restore sql code is towards the end after step 6您的恢复 sql 代码在第 6 步之后接近尾声

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

RESTORE DATABASE [db_name] FROM DISK = 'X:\MSSQL\Data\FullBackups\db_name.bak' WITH RECOVERY

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

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