使用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. JQuery表格插件DataTables 当前页合计功能

    公司项目表格插件使用的是DataTables,最近添加表合计功能,发现百度统一都是如图类型的代码,不知道是配置问题还是怎么了,在我的页面下根本不能用 var addd=0; $(document).r ...

  2. obj转json

    .js模型(JSON)的获取 方法一: 1.安装Python插件.安装完后配置环境变量,path中添加Python路径. 2.找到three.js\utils\converters\obj\conve ...

  3. 1_MVC+EF+Autofac(dbfirst)轻型项目框架_core层(以登陆为例)

    前言 在上一篇0_MVC+EF+Autofac(dbfirst)轻型项目框架_基本框架中,我已经介绍了这个轻型框架的层次结构,在下面的这篇文章中,我将以教师登陆功能为例,具体来扩充下我的core层的代 ...

  4. [8.1] Triple Step

    A child is running up a staircase with n steps and can hop either 1 step, 2 steps, or 3 steps at a t ...

  5. 关于DOM对象与JQuery对象的那些事

    这个问题源自上一次的工作室讨论班,主题是"jQuery选择器的使用",在讨论班的结尾,我留了一个思考题:  jQuery获取到的对象和直接调用原生Javascript方法获得的对象 ...

  6. 阅读jquery源码与js依赖加载的模块化!

    阅读源码肯定是先下载有注释的源码 我也是醉了,10309 行代码,在陆续续的一个月之内,看完了,虽有收获但收获不大, 直到又一次看jquery的github,怎么会有cmd????没听过使用jquer ...

  7. springmvc2 一个控制器写多个方法(非注解方式)

    出处:http://blog.csdn.net/xuewenke/article/details/23895999 springmvc2 一个控制器写多个方法(非注解方式) 分类: spring 20 ...

  8. iOS判断是模拟器还是真机

    #if TARGET_IPHONE_SIMULATOR //模拟器   #elif TARGET_OS_IPHONE //真机   #endif

  9. 数字对象NSNumber

    //将int类型转化成对象 ; NSNumber *numberString = [NSNumber numberWithInt:number]; //对象是可以放入数组的 NSArray *arra ...

  10. 吐槽scala

    scala可能是唯一一个编译器和IDE对代码有不同理解的语言.当你开始用scala的高级特性的时候,他们的分歧特别的大,以至于现在,intellij上的scala插件已经不敢对可能编译不通过的代码标记 ...