0% found this document useful (0 votes)
69 views69 pages

SQL Server 2008/2012: Database Administrator Class 1

This document outlines the details of a 4 hour SQL Server database administrator training class. The class will cover installing and configuring SQL Server, creating databases and objects, security, backups, high availability, performance tuning and more. It includes 48 hands-on lab cases for students to practice administrative tasks.

Uploaded by

Katrina Lu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views69 pages

SQL Server 2008/2012: Database Administrator Class 1

This document outlines the details of a 4 hour SQL Server database administrator training class. The class will cover installing and configuring SQL Server, creating databases and objects, security, backups, high availability, performance tuning and more. It includes 48 hands-on lab cases for students to practice administrative tasks.

Uploaded by

Katrina Lu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 69

SQL-DBA-Hands-on C1

SQL Server
2008/2012
Database Administrator
Class 1
Jay Liu
E: [email protected] C: 647-833-5887

1
SQL-DBA-Hands-on C1

Class 1 - (4 hrs)
1.1. Introduction
1.2. Business Requirements
1.3. Analysis and Technical Understanding
1.4. Environment Requirements and Setup

2
SQL-DBA-Hands-on C1

1.1. Introduction - SQL Server DBA Hands-on


• 40 hours in total.
• 48 Cases.
• Each one has a PC to practice.
• Start from Installation until all cases fixed.
• Case study.
• Analyze and determine solutions.
• Implement solutions.
• Check/verify.
• Explanation & discussion.
3
SQL-DBA-Hands-on C1

SQL Server DBA Hand-on Outline


Project overview, Requirement Analysis and Case Study
Case 1. Installing SQL Server
- Installing new SQL Server 2008 instances, and
applying ServicePack / HotFix
(Standalone and Clustered)
- Post Configurations after Installation
- Configure Surface Area

Case 2. Create Databases


- Files and Filegroups

Case 3. Design and Create Tables


- Determine Data Types

4
SQL-DBA-Hands-on C1

Case 4. Design and Create Indexes


- Creating and adjusting indexes
Case 5. Views
- Designing and creating indexed views

Case 6. Monitoring databases & indexes


- Verifying files, locations, index parameters
- System Monitor Counters

Case 7. Implement Backups


- Full, differential and transaction log backups

Case 8. Database Recovery


- Restore backups
- Recover database to point of time.

5
SQL-DBA-Hands-on C1

Case 9. SQL Server Security


- Design and Manage Logins and Permissions
- Design and Implement Security Policy and an Audit Plan and Audit
SQL Server instances
- Handle transparent data encryption

Case 10. Database Security


- Database Users, Roles and Schemas

Case 11. Object Security


- Access permissions & object ownership
- Associated Permission Controls

Case 12. Security Control


- Manage permissions using stored procedures

6
SQL-DBA-Hands-on C1

Case 13. Encryption


- Encrypting data

Case 14. Working with data loading


- Bulk Insert and bcp
- Using Packages for data loading and extracting

Case 15. Tracking Your Change


- Tracking Data Change

Case 16. Disaster Recovery


- Setting up DR environment

7
SQL-DBA-Hands-on C1

Case 17. High availability (1)


- Failover Clustering

Case 18. High availability (2)


- Auto Failover: Database Mirroring

Case 19. High availability (3)


- Implement, verify & manage replication, snapshot,
transactional and merge
- Peer-to-peer replication *

Case 20. High availability (4)


- Implement, verify & manage log shipping

8
SQL-DBA-Hands-on C1

Case 21. Configuring SQL Server Agent


- Database mail, jobs and alerts

Case 22. Monitoring SQL Server


- Activity Monitor, DMV/DMF & Profiler
- Data collection
- Resource Governor
Case 23. More Performance Tuning
- Using Database engine Tuning Advisor
Case 24. Partition
- Design and Implement Partitioning

9
SQL-DBA-Hands-on C1

Case 25. Optimizing Query Performance (1)


- Subqueries
Case 26. Optimizing Query Performance (2)
- Incorrect use of keywords
Case 27. Optimizing Query Performance (3)
- Solving Table-Scan
Case 28. Optimizing Query Performance (4)
- Using Views
Case 29. Optimizing Query Performance (5)
- Cursor
Case 30. Optimizing Query Performance (6)
- Detecting and resolving locking/blocking

10
SQL-DBA-Hands-on C1

Case 31. Optimizing Query Performance (7)


- Optimizing transactions

Case 32. Optimizing Query Performance (8)


- Managing index

Case 33. Optimizing Query Performance (9)


- Execution Plans

Case 34. Optimizing Query Performance (10)


- Statistics

11
SQL-DBA-Hands-on C1

Case 35. More Database Maintenance (1)


- Shrinking database and files

