Presentation is loading. Please wait.

Presentation is loading. Please wait.

Oracle for the SQL Server Trainer

Similar presentations


Presentation on theme: "Oracle for the SQL Server Trainer"— Presentation transcript:

1 Oracle for the SQL Server Trainer
9/12/2018 1:02 AM Oracle for the SQL Server Trainer © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

2 Agenda Terminology SQL differences Features 9/12/2018 1:02 AM
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

3 Objectives Translation between the worlds
Understand Terminology Differences Understand the similarities between the two platforms Understand the differences between the two platforms Understand some of the SQL differences

4 Lesson 1 Terminology

5 SQL Server Terminology
Instance Installation of SQL Server Includes physical files and in-memory processes What you connect to Database Collection of Objects (Tables, Views, Procs…) Has physical file storage Schema Grouping of database objects Login Credential used to access the instance User Database Level Object which provides access Mapped to a Login Linked Server Access another instance

6 Oracle Terminology Instance Database Schema User Database Link
Processes used to access data What you connect to Database Physical files used to store data Schema Collection of objects (Tables, Views, Procs …) User Credentials used to access a database Tied to a particular schema 1:1 relationship with a schema Database Link Access another database

7 Mapping the Terminology
SQL Server Instance Database + Instance Database Schema (12c Pluggable Database) Schema ? Login User User ? Linked Server Database Link

8 Oracle communications
1: Database and instances Oracle communications Oracle connections Client person system Application layer Oracle Net foundation Oracle protocol support layer Database server Listener (defined by listener.ora; may implement TNSnames.ora) Oracle instance Oracle protocol Storage system Data storage Oracle Net, a set of functionalities within Oracle Net Services, is the proprietary communication software used by a client application to communicate with an Oracle database server. Using the Oracle protocol support layer, within Oracle Net, each end of the connection is able to establish a protocol to be used between the two. Without Oracle Net installed on both systems, the appropriate “handshaking” within the protocol could not be created. Oracle protocol support works with a variety of industry-standard protocols (including the ubiquitous TCP/IP). Once the protocols are confirmed, the Oracle Net foundation layer communicates with the application to establish a connection to request or update information. Until the work is completed, the foundation layer manages the connection. Key components in the interaction of the user (client) with the database environment

9 SQL Server communications
1: Database and instances SQL Server communications SQL Server connections Client person system Application layer SQL Server Network Interface Protocol Layer SQL Server Native Client network libraries Database server engine TDS endpoints (shared memory, TCP/IP, named pipes, VIA, and DAC) Relational engine Tabular data stream packet SQL Server Network Interface Layer Storage system Data storage Ensure the students understand the difference between the network configuration and client configuration when it comes to the protocols. Key components in the interaction of the user (client) with the database environment

10 Temporary tablespace groups
4: Database architecture Storage architecture Database storage architecture includes physical and logical structures Physical structures are data files, log files, and operating system blocks. Logical structures are subdivisions of data files used to manage storage space. Let’s talk about Storage Architecture When you migrate, you have the opportunity to do it right Spend time to understand and plan for the following: How to set up SQL Server file locations/file groups/heap index/extents/pages. Note that in Oracle, the block size is variable, but in SQL Server it is set at 8KB. Compression, which is an option with SQL Server, can provide a good ROI Note that SQL Server is pre-optimized for the Operating System, reducing the work you need to do. (For example prior to SQL Server 2008, you had to manually optimize and set up partition alignment. From SQL Server 2008 onward, this is done automatically.) Data file Physical Logical Tablespace Temporary tablespace groups Segment Extent Oracle Blocks Heap/index Filegroup SQL Server Pages Tempdb

11 Mapping of tablespaces and filegroups
4: Database architecture Mapping of tablespaces and filegroups Oracle database instance Data file Tablespace Group Redo Log Redo log System tablespace SysAux tablespace Temporary tablespace BigFile tablespace User data tablespace User index tablespace Undo tablespace Redo log files SQL Server User Database Log files Master database Resource database Tempdb database Model database MSDB User database Data filegroup Index filegroup Log file(s) This slide shows the mapping of tablespaces and file groups terminology and architecture from an Oracle database instance to SQL Server. Note since SQL Server has a multi-database architecture, there are no user quotas on filegroups or files. If a user has permissions to CREATE TABLE in a database that table can be placed on any of the database’s filegroups.

12 Comparing background processes
2: Instance architecture Comparing background processes

