DAC Usage2:通过Extract,Register 和 Upgrade DAC,实现DB Schema的Migration

一,Introduce

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

The extraction process creates a DAC package file that contains definitions of the database objects and their related instance-level elements. For example, a DAC package file contains the database tables, stored procedures, views, and users, along with the logins that map to the database users.

Register DAC是将DAC包含的object definition 和 related instance-level elements 注册到msdb系统数据库中,从视图 msdb.dbo.sysdac_instances 查看注册的DAC Instance,从表 msdb.[dbo].[sysdac_history_internal] 查看注册的历史记录,后缀是internal,不要修改这些表的记录。

Registration process builds a data-tier application (DAC) definition that describes the objects in an existing database, and register the DAC definition in the msdb system database.

Upgrade DAC是指对现存DB的object definition 和 related instance-level elements 进行upgrade,进行db schema 版本升级。

A DAC upgrade is an in-place process that alters the schema of the existing database to match the schema defined in a new version of the DAC. The new version of the DAC is supplied in a DAC package file.

二,Usage Example

1,Create Data

Use DAC_Study
go

Create Table dbo.dt_1
(
id int,
name varchar(10),
CreateDate datetime)
go

insert into dbo.dt_1
DEFAULT values;
go 11

create view vw_dt
as

select id,name,CreateDate
from dbo.dt_1

go

create procedure dbo.usp_get_ID_Name
as
begin

    select id,name
    from dbo.dt_1
end
go

create function dbo.udf_GetDate( @id int)
returns DateTime
begin

    declare @dt datetime

    select @dt=CreateDate
    from dbo.dt_1

    return @dt
end
go

2, Extract a DAC

选中一个DB,点击Tasks->Extract Data-tier Application...,打开Extract DAC Wizard

从Left Pane 可以看出,Extract DAC主要分为Set Properties,Validation 和 build Package 三步。

Step1, Set DAC Properties

Application name 属性必须填写正确,用于标识DAC。

These properties are used to identify the DAC and help distinguish it from others.

Application Name- This name identifies the DAC. It can be different than the name of the DAC package file and should describe your application.

Overwrite existing file - Select this check box to replace the DAC package file if one already exists with the same name.

Step2,Validation and Summary

对属性设置的Validation 和 Summary

Step3, build Package

创建DAC,在Right Pane中有Result 字段,用以 indicate 创建DAC的结果。

创建DAC成功之后,会在Specified Folder下生成 DAC_Study.dacpac 文件。

3,unpack DAC

unpack DAC 就是拆包,打开dacpac 文件,查看文件的内容。

Use the Unpack Data-tier Application dialog box to unzip the scripts and files from a data-tier application (DAC) package. The scripts and files are placed in a folder where they can be reviewed before the package is used to deploy the DAC into a production system. The contents of one DAC can also be compared with the contents of another package unpacked to another folder.

右键点击dacpac文件,弹出Unpack...,选择拆分文件所存放的folder。

拆解之后,共有四个文件,能够打开逐一查看。

A Transact-SQL script that contains the statements for creating the objects defined in the DAC.

4,Register DAC

在目标实例上创建一个空的DB,DB 不一定和Extract的DB 同名,这里创建的Empty DB是DAC_Test,点击Task->Register as Data-tier Application...,弹出Register DAC Wizard

Step1, Set Properties

Application Name 属性必须填写正确,必须和Extract DAC时填写的Application Name 相同。

Application name. - A string that specifies the name used to identify the DAC defintion, the field is been populated with the database name.

Step2,Vaildation and Summary

Step3, Register DAC

Register DAC,并查看Register的结果。

Step4, 从MSDB system DB中查看Register DAC的结果

从视图 msdb.dbo.sysdac_instances 查看注册的DAC Instance,从表 msdb.[dbo].[sysdac_history_internal] 查看注册的历史记录,后缀是internal,不要修改这些表的记录。

5,Upgrade DAC

A DAC upgrade is an in-place process that alters the schema of the existing database to match the schema defined in a new version of the DAC. The new version of the DAC is supplied in a DAC package file.

选中注册的DB,点击 Tasks->Upgrade Data-tier Application...,打开 Upgrader DAC Wizard

Step1,Select package

Step2,Detect Change

Use this page reports the results of the wizards check for changes made to the database that make it‘s schema different than the schema definition stored in the DAC metadata in msdb. For example, if CREATE, ALTER, or DROP statements have been used to add, change, or remove objects from the database after the DAC was originally deployed. The page first displays a progress bar, and then reports the results of the analysis.

Detecting change, this may take a few minutes - Displays a progress bar as the wizard checks for differences between the current schema of the database and the objects in the DAC definition.

Step3,Option

Step4,Review Upgrade Plan

Step5,Summary

Step6,Upgrade DAC

查看Action,Upgrade DAC 就是一个Deployment 的过程,最终Register Metadata。

三,Check Generation

