0% found this document useful (0 votes)
35 views

Manage and Configure Databases

Uploaded by

Nixon Muluh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Manage and Configure Databases

Uploaded by

Nixon Muluh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

7/23/2019 Print content

Administering Microsoft SQL Server 2012 Databases

Manage and Configure Databases

Introduction
Designing Multiple Filegroups
Configuring and Standardizing Databases
Implementing and Configuring Contained Databases
Summary

Introduction
The Manage and Configure Databases module provides you with the instruction and
server hardware to develop your hands on skills in the defined topics. This module
includes the following exercises:

Designing Multiple Filegroups


Configuring and Standardizing Databases
Implementing and Configuring Contained Databases

Lab Diagram

During your session you will have access to the following lab configuration. Depending
on the exercises you may or may not use all of the devices, but they are shown here in the
layout to get an overall understanding of the topology of the lab.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 1/31
7/23/2019 Print content

Connecting to your lab

In this module you will be working on the following equipment to carry out the steps
defined in each exercise.

PLABSQL01 (SQL Server 1)


PLABSQL02 (SQL Server 2)

To start, simply choose a device and click Power on. In some cases, the devices may
power on automatically.

For further information and technical support, please see our Help and Support
page.

Copyright Notice
This document and its content is copyright of Practice-IT - © Practice-IT 2014. All rights reserved. Any
redistribution or reproduction of part or all of the contents in any form is prohibited other than the
following:
1) You may print or download to a local hard disk extracts for your personal and non-commercial use
only.
2) You may copy the content to individual third parties for their personal use, but only if you
acknowledge the website as the source of the material. You may not, except with our express written
permission, distribute or commercially exploit the content. Nor may you transmit it or store it in any
other website or other form of electronic retrieval system.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 2/31
7/23/2019 Print content

Exercise 1 - Designing Multiple Filegroups


In this exercise, you will perform the tasks required to manage and configure databases.
To better understand this task, please refer to your course material or visit
http://technet.microsoft.com/en-us/library/bb500469.aspx to gain an understanding of
this topic.

Designing multiple filegroups

To design multiple filegroups, perform the following steps:

Step 1
Ensure you have powered on the required devices and Connect to PLABSQL01.

On the desktop, double-click SQL Server Management Studio.

The Connect to Server dialog box is displayed.

Keep the default settings and click Connect.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 3/31
7/23/2019 Print content

Microsoft SQL Server Management Studio opens.

In Object Explorer, expand Databases, right-click AdventureWorks2012, and


select Properties. The Database Properties - AdventureWorks2012 dialog box
opens.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 4/31
7/23/2019 Print content

In the left pane, select Filegroups.

In the right pane, click Add and enter SECONDARY in the text box that appears under
PRIMARY.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 5/31
7/23/2019 Print content

Click Add once again and enter PLAB in the new text box that appears under
SECONDARY and click OK.

After creating the filegroup, you need to add files.

Right-click AdventureWorks2012 and select Proeprties. The Database


Properties - AdventureWorks2012 dialog box is displayed.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 6/31
7/23/2019 Print content

Select Files in the left pane.

In the right pane, click Add and type AdventureWorks2012 in the Logical Name
column. Then, against AdventureWorks2012, in the Filegroup column, select
SECONDARY.

Click OK to close the dialog box.

Managing File Space You can also move indexes from one filegroup to another
filegroup to manage file space. To move an index, perform the following steps:

Step 1
From Microsoft SQL Server Management Studio.

Expand AdventureWorks2012, expand Tables, expand Indexes, and then right-


click AK_Address_rowguid to select Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 7/31
7/23/2019 Print content

In the left pane, click Storage.

From the Filegroup drop-down list, select SECONDARY and click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 8/31
7/23/2019 Print content

The Microsoft SQL Server Management Studio dialog box is displayed. Click OK.

The dialog box closes.

Leave the devices you have powered on in their current state and proceed to the next
exercise.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 9/31
7/23/2019 Print content

Exercise 2 - Configuring and Standardizing


Databases
To configure and standardize databases, perform the following steps:

Step 1
On PLABSQL01 In Object Explorer, expand Databases, expand System
Databases, right-click model, and then select Properties.

The Database Properties - model window is displayed.

Click Options in the left pane.

In the Automatic section, set Auto Shrink to True and click OK to close the window.

Note: Similarly, you can set multiple options in the database properties. For this task,
you will enable only the Auto Shrink option.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 10/31
7/23/2019 Print content

You are now navigated back to the Microsoft SQL Server Management Studio
(Administrator) window.

Configuring Partitioning

To implement and configure partitioning, perform the following steps:

Step 1
Using Object Explorer, expand Databases, expand AdventureWorks2012, expand
Tables, right-click Person.Address, select Storage, and then select Create
Partition.

The Create Partition Wizard is displayed.

Click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 11/31
7/23/2019 Print content

On the Select a Partitioning Column screen, note that AddressID is selected by


default. Keep the default option and click Next.

On the Select a Partition Function screen, the New partition function is selected
by default. Enter PLAB in the text box and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 12/31
7/23/2019 Print content

On the Select a Partition Scheme screen, the New partition scheme option is
selected by default. Enter PLAB_Schema in the text box and click Next.

On the Map Partitions screen, Left boundary is selected by default.

From the Filegroup drop-down list, select PRIMARY and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 13/31
7/23/2019 Print content

