Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft SQL Server 2014 for Oracle DBAs Module 9

Similar presentations


Presentation on theme: "Microsoft SQL Server 2014 for Oracle DBAs Module 9"— Presentation transcript:

1 Microsoft SQL Server 2014 for Oracle DBAs Module 9
11: Monitoring and performance tuning Microsoft SQL Server 2014 for Oracle DBAs Module 9 Data transport

2 Other Transfer Methods
Module Overview 10: Data transport Other Transfer Methods

3 Lesson 1: Getting data into and out of SQL Server
10: Data transport Demonstration: Bulk Copy and Bulk Insert

4 Data out Oracle tools Data Pump Export Utility SQL*Plus DBMS_OUTPUT
10: Data transport Oracle tools Data Pump Export Utility SQL*Plus DBMS_OUTPUT UTL_FILE SQL Server tools SQL Server Integration Services (SSIS) BCP Sqlcmd.exe PowerShell SELECT or PRINT Linked Servers  1. Data Pump Export utility: Used for copying data and metadata into a series of operating system files called a dumpfile set. The dumpfile set can be moved to another system and loaded by the Data Pump Import utility. SSIS provides functionality similar to the Data Pump. SQL*Plus: Although this utility is primarily used to execute SQL and PL/SQL, it does have a SPOOL feature, which is used on a daily basis to create delimited files out of database data. DBMS_OUTPUT: Used to present output from stored procedures, triggers, or packages. This Oracle package is useful for debugging purposes UTL_FILE: Used to read or write to operating system files from inside PL/SQL programs using a restricted version of the I/O stream file. This feature can be used to create delimited or binary files from inside the database without any external utility. Oracle 12c SQL Server 2014

5 Demonstration: Exporting data using PowerShell
10: Data transport In this demonstration you will learn to: Manage data export with PowerShell Demonstration Steps Click Start → Run, type notepad.exe, and then enter the first few lines of the script below: #extract_contact.ps1 #This script will extract information for contacts #and write the results into text files named with the type name. Write-Host "Opening Connection" -foregroundcolor "green" $cn = new-object System.Data.SqlClient.SqlConnection("Data Source=SQLTBWS\INST01;Integrated Security=SSPI;Initial Catalog=AdventureWorks2012"); $cn.Open() Write-Host "Connection Opened and submitting query" -foregroundcolor "green" This code documents our script name and gives a brief description of what we are about to do. It then opens a connection to the database. Enter the next set of lines into the script: $q = "SELECT p.[FirstName]" $q = $q + " ,ISNULL(p.[MiddleName], '') as [MiddleName]" $q = $q + " ,p.[LastName]" $q = $q + " ,ISNULL(pp.[PhoneNumber], '') as [Phone]" $q = $q + " ,ISNULL(pe.[ Address], '') as [ ]" $q = $q + " ,p.[PersonType]" $q = $q + " FROM [AdventureWorks2012].[Person].[Person] p" $q = $q + " LEFT JOIN [AdventureWorks2012].[Person].[PersonPhone] pp" $q = $q + " ON p.[BusinessEntityID] = pp.[BusinessEntityID]" $q = $q + " LEFT JOIN [AdventureWorks2012].[Person].[ Address] pe" $q = $q + " ON p.[BusinessEntityID] = pe.[BusinessEntityID]" $q = $q + " WHERE p.[PersonType] <> 'EM'" $q = $q + " AND pp.[PhoneNumberTypeID] <> 1" $q = $q + " ORDER BY p.[PersonType], p.[BusinessEntityID]" (More notes on the next slide)

6 Data in SQL Server tools SQL Server Integration Services (SSIS)
10: Data transport SQL Server tools SQL Server Integration Services (SSIS) BCP Bulk Insert Sqlcmd.exe PowerShell SELECT INTO Linked Servers Oracle tools Data Pump Import Utility SQL*Plus CREATE TABLE Parts Payroll Person SQL Server 2014

7 SQL Server data transport
SQL Server offers several Bulk Copy commands and tools: BCP, the Bulk Copy utility, is used to transfer large volumes of data in and out of a database To export—data is dumped into a flat file in a delimited format To import—data is first exported from the source database or program and then imported into SQL Server database BULK INSERT command can be used within Transact-SQL programs to insert large volumes of data from a flat file Bulk copy API can be used in ODBC, OLE DB, SQL-DMO and SMO applications OPENROWSET (BULK…) can also be used to bulk import large object data in SQL Server

