M ODULE 4 D ATABASE T UNING AND D ATA LOAD Section 1 Database Tuning and Monitoring 1 ITEC 450 Fall 2012.

Slides:



Advertisements
Similar presentations
Copyright © SoftTree Technologies, Inc. DB Tuning Expert.
Advertisements

9 Copyright © 2006, Oracle. All rights reserved. Automatic Performance Management.
Chapter 9. Performance Management Enterprise wide endeavor Research and ascertain all performance problems – not just DBMS Five factors influence DB performance.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
CHAPTER 13 Data Pump. Tool that replaces legacy exp/imp utilities Data Pump is a scalable, feature-rich utility that allows you to extract objects and.
Loading & organising data. Objectives Loading data using direct-load insert Loading data into oracle tables using SQL*Loader conventional and direct paths.
18 Copyright © 2005, Oracle. All rights reserved. Moving Data.
Oracle 10g Database Administrator: Implementation and Administration Chapter 11 Advanced Data Management.
Oracle Architecture. Instances and Databases (1/2)
The New Data Pump Caleb Small Next generation Import / Export New features Better performance Improved security Versatile interfaces.
Page Footer Keed Education Oracle Database Administration Basic Copyright 2009 Keed Education BV Version Concept.
MCTS GUIDE TO MICROSOFT WINDOWS 7 Chapter 10 Performance Tuning.
12 Copyright © 2005, Oracle. All rights reserved. Proactive Maintenance.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
Harvard University Oracle Database Administration Session 2 System Level.
Oracle 10g Database Administrator: Implementation and Administration Chapter 14 Proactive Maintenance.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
A Guide to Oracle9i1 Introduction to Oracle9i Database Administration Chapter 11.
Chapter 9 Overview  Reasons to monitor SQL Server  Performance Monitoring and Tuning  Tools for Monitoring SQL Server  Common Monitoring and Tuning.
Module 8: Monitoring SQL Server for Performance. Overview Why to Monitor SQL Server Performance Monitoring and Tuning Tools for Monitoring SQL Server.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
M ODULE 5 Metadata, Tools, and Data Warehousing Section 4 Data Warehouse Administration 1 ITEC 450.
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
12 Copyright © 2004, Oracle. All rights reserved. Automatic Management.
Database Advisors Automatic Database Diagnostic Monitor ( ADDM )
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
12 Copyright © 2007, Oracle. All rights reserved. Database Maintenance.
M ODULE 2 D ATABASE I NSTALLATION AND C ONFIGURATION Section 1: DBMS Installation 1 ITEC 450 Fall 2012.
Data Administration & Database Administration
15 Copyright © 2004, Oracle. All rights reserved. Proactive Maintenance.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
MCTS Guide to Microsoft Windows 7
2 Copyright © 2006, Oracle. All rights reserved. Performance Tuning: Overview.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
DATABASE UTILITIES. D ATABASE S YSTEM U TILITIES In addition to possessing the software modules most DBMSs have database utilities that help the DBA in.
1Introduction Objectives 1-2 Course Objectives 1-3 Oracle Products 1-4 Relational Database Systems 1-5 How the Data Is Organized 1-6 Integrity Constraints.
Michael Sit Solution Specialists Manager Oracle Corporation.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
CSE 781 – DATABASE MANAGEMENT SYSTEMS Introduction To Oracle 10g Rajika Tandon.
1 Robert Wijnbelt Health Check your Database A Performance Tuning Methodology.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Oracle9i Performance Tuning Chapter 1 Performance Tuning Overview.
The Self-Managing Database: Guided Application and SQL Tuning Mohamed Ziauddin Consulting Member of Technical Staff Oracle Corporation Session id:
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
Oracle Tuning Ashok Kapur Hawkeye Technology, Inc.
13 Copyright © 2006, Oracle. All rights reserved. Tuning PGA and Temporary Space.
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
By Lecturer / Aisha Dawood 1.  Dedicated and Shared Server Processes  Configuring Oracle Database for Shared Server  Oracle Database Background Processes.
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
Process Architecture Process Architecture - A portion of a program that can run independently of and concurrently with other portions of the program. Some.
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
1 Copyright © 2005, Oracle. All rights reserved. Following a Tuning Methodology.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
13 Copyright © 2007, Oracle. All rights reserved. Using the Data Recovery Advisor.
I NTRODUCTION OF W EEK 2  Assignment Discussion  Due this week:  1-1 (Exam Proctor): everyone including in TLC  1-2 (SQL Review): review SQL  Review.
3 Copyright © 2006, Oracle. All rights reserved. Designing and Developing for Performance.
Planning a Migration.
SQL Server Monitoring Overview
Introduction of Week 3 Assignment Discussion
Introduction of Week 10 Assignment Discussion
One Picture is Worth a Thousand Words
Proactive Maintenance
How to Thrive as a DBA in an Oracle10g World
RAC Performance Lab.
Index Index.
Database administration
Presentation transcript:

