Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft SQL Server 2014 for Oracle DBAs Module 3

Similar presentations


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

1 Microsoft SQL Server 2014 for Oracle DBAs Module 3
11: Monitoring and performance tuning Microsoft SQL Server 2014 for Oracle DBAs Module 3 Database architecture

2 Logging and data dictionary
Module Overview 4: Database architecture Logging and data dictionary Note: The spelling of datafiles and data files above is intentional. Within Oracle, it is spelled as a single word as DATAFILE to denote a syntax element. (Note that there is also a view called DBA_DATA_FILES, so both forms are used in Oracle.) For SQL Server, it is two words and not used in syntax.

3 Lesson 1: Schema and data storage
4: Database architecture Managing extents and pages

4 Schema and data structures (objects)
4: Database architecture Schema – a collection of objects owned by a database user Schemas in SQL Server provide logical separation of objects, similar to Oracle’s schema 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 N/A Service Broker Queue Type XML Schema Collection & Data type

5 Temporary Tablespace Groups
Storage architecture 4: Database 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 Data File Tablespace Temporary Tablespace Groups Segment Extent Heap/Index Filegroup Physical Logical Oracle SQL Server Blocks Pages

6 Data blocks, extents, and segments
4: Database architecture Structure Oracle SQL Server Smallest unit of Logical storage Block size Storage allocation Extent size Segment Block Variable Any logical structure that is allocated storage Page 8 KB fixed Performed in multiple pages; are ‘extents’ 64 KB fixed No equivalent structure

7 40074A Storage allocation 4: Database architecture Fundamental difference in storage allocation between Oracle and SQL Server 2k block 6 x 2K = 12k Extent 12K x 16K = 28K Segment (Table/Index) 8x 2K = 16k 8k 64K x 64K = 128K Heap/Index Oracle SQL Server 8x 8K = 64k  What does the size difference mean? Optimized for each of the database engine types

8 Managing extents and pages
4: Database architecture File header extent Extents in SQL Server GAMs and SGAMs File header Page 0 SGAM Page 3 GAM Page 2 PFS Page 1 table2 index1 index2 table3 index3 Mixed extent table1 Uniform extent Current use of extent GAM bit setting SGAM bit Free, not being used Uniform, extent, or full mixed extent 1

9 Lesson 2: Tablespaces and datafiles
4: Database architecture Demonstration: Viewing an instance’s system databases

10 Oracle tablespaces and datafiles
4: Database architecture Oracle and SQL Server store data in datafiles The largest logical storage structure in Oracle is a tablespace The largest logical storage structure in SQL Server is a filegroup Tablespaces/filegroups are used to group application objects Tablespaces/filegroups optimize administration of datafiles

11 Three file types supported by SQL Server: Primary data files
SQL Server data files 4: Database architecture Three file types supported by SQL Server: Primary data files Secondary data files Log data files Database: MyDB Primary filegroup c:\Program Files\Microsoft SQL Server\MSSWL\Data\MyDB_Prm.mdf Log file c:\Program Files\Microsoft SQL Server\MSSWL\Data\MyDB.Idf MyDB_FG1 filegroup c:\Program Files\Microsoft SQL Server\MSSWL\Data\MyDB._FG1_1.ndf c:\Program Files\Microsoft SQL Server\MSSWL\Data\MyDB._FG1_2.ndf 4 MB 1 MB

12 Mapping of tablespaces and filegroups
4: Database architecture Oracle database instance Data File Tablespace Group 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 DB Resource DB Temp DB Model DB MSDB User DB Data FG Index FG Log File(s)

13 Demonstration: Viewing an instance’s system databases
4: Database architecture In this demonstration you will see how to: Connect to an instance Review system databases Review application or user databases Demonstration Steps Open SQL Server Management Studio and connect to an instance. Click Start → All Programs → Microsoft SQL Server 2014 → SQL Server Management Studio. Connect to the instance INST01 using Windows authentication. In the Object Explorer, expand the INST01 instance node, expand Databases, and then expand the System Databases folder. Below is a description of the system databases. Master: Composed of system tables that keep track of the server installation as a whole and all databases that are subsequently created. The master database has system catalogs containing information about disk space, file allocations, usage, system-wide configuration settings, login accounts, the existence of other databases, and the existence of other SQL Servers. Model: The model database is a template database. Every time a new database is created, SQL Server makes a copy of the model to form the basis of the new database. TempDB: The temporary database, TempDB, is a workspace. Every time SQL Server is restarted, the TempDB is recreated and not recovered. It is used for temporary tables created explicitly by users, for worktables to hold intermediate results created internally by SQL Server for query processing and sorting, and for materialization of static cursors and the keys of key set cursors. MSDB: The MSDB database is used by the SQL Server Agent service to perform scheduled activities such as backups and replication tasks.In the Databases folder, note that the user databases are shown. If Reporting Services were installed on this server, two reporting databases would be installed here: ReportServer ReportServerTempDB Note the installed sample databases: AdventureWorks2012: This is the sample OLTP database. AdventureWorksDW2012: This is the sample data warehouse database. (More notes on the next slide)

14 Lesson 3: Logging and data dictionary
4: Database architecture Demonstration: View the data dictionary

15 40074A Logging model 4: Database architecture 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  In-Memory OLTP – doesn’t use write ahead logging to disk – thus improving performance MVCC Virtual log 1 Virtual log 2 Virtual log 3 Virtual log 4 Virtual log 5 Truncated Unused Start of logical log MinLSN Last checkpoint End of logical log Virtual Log 1 Virtual Log 2 Virtual Log 3 Virtual Log 4 Truncated Start of logical log MinLSN Next to last checkpoint Last checkpoint End of logical log

16 40074A Data dictionary 4: Database architecture In Oracle the data dictionary is stored under the SYS schema in the SYSTEM tablespace In SQL Server the data dictionary consists of: Catalog View—the best way to access system metadata Backward Compatibility Views—All system tables from previous releases are provided as backward compatibility views Dynamic Management Views—to view the current state of the SQL Server system. Provide real-time snapshots of internal memory structures indicating the server state. INFORMATION_SCHEMA views—SQL-99 method to view system metadata SQL Server’s Resource database contains the metadata for system stored procedures

17 Demonstration: View the data dictionary
4: Database architecture In this demonstration you will learn how to: View the dictionary with object explorer View the data dictionary with catalog views View the data dictionary within a database View the data dictionary via system stored procedures Demonstration Steps Click any instance from the Object Explorer. If you are not sure which one to choose, select INST01. Click Databases → System Databases → Master → Views → System Views to see catalog views. To see similar catalog views for a user database other than the system databases, select and expand the Databases folder. To view the system-stored procedures, go to Databases → System Databases → Master → Programmability. Open the New Query Editor. Right-click the Context menu. Notice the connection dialog. Navigate to the Change Connection dialog. Notice that you can change the context of the query by connecting it to another server. Release the mouse button. Look at the bottom right window of the query. Notice your identity and database connection properties. Connect to the SQL Server INST01 instance and select the master database. Use the following query to extract the system tables: Select name from sys.objects where type = 'S' Use the following query to extract views: Select name from sys.objects where type = 'V' You also can view properties of stored procedures. To show the names of stored procedures, execute the code below: Select name from sys.objects where type = 'P'Open the Query Editor and select the Adventureworks2012 database. To find column information for the Shift table in the AdventureWorks2012 database, execute the (More notes on the next slide)

18 © 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 3"

Similar presentations


Ads by Google