On the Select an Output Option screen, select Run immediately and click Next.

On the Review Summary screen, click Finish.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 14/31
7/23/2019 Print content

The Creation Partition Wizard Progress screen displays the progress of


partitioning. Click Close.

You are now navigated back to the Microsoft SQL Server Management Studio
(Administrator) window.

Leave the devices you have powered on in their current state and proceed to the next
exercise.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 15/31
7/23/2019 Print content

Exercise 3 - Implementing and Configuring


Contained Databases
To configure contained databases, perform the following steps:

Step 1
On PLABSQL01 In Object Explorer, right-click PLABSQL01, which is the server
name and select Properties.

The Server Properties - PLABSQL01 dialog box is displayed.

Click Advanced in the left pane.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 16/31
7/23/2019 Print content

Note that Containment section has the Enable Contained Databases option set to
False.

Click the Enable Contained Databases drop-down list, select True, and click OK.

You can also set containment at the individual database level. To do this, perform the
following steps:

In Object Explorer, right-click AdventureWorks2012 and select Properties.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 17/31
7/23/2019 Print content

The Database Properties - AdventureWorks2012 dialog box is displayed.

Click Options in the left pane.

In the Cotainment type list, select Partial and click OK.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 18/31
7/23/2019 Print content

You are navigated back to SQL Server Management Studio.

Configuring Data Compression

To configure data compression, perform the following steps:

Step 1
https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 19/31
7/23/2019 Print content

In Object Explorer, expand Databases, expand AdventureWorks2012, expand


Tables, right-click Person.Address, select Storage, and then select Manage
Compression.

The Data Compression Wizard wizard is displayed.

Click Next.

Select Use same compression type for all partitions. Note that the drop-down list
next to Use same compression type for all partitions becomes active.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 20/31
7/23/2019 Print content

From the drop-down list, select Row and click Next.

On the Select an Output Option screen, select Run immediately and click Next.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 21/31
7/23/2019 Print content

On the Data Compression Wizard Summary screen, click Finish.

The Compression Wizard Progress screen displays the progress status. Click Close.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 22/31
7/23/2019 Print content

You are now navigated back to the Microsoft SQL Server Management Studio
(Administrator) window.

Configuring TDE

To configure TDE (Transparent Data Encryption), perform the following steps:

Step 1
In Object Explorer, right-click PLABSQL01, which is the server name, and select
New Query.

The right pane displays the new query window.

Enter the following query and click Execute.

USE master;
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Passw0rd';
GO

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 23/31
7/23/2019 Print content

The query should execute.

After you have created the master encryption key, you will need to create a certificate that
is protected by the master key. This certificate will be used to encrypt databases.

Open a new query window.

Enter the following query and click Execute.

CREATE CERTIFICATE ServerCertificate WITH SUBJECT = 'Master


Certificate';

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 24/31
7/23/2019 Print content

After you have created the master encryption key and certificate, you need to create a
Database Encryption Key (DEK).

Open a new query window.

Enter the following query and click Execute.

USE AdventureWorks2012;
GO
CREATE DATABASE ENCRYPTION KEY
WITH ALGORITHM = AES_128
ENCRYPTION BY SERVER CERTIFICATE ServerCertificate;

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 25/31
7/23/2019 Print content

After you have performed these first three steps, you need to encrypt the database. You
can do this by using the ALTER DATABASE statement.

Open a new query window.

Enter the following query and click Execute.

ALTER DATABASE AdventureWorks2012


SET ENCRYPTION ON;

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 26/31
7/23/2019 Print content

After encrypting the database, you need to ensure that you have backed up the server
certificate. If you lose this certificate, you will not be able to access the data from the
database that you have encrypted.

Though this is an optional step, it is strongly recommended that you back up the server
certificate.

Open a new query window.

Enter the following query and click Execute.

BACKUP CERTIFICATE ServerCertificate


TO FILE = 'ServerCertExport'
WITH PRIVATE KEY
(
FILE = 'PrivateKeyFile',
ENCRYPTION BY PASSWORD = 'Passw0rd'
);
GO

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 27/31
7/23/2019 Print content

Managing Log File Growth

To manage log file growth, perform the following steps:

Step 1
In Object Explorer, expand Databases, right-click AdventureWorks2012, and
then select New Query.

The right pane displays a new query window.

Enter the following query and click Execute.

DBCC SQLPERF (LOGSPACE)

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 28/31
7/23/2019 Print content

You should get the following result:

Click the Messages tab in the bottom section of the right pane. Note the message
displayed.

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 29/31
7/23/2019 Print content

Shutdown all virtual machines used in this lab, by using the power functions located in
the Tools bar before proceeding to the next module. Alternatively you can log out of the
lab platform.

Summary
In this module, you covered carried the following practical tasks:

Designing multiple file groups


Configuring and standardizing databases
Managing file space
Implementing and configuring contained databases
Configuring data compression
Configuring TDE
Configuring partitioning
Managing log file growth

Also try
Using the current lab setup you can try the following concepts at your own pace.
https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 30/31
7/23/2019 Print content

Running SQLIOSIM on PLABSQL02 on AdventureWorks2012 database


Shrinking the existing AdventureWorks2012 database

https://www.practice-labs.com/authenticated/vNext/vn-print-content.aspx 31/31

You might also like