M ODULE 4 D ATABASE T UNING AND D ATA LOAD Section 1 Database Tuning and Monitoring 1 ITEC 450 Fall 2012

B ULK D ATA I MPORTS AND E XPORTS U SING D ATA P UMP Previously, export (exp) and import (imp) utilities were used to import/export data from a DB Data Pump export (expdp) and import (impdp) utilities are more versatile and much faster Can be executed in parallel, failed/stopped jobs can be restarted, metadata can be filtered out, etc. Exporting/importing is allowed at all logical layers: tables, schemas, groups of objects, or an entire DB You export data and metadata Database exports can used to migrate and upgrade between different versions of Oracle Fall ITEC 450

B ULK D ATA I MPORTS AND E XPORTS U SING D ATA P UMP Fall ITEC 450

E XPORTING U SING D ATA P UMP Steps: 1. Start a shell and 2. Type expdp help=y 3. Do a simple export expdp classmate/ DIRECTORY=dmpdir DUMPFILE=classmate.dmp 4. Create a directory object for Data Pump C/ CREATE OR REPLACE DIRECTORY DP AS 'C:\'; 5. Execute the expdp utility and export expdp DIRECTORY=dp DUMPFILE=system. dmp NOLOGFILE=Y 6. Export the CLASSMATE schema expdp DIRECTORY=dp DUMPFILE=classmate2. dmp SCHEMAS=('CLASSMATE') NOLOGFILE=Y Fall ITEC 450

I MPORTING U SING D ATA P UMP Data Pump is only available to DB- and OS level administrative personnel Older utils. allow exports/imports across a network Are secure because users have to have the schema password names to access schemas Steps: 1. Start a shell 2. Type impdp help=y The most likely use of these utilities are as fast backups and as an easy method of copying DBs IMP and EXP are easier to use than Data Pump, with the same options, just fewer options Fall ITEC 450

B ULK D ATA L OADS WITH SQL*L OADER SQL*Loader can perform magnificently in direct path, parallel mode, and using external tables Direct path loads allow appending to tables Some situations will cause single tables and even entire SQL*Loader executions to execute using a conventional path load SQL*Loader is not limited to individual table loads It can load into more than one table at once, considering all constraints SQL*Loader can also perform fast direct loads with external tables Fall ITEC 450

B ULK D ATA L OADS WITH SQL*L OADER Fall ITEC 450

D IRECT V ERSUS C ONVENTIONAL P ATH L OADS In a conventional path load rows are parsed into an array structure according to field specification, as defined by SQL Loader and table to be added to A direct path is similar to a conventional one; but, load writes data to end of table into new block and extent structures, creating new blocks as it goes Potentially much faster than conventional path loads A parallel direct path load is a variation on a direct path load and is potentially faster than a direct one The external table load creates and loads an external table Fall ITEC 450

SQL L OADER I NPUT D ATA F ILES The input data files provide the data loaded in SQL Loader Input data file contents can be fixed-length rows, variable-length rows, or a single stream (string) Input data can consist of a single data file in control file, or a separate data set in the input data file File does not have to exist and that input data can all be included in the control file To avoid confusion, it is best to divide things into the different appropriate files Fall ITEC 450

T HE SQL L OADER C ONTROL F ILE Control file contains a mapping between input data and table structures into which data is to be loaded LOAD DATA INFILE 'data\Chapter11\ch11.dat' INTO TABLE client APPEND FIELDS TERMINATED BY "," TRAILING NULLCOLS ( CLIENT_ID INTEGER, FIRST_NAME CHAR(10), LAST_NAME CHAR(20), CONTACT_PHONE CHAR(15), CONTACT_ CHAR(30) ) The bad rows and discard rows can be defined too BADFILE 'solutions\Chapter11\bad.dat' DISCARDFILE 'solutions\Chapter11\discard.dat' Fall ITEC 450