8 Demonstration: Bulk Copy and Bulk Insert
10: Data transport In this demonstration you will learn to: Extract the data with the Bulk Copy Program (bcp) Use bcp and Bulk Insert to import data into new tables Demonstration Steps Click Start, Run and enter cmd, then enter the following command: bcp /? You see the parameters available for using bcp.Enter and run the following command: bcp AdventureWorks2012.HumanResources.Employee format null -T -S SQLTBWS\INST01 -N -f e:\Scripts\emp.fmt Navigate to e:\scripts Type the following to review the format NOTEPAD emp.fmt Close Notepad.Enter and turn the following command (notice the only difference is the ‘-x’ included to generate an XML file and the extension name change) : bcp AdventureWorks2012.HumanResources.Employee format null -T -S SQLTBWS\INST01 -N -x -f e:\Scripts\emp.xml NOTEPAD emp.xml Close Notepad.Enter and run the following command: bcp AdventureWorks2012.HumanResources.Employee out e:\Scripts\emp.bcp -S SQLTBWS\INST01 -T - N This will export the HumanResources.Employee table from the AdventureWorks2008 database. The parameters indicate the server name, the fact that we’re using a trusted connection, and to use native mode to store the data in the exported file, which we called emp.bcp. Wide Native mode preserves all of the SQL Server data types based on unicode and is the best way to move large amounts of data from one SQL Server database to another. Other formats are more suited to (More notes on the next slide)

9 Lesson 2: Understanding SQL Server Integration Services
10: Data transport SSIS tools

10 Introducing SQL Server Integration Services (SSIS)
10: Data transport SQL Server Integration Services offers several tools to extract, transform and load data from multiple data sources into SQL Server databases and vice versa Provides control over data flow, looping and conditioning Packages can be built using SSIS designer in Business Intelligence Development Studio Import / Export wizard Database Export utility

11 Elements of Integration Services
10: Data transport SQL Server Integration Services Service (MsDtsSrvr.exe) Package Control flow elements Containers Tasks Precedence constraints Data flow elements Event handlers Variables Configurations

12 SSIS tools SSIS tools are used to create, modify and execute packages
10: Data transport SSIS tools are used to create, modify and execute packages SSIS Import / Export wizard Assists in building simple packages to import, export, and transform data or to copy database objects SSIS Designer inside SQL Server Data Tools (SSDT) Graphical application that lets us build and debug packages containing complex workflows, multiple connections to heterogeneous data sources, and event-driven logic SSIS Package Execution utilities dtexecui.exe dtexec.exe dtutil.exe is a tool used to manage SSIS packages

13 Lesson 3: Other Transfer Methods
10: Data transport Change Data Capture Service for Oracle by Attunity

14 Using the Copy Database wizard
10: Data transport Copy Data Wizard (CDW) can be used to copy or move databases across SQL Server instances Provides two methods: Attach / Detach Using SQL Server Management Objects (SMO) A proxy account must be created in order to run SSIS package created by CDW

15 Demonstration: Database Import/Export wizard
10: Data transport In this demonstration you will learn to: Move infrequent data transformations with a wizard Demonstration Steps In SQL Server Management Studio, open a New Query window and execute the following T-SQL statements to clear the US Addresses table: USE AdventureWorks2012 GO TRUNCATE TABLE Person.US_AddressList GORight-click the AdventureWorks2012 database and select Tasks, Import Data. In the Welcome to SQL Server Import and Export Wizard click Next. In the Data Source dialog, set the server name to SQLTBWS\INST01, the authentication to Use Windows Authentication, and the database to AdventureWorks2012, and click Next. Select the exact same values for the Destination dialog. In the Specify Table Copy or Query dialog, select the “Write a Query” button and click Next. In the Source Query dialog, enter the following query in the SQL Statement property: SELECT p.[BusinessEntityID] ,p.[FirstName] ,p.[LastName] ,a.[AddressLine1] ,a.[AddressLine2] ,a.[City] ,s.[StateProvinceCode] ,s.[CountryRegionCode] ,a.[PostalCode] (More notes on the next slide)

16 Copying databases to Windows Azure
10: Data transport Deploy database to Windows Azure VM wizard Used to deploy a database to a virtual machine hosted on Windows Azure. Microsoft manages the VM hosting, you manage the database on the VM. Deploy database to Windows Azure SQL Database wizard Used to deploy to Windows Azure SQL Database service This service is fully managed by Microsoft

17 Change Data Capture Service for Oracle by Attunity
10: Data transport Affordable, efficient and real-time data integration of Oracle data Uses Oracle transaction logs to load data into SQL Server Uses SQL Server Change Data Capture to reflect changes to the data Can be extended using Attunity Oracle CDC for SSIS for more complex scenarios

18 Other Transfer Methods
Module Overview 10: Data transport Other Transfer Methods  Next module Back up and recovery

19 © 2014 Microsoft Corporation. All rights reserved
© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "Microsoft SQL Server 2014 for Oracle DBAs Module 9"

Similar presentations


Ads by Google