Date post: | 26-Mar-2015 |
Category: |
Documents |
Upload: | gabriella-bond |
View: | 214 times |
Download: | 1 times |
Southern California Code Camp at USCSouthern California Code Camp at USC
October 15-16, 2011October 15-16, 2011
SQL Server Analysis ServicesSQL Server Analysis ServicesPlanning Planning & & Implementation Implementation
By: By: Ben AminniaBen Aminnia
President, L.A. SQL Server Professionals Group President, L.A. SQL Server Professionals Group [email protected] [email protected]
Database Architect and .NET Developer, Pointer Corporation Database Architect and .NET Developer, Pointer Corporation [email protected] [email protected]
Southern California Code Camp at USCSouthern California Code Camp at USC
October 15-16, 2011October 15-16, 2011
SQL Server Analysis ServicesSQL Server Analysis ServicesPlanning (80%)Planning (80%) & & Implementation (20%)Implementation (20%)
By: By: Ben AminniaBen Aminnia
President, L.A. SQL Server Professionals Group President, L.A. SQL Server Professionals Group [email protected] [email protected]
Database Architect and .NET Developer, Pointer Corporation Database Architect and .NET Developer, Pointer Corporation [email protected] [email protected]
33
AgendaAgenda
IntroductionIntroductionPresentationPresentationQuestions and AnswersQuestions and Answers
44
IntroductionIntroduction
Primary Objective:Primary Objective: Explore a recent implementation of Analysis Explore a recent implementation of Analysis
Services, with focus on some important Services, with focus on some important planningplanning tasks.tasks.
Presentation Style:Presentation Style: We will be placed in a unique setting called: “We will be placed in a unique setting called: “Live Live
from SQL Server Studiosfrom SQL Server Studios”” I will be the I will be the interviewerinterviewer – telling you about an – telling you about an
Analysis Services application one of my staff had Analysis Services application one of my staff had developed.developed.
Now that he has left the company, I’m Now that he has left the company, I’m interviewing interviewing youyou for his position. for his position.
55
IntroductionIntroduction
Why the “Interview” Model:Why the “Interview” Model:
Look at it from an IT Manager’s viewpoint;Look at it from an IT Manager’s viewpoint; This is not a sales presentation, showing off This is not a sales presentation, showing off
“the cool stuff” in a new product;“the cool stuff” in a new product; This is not a “This is not a “What’s New in SSASWhat’s New in SSAS” presentation ” presentation
either;either; Don’t expect “Don’t expect “click here – click there – voila!click here – click there – voila!”” We may not even show off any “We may not even show off any “WizardWizard” ”
screens;screens;
66
IntroductionIntroduction
Interview Structure:Interview Structure: I’ll present a task and seek your opinion.I’ll present a task and seek your opinion. You will share your thoughts with me and will You will share your thoughts with me and will
tell me how you would approach that task.tell me how you would approach that task. I will then show you how my ex-employee I will then show you how my ex-employee
accomplished that task.accomplished that task. Finally, you will have your turn to make Finally, you will have your turn to make
comments and state your opinion:comments and state your opinion: You may agree with the presented approach;You may agree with the presented approach; You may agree and also extend it further according to You may agree and also extend it further according to
your viewpoint;your viewpoint; You may disagree and offer an alternative approach.You may disagree and offer an alternative approach.
77
Final GoalsFinal Goals
Four Stages of an SSAS System:Four Stages of an SSAS System:1.1. VisionVision2.2. ArchitectureArchitecture3.3. Development of various piecesDevelopment of various pieces4.4. Periodic data loads and refreshing pivot tablesPeriodic data loads and refreshing pivot tables
88
At the Receptionist’s DeskAt the Receptionist’s Desk
99
Advice from the ReceptionistAdvice from the Receptionist
As we walk down the hallway to the As we walk down the hallway to the conference room for your interview, let conference room for your interview, let me tell you a little bit about Ben’s me tell you a little bit about Ben’s Analysis Services project:Analysis Services project:
The StethoscopeThe Stethoscope The ThermometerThe Thermometer The WheelThe Wheel The ChartsThe Charts
1010
Interview Question #1Interview Question #1
How many servers do you need in order to How many servers do you need in order to implement an Analysis Services system?implement an Analysis Services system?
• A) One server can host everything we needA) One server can host everything we need• B) At least two (for DWH / Data Mart and AS)B) At least two (for DWH / Data Mart and AS)• C) At least three (for DEV, QA, and C) At least three (for DEV, QA, and
Production)Production)• D) It depends … Could be moreD) It depends … Could be more
1111
Interview Question #1Interview Question #1
How many servers do you need to implement How many servers do you need to implement an Analysis Services system?an Analysis Services system?
• A) One server can host everything we needA) One server can host everything we need• B) At least two (for DWH / Data Mart and AS)B) At least two (for DWH / Data Mart and AS)• C) At least three (for DEV, QA, and C) At least three (for DEV, QA, and
Production)Production)• D) It depends … Could be more (virtual D) It depends … Could be more (virtual
/ in the cloud)/ in the cloud)
1212
Interview Question #2Interview Question #2
What do you need to do before building the 1What do you need to do before building the 1stst Cube?Cube?
• A) Open the Cube WizardA) Open the Cube Wizard• B) Run ETL to populate a Data MartB) Run ETL to populate a Data Mart• C) Plan the measures and the schemasC) Plan the measures and the schemas• D) Setup SSIS and SSASD) Setup SSIS and SSAS
1313
Interview Question #2Interview Question #2
What do you need to do before building the 1What do you need to do before building the 1stst Cube?Cube?
• A) Open the Cube WizardA) Open the Cube Wizard• B) Run ETL to populate a Data MartB) Run ETL to populate a Data Mart• C) Plan the measures and the schemasC) Plan the measures and the schemas• D) Setup SSIS and SSASD) Setup SSIS and SSAS
1414
Interview Question #3Interview Question #3
What’s your definition of What’s your definition of Analysis ServicesAnalysis Services??
1515
Interview Question #4Interview Question #4
What’s the value of What’s the value of ONE RECORDONE RECORD in a SQL in a SQL Server table?Server table?
1616
At the Heart of ETL …At the Heart of ETL …
Avoid Fundamental Mistakes or Mis-conceptions!Avoid Fundamental Mistakes or Mis-conceptions!
Do not overlook the “measures” which are the Do not overlook the “measures” which are the heart of the solution and jump on building the heart of the solution and jump on building the databases and the cubes.databases and the cubes.
An analytical solution is all about numbers.An analytical solution is all about numbers. A beautiful chart does not guaranty useful A beautiful chart does not guaranty useful
results.results. AS data is not like customer address table.AS data is not like customer address table. There’s virtually no room for retroactive data There’s virtually no room for retroactive data
corrections.corrections.
1717
At the Heart of ETL …At the Heart of ETL …
Focus on the Target – Aerial Photos Won’t Help!Focus on the Target – Aerial Photos Won’t Help!
At the heart of the ETL process, look for data At the heart of the ETL process, look for data sources that are accessible and agreeable to sources that are accessible and agreeable to both users and architects.both users and architects.
Start with a stethoscope that picks up one heart Start with a stethoscope that picks up one heart beat or a thermometer that reads one body beat or a thermometer that reads one body temperature accurately and consistently.temperature accurately and consistently.
1818
Ground RulesGround Rules
Any Solution Must Answer a Well-known ProblemAny Solution Must Answer a Well-known Problem A solution that doesn’t tell you which problem it A solution that doesn’t tell you which problem it
is solving is not worth our time.is solving is not worth our time. The technology tools, like builders and wizards, The technology tools, like builders and wizards,
are only part of the solution.are only part of the solution.
Re-use Existing SolutionsRe-use Existing Solutions Do not re-invent the wheel.Do not re-invent the wheel. Use the right-size wheel according to the car Use the right-size wheel according to the car
manufacturer’s specifications.manufacturer’s specifications.
Think End-to-EndThink End-to-End
1919
Enough Lecturing!Enough Lecturing!
2020
Problem StatementProblem Statement
Here’s a summary of system requirements:Here’s a summary of system requirements:
1.1. The DBA at a SQL Server shop with dozens of The DBA at a SQL Server shop with dozens of servers needs to monitor disk space utilization servers needs to monitor disk space utilization of these servers.of these servers.
2.2. Servers are both within firewalls and in the Servers are both within firewalls and in the DMZ.DMZ.
3.3. Monitoring intervals are not fixed.Monitoring intervals are not fixed.4.4. Every server may not necessarily be available Every server may not necessarily be available
when the monitor job runs.when the monitor job runs.
2121
Problem StatementProblem Statement
Additional Notes and Requirements:Additional Notes and Requirements:
5.5. Both Free-space and Used-space amounts need Both Free-space and Used-space amounts need to be monitored (in MB and GB).to be monitored (in MB and GB).
6.6. Free-space and Used-space DELTA amounts Free-space and Used-space DELTA amounts (from last monitor date to the current) are (from last monitor date to the current) are needed as well.needed as well.
7.7. If a server was not available on the last monitor If a server was not available on the last monitor date, its DELTA amount needs to be calculated date, its DELTA amount needs to be calculated from its most recent available date until current from its most recent available date until current date.date.
2222
Feasibility Analysis & Some Feasibility Analysis & Some Critical QuestionsCritical Questions
Before Drawing a Roadmap and Planning the Stops Before Drawing a Roadmap and Planning the Stops on our Trip …on our Trip …
Is Is Server Disk-space PlanningServer Disk-space Planning a good project for a good project for Analysis Services?Analysis Services?
How would you compare and contrast this to a How would you compare and contrast this to a typical typical Sales ForecastSales Forecast model? model?
How would our model behave if we delete a 100 How would our model behave if we delete a 100 GB database, or move it to a different server?GB database, or move it to a different server?
What if we zip / archive some of the folders?What if we zip / archive some of the folders?
2323
The Road MapThe Road Map
Processing Stages:Processing Stages:
1.1. Collect data about server space information and Collect data about server space information and store in a staging database;store in a staging database;
2.2. Perform additional calculations as needed;Perform additional calculations as needed;3.3. Populate Populate factfact tables in the Data Mart; tables in the Data Mart;4.4. Update / add to Update / add to dimdim tables in the Data Mart; tables in the Data Mart;5.5. Transfer data from Data Mart Transfer data from Data Mart factfact & & dimdim tables tables
to Analysis Services database (“Process”);to Analysis Services database (“Process”);6.6. Update user interface data (e.g. Refresh Excel Update user interface data (e.g. Refresh Excel
Pivot Tables); Pivot Tables);
2424
But Wait!But Wait!
2525
Interview Question #2Interview Question #2
What do you need to do before building the 1What do you need to do before building the 1stst Cube?Cube?
• A) Open the Cube WizardA) Open the Cube Wizard• B) Run ETL to populate a Data MartB) Run ETL to populate a Data Mart• C) Plan the measures and the schemasC) Plan the measures and the schemas• D) Setup SSIS and SSASD) Setup SSIS and SSAS
2626
Interview Question #2Interview Question #2
What do you need to do before building the 1What do you need to do before building the 1stst Cube?Cube?
• A) Open the Cube WizardA) Open the Cube Wizard• B) Run ETL to populate a Data MartB) Run ETL to populate a Data Mart• C) Plan the measures and the schemasC) Plan the measures and the schemas• D) Setup SSIS and SSASD) Setup SSIS and SSAS
2727
11stst Star Schema: Star Schema: DM_Ben_FreespaceDM_Ben_Freespace
2828
11stst Star Schema Star SchemaFreespaceFactFreespaceFact
CREATE TABLE [dbo].[FreespaceFact]([Freespace_id] [int] IDENTITY(1,1) NOT NULL,[server_fk] [int] NULL,[drive_fk] [int] NULL,[cycle_fk] [int] NULL,[mb_free] [int] NULL,[gb_free] [int] NULL
2929
11stst Star Schema Star SchemaCycleDimCycleDim
CREATE TABLE [dbo].[CycleDim]([cycle_id] [int] IDENTITY(1,1) NOT NULL,[cycle] [int] NULL,[cycle_date] [datetime] NULL,[year_number] [int] NULL,[month_number] [int] NULL,[day_number] [int] NULL,[week_number] [int] NULL,[day_of_the_week] [int] NULL
3030
11stst Star Schema Star SchemaServerDimServerDim
CREATE TABLE [dbo].[ServerDim]([server_id] [int] IDENTITY(1,1) NOT NULL,[name] [nchar](50) NULL,[location] [nchar](50) NULL,[ip] [nchar](15) NULL,[stage] [nchar](10) NULL
3131
11stst Star Schema Star SchemaDriveDimDriveDim
CREATE TABLE [dbo].[DriveDim]([drive_id] [int] IDENTITY(1,1) NOT NULL,[server_id] [int] NOT NULL,[server_name] [nchar](50) NULL,[drive_letter] [nchar](1) NOT NULL
3232
22ndnd Star Schema: Star Schema: DM_Ben_UsedspaceDM_Ben_Usedspace
3333
22ndnd Star Schema Star Schema UsedspaceFactUsedspaceFact
CREATE TABLE [dbo].[UsedspaceFact]([usedspace_id] [int] IDENTITY(1,1) NOT NULL,[server_fk] [int] NULL,[drive_fk] [int] NULL,[cycle_fk] [int] NULL,[file_fk] [int] NULL,[size] [nvarchar](18) NULL,[size_kb] [bigint] NULL,[size_mb] [bigint] NULL,[size_gb] [bigint] NULL,[maxsize] [nvarchar](18) NULL,[growth] [nvarchar](18) NULL,[usage] [varchar](9) NULL
3434
22ndnd Star Schema Star SchemaFileDimFileDim
CREATE TABLE [dbo].[FileDim]([file_id] [int] IDENTITY(1,1) NOT NULL,[server_fk] [int] NULL,[server_name] [sql_variant] NULL,[drive_fk] [int] NULL,[drive_letter] [nvarchar](1) NULL,[DatabaseName] [nvarchar](128) NULL,[DB_fileid] [smallint] NULL,[DatabaseFileName] [nvarchar](128) NULL,[filename] [nvarchar](260) NULL,[filegroup] [nvarchar](128) NULL
3535
The Road MapThe Road Map
Processing Stages:Processing Stages:
1.1. Collect data about server space information and Collect data about server space information and store in a staging database;store in a staging database;
2.2. Perform additional calculations as needed;Perform additional calculations as needed;3.3. Populate Populate factfact tables in the Data Mart; tables in the Data Mart;4.4. Update / add to Update / add to dimdim tables in the Data Mart; tables in the Data Mart;5.5. Transfer data from Data Mart Transfer data from Data Mart factfact & & dimdim tables tables
to Analysis Services database (“Process”);to Analysis Services database (“Process”);6.6. Update user interface data (Refresh Excel Pivot Update user interface data (Refresh Excel Pivot
Tables); Tables);
3636
The Road MapThe Road Map
Processing Stages:Processing Stages:
1.1. Collect data about server space Collect data about server space information and store in a staging DB;information and store in a staging DB;
2.2. Perform additional calculations as needed;Perform additional calculations as needed;3.3. Populate Populate factfact tables in the Data Mart; tables in the Data Mart;4.4. Update / add to Update / add to dimdim tables in the Data Mart; tables in the Data Mart;5.5. Transfer data from Data Mart Transfer data from Data Mart factfact & & dimdim tables tables
to Analysis Services database (“Process”);to Analysis Services database (“Process”);6.6. Update user interface data (Refresh Excel Pivot Update user interface data (Refresh Excel Pivot
Tables); Tables);
3737
Data CollectionData Collection
3838
Data CollectionData Collection
3939
Data CollectionData Collection
4040
Data CollectionData Collection
4141
Data CollectionData Collection
4242
Data CollectionData Collection
4343
Data CollectionData Collection
XX XX
4444
Data CollectionData Collection
Take 1Take 1
Write a couple of stored proceduresWrite a couple of stored procedures Define each target server as a linked serverDefine each target server as a linked server Define logins for each target linked serverDefine logins for each target linked server Run the stored procedures against each target Run the stored procedures against each target
linked serverlinked server Continue with loading the fact and dimension Continue with loading the fact and dimension
tables, the cubes, and the Excel pivot tablestables, the cubes, and the Excel pivot tables
4545
Data CollectionData Collection
Take 1Take 1
4646
Data CollectionData Collection
Take 1Take 1
4747
Data CollectionData Collection
Take 1Take 1
4848
Data CollectionData Collection
Take 1Take 1
4949
Data CollectionData Collection
Take 1 – Pros and ConsTake 1 – Pros and Cons
Pros:Pros: It worked!It worked! Opportunity to refine those stored proceduresOpportunity to refine those stored procedures
5050
Data CollectionData Collection
Take 1 – Pros and ConsTake 1 – Pros and Cons
Cons:Cons: Too many manual stepsToo many manual steps Problems with access to linked serversProblems with access to linked servers Extra work to add a new serversExtra work to add a new servers
5151
Data CollectionData Collection
Take 2Take 2
Try to automate some of the process;Try to automate some of the process; Look for a reusable “wheel” … Look for a reusable “wheel” … Don’t re-invent!Don’t re-invent!
5252
Data CollectionData Collection
Take 2Take 2
Try to automate some of the process;Try to automate some of the process; Look for a reusable “wheel” … Look for a reusable “wheel” … Don’t re-invent!Don’t re-invent!
5353
Data CollectionData Collection
The WheelThe Wheel
5454
Data CollectionData Collection
The WheelThe Wheel
5555
Data CollectionData Collection
Additions to the WheelAdditions to the Wheel
5656
Data CollectionData Collection
Additions to the WheelAdditions to the Wheel
5757
Data TransferData Transfer
From Data Mart to Analysis ServicesFrom Data Mart to Analysis Services
Design Time through 1Design Time through 1stst Full Transfer: Full Transfer: Easier to developEasier to develop Longer to runLonger to run
Cyclical Updates:Cyclical Updates: Shorter run-timeShorter run-time Complex development logic to identify what to Complex development logic to identify what to
transfer and howtransfer and how
5858
Data Delivery to End-UsersData Delivery to End-Users
XX XX
5959
Data Delivery to End-UsersData Delivery to End-Users
6060
Data Delivery to End-UsersData Delivery to End-Users
Reporting Services:Reporting Services: Part of “The Wheel” – SSIS & SSRSPart of “The Wheel” – SSIS & SSRS
Excel Pivot Tables:Excel Pivot Tables: 2003 Version2003 Version 2007 Version2007 Version 2010 Version2010 Version
6161
PresentationPresentation
6262
Questions and AnswersQuestions and Answers
6363
Additional ReferencesAdditional References
• SQL Server Magazine Article – February 2008 SQL Server Magazine Article – February 2008 http://www.sqlmag.com/Articles/ArticleID/97840/97840http://www.sqlmag.com/Articles/ArticleID/97840/97840.html?Ad=1.html?Ad=1
• SQL Server 2008 Analysis Services Step by Step – SQL Server 2008 Analysis Services Step by Step – Scott CameronScott Cameron
• Data Mining with Microsoft SQL Server 2008 – Data Mining with Microsoft SQL Server 2008 – Jamie Jamie MacLennanMacLennan
• Foundations of SQL Server 2005 Business Intelligence - Foundations of SQL Server 2005 Business Intelligence - Lynn LangitLynn Langit
• Practical Business Intelligence with SQL Server 2005 - Practical Business Intelligence with SQL Server 2005 - John C. Hancock and Roger TorenJohn C. Hancock and Roger Toren
• A Decision Maker's Overview of Business A Decision Maker's Overview of Business Intelligence in SQL Server 2005 – Intelligence in SQL Server 2005 – Ben AminniaBen Aminnia www.sql.lawww.sql.la
6464
Contact InformationContact Information
• Emails:Emails: [email protected] [email protected] [email protected] [email protected]
• Websites:Websites: www.sql.lawww.sql.la www.pointercorp.com www.pointercorp.com www.vipletters.com www.vipletters.com www.takeatest.net www.takeatest.net
6565
Thank You!Thank You!