Case 36. More Database Maintenance (2)


- Backup SQL Server system databases

Case 37. More Database Maintenance (3)


- Repair SQL Server from corruption
Case 38. More Database Maintenance (4)
- Managing tempdb

12
SQL-DBA-Hands-on C1

Case 39. More Database Maintenance (5)


- Linked server
Case 40. More Database Maintenance (6)
- Security Auditing
Case 41. More Database Maintenance (7)
- Configuring Errorlog
Case 42. More Database Maintenance (8)
- Using DAC
Case 43. More DBA Stuff (1)
- Using osql
Case 44. More DBA Stuff (2)
- Scripting DBA tasks using T-SQL

13
SQL-DBA-Hands-on C1

Case 45. Touching SQL Server BI (1)


- Processing Data for Extracting, Transforming and
Loading (ETL) – SSIS
Case 46. Touching SQL Server BI (2)
- Presenting and Reporting data – SSRS
Case 47. Touching SQL Server BI (3)
- Mining and Analyzing Data - SSAS
Case 48. Upgrade to SQL Server 2012
- The AlwaysOn
- Moving SQL 2008 DBs to 2012
- Miscellaneous Tasks

14
SQL-DBA-Hands-on C1

1.2. Business Requirements


Background:
VIC.com is a retail company that provides product sales
between the customers and the manufactures. The current
system is running on SQL Server 2008 environment. The
company is upgrading their database to SQL Server 2012, and
also wants to solve some existing issues.
The project moves the data to a new environment where the
new SQL Server 2012 is installed and running, and this
migration will reduce the cost of completing transactions, so
that the company will gain cost-saving and increase the profit
from it. To protect the new database better than ever, it will be
designed in clustered environment.

15
SQL-DBA-Hands-on C1

Database Environment:
For testing and verification purpose, the rehearsal environment
is required to be created under 2008, and then upgrade to 2012.
The current OLTP database system consists of two databases,
Orders, and Products.
The Orders database holds information of online and/or offline
ordering records. It is a highly active database, with at least
300 orders entered per hour.
The Products database has pricing information for all products
the company sells. A copy of this database will be located in
the Seattle branch office, people there should be able to make
any new changes themselves, and the updates between the
branch in Seattle and the head office must be in sync.

16
SQL-DBA-Hands-on C1

Data Import:
Orders data files are text formatted and nightly transferred to
the database server, and loaded into the SQL Server database
manually by the database operators in the coming morning.
This should be automated after the upgrade.
Products information is usually imported by loading the files
transferred from the host data warehouse, updated in the
Products database to keep it up-to-date in daily basis.
Backup:
All databases have backup strategy for backing up the data in
nightly basis. This needs to be changed to avoid any data lose
happened few months ago when a hard drive failed and all
orders on that day were lost.

17
SQL-DBA-Hands-on C1

Reporting:
Currently, the reporting team creates their reports directly
against the production databases, and it frequently causes the
performance impact to the Order Provisioning and the Billing
applications. With the upgrade to the new environment, this
issue must be fixed.
Reports are exactly real-timing and almost request the
synchronized results as production no later than 10 minutes,
and the new databases should allow users to run any reports at
any time. Some reports are running at very low performance
right now, and those reports need to be promoted to work
faster. Major reports are combining Orders and Products
information and generating the associated results, such as order
details for each product on the running day.

18
SQL-DBA-Hands-on C1

Security and Permissions:


Currently, all developers have access on all database objects
and all data including sensitive information, such as credit card
numbers.
In future with the new system, only certain users should be
able to see all information, called Admin Group. Sales
department should have read-write permit on Orders, but read
only on Products. Products and Shipping departments should
have read only on Orders, but writable on Products. All
users should be grouped up based on their functional
departments with the different access allowances. Some data,
typically credit card information should be encrypted, and only
those Admin Group users can view it by decrypting the data.

19
SQL-DBA-Hands-on C1

Current issues needed to be solved in new system


1. Few months ago, end users got an error message at least once a
week that the “transaction log is full.” No one knows what to
do about it, except the database operators run a command to
“truncate the log.” Developers report that the database has
grown to consume almost the entire disk space and keep filling
up. The windows administrator is complaining about getting
“disk full” message on the database drive.
2. The windows administrator tells that Windows system backups
cannot be done more frequently than nightly. Two months ago,
there was a hard drive failure at 4:00pm, and all orders (about
1,600) for that day had to be reentered because of the data lose.
There must be a reliable solution to handle this situation in the
new environment of SQL Server 2008/2012.

20
SQL-DBA-Hands-on C1

3. Developers have been logging in with the system administrator


