The Real MTCS SQL Server 2008 Exam 70/432 Prep Kit- P6 docx

5 280 0
The Real MTCS SQL Server 2008 Exam 70/432 Prep Kit- P6 docx

Đang tải... (xem toàn văn)

Thông tin tài liệu

NewFeaturesinSQLServer2008•Chapter1 7 The T-SQL procedure to do a Copy Only Backup would look like: BACKUP DATABASE [robby] TO DISK = N'C:\Backup\robby.bak' WITH COPY_ONLY, NOFORMAT, NOINIT, NAME = N'robby-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 GO Figure 1.3 The Copy Only Backup Option Te s T Da y Ti p Be sure you are very familiar with doing backups and restores both from a T-SQL standpoint and a GUI standpoint. Since this is the bread and butter of a DBA’s job, you can be sure there will be plenty of questions about backups, restores, and recovery. 8 Chapter1•NewFeaturesinSQLServer2008 Enhanced Configuration and Management of Audits Auditing is available using the new Change Data Capture (CDC) feature. CDC can be used to capture insertions, updates, and deletes in an SQL table in a database and place the changes in another table. The following SQL code demonstrates how to configure CDC for auditing of a table in a database: Activate CDC EXEC sys.sp_cdc_enable_db_change_data_capture Enable CDC on table EXEC sys.sp_cdc_enable_table_change_data_capture @source_schema = 'dbo', @source_name = 'myTable', @role_name = 'cdc' To read the data from the CDC table, there are a series of system stored procedures and functions available, or you can query the tables directly. System stored procedures: sys.sp_cdc_add_ job  sys.sp_cdc_generate_wrapper_function  sys.sp_cdc_change_ job  sys.sp_cdc_get_captured_columns  sys.sp_cdc_cleanup_change_table  sys.sp_cdc_get_ddl_history  sys.sp_cdc_disable_db  sys.sp_cdc_help_change_data_capture  sys.sp_cdc_disable_table  sys.sp_cdc_help_ jobs  sys.sp_cdc_drop_ job  sys.sp_cdc_scan  sys.sp_cdc_enable_db  sys.sp_cdc_start_ job  sys.sp_cdc_enable_table  sys.sp_cdc_stop_ job  NewFeaturesinSQLServer2008•Chapter1 9 System functions: cdc.fn_cdc_get_all_changes_<capture_instance>  sys.fn_cdc_has_column_changed  cdc.fn_cdc_get_net_changes_<capture_instance>  sys.fn_cdc_increment_lsn  sys.fn_cdc_decrement_lsn  sys.fn_cdc_is_bit_set  sys.fn_cdc_get_column_ordinal  sys.fn_cdc_map_lsn_to_time  sys.fn_cdc_get_max_lsn  sys.fn_cdc_map_time_to_lsn  sys.fn_cdc_get_min_lsn  Te s T Da y Ti p You can count on questions about Change Data Capture on your exam. This new feature makes tracking down changes and auditing much easier than it has been in the past. New Table Value Parameter Passing tables as parameters has been a long time coming. The new table type can be passed to a stored procedure. This will solve quite a few problems! Here’s an example: To declare a Table User Defined Type in the database: create type MyTableType as table ( Name varchar(150), City varchar(20), AddressID int ) And here's the stored procedure that consumes it: create procedure InsertFriends 10 Chapter1•NewFeaturesinSQLServer2008 ( @MyTable MyTableType readonly ) as insert into Friends (Name, city, AddressID) select Name, city, AddressID from @MyTable; To fill create and fill the temp table: declare @MyBestFriends_temp MyTableType insert into @MyBestFriends_temp values ('Debbie', 'Havertown', 2) insert into @MyBestFriends_temp values ('Chris', 'Philadelphia', 1) insert into @MyBestFriends_temp values ('Tom', 'Garden City', 11) insert into @MyBestFriends_temp values ('Greg', 'Lansdowne', 6) insert into @MyBestFriends_temp values ('Steve', 'Wilmington', 6) And finally, to execute: execute InsertFriends @MyBestFriends_temp FileStream Data Types FileStream data types are a new, interesting feature in SQL SERVER 2008. Basically, the database engine will store all of the data associated with the column in a disk file as opposed to the actual database. You might have used a similar home-grown scheme in earlier versions of SQL, but this integrates everything nicely into SQL Server. In order to use FileStream, you must first enable it. This is accomplished via the sp_FILESTREAM_configure system stored procedure, or via the GUI in Management Studio under advanced settings. Once FileStream is enabled, a file group must be added to the database in order for it to be able to use FileStream data types. FileStream has the following limitations: Database mirroring cannot be configured in databases with FileStream data.  Database snapshots are not supported for FileStream data.  Native encryption is not possible by SQL Server for FileStream data.  ex a m Wa r n i n g Be sure you remember the limitations of FileStream data types! NewFeaturesinSQLServer2008•Chapter1 11 Sparse Column Support Sparse columns are a new addition to SQL Server. Sparse columns allow for the optimized storage of null columns. Sparse columns can be a good thing, but be sure to enable them only on columns that contain sparse data, or your storage requirements may go up instead of down. To enable a column as a sparse column, use the create statement in SQL or change the properties in the column to Sparse (see Figure 1.4). Figure 1.4 Enabling a Column as a Sparse Column The SQL to accomplish this is as follows: CREATE TABLE dbo.Table_1 ( OID int NULL, MyValue1 varchar(50) SPARSE NULL ) ON [PRIMARY] GO . a new, interesting feature in SQL SERVER 2008. Basically, the database engine will store all of the data associated with the column in a disk file as opposed to the actual database. You might. using the new Change Data Capture (CDC) feature. CDC can be used to capture insertions, updates, and deletes in an SQL table in a database and place the changes in another table. The following SQL. encryption is not possible by SQL Server for FileStream data.  ex a m Wa r n i n g Be sure you remember the limitations of FileStream data types! NewFeaturesin SQL Server 2008 •Chapter1 11 Sparse

Ngày đăng: 06/07/2014, 23:21

Từ khóa liên quan

Mục lục

  • The Real MCTS SQL Server 2008 Exam 70-432 Prep Kit: Database Implementation and Maintenance

  • Copyright Page

  • Technical Editor

  • Lead Authors

  • Contributing Authors

  • Contents

  • Chapter 1: MCTS SQL Server 2008 Exam 432 New Features in SQL Server 2008

    • Introduction

      • A Word About the Test

      • New Feature Overview

        • Installation

        • Compressed Backups

        • Enhanced Configuration and Management of Audits

        • New Table Value Parameter

        • FileStream Data Types

        • Sparse Column Support

        • Encryption Enhancements

          • Key Management and Encryption

          • High Availability

          • Performance

            • Performance Data Management

            • Resource Governor (similar to Query Governor)

            • Freeze Plan

            • SQL Server 2008 Declarative Management Framework

            • Development Improvements

              • LINQ Support

Tài liệu cùng người dùng

Tài liệu liên quan