Sunday, January 31, 2010

Cleaning up Backup and Restore History Logs in MSDB

Sometimes, there are cases, where it is reported to me that the MSDB database is huge and needs to be shrinked again back to "normal" sizes.

One case which affects the size of MSDB, is the backup history. Every time a database backup/restore operation takes place in SQL Server, the relevant information is kept into certain system tables in the MSDB database.

SQL Server stores database backup and restoration information into the following tables that exist in the MSDB database:
  • backupfile
  • backupfilegroup
  • restorefile
  • restorefilegroup
  • restorehistory
  • backupset

Let's examine an example for better understanding the process.

In this example I am using a database in SQL Server 2008 called "DEMODB2008". To this end, I performed some backup and restore operations for allowing us to check out the data stored in MSDB.

The following queries retrieve information regarding the backup and restore operations that took place on the specific database:


-- This query returns information about the backup set
SELECT * FROM msdb.dbo.backupset
WHERE [database_name]='DEMODB2008'

-- This query returns information about the backup files including 
-- the logical and physical file names, drive, etc.
SELECT bf.*
FROM msdb.dbo.backupfile bf
INNER JOIN msdb.dbo.backupset bs
ON bf.[backup_set_id]=bs.[backup_set_id]
AND bs.[database_name]='DEMODB2008'

-- This query returns information about the filegroups that were backed up.
SELECT bg.*
FROM msdb.dbo.backupfilegroup bg
INNER JOIN msdb.dbo.backupset bs
ON bg.[backup_set_id]=bs.[backup_set_id]
AND bs.[database_name]='DEMODB2008'

-- This query returns information about when a database was restored.
SELECT * FROM msdb.dbo.restorehistory
WHERE [destination_database_name]='DEMODB2008'

-- This query returns information about the physical files involved in the restoration process.
SELECT rf.*
FROM msdb.dbo.restorefile rf
INNER JOIN msdb.dbo.restorehistory rh
ON rf.[restore_history_id]=rh.[restore_history_id]
AND rh.[destination_database_name]='DEMODB2008'

-- This query returns information about the restored filegroups.
SELECT rg.* FROM msdb.dbo.restorefilegroup rg
INNER JOIN msdb.dbo.restorehistory rh
ON rg.[restore_history_id]=rh.[restore_history_id]
AND rh.[destination_database_name]='DEMODB2008'

In the case where the MSDB database is huge you can try removing any unnecessary backup and restore history logs.

Instead of manually deleting these logs from the above tables, you can use a SQL Server system stored procedure instead.

This stored procedure is called "sp_delete_backuphistory" and exists in the MSDB system database.

The usage for the above stored procedure is:

sp_delete_backuphistory [ @oldest_date = ] 'oldest_date'

Example:
exec msdb.dbo.sp_delete_backuphistory '2009-01-01'

The above command will clean up the backup and restore history logs up to 01/01/2009.

For more information you can visit SQL Server Books Online.
Read more on this article...

Tuesday, January 5, 2010

The PowerPivot Experiment

Hello and Happy New Year 2010!

Wishing you all the best, a new year full of health, happiness, success and even more SQL Server knowledge!!! :)

As this is my first blog post in 2010, I thought that it should focus on a really hot topic! I hope you will enjoy it!

I called this post “The PowerPivot Experiment”. Here’s a little background information on how I decided writing this article.

When PowerPivot (formerly known as "Gemini") was released, I really wanted to test its real capabilities by trying to import a really large amount of information right into excel and perform aggregations. To this end, I designed a simple relational database with five tables, populated it with data and performed my experiment using PowerPivot. For the record, the total amount of data was more than 100 Million Rows.

In this post I will explain step-by-step the experiment, starting from the database design, then explaining the import process and finally, provide some examples on how I processed this huge amount of data.

Before describing the steps, I would like to list the several software technologies used, as well as the hardware and O/S configuration of my infrastructure.