(sa) account, and have complete control over the entire SQL
Server. Last week, someone changed the pricing information
accidentally, and caused all reports against that product got
wrong results; it also impacted the monthly billing to delay by
spending a long time to fix the error.
4. The company’s Seattle branch office has another SQL Server
database, and people there are supposed to update their local
data in their own system, but the data cannot be synchronized
with the main office automatically. They are currently sending
emails once their local information gets changed, and then the
main office people make the same change in the central
database.

21
SQL-DBA-Hands-on C1

5. Currently, data importing is nightly done, but the database


backup is not ensured to perform after the data is imported, as
the loading time is not certain while the database backup time
it scheduled at the same time every night.
6. Customer credit card numbers are stored in the Orders
database. It has to be hidden from everyone’s view, but access
can be gained when necessary, e.g., to pay for a new order.
7. Queries against databases are getting slower and slower, and
developers are suggesting to create more indexes, or even
rebuild existing indexes.
8. There is no production backup server right now, if the
production server or database is totally unavailable, everything
will be gone.

22
SQL-DBA-Hands-on C1

1.3. Analysis & Technical Understanding


- Collecting information from BR and
generating a list of requirements
1.Setting up SQL Server 2008, cluster, and
then migrating to SQL Server 2012.
- Case 1, 17, 48
2. Migrating Databases.
- Case 2, 48
3. Cloning tables with same structures.
- Case 3, 4, 5

23
SQL-DBA-Hands-on C1

4. Copying data.
- Case 14
5. Designing new backup strategies.
- Case 7, 8
6. Creating logins/users groups to reorganize.
and better control the permission and access.
- Case 9, 10

24
SQL-DBA-Hands-on C1

7. Creating on-line reporting server for


generating reports, and keep the data in
sync with production data in minimum
latency.
- Case 19
8. On any sensitive column, the data should
be encrypted and can be gained again when
necessary.
- Case 13

25
SQL-DBA-Hands-on C1

9. Certain safer ways should be provided to


allow users access data only via those ways.
- Case 11, 12, 15, 39, 40
10. Synchronizing the data changes between
the head office and the Seattle branch.
- Case 19
11. Review indexes to ensure the high
performance of queries
- Case 23 ~ Case 34

26
SQL-DBA-Hands-on C1

12. Automating the file import and following


a backup after loading.
- Case 7, 14, 21, 45
13. A backup server of production should be
setup for disaster recovery. When the
production is unavailable, an immediate
fail-over is required.
- Case 16, 18, 20

27
SQL-DBA-Hands-on C1

14. To provide easy access and higher


performance for reporting, certain amount
of views with indexes might be needed.
- Case 22, 46, 47
15. When any problems happen, such as disk
full, memory not enough, CPU extremely
busy, i.e., there is no way to immediately
know it. With the new system, these
should be paid more attention.
- Case 21, 22

28
SQL-DBA-Hands-on C1

16. Some policy based monitoring tool better


to be implemented. More monitoring
tools/functions should be added to track
down data change/loss.
- Case 22, 40
17. Some extra database maintenance work is
required to improve protection.
- Case 6, 35 ~ 44

29
SQL-DBA-Hands-on C1

Class 1 - (4 hrs)
1.1. Introduction of SQL Server DBA Hands-on Course
1.2. Business Requirements
1.3. Analysis & Technical Understanding
1.4. Environment Requirements and Setup
Class 2 – (4 hrs)
2.1. Planning SQL Server 2008 Instances
2.2. Installing SQL Server 2008 Instances
- PROD Instance1/Clustered
- PROD Instance2/Clustered
2.3. Patch SQL Server PROD Instances (Apply Service Pack)

30
SQL-DBA-Hands-on C1

Class 3 – (4 hrs)
3.1. Install SQL Server instances on DR VM
- DR/Standalone
- RPT/Standalone
3.2. Patch DR instances (DR, RPT)
3.3. Finalizing SQL Server Installation (Post-Configuration)
3.4. Looking into SQL Server
- Services, Instance structure, Databases, SSMS
Class 4 – (4 hrs)
4.1. Creating and Configuring Databases
4.2. Database Maintenance
4.3. Creating and Maintaining Database Objects
4.4. Recovering Databases

31
SQL-DBA-Hands-on C1

Class 5 – (4 hrs)
5.1. High Availability Solutions
5.2. Database Mirroring
5.3. Replication
5.4. Log Shipping
Class 6 – (4 hrs)
6.1. Standing up SQL Server 2012
6.2. Planning Migration
6.3. Implementing Upgrade
6.4. Post-Configuring
Class 7 – (4 hrs)
7.1. SQL Server Security
7.2. DBA Scripting (1)

32
SQL-DBA-Hands-on C1

