使用DAC,能够将database的schema 和 data 从一个server 或 cloud 上复制到另外一个server上,存储schema 和 data的文件是 .bacpac 文件。

方法一,使用SSMS Wizard

右击Databases,打开“Import Data-tier Application”,打开Wizard,按照UI提示配置即可

方法二,使用SqlPackage.exe 实现自动Import DAC

Import the bacpac file to SQLAzure

“C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe” /a:Import /sf:C:\DataExtraction\Tailspintoys.bacpac /tsn:cgrd7z8kac.database.windows.net /tdn:Tailspintoys /tu:mysysadmin@cgrd7z8kac /tp:Pa55w0rd

sf – Specifies a source file to be used as the source of action instead of database.

tsn –  Specifies the name of the server that hosts the target database.

tdn –  Specifies the name of the target database.

tu – SQL Server user that is used to get access to the target database.

tp – specifies password that is used to get access to the target database.

如果使用Windows 验证方式登陆,可以使用ttsc差数代替 tu 和 tp。

C:\Program Files (x86)\Microsoft SQL Server\\DAC\bin\SqlPackage.exe -a:Import -sf:C:\TestDAC\dac_name.bacpac -tsn:server_name -tdn:db_name -ttsc:true

ttsc:{True | False} Specifies whether to use Secure Socket Layer (SSL) to encrypt the source database connection and bypass walking the certificate chain to validate trust.

在SSIS中使用Execute Process Task 调用SqlPackage.exe ,设置相应的Arguments,创建Schedule,能够实现从bacpac文件自动还原db。

Appendix

Backup Package (.bacpac)

A BACPAC is an artifact that encapsulates the database schema as well as the data stored in the database. The BACPAC is a Windows file with a .bacpac extension. Similar to the DACPAC, the BACPAC file format is open – the schema contents of the BACPAC are identical to that of the DACPAC. The data is stored in JSON format.

DACPAC and BACPAC are similar but they target different scenarios. A DACPAC is focused on capturing and deploying schema, including upgrading an existing database. The primary use case for a DACPAC is to deploy a tightly defined schema to development, test, and then production environments, and the reverse: capturing production’s schema and applying it to back to test and development environments.

A BACPAC, on the other hand, is focused on capturing schema and data. A BACPAC is the logical equivalent of a database backup and cannot be used to upgrade existing databases. The primary use case for a BACPAC is to move a database from one server to another - or from a local server to the cloud - and archiving an existing database in an open format.

A BACPAC supports two main operations:

  • EXPORT– The user can export the schema and the data of a database to a BACPAC.

  • IMPORT – The user can import the schema and the data into a new database in the host server.

参考doc:

Data-tier Applications

Export and Import BACPAC using command line

SqlPackage.exe