R OW L OADING O PTIONS LOAD DATA INFILE... BADFILE... DISCARDFILE... INTO TABLE table1 [ INSERT | REPLACE | TRUNCATE | APPEND ] FIELDS TERMINATED BY "," TRAILING NULLCOLS ( FIELD1 INTEGER EXTERNAL, FIELD2 INTEGER EXTERNAL,... FIELDn... ) INSERT is the default Fall ITEC 450

C OLUMN D ELIMITERS Two examples: LOAD DATA INTO TABLE table1 TRUNCATE ( FIELD1POSITION(001:010) CHAR(10) TERMINATED BY WHITESPACE, FIELD2 POSITION(011:030) CHAR(20) TERMINATED BY WHITESPACE,..., FIELDn... ) LOAD DATA INTO TABLE table1 TRUNCATE FIELDS TERMINATED BY "," TRAILING NULLCOLS ( FIELD1 INTEGER EXTERNAL, FIELD2 INTEGER EXTERNAL,... FIELDn... ) Fall ITEC 450

T HE P ARAMETER F ILE SQL*Loader can include a parameter file containing repeated settings, across multiple executions of SQL*Loader USERID = DISCARDMAX = 2 ERRORS = To load your new client rows: sqlldr control= \data\Chapter11\ch11.ctl log= \data\Chapter11\ch11.log parfile= \data\Chapter11\ch11.par Some of the most likely uses of SQL*Loader are to bulk load large amounts of data into a data warehouse, or when importing data from outside, into an existing database Fall ITEC 450

E XAMPLES OF P ERFORMANCE I SSUES A query has a response-time problem A query used to run for 5 minutes, now for an hour and still running A tablespace runs out of disk storage space The batch window extends into day Someone submitted a “query from hell” that just won’t stop running, and take away CPU and I/O resources Fall ITEC 450

P ERFORMANCE I NFLUENTIAL F ACTORS Workload – a combination of online transactions, batch jobs, ad hoc queries, and other system activities outside of database Throughput – the overall capability of the computer to process data, such as I/O speed Resources – hardware and software tools, such as chips, memory, and database kernel Optimization – query tuning, configuration change Contention – two or more components of the workload are competing a single resource Fall ITEC 450

D ATABASE P ERFORMANCE T UNING Database performance tuning can be defined as the optimization of resource use to increase throughput and minimize contention, enabling the largest possible workload to be processed. Identify the most troublesome areas Application tuning – 80% of database performance problems are from poorly coded SQL or application logic Database system tuning areas: Memory allocation (buffer/cache for data) Logging option (log cache, log size, log switch) I/O efficiency (data contention, fragmentation) Enabled features (parallelism, query rewrite) Fall ITEC 450

P ERFORMANCE M ANAGEMENT C OMPONENTS Monitoring – scanning the environment to collect performance information Analysis – analyzing collected information to identify problem Correction - modifying problematic behaviors Fall ITEC 450

S ERVICE -L EVEL M ANAGEMENT SLM is the disciplined methodology and procedures used to ensure adequate levels of services are delivered A service level is a measure of operational behavior. SLM focus on mainly availability, sometimes performance. 99.9% uptime from 8:00 AM to 6:00 PM weekdays Average response time for the transaction will be two seconds or less for workloads of 500 or fewer users All involved parties, DBA and users, have to agree the service levels on stated objectives for availability and performance. Fall ITEC 450

DBMS P ERFORMANCE B ASICS Do not over-tune – stop tuning when performance reaches a pre-defined service level Remain focused – don’t tune multiple things at once Do not panic – “I don’t know, but I’ll find out.” Communicate clearly – keep users informed with progress, and coordinate discussions among all involved parties Accept reality – Proactive is the goal, but reality is often that dealing with problems as they occur. Fall ITEC 450

M ODULE 4 D ATABASE T UNING Section 2 Managing and Monitoring Oracle Database 20 ITEC 450 Fall 2012