13 Comparison of core schema and data structures (objects)
4: Database architecture Schema Objects Comparison of core schema and data structures (objects) Table Index View Synonym Sequence Procedure Function Package Queue in Streams Advanced Queuing Object Type XML DB Stored procedure SSMA transfers to stored procedures Service Broker Queue User-Defined Type XML Schema Collection and Data Type There are differences between the schema and data structures (objects) terminology used with Oracle Databases compared with SQL Server Table, Indexes, Views and Synonym terms are the same The use of Sequences are equivalent now, though they were different until SQL 2008R2 An Oracle procedure is called a Stored Procedure in SQL Server An Oracle package does not exist in SQL Server, but SSMA creates equivalent components to plug that gap. EG MY_PACKAGE.MY_PROCEDURE is mapped to MY_PACKAGE_MY_PROCUEDURE Package variables are supported with CLR functions Materialized views map to Indexed views Indexed views are updated as part of the statement that modifies the table, similar to ON COMMIT REFRESH in Oracle. Both Oracle and SQL Server have triggers, but Oracle’s implementation is a little different Oracle has both statement triggers and row triggers SQL Server has only statement triggers (set-based) You can use a cursor inside a statement trigger to emulate a row trigger Oracle SQL Server

14 40074A 4: Database architecture Logging model Oracle uses online redo logs to record changes made to the database by transactions and to undo segments to capture the before image of data. SQL Server implements both of these functions using transaction logs. Each transaction record contains the undo and redo image of the transaction. SQL Server and Oracle ensure data durability and recovery capabilities using Write-Ahead Logging, hardening log records when a transaction is committed, and hardening the changed database pages sometime later. Understanding database logging is vital as you design a system to meet the recovery time and data loss objectives in your requirements definition. Oracle uses online redo logs to record changes made to the database by transactions, and undo segments to capture the before image of data. SQL Server implements both of these functions using transaction logs. Each transaction record contains the undo and redo image of the transaction. Oracle uses the UNDO to provide row-versioning transaction isolation. SQL Server uses the version store in TempDb for this, not the transaction log. Oracle uses multiple redo log files, and rotates between them. SQL Server divides each physical log file internally into a number of virtual log files (VLFs) containing log records. VLFs have no fixed size, and there is no fixed number of virtual log files for a physical log file. The size of the virtual log files is determined dynamically by SQL Server when creating or extending physical log files. SQL Server tries to maintain a small number of VLFs for the best performance. The size or number of virtual log files cannot be configured or set by system administrators, but it can be influenced by the initial creation of the transaction log file and the subsequent growth of that file. When the database is created, the logical log file begins at the start of the physical log file. New log records are added at the end of the logical log and expand toward the end of the physical log. In SQL Server the log file is reused after CHECKPOINT in SIMPLE RECOVERY or after a LOG BACKUP in full recovery. In Oracle the redo logs are overwritten in NOARCHIEVELOGMODE and copied to in ARCHIEVELOGMODE. The MinLSN is the log sequence number of the oldest log record that is required for a successful database-wide rollback. The MinLSN is the minimum of the: LSN of the start of the checkpoint. LSN of the start of the oldest active transaction. LSN of the start of the oldest replication transaction that has not yet been delivered to the distribution database. References: SQL Swiss Army Knife #9 - Fixing VLFs ( army-knife-9-vlfs-revisited.aspx) SQL Swiss Army Knife #10 - VLFs again. What’s your current status? ( current-status.aspx) Transaction Log VLFs – too many or too few? ( many-or-too-few) Important change to VLF creation algorithm in SQL Server ( Checkpoints and the Active Portion of the Log ( us/library/ms189573(v=sql.100).aspx)

15 Diagnostic and Performance Views
9/12/2018 1:02 AM Diagnostic and Performance Views Both Oracle and SQL Server have system views and functions that enable insight into the current state of the system and provide real-time snapshots of internal memory structures indicating the server state. SQL Server Dynamic Management Views (DMVs) select * from sys.dm_exec_query_stats select * from sys.dm_exec_session_wait_stats Oracle Dynamic Performance Views (V$ Views) select * from v$sql_plan_statistics select * from v$session_wait_class © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.