DAC Usage4:从 Backup Package(.bacpac)还原DB的更多相关文章

  1. ylb: 数据库备份(Backup)和还原(Restore)

    ylbtech-SQL Server:SQL Server- 数据库备份(Backup)和还原(Restore) -- ======================================== ...

  2. How to backup a remote PostgreSQL db and restore it locally?

    pg_dump and pg_restore 来备份和恢复数据库中的数据. 原文:  https://ksearch.wordpress.com/2012/09/28/how-to-backup-a- ...

  3. DAC Usage2:通过DAC实现DB Schema的Migration和Upgrade

    一,Introduce Extract DAC 是从现存的DB中创建DAC,抽取DB Object的definition 和 与之相关的实例级别的元素,比如Login,以及Login 和User之间的 ...

  4. Aras Innovator DB备份与还原

    错误信息 确认到该问题是因为孤立帐号的问题,在解决孤立帐号之前,可以通过语句查看,另外,还原了DB后,系统不会自动创建原来的登陆帐号的,需要手动新增登陆帐号 #查看孤立帐号列表exec sp_chan ...

  5. SQLServer批量备份与还原

    原文地址:http://www.cnblogs.com/fygh/archive/2011/09/09/2172546.html 备份与还原是数据库避不开的主题,而作为DBA,经常会面临将一台机器上的 ...

  6. mysql数据库的备份和还原的总结

    mysql数据库的备份和还原的总结 (来自一运维同事的总结) 1. 备份方式: 热备:数据库在线进行备份,不影响读和写的在线备份方式! 温备:数据库在线进行备份,对表备份时先锁定写操作,仅可以执行读操 ...

  7. SQLServer 批量备份与还原

    备份与还原是数据库避不开的主题,而作为DBA,经常会面临将一台机器上的所有数据库重新构建到一台新机器上的要求: 在现在都讲究自动化管理的时代,传统的界面操作备份还原的做法不仅浪费时间和精力,而且还很容 ...

  8. mysql数据库-备份与还原-Percona XtraBackup 2.4备份工具使用

    目录 xtrabackup 特点 备份生成的相关文件 xtrabackup 安装 xtrabackup 用法 1 备份 2 预备份 3 还原 4 其他 还原注意事项 xtrabackup实现完全备份及 ...

  9. 通过innobackupex实现对MySQL的完整备份与还原

    备份 新建一个用于存放备份的目录 mkdir /backup 执行以下命令: innobackupex --password=test /backup/ 执行完后你会看到“completed OK!” ...

随机推荐

  1. 将Unreal4打包后的工程嵌入到Qt或者桌面中

    #include "widget.h" #include "ui_widget.h" #include "windows.h" #inclu ...

  2. html5与css3

    Video属性 符号:<video>这里插入视频</video> Drag 和 drop属性 为了使元素可拖动,把 draggable 属性设置为 true: 2.       ...

  3. 单片机与控制实验(5)——重量测量并在LCD12864显示

    一.实验目的和要求 掌握点阵式液晶显示屏的原理和控制方法,掌握点阵字符的显示方法.掌握模拟/数字(A/D)转换方式,进一步掌握使用C51语言编写程序的方法,使用C51语言编写实现重量测量的功能. 二. ...

  4. JavaScript之基础篇

    标识符 命名要求 以字母.下划线或者$开头: 由字母.下划线.$和数字组成. 关键字和保留字 关键字.保留字不可以作为标识符. 大小写敏感 区分大小写. 基本数据类型 Number 整数 浮点数 特殊 ...

  5. 【原】iOS学习之UITabBar的隐藏

    当页面使用 UITabBarController + UINavigationController 框架的时候,当跳转到详情页面的时候,如果 UITabBar 仍然存在的话就会造成逻辑混乱,用户体验也 ...

  6. c#比较两个List相等

    1.if(ListA.Count == ListB.Count && ListA.Count(t => !ListB.Contains(c)) == 0) 数量相等,元素值相等即 ...

  7. 【读书笔记】《编程珠玑》第一章之位向量&位图

    此书的叙述模式是借由一个具体问题来引出的一系列算法,数据结构等等方面的技巧性策略.共分三篇,基础,性能,应用.每篇涵盖数章,章内案例都非常切实棘手,解说也生动有趣. 自个呢也是头一次接触编程技巧类的书 ...

  8. 如何在windows上编译Chromium (CEF3) 并加入MP3支持(二)

    时隔一年,再次编译cef3,独一无二的目的仍为加入mp3支持.新版本的编译环境和注意事项都已经发生了变化,于是再记录一下. 一.编译版本 cef版本号格式为X.YYYY.A.gHHHHHHH X为主版 ...

  9. 将excel数据读入matlab

    1.[NUM,TXT,RAW]=xlsread('example'),其中example是你的excel名,假设所有的数据都在example.xls中. 2.NUM返回的是excel中的数据,TXT输 ...

  10. clang: error: linker command failed with exit code 1 (use -v to see invocati

    安装了 pod 的项目,如果仍旧打开 xcodeproject 文件, 运行时会弹出此 bug