P ROACTIVE D ATABASE M ONITORING Alerts are used to monitor the database when particular metric thresholds are crossed, or can issue simply because an event has occurred. For each alert, you can set critical and warning threshold Default server-generated alerts: CPU Time Per Call (warning at 8000 ms, critical at 10,000 ms) Table space usage (warning at 85% full, critical at 97% full) SQL Service Response Time Recovery Area Space Usage Fall ITEC 450

Fall ITEC 450 O RACLE E NTERPRISE M ANAGER

M ANAGING A LERTS Using Oracle Enterprise Manager Warning and critical thresholds Response action, setting notification rules Read Chapter 10 in Oracle 2 Day DBA; and Chapter 5 in Oracle 2 Day DBA Tuning Guide Using DBMS_SERVER_ALERT Package Use DBMS_SERVER_ALERT.GET_THRESHOLD, SET_THRESHOLD SQL> connect sys/password as sysdba; SQL> desc dbms_server_alert SQL> select reason from dba_outstanding_alerts; SQL> select reason, resolution from dba_alert_history; Metrics and alerts information – v$sysmetric, v$servicemetric, v$sysmetric_history Information about alert types – v$alert_types SQL> select distinct object_type from v$alert_types Fall ITEC 450

A LERTS S ECTION OF OEM Fall ITEC 450

A UTOMATIC W ORKLOAD R EPOSITORY (AWR) AWR automatically collects and stores database performance statistics relating to problem detection and tuning. A temporary in-memory collection of statistics in the SGA, accessible through dynamic views – v$sysstat, v$sessstat, v$session, v$session_wait, etc. A persistent type of performance data, access by data dictionary views – dba_users, dba_source, dba_errors, etc. By default, AWR generates snapshots once every hour, and retains the statistics for 8 days. Read Chapter 3 in Oracle 2 Day DBA Tuning Guide Fall ITEC 450

Fall ITEC 450 M ETRICS P AGE FROM AWR

AWR R EPORTS Oracle provides a script generate summary reports: Top five timed events Wait events and latch activity Time-model statistics Buffer pool and PGA statistics and advisories dbhome_1\RDBMS\ADMIN\awrrpt.sql; Type Specified: html Enter value for num_days: 1 Enter value for begin_snap: 84 Enter value for end_snap: 89 A report is generated under: C:\app\Administrator\product\11.2.0\dbhome_1\BIN. The file name can be specified or default. Fall ITEC 450

A CTIVE S ESSION H ISTORY (ASH) Oracle also provides statistics for all active sessions every second, instead of AWR with 60 minutes by default. Current active session data – v$session, v$active_session_history SQL> select username, status, sid, serial#, program from v$session 2 where username is not null; SQL> select sample_time, session_id, event, module from v$active_session_history 2 where user_id = (select user_id from dba_users where username = 'SYSTEM'); Read Chapter 4 in Oracle 2 Day DBA Tuning Guide Fall ITEC 450

A UTOMATIC D ATABASE D IAGNOSTIC M ONITOR ADDM identifies performance problems, and recommends actions, after the AWR takes a new snapshot. ADDM diagnoses problems such as: Expensive SQL statements I/O performance issues Resource bottlenecks, including memory and CPU bottlenecks ADDM findings and recommendations Finding types – problem, symptom, and informational Recommendations – actions for each problem finding Fall ITEC 450

M ANAGING ADDM Using Oracle Enterprise Manager Performance findings of the stored ADDM reports Using DBMS_ADVISOR Package CREATE_TASK – creates a new advisor task SET_DEFAULT_TASK – modifies default values of parameters within a task DELETE_TASK – deletes a specific task from the repository GET_TASK_REPORT – Displays the most recent ADDM report Using Oracle Provided Script C:\app\Administrator\product\11.2.0\dbhome_1\ RDBMS\ADMIN \addmrpt.sql; A report is generated under: C:\app\Administrator\product\11.2.0\dbhome_1\BIN by default. The file name should start with addmrpt. Fall ITEC 450

M ANAGEMENT A DVISORY F RAMEWORK The advisors help in the performance tuning, identifying bottlenecks and suggesting optimal sizes for key database resources. Memory advisor – recommendations regarding the optimal sizing of the SGA and PGA. Tuning-related advisors SQL tuning advisor – analyzing complex SQL statements and recommending way to improve performance SQL access advisor – advising on creating new indexes, materialized views, or materialized view logs. Space-Related advisors – segment advisor, undo advisor Fall ITEC 450