ICT ITS4 10 0811 Identify and Resolve Database Performance Problems
ICT ITS4 10 0811 Identify and Resolve Database Performance Problems
This learning guide is developed to provide you the necessary information regarding the following content coverage
and topics.
Identifying Diagnose Tool based on organizational database requirements
determining and recording inappropriate use of database
This guide will also assist the trainee to attain the learning outcome stated in the cover page. Specifically, upon
completion of this Learning Guide, the trainee will be able to:
Identify Diagnose Tool based on organizational database requirements
Determine and recording inappropriate use of database
Learning Instructions:
1. Read the specific objectives of this Learning Guide.
2. Read the information written in the “Information Sheets 1”. Try to understand what are being discussed. Ask
your teacher for assistance if you have hard time understanding them.
3. Accomplish the “Self-check 1”.
4. Ask from your teacher the key to correction (key answers) or you can request your teacher to correct your work.
(You are to get the key answer only after you finished answering the Self-check 1).
5. If you earned a satisfactory evaluation proceed to “Information Sheet 2”. However, if your rating is not
satisfactory, see your teacher for further instructions,
6. Submit your accomplished Self-check. This will form part of your training portfolio.
A latch is a type of a lock that can be used to prevent more than one process from executing the same piece of code
at a given time.
1.1.2.3 Identify events causing waits and record outcomes
SQL Server Extended Events (Extended Events) is a general event-handling system for server systems.
The Extended Events infrastructure supports the correlation of data from SQL Server, and under certain conditions,
the correlation of data from the operating system and database applications. In the latter case, Extended Events
output must be directed to Event Tracing for Windows (ETW) in order to correlate the event data with operating
system or application event data.
1.1Determining and recording inappropriate use of database
1.4 Fixing The Database based on diagnostic results
When problems occur with a system, it is important to perform accurate and timely diagnosis of the problem before
making any changes to a system. Often a database administrator (DBA) simply looks at the symptoms and
immediately starts changing the system to fix those symptoms. However, long-time experience has shown that an
initial accurate diagnosis of the actual problem significantly increases the probability of success in resolving the
problem.
Automatic Database Diagnostic Monitor
The types of problems that ADDM considers include:
CPU bottlenecks
Undersized Memory Structures
I/O capacity issues
Database configuration issues
Concurrency issues
In addition to problem diagnostics, ADDM recommends possible solutions. When appropriate, ADDM recommends
multiple solutions for the DBA to choose from.
The recommendations include:
Hardware changes - Adding CPUs or changing the I/O subsystem configuration
Database configuration - Changing initialization parameter settings
Schema changes
Application changes
Like an operating system organizes files in a hierarchical file management system, the distributed system uses a
uniform naming convention and a mapping scheme to keep track of where files are located.
When the client device retrieves a file from the server, the file appears as a normal file on the client machine, and the
user is able to work with the file in the same ways as if it were stored locally on the workstation.
Distributed file systems can be advantageous because they make it easier to distribute documents to multiple clients
and they provide a centralized storage system so that client machines are not using their resources to store files.
Ensuring Database back-up procedures
Backup is the process by which you make a copy of your work for safekeeping in an alternate location, in case your
current work becomes lost or corrupt. The backup copy is only as recent as the last time it was modified. The more
work you do, the more frequently you should back up your work.
Before creating databases and schema repositories, administrators should establish procedures and schedules for
regular backups.
- Backups can be performed using backup tools provided by the database vendors and third parties.
- Backups should also be performed before moving schema repositories or user databases.
Backup all databases at the same time, including schema repositories and all associated user databases preserves
both data and customizations, and ensures that schema repositories and user databases are synchronized in case they
need to be restored from a backup.
› Backup Option/Tool
There are only two commands for backup, the primary is BACKUP DATABASE. This allows you to do a complete
backup of your database as well as differential, file, etc.
The BACKUP DATABASE command gives you many options for creating backups.
› Create a full backup to disk
The command is BACKUP DATABASE databaseName. The "TO DISK" option specifies that the backup should
be written to disk and the location and filename to create the backup is specified.
Example: BACKUP DATABASE DatabaseName TO DISK = 'D:\backupFileName.BAK'
› Create a differential backup
This command adds the "WITH DIFFERENTIAL" option.
Example: BACKUP DATABASE databaseName TO DISK = 'D:\BackupFileName.BAK' WITH DIFFERENTIAL
› Create a full backup to multiple disk files
This command uses the "DISK" option multiple times to write the backup to three equally sized smaller files instead
of one large file.
Example: BACKUP DATABASE databaseName TO DISK = 'C:\backupfileName.BAK',
DISK = 'D:\backupfileName.BAK',
DISK = 'E:\backupfileName.BAK'
Secure Backup
Passwords are not required to perform backup operations, but they provide an added level of security. You can use
them in addition to using SQL Server security roles. The use of password protection helps guard against
unauthorized or unintentional actions such as:
Restoration of databases
Appends to the media
Overwriting of the media
A user Managed Backup
In order to select a proper backup type, a SQL Server administrator needs to understand the difference between the
major backup types clearly.
You should always have proper backup plan in place to protect your database from failures.
Backup type
SQL Server has different types of backups
- Full Backup
- Incremental Backup
Note: The database must have full back up in order to take a differential backup, it only backups the changes since
last full backup.
Full/Differential/Transaction Log Backup using SQL Server Management Studio
. Right click on the database name
. Select Tasks > Backup
. Select backup type either "Full" or "Differential" or” Transaction Logl”
. Select the appropriate Backup Destination and click "OK"
File or File Groups Backup using SQL Server Management Studio
o Right click on the database name
o Select Tasks > Backup
o Select backup type either "Full" or "Differential"
o Select Backup component as "Files and file groups"
o Select the appropriate file group
o Select the appropriate Backup Destination and click "OK"
Backup Mode
Offline
Offline backup is a way to store files from a network so that they will be accessible even when the user is not
connected to the network they are stored on.
Online
Online backup, also known as remote backup, is a method of offsite data storage in which files, folders, or the entire
contents of a hard drive are regularly backed up on a remote server or computer with a network connection.
Online backup means to back up data from your hard drive to a remote server or computer using a network
connection.
Configuring and testing database performance
You need to configure the SQL server database to work with the application properly.
You can improve performance by considering the following items when configuring the database and log files.
1. Pre-allocating the space required for database files and log files will improve performance.
2. Allowing the log files to grow automatically is required to ensure that unexpected errors do not occur.
3. Placing the data files and log files on separate physical disk drives will improve performance substantially.
Make sure that these physical disk drives have enough free space to allow for database growth.
4. The database must be backed up regularly, and other database maintenance tasks must be performed from
time to time.
Database maintenance
After the application has been successfully installed, a database maintenance plan must be established.
Use the 'Maintenance Plan Wizard' to create the plan and schedule it. In the wizard, select these options:
Check database integrity
Shrink the database
Reorganize the index
Update statistics
Do a full backup of the database
This learning guide is developed to provide you the necessary information regarding the following content coverage
and topics.
Monitoring and tuning efficiency of structured query language
monitoring and measuring Performance of shared pool, blocks and buffers
Detecting, identifying and resolving contentions that arise in the real-time operation of the database
Reconfiguring the database according to specifications
This guide will also assist the trainee to attain the learning outcome stated in the cover page. Specifically, upon
completion of this Learning Guide, the trainee will be able to:
Monitor and tune efficiency of structured query language
monitor and measure Performance of shared pool, blocks and buffers
Detect, identify and resolve contentions that arise in the real-time operation of the database
Reconfigure the database according to specifications
Learning Instructions:
13. Read the specific objectives of this Learning Guide.
14. Read the information written in the “Information Sheets 3”. Try to understand what are being discussed. Ask
your teacher for assistance if you have hard time understanding them.
15. Accomplish the “Self-check 3.
16. Ask from your teacher the key to correction (key answers) or you can request your teacher to correct your work.
(You are to get the key answer only after you finished answering the Self-check 3).
17. If you earned a satisfactory evaluation proceed to “next Information Sheet”. However, if your rating is not
satisfactory, see your teacher for further instructions,
18. Submit your accomplished Self-check. This will form part of your training portfolio.
Database tuning describes a group of activities used to optimize and homogenize the performance of a database.
Database tuning aims to maximize use of system resources to perform work as efficiently and rapidly as possible.
Monitoring and tuning efficiency of structured query language
Microsoft SQL Server provides a comprehensive set of tools for monitoring events in SQL Server and for tuning the
physical database design. The choice of tool depends on the type of monitoring or tuning to be done and the
particular events to be monitored.
Tune I/O
Hardware and software configuration of disk subsystems MUST examine:
- RAID levels and configuration,
- Block and stripe size allocation,
- The configuration of disks, controller cards, storage cabinets, and external storage systems.
Frequently accessed tables and indexes are placed on separate disks to balance I/O and prevent read queuing.
Monitoring and measuring Performance of shared pool, blocks and buffers
Check the SQL query optimization
Query optimization is a function of many relational database management systems. The query optimizer attempts
to determine the most efficient way to execute a given query by considering the possible query plans.
Indexing a column is a common way to optimize the search result.
SQL Tuning/SQL Optimization Techniques:
1) The SQL query becomes faster if you use the actual columns names in SELECT statement.
Example: SELECT Id, FirstName, LastName, Age, subject FROM student_details; Instead of:
SELECT * FROM student_details;
2) Use operator EXISTS, IN and table joins appropriately in your query.
a) IN is efficient when most of the filter criteria is in the sub-query, but Usually IN has the slowest performance.
b) EXISTS is efficient when most of the filter criteria is in the main query.
Example: Select * from product p
where EXISTS (select * from order_items o
where o.product_id = p.product_id)
Instead of:
Select * from product p
where product_id IN(select product_id from order_items
Tune memory
Each process running on a computer requires a certain amount of memory to temporarily store its machine code and
data. Database management systems (DBMS) also employ shared memory to store data used by many client
applications. Memory tuning involves the allocation of the memory resource to the various components of the
database management system.
Memory management is all about allocation of objects. A correctly tuned memory management system minimizes
the overhead inflicted by garbage collection and makes object allocation fast.
Note: - Contentions are detected, identified and resolved that may arise in the real-time operation of the database.
- Database must be reconfigured according to organizational specifications