打开 DAC_Test DB,查看产生的Object,可以看到,通过Extract,Register 和 Upgrade,实现DB Schema的Migration。

参考文档:

Data-tier Applications

时间: 2024-08-04 15:34:04

DAC Usage2:通过Extract,Register 和 Upgrade DAC,实现DB Schema的Migration的相关文章

STM32之DAC君

如花说得好:呃呃呃.是俗话说得好:有了ADC,怎可少了DAC..我觉得奇怪.今天我开头就直奔主题了.我想了想,总结了一句话:孙悟空纵然有七十二变.无论是变成猫也好,变成狗也罢.始终还是会变回他本身.所以我怎么的拐弯抹角,还是会回到DAC..这不.前面几句废话,还是回到了讲DAC上来了..好吧.今天就直接一点吧,换个风格的开头. 先来张比如花漂亮的照片.大家请尽情欣赏:因为其够美丽了.所以我就不展现我美丽而销魂的涂鸦了. 鉴赏过之后.我们来看看STM32之DAC的Resume(简历简介): ● 2

启用SQL Server 2008的专用管理员连接(DAC)

参考:http://technet.microsoft.com/zh-cn/library/ms178068(v=SQL.105).aspx 问题: 一个在我们公司实习的DBA向我询问如何开启SQL Server 2008的DAC.起初我想直接告诉他,但更明智的选择是将文档选项共享.本文将向你讲述如何在SQL Server 2008中打开DAC. 解决方案: 微软在SQL Server 2005中添加了DAC新特性.数据库管理员可以在数据库无法响应正常连接时使用该特性连接数据库.连接以后,DBA

对ADC(DAC)的线性度(INL和DNL)的一点理解 [转]

大家在使用ADC的时候,往往最关注位数,而对ADC的线性度往往会忽略. 其实这个线性度也是ADC非常重要的指标,ADC(或DAC,其实ADC也是由DAC组成的)线性度指标有两个: INL:翻译过来叫“积分非线性”,指的是ADC整体的非线性程度. DNL:翻译过来叫“微分非线性”,指的是ADC局部(细节)的非线性程度. 我们通常讲的“线性度”都是指“积分非线性”,积分非线性一般以百分比给出,或者以位数给出.举个例子:AD7705(16位)的datasheet上说有0.003%的非线性.1LSB为1

DAC Essentials

http://e2e.ti.com/blogs_/b/analogwire/archive/tags/DAC%2bEssentials DAC Essentials: A new blog series A digital-to-analog converter, or DAC, performs the opposite function of an analog-to-digital converter, or ADC. Duh, right? But, have you ever wond

ESP32 DAC

ESP32有两个DAC通道,通道1链接GPIO25, 通道2链接GPIO26; 当DAC设置为 “built-in DAC mode”的时候,I2S可以通过DAC发送数据: 使用示例: dac_output_enable(DAC_CHANNEL_1); dac_output_voltage(DAC_CHANNEL_1, 200); dac一共有8位,将3.3V电压按照255均分之后,就是dac的精度的最小单位: API函数如下: esp_err_tdac_pad_get_io_num(dac_c

Pyboard基本功能---ADC模数转换/DAC数模转换

ADC模数转换 1.获取ADC类里面的方法 >>> help(pyb.ADC) object <class 'ADC'> is of type type read -- <function> read_timed -- <function> read_timed_multi -- <staticmethod> >>> ADC (模拟信号转换为数字量)是嵌入式中最常用的功能之一,在MicroPython 同样也提供了相应的函

数据库的迁移

数据层应用程序(Data-tier AppliCation,简称DAC)是一个数据库逻辑架构的管理工具,DAC定义了用于管理单个SQL Server数据库对象(包括table,view,以及实例级别对象login等)的元数据.使用DAC,用户能够很方便地将数据库打包成一个DAC package文件,后缀名是DACPAC,只需要简单的操作,就能将数据库部署在其他服务器上,类似于数据库的完整备份,只不过dacpac文件不包含数据,只包括数据库对象的元数据,用户使用这些元数据能够创建一个空的,一模一样

【原创】TLV5618芯片驱动程序

/** ****************************************************************************** * @file    T_TLV5618.h * @author  LuJ * @version V3.5.0 * @date    2015-03-31 * @brief   DAC头文件管理 *********************************************************************

(原)hisi3531立体声pcm实现播放方式

版权声明:本文为博主原创文章,未经博主允许不得转载(http://www.cnblogs.com/lihaiping/p/5251854.html) 最近在使用hisi3531做一个项目,需要实现本地文件播放的功能,在做音频播放功能的时候,调试了很久才算基本调通. 因为hisi3531的硬解码音频功能不支持对mp3和aac等常见类型的解码,所以这里需要实现音频播放,当然就需要借助强大的ffpmeg来实现软件解码音频,我当初的实现方案是:ffmpeg-->dec--->pcm--->ade