Hardware –O/S Configuration:

  • OS Name: Microsoft Windows Server 2008 R2 Enterprise 
  • OS Version: 6.1.7600 Build 7600 
  • System Type: x64-based PC 
  • Processor: Intel(R) Core(TM)2 Duo CPU T7250 @ 2.00GHz, 2001 Mhz, 2 Core(s), 2 Logical Processor(s) 
  • Installed Physical Memory (RAM): 4.00 GB 
  • Total Physical Memory: 4.00 GB 
  • Available Physical Memory: 2.47 GB 
  • Total Virtual Memory: 8.00 GB 
  • Available Virtual Memory: 6.10 GB 
  • Page File Space: 4.00 GB 
  •  
    Software tools/technologies used:


    Database Design
    The following database diagram displays the tables participating in the DB Schema used in my experiment along with the table sizes in terms of total number of records:
























    Database size and other statistics:










    Importing the Data Using PowerPivot

    Step 1: Starting up Excel 2010 and launching PowerPivot Window











    Step 2: Establishing a connection to a SQL Server Instance

























    Step 3: Selecting SQL Server Database Tables for importing it into Excel 2010



























    Step 4: Start Importing Data (Time: 15:46)



























    Let’s take a look on the status of the import process as it is occurring:





















    Step 5: Import completed! Total Time: 15:5415:46 = 8 minutes!!!

















    It only took 8 minutes for the entire import process to complete! I personally believe that this is awesome! :)
    Total number of records imported: 40,000 + 60,000 + 500,000 + 100,000,000 + 5,000 = 100,605,000

    Working with the pivot tables
    Right after importing the data, I proceeded with creating two pivot tables (by clicking on the “PivotTable” button in the PowerPivot window) for being able to easily perform aggregations:





























    The following two screenshots are examples of some basic processing I did against the data I imported into Excel using PowerPivot. Using the PivotChart tools, I visually built OLAP queries answering business questions like: (i) What is the total sales amount by product, and (ii) What is the total sales amount by customer:
















    Note that you can also modify the charts as you could also do in earlier versions of Excel. For example, in the below screenshot you can see that the chart “Total Sales by Customer ID” was modified in order to illustrate the data using a pie chart:














     

    Saving the workbook
    After I finished with aggregating the data using the PivotChart tools, I saved the workbook. Note that by saving the workbook, the data that were imported earlier into the workbook using PowerPivot, are stored IN the workbook and you can access it anywhere as they are contained in the workbook file as a binary object.

    In my example, the database size was around 2300 MB. If you take a look at the following screenshot which presents the properties of the saved workbook, you can see that the file size is 732 MB:























    Remarks
    After performing the above practice, I was able to see in action and test some of the powerful capabilities of PowerPivot.

    The data compression, the speed of the import process, the ease of creating rich Pivot Tables and OLAP queries are some of the great features of PowerPivot that take Business Intelligence a step further!

    Well, that was a description of my “PowerPivot Experiment” :)

    I hope you found this post useful!

    There is more to come on PowerPivot so make sure you check back my blog soon!
    Read more on this article...

    Thursday, December 24, 2009

    Selected Tweets of Year 2009!

    This is a rather different post than the usual. As the end of year 2009 approaches, I decided to publish a selected number of tweets I did, grouped into different categories.

    It was a great experience to communicate with the Community, among other, by using Twitter. Throughout tweeting it was possible to easily and directly publish short but useful SQL Server tips, links to articles, links to reviews of SQL Server tools and much more!

    I hope you find my tweets useful! :)

    Further below you can find my tweets grouped into the following categories:
    • T-SQLTips
    • SQL Server Performance Tips
    • Events-Related – Screencasts – Webcasts
    • Blog Announcements
    • Other SQL Server-Related  Tips, Articles and Tools
    • Miscellaneous

    [T-SQLTips]
    1. [T-SQL Tip] You can find information on foreign key constraints in sys.foreign_keys and sys.foreign_key_columns catalog views
    2. [T-SQL Tip] You can find information on primary keys and unique constraints in sys.key_constraints and sys.indexes catalog views
    3. [T-SQL Tip] The last digit in a DATETIME instance can only be 0, 4 or 7. You can use DATETIME2 for more precision.
    4. [T-SQL Tip] A Best Practice for avoiding deadlocks, is to keep transactions in a single batch
    5. [T-SQL Tip] When you rollback a transaction, some functionalities are not reset (i.e. seed values for identity columns)
    6. [T-SQL Tip] An option for Data Archiving in SQL Server is using the OUTPUT clause - http://bit.ly/QpNIf
    7. [T-SQL Tip] SELECT GROUPING(ColumnName): Value '1' indicates an aggregate/summary row, Value '0' indicates a detail row
    8. [T-SQL Tip] If you want all values to be included in an aggregation, make sure you replace NULL values with 0's using ISNULL(ColumnName,0) 
    9. [T-SQL Tip] When using 'COUNT(ColumnName)' it returns the number of rows containing data in that column. NULL values are ignored
    10. [T-SQL Tip] Order of operations in a WHERE clause: NOT, AND, OR - When not sure, use parentheses
    11. [T-SQL Tip] To use in the WHERE clause of a query 'value<>NULL' you first need to 'SET ANSI_NULLS OFF' - By default is set to ON 
    12. [T-SQL Tip] SET XACT_ABORT OFF: Only the T-SQL stmt (in some cases) that raised the error is rolled back and the txn continues processing. 
    13. [T-SQL Tip] SET XACT_ABORT ON: If a T-SQL statement raises a run-time error, the entire transaction is terminated and rolled back.

    [SQL Server Performance Tips]
    1. [MSSQL Perf. Tip] When perf. counters indicate a large number of page splits, consider rebuilding the index and decreasing the fill factor 
    2. [MSSQL Perf. Tip] For optimal performance, avoid using functions in the WHERE clause
    3. [MSSQL Perf. Tip] The Query Optimizer cannot use indexes when leading wildcard characters are used in the LIKE clause of a WHERE clause
    4. [MSSQL Perf. Tip] The Query Optimizer cannot use indexes when a NOT operator is used in the WHERE clause of a query
    5. [MSSQL Perf. Tip] Regarding joins - Minimize the number of join clauses. Outer joins are more expensive than inner joins. 
    6. [MSSQL Perf. Tip] How to optimize queries: re-write query, add/remove indexes, de-normalize/normalize referenced tables
    7. [MSSQL Perf. Tip] With using "SET STATISTICS TIME ON" you are able to get the execution time in ms for each query execution
    8. A great SQL Server DMV for identifying various bottlenecks and other performance issues - sys.dm_os_wait_stats - http://bit.ly/158Iot 
    9. [MSSQL Perf. Tip] Want a fast way to check your query's performance (page reads, etc)? Check out "SET STATISTICS IO" - http://bit.ly/4BNUDG 
    10. With "SET STATISTICS IO" you can also easily check the performance of table scans when experimenting with indexes. 
    11. Covered Index: An index that contains all the columns referenced in the query (in any clause) 
    12. Nonclustered Index: Its bottom level (B-tree leaf nodes) contains only columns included in its key and pointers to the actual data rows 
    13. Clustered Index: Its bottom level (B-tree leaf nodes) contains all the table rows (with all the columns) 
    14. [SQL Server Performance Tip] Always use a covered index in the cases you have READ operations that return a large number of rows. 
    15. Using a covered index will improve performance a lot for queries that return a large number of rows. 
    16. When changing the collation of a col. in a WHERE clause, the col. index won't be used as the data is sorted based on another collation

    [Events-Related – Screencasts – Webcasts]
    1. I have just updated CDNUG's website with a review and photos of our recent event on VS2010 and Windows Azure! - http://bit.ly/2SBLWA 
    2. New Screencast Available! - "Object Dependencies in SQL Server 2008" - http://tinyurl.com/m7pduc
    3. My Webcast on SQL Server 2008 T-SQL Enhancements Now Publicly Available! - http://tinyurl.com/n5ztph
    4. Summary of the CDNUG special event which took place on June 18th, 2009: http://tinyurl.com/nmtfdx 
    5. New screencast - Using Inheritance in the ADO .NET Entity Framework: http://tinyurl.com/ofxnb3 
    6. My first screencast on SQL Server 2008! http://tinyurl.com/oz7ph9 
    7. Just finished updating CDNUG's website with last Tuesday's event. Entity Framework and LINQ to Entities! http://tinyurl.com/d9ynh2 
    8. Reviews for my two latest Live Webcasts on 24 Hours of PASS and MY-TG SQL Server Community Series: http://bit.ly/O8LIE, http://bit.ly/MqRDD 
    9. [Blog] Introduction to #SQLServer #PowerPivot - MS Momentum 2009 Session Review: http://bit.ly/8wjE7t 
    10. [Blog] CDNUG Event Review - October 27, 2009 - Visual Studio 2010 Beta / Windows Azure Platform - http://bit.ly/1zIEaN 
    11. The review of my session (Sync Framework) on MY-TG SQL Server Community Series now available on my blog - http://bit.ly/MqRDD 
    12. Finally! The review of my session (18) on 24 Hours of PASS is now available on my blog - http://bit.ly/O8LIE - Enjoy! 
    13. Published a review on my blog for my session (http://bit.ly/RhVer) of 24 Hours of PASS.

    [Blog Announcements]
    1. [Blog] Using the OUTPUT Clause: A simple data archiving example - http://bit.ly/8HSfd8 #in #SQLServer 
    2. [Blog] #Microsoft Momentum 2009 - http://bit.ly/48laSb
    3. Blog article on Windows Internal Database - http://bit.ly/4dYhyz 
    4. Posts on my blog about SQL Azure - http://bit.ly/274OC6
    5. Blog post on a way of rebuilding all the indexes of a database in SQL Server - http://bit.ly/tIiho
    6. Blog post on index fragmentation in SQL Server (Tips for all the different versions of SQL Server) - http://bit.ly/2wOTT2
    7. Blog post on getting basic table index information in SQL Server - http://bit.ly/ntLO3
    8. Blog post about Sync Framework - http://bit.ly/MqRDD | Blog post about ADO .NET Data Services - http://bit.ly/O8LIE
    9. [New blog post]: Using Computed Columns in SQL Server - http://bit.ly/PGyxi
    10. [New Blog Post]: Mysore PASS Chapter SQL Server Webcasts Series - http://bit.ly/c85gB
    11. [New blog post]: Accessing SQL Azure Using ADO.NET - http://bit.ly/bBGHf
    12. New Blog Post: Using the "GO" Command in SQL Server - http://tinyurl.com/ovvs92
    13. New blog post: New Date-Related Functions in SQL Server 2008 - http://tinyurl.com/mmacns
    14. New blog post - SQL Server 2008 Collation Alignment with Windows Server 2008: http://tinyurl.com/nphd38
    15. New blog post - Error converting data type varchar to float: http://tinyurl.com/lgj8zv
    16. New blog post - Windows Internal Database (SSEE): http://tinyurl.com/mjq7eu 
    17. New blog post - How to rebuild all the indexes of a database in SQL Server: http://tinyurl.com/lr87bo
    18. New Blog post - Renaming Windows Logins in SQL Server: http://tinyurl.com/l5jysa
    19. New blog post: Installing 32-bit SQL Server 2005 Reporting Services on a 64-bit machine/Windows OS - http://tinyurl.com/o88nbq
    20. New blog post - "The Entity Framework - Part 2 - Inheritance": http://tinyurl.com/qs7grx
    21. "The Entity Framework - Part 1 - Introduction" is ready! http://tinyurl.com/coz3uq
    22. Have you ever wondered where are temporary tables stored in SQL Server? - http://bit.ly/34GaBx 
    23. Comparing DATETIME with DATETIME2 - http://bit.ly/4ySjVq
    24. Oh well, here it is! http://bit.ly/4ys37Y - A little tip related to Maintenance Plans in SQL Server 2005!
    25. Date Functions in #SQLServer 2008 - http://bit.ly/itRCx
    26. New blog post - SQL Azure: A First Contact - http://bit.ly/19U98Q 
    27. Discussion: A DBA or a Database Developer? - Your comments are welcome! - http://bit.ly/16G3CI 

    [Other SQL Server-Related  Tips, Articles and Tools]
    1. Business intelligence made easy: #PowerPivot - http://bit.ly/XJYEh 
    2. Great article on how to create a #SQLServer Management Studio Add-in - http://bit.ly/1FmpUM
    3. When you use MS Sync Framework, you do not have to worry about data conflicts; it is efficiently handled! And yes, it's parameterizable!
    4. A "Local Database Cache" in Visual Studio 2008 SP1, is actually a SQL Server Compact 3.5 database.
    5. The easiest way to build an occasionally connected application in Visual Studio 2008 SP1, is to add a new item called "Local Database Cache" 
    6. Microsoft Sync Framework 2.0 CTP2: http://bit.ly/EDkJ2 - Yummy! :)
    7. A handy ADO .NET Data Services (v1) cheat sheet: http://bit.ly/2VTUJj
    8. An interesting tool (on CodePlex)! - SQL Azure Explorer - http://bit.ly/1OmhR8
    9. Snippet Editor on CodePlex: A great tool! - http://bit.ly/wV12A
    10. Good morning! Very interesting project on codeplex - SQL Azure Migration Wizard - http://bit.ly/17k4s0 
    11. extremely useful when migrating SQL Server instances: http://tinyurl.com/648c6c 
    12. It's time to generate a huge amount of sample data for use with my #PowerPivot demos. I will use @RedGate's SQL Data Generator for this
    13. [Blog Post] Product Review: @redgate's SQL Object Level Recovery Native - http://bit.ly/45dqL5
    14. During today's session I also used Red Gate's (@redgate) tool "SQL Prompt 4" (http://bit.ly/8kAlW); a great tool! 
    15. Using Computed Columns in #SQLServer - http://bit.ly/PGyxi 
    16. Change Data Capture (CDC): Determines and tracks the data that has changed- How it is implemented in #SQLServer 2008: http://bit.ly/5s17UI
    17. GROUPING SETS can be also combined with ROLLUP and CUBE operations. Isn't this cool? :)
    18. GROUPING SETS in #SQLServer 2008 - http://bit.ly/7gm0DK - In many cases they can even be equivalent to ROLLUP or CUBE operations
    19. [MSSQL DBA Tip] How to shrink the tempdb database in SQL Server - http://bit.ly/81bd3s
    20. MSDN BOL on Master Data Services in SQL Server 2008 R2 Nov. CTP - http://bit.ly/2qbScq
    21. Always keep in mind the following upgrade scenarios supported in #SQLServer 2008 - http://bit.ly/UWd3O 
    22. #SQLServer 2008 R2 November CTP available to the general public on November 11th - http://bit.ly/QMrA8
    23. Taking #SQLServer DBs offline: ALTER DATABASE [DB_NAME] SET OFFLINE WITH ROLLBACK [IMMEDIATE | x seconds]
    24. need to copy the DB files from an instance to another but I can't stop the source MSSQL instance. Oh well, I'll just take the DBs offline!
    25. Useful: Deprecated Database Engine Features in SQL Server 2008 - http://bit.ly/47jrPz
    26. So it is preferable to use sp_send_dbmail when needed to send mail from MSSQL Database Engine. For more information: http://bit.ly/2g6KtR
    27. Comparing xp_sendmail to sp_send_dbmail: They both send mail from SQL Server but the former will be removed in a future version of MSSQL.
    28. [MSSQL Error Handling Tip] ERROR_PROCEDURE - http://bit.ly/2Pl9JQ
    29. By the way, it always useful to understand the SQL Server Error Message Severity Levels - It helps for debugging! - http://bit.ly/32CORI
    30. By the way, to get a list of all the schemas in a database you can try this: USE [DatabaseName]; SELECT * FROM sys.schemas;
    31. More on Capitalization Styles - http://bit.ly/27lJNt
    32. Naming guidelines for when creating DB tables/columns: use Pascal Casing, avoid abbreviations, use self-explanatory names. 
    33. REVOKE just "cancels" any previously given permissions (including DENY).
    34. Do not get confused with DENY and REVOKE. DENY is a permission which just denies access to a securable (i.e. a database table). 
    35. When you are using the REVOKE statement in SQL Server, you can either use the clause TO or FROM for specifying the grantee principal
    36. How to transfer logins and passwords between instances of SQL Server: http://bit.ly/2KguZr - Actually I am just doing this! 
    37. Just got the error message: Unable to load DLL 'sqlceme35.dll' - To fix it just (re)install SQL Server CE 3.5 SP1! - http://bit.ly/5lhDc
    38. How to identify your SQL Server version and edition: http://bit.ly/5lYtO
    39. SQL Server 2008 R2 – Application and Multi-Server Management - http://tinyurl.com/qd8n7m
    40. What's New in SQL Server 2008 R2 November CTP - http://bit.ly/1dy0S2
    41. A great article on @mssqltips website; Scheduling a SQL Server Profiler Trace - http://bit.ly/VW3Ke

     [Miscellaneous]
    1. Want to convert Live Meeting wmv successfully? Use Windows Media Encoder! It's great! - http://tinyurl.com/g37zo 
    2. Differences between Windows XP Mode and MED-V: http://tinyurl.com/dhovnf
    3. Windows 7 Learning Portal: http://tinyurl.com/dftebp
    More tweets about SQL Server to come in 2010!
    Read more on this article...

    Tuesday, December 15, 2009

    Using the OUTPUT Clause: A simple data archiving example

    The OUTPUT Clause in T-SQL as described in MSDN SQL Server BOL, "returns information from, or expressions based on, each row affected by an INSERT, UPDATE, DELETE, or MERGE statement."

    The functionality provided by the OUTPUT clause is very powerful and can be used in many scenarios. One such a scenario is Data Archiving.

    Consider the following example based on which there is a "CustomerData" table containing customer IDs and status codes indidicating whether a customer is Active or Inactive.

    A data archiving scenario would be to archive all the customers having the status "INACTIVE".

    For this example I am going to use two tables called "CustomerData" and "CustomerArchive".

    OK, let's see some code!


    --Creates the schema
    CREATE SCHEMA Test
    GO


    --Creates the data table for customers
    CREATE TABLE Test.CustomerData
    (
    ID int IDENTITY(1,1) NOT NULL,
    StatusCode VARCHAR(10) NOT NULL
    )
    GO


    --Creates the data table for customers archive
    CREATE TABLE Test.CustomerArchive
    (
    ID int NOT NULL,
    StatusCode VARCHAR(10) NOT NULL
    )
    GO


    --Populates data table with some sample data (Using Row Constructors)
    INSERT INTO Test.CustomerData (StatusCode)
    VALUES    ('ACTIVE'),
            ('ACTIVE'),
            ('INACTIVE'),
            ('ACTIVE'),
            ('ACTIVE'),
            ('INACTIVE'),
            ('ACTIVE'),
            ('INACTIVE'),
            ('ACTIVE'),
            ('ACTIVE')


    Now, let's check out the contents of the two tables:


    CustomerData
















    CustomerArchive





    Now, let's archive the CustomersData table using the OUTPUT clause in the below query:

    --Archive inactive customers and store the records in the "CustomerArchive" table
    DELETE FROM Test.CustomerData
    OUTPUT DELETED.* INTO Test.CustomerArchive
    WHERE StatusCode='INACTIVE'


    CustomerData













    CustomerArchive








    As you can see from the above results, with just a single T-SQL statement, we managed to delete the desired data from the CustomerData table and also archive it into the CustomerArchive table.

    The above scenario was just a simple example on how data archiving can be performed using the OUTPUT clause in SQL Server. You can build more complex data archiving logic using the OUTPUT clause as you can also use the INSERTED keyword and perform multiple joins in the query which uses the OUTPUT clause.

    Note: Always be careful when deleting data! Always keep a backup of your data.
    Read more on this article...

    Friday, December 11, 2009

    MCTS: SQL Server 2008, Database Development

    Today I managed to pass the Microsoft Exam 70-433 - TS: Microsoft SQL Server 2008, Database Development and thus I got my third MCTS certification on SQL Server :)

    This exam was all about database development using SQL Server 2008. While studying for the exam, I had the chance to try and learn more on the various programmability features of SQL Server 2008 which I did not have the chance to heavily use it yet.

    What I think, is that while it is very important studying for certification, the entire process also provides you with the opportunity of learning things which you can use when working with SQL Server and get things work with intelligent techniques.

    It was a great experience, especially when I saw the "Congratulations" message on the screen of the PC at the Exam Center where I took the exam! :)

    For more information on Microsoft SQL Server certifications, check out this link!

    Read more on this article...

    Wednesday, December 2, 2009

    Introduction to SQL Server PowerPivot - MS Momentum 2009 Session Review

    On November 26th 2009, Microsoft-Cyprus launched Momentum 2009; a New Efficiency Community Launch event.

    The event took place in Nicosia, Cyprus, Europe, and had at around 400 attendees. Two tracks were featured: one for Developers, and another one for IT-Pros.




















    I had the pleasure to participate as one of the Cyprus .NET User Group (CDNUG) speakers.

    The topic of my session was “Self-Service Business Intelligence with SQL Server 2008 R2”. Actually, I talked about PowerPivot :)

    Though before the deep dive into PowerPivot and the demonstration of the unlimited power it offers, I provided a short introduction to the great SQL Server 2008 R2 features along with a first demo showcasing these features.

    Some of the exciting new features in SQL Server 2008 R2 (November 2009 CTP) are:
    • Connectivity to SQL Azure
    • Data-tier Application Upgrade
    • SQL Server Utility
    • Master Data Services
    • StreamInsight
    • A large number of enhancements on Reporting Services
    You can find more information on the new features of SQL Server 2008 R2 Nov. CTP on this link.

    After the above introduction to SQL Server 2008 R2, my session got focused on the Analysis Services set of features in SQL Server 2008 R2 and more specifically on SQL Server PowerPivot for Excel 2010.

    So what exactly PowerPivot is?

    PowerPivot (formerly known as “Gemini”) is an add-on for Excel 2010 / SharePoint 2010 which brings the full power of SQL Server Analysis Services right into Excel.

    Its engine called “Vertipaq” uses in-memory column based compression allowing millions of rows of data to be stored, sorted and aggregated.

    PowerPivot supports a wide variety of sources and provides the Business User with a rich set of mathematical functionally featuring the existing functions already in Excel and the powerful Data Analysis eXpressions (DAX).

    You can access PowerPivot by clicking on the “PowerPivot” button on the Ribbon in Excel 2010:



    Then, you are presented with the PowerPivot dialog:








    Within the PowerPivot dialog, under the “Home” menu, you can select from a huge variety of data sources such as:
    • Several providers to DBMSs
    • Text files
    • Excel workbooks
    • Reporting services
    • RSS feeds
    After you select the data source(s), you can import data which is imported in tabular format.
    You can even import data from the clipboard with copy-paste!

    Under the “Table” menu, you are able to manage tables’ properties along with managing the various relationships between the tables. You can also create new relationships:







    Under the “Column” menu, you are able to manage the columns’ properties such as data types and format. Also, you can add new columns:







    After importing the data, by returning under the “Home” menu and by clicking on the “PivotTable” button, you are able to create Pivot Tables based on several presets. Then PowerPivot automatically switches back to the workbook (it lets you either create new sheets or use the existing ones) where you are able to easily perform aggregations and many other mathematical calculations on the data you have previously imported.

    This is a very basic introduction to PowerPivot as it is within the context of the review regarding my session on Microsoft Momentum 2009. In subsequent posts, I will thoroughly explain and demonstrate all the exciting features of PowerPivot!

    Throughout my session many demos were performed including the following scenarios:
    • Import data from the clipboard with copy-paste
    • Import data from Excel workbooks
    • Import data from a SQL Server database containing 5+ million rows
    • Perform a mashing-up of data using various data sources (clipboard, excel workbooks, SQL Server database)
    After importing data based on the different scenarios, aggregations were performed against the data for answering business queries.

    Here are some pictures taken during my session:




















































































    PowerPoint Presentation
    Please find below the PowerPoint presentation of my session at Momentum 2009:
    CDNUG Presence
    CDNUG presence on the event was strong! We had a special “CDNUG Area” where developers could sign-up with the User Group. Many people expressed interest on the activities of our User Group. The feeling was great! :)

    Remarks
    The event was definitely a huge success thanks to the great organization of Microsoft and the rich and high-quality content delivered by all the speakers. CDNUG participated by delivering three sessions on the Developers track. You can find the full review of our User Group’s participation on the CDNUG website along with a description of the entire Developers track.

    The “PowerPivot Experiment”
    I have to admit that I was really looking forward to test the capabilities of SQL Server PowerPivot. Thus being a SQL Server fan, in one of my tweets, I mentioned that I would not rest until I tried the real capabilities of PowerPivot :)

    To this end, after the event, I tried importing 100+ Million rows from a SQL Server Database into Excel 2010 using PowerPivot. Guess what? I did it! :)

    After designing a database and populating it with a total of 100+ Million rows, I imported the data from its five tables into excel. It only took 7 minutes to import the data! Also, performing aggregations on the data was very fast!

    On one of my subsequent posts on PowerPivot, I will provide the schema of my database and a full description of entire process!

    Make sure you check back my blog soon for newer posts on this topic!
    Read more on this article...

    Tuesday, November 17, 2009

    Microsoft Momentum 2009

    In November 26th, Microsoft Cyprus will be hosting "Momentum 2009", this year's biggest event in Cyprus.
    The event features two tracks; (i) A track for IT Professionals, and (ii) A track for Developers.

    On the IT Professionals track, attendees can learn on how to increase productivity using innovations in Windows 7, Windows Server 2008 R2 and Microsoft Exchange Server 2010.

    On the Developers track, attendees can learn about Windows 7 application development, IE 8 tips and tricks for developers, Self-service BI with SQL Server 2008 R2, SharePoint 2010 Developer Platform and the Microsoft Azure Cloud application platform.
     
    Cyprus .NET User Group (CDNUG) is actively participating to this event with three of its members presenting sessions on the Developers track!
     
    To this end, I am happy to be participating by presenting the session with topic "Self-Service Business Intelligence with SQL Server 2008 R2".

    In my session I will talk about SQL Server PowerPivot for Excel 2010 (formerly codenamed “Gemini”) and show how business users can take advantage of this great feature and fulfill their analytical requirements efficiently and iteratively, without the need to be based on a predefined model. During the session, many live demonstrations will take place in order to see PowerPivot in action!

    Looking forward to seeing you all at the event!
    Read more on this article...

    Friday, November 6, 2009

    Product Review: SQL Object Level Recovery Native

    One of the many privileges of being a Friend of Red Gate, is that you have the chance to evaluate the company's products and provide feedback and suggestions. In this post, I provide my review for one of Red Gate's latest tools; SQL Object Level Recovery Native.

    SQL Object Level Recovery Native enables you to recover individual database objects from a native SQL Server backup file. Yes, that’s right! You do not have to restore the entire database, but you can just restore individual objects you select when “browsing” the backup files using the tool.

    I am sharing the experience I had with using the tool through several screenshots along with explanation of the steps involved in my test case scenario. OK, let's start!

    On the first screen by clicking on the “Select backup source” hyperlink, you are presented with a screen where you can select one or more SQL Server native backup files to be included in the backup sources:


    On this screen by clicking on the “Add Files” button you can select the SQL Server native backup files for choosing objects to restore from:


    In my test case scenario I used the “master” and “bikes” database backup files, as you can see on the next screen. After adding the backup files you want, in the “Available Backups” table you are presented with the backups you can use and which exist within the selected native SQL Server backup files (more than one backup may exist in the backup file as you might have appended more than one within the same backup file).

    At this point you have to note that you can only select a single backup at-a-time for restoring objects from. In my example, I chose the bikes backup taken on October 1, 2009:


    Then, it is the most important screen of all; selecting the objects for recovery! In this example I selected the “Category” table. On the right of the screen, you are presented with schema and data (where available) previews for each object you focus on. This helps you easily understand what object you are looking for (if you do not know already! :)

    So as said, I chose the “Category” table. This screen shows the schema preview for this table:


    And this screen shows the data preview for the same table:

    At the bottom of the above screen there are two buttons. If you click on the “View Recovery Script” button you will be provided with a generated script which creates a DDL script for the object(s) you selected for recovery and also a DML script for recovering the data contained within the object (in the case the selected object is a table).


    If you click on the “Recover Objects” button, you are presented with the following screen. The screen contains the object(s) to be recovered (you can select more than one object), and the necessary fields for specifying the destination database. To this end, you have to complete the SQL Server/Instance name, the authentication method/credentials, and the destination database. In this example I am using an instance of SQL Server 2008 on my localhost named “SQL2008”, windows authentication and I chose to restore the “Category” table into the “SampleDB” database.


    When clicking on the “Recover” button, the object recovery process takes place and after it finishes, you are presented with a summary of the process outcome (note: if the specific object already exists on the destination you will get a relevant error message).


    OK, it is time to check within SQL Server Management Studio to see if the object exists on the database and it is operational. As you can see on the following screenshot, of course it is! :)



    Remarks
    I am quite sure that many times in the life of a DBA or Database Developer, specific objects were needed to be restored from a backup file. SQL Object Level Recovery Native allows recovering individual database objects without needing to restore the entire database backup.

    I find this useful and cool!

    The SQL Server native backup files supported by the tool are these of SQL Server 2000, 2005 and 2008.

    For more information on SQL Object Level Recovery Native please visit this link.

    I hope you find this review useful!
    Read more on this article...

    Sunday, November 1, 2009

    CDNUG Event Review - October 27, 2009 - Visual Studio 2010 Beta / Windows Azure Platform

    Another great CDNUG event took place last Tuesday, October 27, 2009 at Microsoft-Cyprus.
    This event was "celebratory" as it was the first offline event after summer holidays.

    Of course summer was not an idle time. It was rather a great period of online events, and more specifically Live Webcasts!

    Among other, in July 29, I delivered a talk on the new Programmability features in SQL Server 2008 and more specifically about the T-SQL Enhancements (Review).

    Additionally I had the pleasure to participate to the 24 Hours of PASS, and MY-TG SQL Server Community Series as a speaker, delivering Live Webcasts on ADO .NET Data Services (Review) and Sync Framework respectively (Review) and thus representing Cyprus .NET User Group (CDNUG)!

    Due to the nature of this event, we had two great sessions delivered by two great speakers! In the first session, Karl Davies-Barrett, Developer Platform Evangelist at Microsoft Malta & Cyprus and great friend of CDNUG, talked about Microsoft Visual Studio 2010 Beta 2 and demonstrated many of its great new features. In the second session, Luka Debeljak, CEE DPE Regional Technical Lead at Microsoft Corporation, introduced to us the Microsoft Windows Azure Platform from a developer’s perspective.

    Microsoft Visual Studio 2010 provides the .NET developer with a huge variety of new enhancements in areas such as: Application Lifecycle Management, Developer Experience, Cloud Development, Web Development and last but not least, Parallel Programming.

    In his session, Karl talked about all these features and with the use of some really interesting demos, showed us how the developer can take advantage of these features and thus, have a fantastic development experience!

    Right after Karl's session, we moved on with the introduction to the Windows Azure Platform by Luka!

    Windows Azure is a new, cloud services Microsoft Operating System that serves as the development, service hosting and service management environment for the Windows Azure platform. The Windows Azure platform offers an intuitive, reliable and powerful platform for the creation of web applications and services. The Windows Azure platform is comprised of Windows Azure: an operating system as a service; SQL Azure: a fully relational database in the cloud; and .NET Services: consumable web-based services that provide both secure connectivity and federated access control for applications.

    Luka talked about the Microsoft Windows Azure Platform and also provided information regarding all the services currently offered for hosting/management on the platform. To this end, we were presented many live demos of SQL Azure and .NET Services. Luka also demonstrated how we can develop .NET applications for hosting on the Windows Azure Platform using the Windows Azure tools for Visual Studio. The development environment for the demos was Microsoft Visual 2010 something which proved that it was a really great idea hosting these two sessions within a single event!

    A BIG thank you to Karl Davies-Barrett and Luka Debeljak for delivering these two really interesting sessions to our User Group. Thanks for supporting CDNUG!

    For event pics and other information please visit CDNUG website!
    Read more on this article...