SSIS brief summary of the project from creation to deployment of (a)

Recently deployed in a test environment to the project needs to be part of the data migration work. First exposure to the SSIS, studied for a long time, finally to deploy the project to the database. Since the contact SSIS is still relatively shallow, writing this article is actually used to work around the part, I believe that for students new to SSIS, understanding how to use SSIS should have some help. Ado, we get into.

1, install BI development tools
Business Intelligence Development tool integration from Microsoft SQL Server Data Tools. Install Integration Services project template we need to select the function from SQL Server 2012 installation package. Figure 1.1: to note here is that the use of SQL Server 2012 installed SQL Server Data Tools classmates, may need to provide Visual Studio 2010 installation package to install Visual Studio 2010 Shell (I was so prompted), because SQL Server 2012 comes with SQL Server Data Tools for Visual Studio 2010 is the. In other words, after the installation is complete, we are actually written in VS2010 SSIS environment. So, if you want to use VS2012 students can develop the venue to Microsoft's official website to download this tool: https://www.microsoft.com/zh-CN/download/details.aspx?id=36843 After installation wait, in our VS2012, Integration Services project will appear. Figure 1.2: Thus, the development environment to complete the installation.
Figure 1.1


Figure 1.2

2、编写IS项目
新建IS项目后,我们先熟悉一下工作环境。如图2.1:
Figure 2.1
可以看到,微软同样给我们提供了很多控件,通过这些控件,我们很容易就可以完成原本只能在SQL Server Management Studio中才能完成的任务。
下面,我们要做的就是把源数据库中的某张表里的数据复制到目标数据库中对应的表中。其实,SSIS最典型的用途在于能够从不同版本或者不同类型的数据库间很方便的迁移数据。为了操作方便,我在这里仅仅使用了SQL Server做为唯一数据源。
2.1 建立数据库
这里,为了演示方便,我在同一个实例下建立了两个数据库,分别为DBSource和DBTarget。在DBSource和DBTarget下,又分别创建了一张Student表。如图2.2:
Figure 2.2
在DBSource的Student表中,先录入数据,为一会儿的操作做准备。
2.2 配置连接管理器
在解决方案资源管理器中,右键连接管理器,选择“新建连接管理器”。我们选择OLEDB做为链接管理器的类型。如图2.3:
Figure 2.3
然后,在弹出的“配置 OLE DB 连接管理器”中,选择新建。因为我使用的是SQL Server数据库,所以一般使用默认的提供程序“SQL Server Native Client 11.0”。如果你的源数据库是Oracle,则选择”Oracle Provider for OLE DB”做为提供程序即可。如果列表中没有“Oracle Provider for OLE DB”,可以搜一下,网上有很多解决办法。选择完提供程序并且输入了服务器的登陆信息后,我们可以测试一下连接是否成功。单击“测试链接”,如果没有问题,我们就可以选择源数据库了。具体如图2.4:
Figure 2.4
单击“确定”,我们就打开了一条通向源数据库的通道。
用同样的方法,我们再次创建一个用于目标数据库的连接管理器。由于步骤相同,不再赘述。
2.3 编辑SSIS包
在我们创建项目的时候,默认已经新建了一个SSIS包,我们对其进行重命名为“Student”,与我们需要进行操作的表名相同。如图2.5:
Figure 2.5
双击“Student.dtsx”文件,打开包。切换到“控制流”视图下,我们向设计器中拖入“执行SQL任务”控件。这个控件的作用是执行SQL语句,我们使用这个控件的目的是,在每次从源数据库获取数据存入目标数据库之前,先将目标数据库中的数据清空。如图2.6:
Figure 2.6
双击该控件,打开编辑器。在Connection属性中选择目标服务器,SQLStatusment属性中输入执行的SQL语句。如图2.7所示:
Figure 2.7
切换到“表达式”页中,我们在Expressions属性下添加两个表达式,分别为“Name”和“SqlStatementSource”。如图2.8:
Figure 2.8
填入相应的信息(可参考如上写法,添加变量“System::PackageName”,也就是我们刚才设置过的包名)后,保存。
接着,我们再在桌面中拖一个“数据流任务”控件,并移动箭头指向数据流任务。如图2.9:
Figure 2.9
双击“数据流任务”控件,切换到“数据流”视图下,在工具栏中分别拖出“OLE DB源”和“OLE DB目标”控件,如图2.10:
Figure 2.10
双击“OLE DB源”控件,打开编辑器,在“OLE DB 连接管理器”中,选择源数据库,“数据访问模式”选择“表或视图”,最后选择我们需要迁移的数据表,如图2.11:
Figure 2.11
单击保存,配置完成。我们以同样的方式,配置“OLE DB目标”控件,在“映射”页中可以查看源数据库和目标数据库的列的映射关系是否正确,如图2.12:
Figure 2.12
当然,对于设置为自增的列,我们无法为其插入数据。所以我们可以删除其映射关系,这样这一列的数据就不会被转移到目标数据库中。
到这里,编辑SSIS包的工作就完成了。最后让我们执行一下,看看我们的包是否配置成功。成功的显示效果如图2.13:
Figure 2.13
当然,我们也可以在“进度”视图下,查看更具体的执行情况。

3, the deployment of SSIS packages
After completing the above steps, we can begin deployment package. Right solution, deployed in the context menu select, enter "Integration Services Deployment Wizard" screen, shown in Figure 3.1: In the "Select target" tab, select the server we want to deploy the package, individuals need to select local or remote server according to and select the path of the package store. At this time, it will prompt the following message: This is because the fixed SSIS package is stored in the "SSISDB" directory under SQL Server's "Integration Services Catalog", this is not the default directory, we need to create your own. Open SQL Server, find the "Integration Services Catalog" in the Object Explorer. Right, select "New Directory" to open the "Create Directory" dialog box, shown in Figure 3.3: Check the "Enable CLR integration", type a password. Click OK, "SSISDB" directory created successfully. Well, now we go back to Visual Studio. Select the path again, the information just disappears in favor of a "browse for folder or item" dialog box. We can see just already created "SSISDB" file. Figure 3.4: the SSIS package can not be placed directly under the "SSISDB" directory, we create a new folder, then click OK, OK, the program has helped us set up the path. Click Next, we begin deployment. After the deployment is complete interface shown in Figure 3.5: Now we enter the SQL Server. You can see, the package has been deployed successfully:
Figure 3.1

Figure 3.2


Figure 3.3


Figure 3.4


Figure 3.5

Figure 3.6

 

Guess you like

Origin www.cnblogs.com/xiaohuhu/p/11989307.html