Class 8 – (4 hrs)
8.1. More Database Maintenance Tasks
8.2. DBA Scripting (2)
Class 9 – (4 hrs)
9.1. Performance Tuning
9.2. DBA Scripting (3)
Class 10 – (4 hrs)
10.1. BI Basics – SSIS, SSRS, SSAS
10.2. BIDS and SSDT
10.3. Managing SSIS Packages
10.4. Maintaining SSRS Reports
10.5. About SSAS

33
SQL-DBA-Hands-on C1

1.4. Environment Requirements and Setup


D

34
SQL-DBA-Hands-on C1

1.4. Environment Requirements and Setup

35
SQL-DBA-Hands-on C1

1.4.1. Environment Requirements

Hardware required for setting up the virtualization


environment and exercise all cases:
- No less than 100 GB free space on the hard disk
- No less than 4 GB memory
- CPU better x2, or Dual Core, 2.0 GHz or higher
- USB 2.0/3.0 supported
- 32GBx2 or 64GB USB storage device
- 100GB+ USB hard disk (optional)

36
SQ-DBA-Hands-on C1

1.4.1. Environment Requirements

Components and software required for setting up the


virtualization environment:
- VMWare Workstation >> setup the lab environment
- WinRAR >> decompress all files
- Windows Server 2003 Enterprise Edition SP2
SQL Server 2008 Developer Edition & SP2
-Windows Server 2008 R2 SP2 (activation key
required)
SQL Server 2012 Developer Edition & SP2

37
SQL-DBA-Hands-on C1

1.4.1. Environment Requirements

Instances to be installed for this course:


- PROD – Clustered (PRD)
- Preprod – Clustered (PP)
- DR – Standalone (DR)
- Reporting – Standalone (RPT)

38
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

To setup the environment, we need firstly install


VMWare software, and the following steps can lead to
do it.
The VMWare installation image can be found under
“Software\VMware Installation” folder, and the
executable is VMware-workstation-full-8.0.2-
591240.exe.
Locate and launch the installation.

39
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

When seeing the following security warning screen,


click Run to continue.

40
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

VMWare Installation starts:

41
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Click Next

42
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Choose [Typical]

43
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Click Next

44
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Uncheck [Check for product updates on startup] and click Next

45
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Uncheck [Help improve VMWare Workstation] and click Next

46
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Click Next

47
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Click Continue to start installing VMWare Workstation

48
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Installation is in progress

49
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

License key screen appears before installation finishes

50
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

After entering the license key, click Enter to continue

51
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Note: This license key is for demo, making this


document and setting up the environment for the
class purposes only, you should consider obtain your
own license if deciding to really use VMWare
Workstation yourself.

52
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Installation is finished

53
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Now let us launch VMWare Workstation client tool.

54
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

When seeing the License Agreement screen as below,


click Yes, I accept… and then click OK to continue.

55
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Your VMWare Workstation is now opened as below:

You are done with VMWare installation!

56
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Next, let us setup the Virtual Machines in the VMWare


environment which we have just installed.
On the course materials storage, under folder “SQL
Server DBA (2008-2012)\VMWare VMs\Cluster
Ready”, copy-paste all RAR files into your local hard
drive, and let us call it VMWare on C: or D: drive.

57
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Your folder may look like following.

58
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- Backup the folder if wishing for future redoing.


- Under VMWare folder, decompress all compressed files (.rar):
VMWare\DC
VMWare\Node1
VMWare\Node2
VMWare\DR
VMWare\DriveE
VMWare\DriveF
VMWare\Quorum
- All corresponding folders with VM files are created.

59
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

60
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Note, if your hard disk drive is not D:, you can then use
notepad to open .vmx file under each VM’s folder, and
change the description of each disk from D: to C:, or
follow the steps from the instructor.
This is important before moving to the next step to
open the VMs, otherwise the VMs cannot be loaded
properly, as the physical device is different than their
config file (.vmx), so it must be fixed before VMWare
can open the VM and locate the disk files correctly.

61
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Now let us load the VMS into VMWare. In VMWare


Workstation, make sure you are in the tab Home.

62
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- Click Open a Virtual Machine.

63
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- In Open File window, locate VMWare folder on D: drive.

64
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- Then go to folder DC under D:\VMWare, and click DC.vmx.

65
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- Click Open, DC VM is opened and shown in VMWare.

66
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

- Using the same to open Node1, Node2 and DR.

67
SQL-DBA-Hands-on C1

1.4.2. Environment Setup

Your working environment for practicing all the hands-on cases


has now been setup and ready to use.

Note, that we did not go through all detailed steps to build the
whole thing from foundation, but we will discuss about the
concepts briefly in the class, so that you get the basic ideas of
how those VMs are created and configured.

68
SQL-DBA-Hands-on C1

Q&A

Thanks and See You Next Time

69

You might also like