16 Table types in Oracle and SQL Server
5: Data Objects Understanding tables Table types in Oracle and SQL Server Oracle SQL Server Heap-organized table Heap Clustered table N/A Partition table Partitioned table Temporary table External table Linked server/ External Table Object table Table type Index-organized table Clustered index In-Memory OLTP table Hybrid columnar compressed table Columnstore index To improve performance and extend functionality, each DBMS offers types of tables that support varying access needs. Oracle and SQL Server have different terminology regarding these constructs: Oracle has a Heap-organized table which SQL Server calls “Heap” Oracle’s ‘Clustered’ tables are called ‘Indexed Views’ in SQL Server Both Oracle and SQL Server have ‘Partition’ & ‘Temporary’ tables Oracle’s ‘External’ tables are called ‘Linked Servers’ in SQL Server. Oracle’s ‘Object’ table is called ‘Table Type’ in SQL Server. Oracle’s ‘Index-organized’ tables are referred to as a ‘Clustered index’ in SQL Server. Oracle does not have an equivalent/term for SQL Server’s In-Memory OLTP table And Oracle’s ‘Hybrid columnar’ compressed tables are similar to Columnstore indexes in SQL Server. Tables are the primary objects that store data in rows and columns. To improve performance and extend functionality, each DBMS offers different types of tables that support different access needs.

17 Indexes Index structures in Oracle and SQL Server Feature Oracle
5: Data Objects Indexes Feature Oracle SQL Server B-tree unique Yes B-tree non-unique B-tree composite Yes (32 cols) Yes (16 cols) B-tree ascending/descending B-tree reverse key No B-tree key compressed B-tree function-based Filtered Indexes/Indexes on computed columns B-tree index organized table Yes (clustered index) B-tree partitioned Bitmap Bitmap join Columnstore index In-Memory OLTP table index Invisible index Index structures in Oracle and SQL Server It is very important to use indexes to derive the benefits of any relational database system. During migration, make sure you understand the index capabilities of SQL Server and use those capabilities. Before migrating indexes it is important to ensure that they are actually used. Do not migrate unnecessary or unused indexes as this can result in a lot of unnecessary processing. Also note that since SQL is more “set-based” than Oracle, it may need fewer indexes due to advanced query optimizations. We recommend that you use the index tuning wizard after migration to recommend new indexes. Do not run this wizard during peak load times, however. * If asked by attendees, Oracle’s invisible indexes are maintained like any other index, but they are ignored by the optimizer unless the OPTIMIZER_USE_INVISIBLE_INDEXES parameter is set to TRUE at the instance or session level. Disabled indexes in SQL Server prevent user access to the index, and for clustered indexes, to the underlying table data. The index definition remains in metadata and index statistics are kept on nonclustered indexes. Disabling a clustered index on a table prevents access to the data; the data still remains in the table, but is unavailable for DML operations until the index is dropped or rebuilt.

18 Lesson 2 SQL similarities and differences

19 Similarities Relational Database Optimizer Service you connect to
Normalization, Indexing, Design matter in both Bad Data Model = Bad Data Model Good Data Model = Good Data Model Optimizer Cost based Execution Plans Service you connect to Listener Instance

20 Similarities Features SQL Replication SQL Server Peer to Peer
Oracle MultiMaster Mirroring / Log Shipping Types of Data Guard SQL Mostly the same Fight over ANSI-92!

21 Differences Locking Methodology Clustering Multi-Platform
Optimistic vs. Pessimistic Think Snapshot Isolation Level Clustering RAC is true Active/Active SQL is Failover Multi-Platform Pros and Cons Tons of Configuration Options Complexity

22 Differences (cont.) Data Types Built-In Functions Too many to list
Google is your friend You should also know how each platform maps to SSIS Data Types Built-In Functions Also too many to list Example: MSSQL: GETDATE() Oracle: SYSDATE

23 SQL Language Differences
T-SQL is T-SQL In Oracle, SQL <> PL/SQL PL/SQL is the procedure language SQL is vanilla DML language The difference between the two is a big deal to Oracle DBAs Performance impact of using PL/SQL

24 Example Differences Need for Dual table AutoNumber / Identity INSERT
UPDATE DELETE

25 Dual() MSSQL: Oracle: select getdate(); select sysdate from dual;

26 Auto Numbering MSSQL IDENTITY Property New starting in 2012 Oracle
create table t1 ( col1 int identity(1,1) col2 int); insert t1(col2) values(3); create table t1 ( col1 int col2 int); create sequence t1_seq start with 1 increment by 1; insert t1(col1, col2) values(next value for t1_seq, 3); create table t1 (col1 integer, col2 integer); create sequence t1_seq increment by 1 start with 1; insert into t1 values (t1_seq.nextval, 3);

27 INSERT INTO not optional Oracle MSSQL:
insert mytable values('more text'); insert into mytable values('more text');

28 UPDATE No UPDATE FROM MSSQL: Oracle update t1 set t1.col2 = t2.col2
from t1 inner join t2 on t1.col1 = t2.col1; update (select t2.col2 as src_2, t2.col2 as tgt_2 from t1 inner join t2 on t1.col1 = t2.col1 ) set tgt_2 =src_2;

29 DELETE Oracle requires FROM MSSQL: Oracle DELETE MyTable;
DELETE FROM MyTable;

30 Lesson 3 Feature comparisons

31 Oracle Feature Comparison
DW Requirement APS/SQL Server exadata High availability AlwaysOn enhancements AlwaysOn Failover Clustering AlwaysOn Active Secondaries AlwaysOn Availability Groups Online Operations Support for Windows Server Core and ReFS RAC One Node Active Data Guard Performance and scale A shared nothing MPP architecture and scalability from tens to hundreds of terabytes (PDW) In-memory Column Store Partitioning to 15k/table Table & Backup Compression In-Memory OLTP Buffer Pool Cache (SSD) Exadata Smart Scan Exadata Smart Flash Cache Partitioning Exadata Hybrid Columnar Compression Oracle Database In-Memory Security Label Security Toolkit User-Defined Server Roles TDE & EKM Label Security Database Vault Advanced Security Manageability/ Ease of development Distributed Replay Database Snapshot Spatial Data Support Database Tuning Advisor SSMS, DMV, Policy-based Mgmt Real Application Testing Total Recall Tuning Pack Diagnostics Pack Value SQL Server offers advanced DW capabilities built-in APS includes DW and HDInsight Oracle Big Data Appliance

32 EIM Comparison Key Microsoft strengths EIM Solution Data Quality
Integration/ETL MDM SQL Server DQS SSIS MDS Oracle (high price) Oracle Enterprise Data Quality Data Integrator Master Data Management Suite Key Microsoft strengths Value: Powerful functionality out-of-the-box vs. paid add-ons for competitors Integrated solution: Combines DQS, SSIS, MDM, and Analysis Services, Reporting Services, and self-service BI

33 Integration Linked Server / Database Links
Linked Server to Oracle is Easy Other Direction depends on platform and Oracle Products SSIS works great with Oracle BI Stack Analysis Services Reporting Services Oracle Drivers / Clients 32-bit vs. 64-bit Gets funs with SQL Server Data Tools for BI

34 Oracle Exalytics In-Memory Machine T5-8 overview
Description Engineered System—hardware and software designed to work together Oracle Business Intelligence Foundation Suite with hardware-specific optimizations Analytic In-Memory Database with Adaptive In-Memory Caching and Columnar Compression Optimized InfiniBand connectivity to Oracle Exadata Advanced data visualization Learn more at Compared to the Microsoft BI stack The Exalytics appliance is the equivalent of SQL Server Analysis Services, SharePoint BI with Power View, and SQL Server Reporting Services integration on proprietary hardware.

35 Backup and recovery tools
Use Oracle Recovery Manager (RMAN) to back up and recover database files Use SQL Server backup and restore components, in conjunction with SQL Server Agent, to set up, schedule, and automate backups and perform recovery Use BACKUP and RESTORE commands in applications, T- SQL scripts, stored procedures, and triggers Backup history is maintained in the RMAN recovery catalog, and the equivalent system catalog tables are in the msdb database in SQL Server Consider encryption and compression (both tools provide a form of it) Oracle has no backup to cloud capabilities

36 Tools Oracle has nothing similar to SSMS Command Line
Oracle SQL Developer -> more like SQL Server Data Tools Command Line SQL*Plus SQLCMD Really requires 3rd Party Toad seems to be popular Others No SQL Profiler Equivalent OEM / Grid Control is more like MDW

37 Oracle Performance Tools
Automatic Workload Repository (AWS) Active Session History (ASH) Automatic Database Diagnostic Monitor (ADDM) SQL Tuning Advisor

38 Resources Oracle OTM – Database Admins and Developers
Oracle 12c Database Administration 2 Day Training

39 9/12/2018 1:02 AM © 2015 Microsoft Corporation. All rights reserved. Microsoft, SQL Server, Windows, 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. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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 "Oracle for the SQL Server Trainer"

Similar presentations


Ads by Google