Simplify Your Database and Application Server
Download
Report
Transcript Simplify Your Database and Application Server
Oracle Database 10g
Automation Features
Dallas Oracle Users Group - Oct. 2005
Arun Kumar R.
Cingular Wireless
Oracle Database 10g
Automation Features
Speaker Bio
Over
a decade of database administration and
architecture experience in Oracle technologies.
Author of Oracle Database 10g Insider
Solutions, Sams Publishing, Aug. 2005 and
Easy Oracle Automation, Rampant
TechPress, Dec. 2004.
Columnist on Oracle Data Strategies in
Database Trends and Applications Journal
(www.dbta.com)
Executive Editor, IOUG Select Journal
(www.ioug.org/select)
Agenda
Introduction
Oracle Database 10g
Automation Features
Grid Control
Security & Recoverability
Wrapping it up
Q&A
Introduction
•
Until Oracle 9i, DBAs spent a lot of time on
database monitoring, identifying problem
areas and performance bottlenecks
• DBA tasks focused on
•
•
•
•
•
•
System Resources
Storage management
Space Management
Application and SQL tuning
Fixing Security Issues
Backup and Recovery Management.
Oracle Database 10g
•
•
•
•
•
Oracle Database 10g is more sophisticated
and powerful, suitable for even small
businesses.
Get an overview of all the major automatic
features of Oracle Database 10g.
Review improved Enterprise Manager and
Grid Control.
Learn how Database Administrators can
easily automate many administrative
routines.
Let us dive into the details.
Manageability Features- Overview
•
•
•
•
•
•
Automatic diagnosis of performance problems,
potential or real, and subsequent correction
by Automatic Statistics Collection and Retention
using the new Automatic Workload Repository.
Automatic Database Diagnostic Monitor (ADDM)
Automatic Shared Memory Management (ASMM)
Automatic Storage Management (ASM)
helps to add and remove storage as needed and
improve the I/O on various disks
Automatic SQL Tuning features.
Better Data Movement, Security, Backup &
Recoverability features
What is Automatic Workload
Repository?
•
•
•
•
AWR, a built-in repository in every database is the central
component of Oracle Database 10g manageability
infrastructure.
Provides services to the database to access, collect,
process, and maintain performance statistics on various
functionalities within the database.
At regular intervals (60 minutes), Oracle Database 10g
takes snapshots of all vital statistics and workload data
Stores them in the repository for a period of seven days.
AWR (Continued..)
•
•
•
•
Repository data used for analysis and as statistics
for problem detection and self-tuning.
Used for system level and user level analysis.
AWR is the basis for all self-management
functionalities of the database.
Gives the Oracle Database with the historical
perspective on its usage.
AWR has report generation mechanism to produce
summary reports based on database statistics.
Very similar to STATSPACK in previous database
versions, but a lot convenient to use !
Architecture of AWR
•
AWR in Oracle Database 10g collects•
•
•
•
Time model statistics
Object statistics
Session and system statistics in v$sesstat and
v$sysstat
Optimizer statistics
Active Session History
•
Active Session History (ASH) contains recent session
activity.
• Memory for ASH comes from the SGA, fixed for the
instance lifetime.
• ASH samples the v$session view every second and
records the events the active sessions are waiting for.
• ASH statistics can be viewed from
v$active_session_history, one row for each active
session per sample with the latest session rows first.
• Contents of v$active_session_history flushed to disk
as part of the AWR snapshot process.
AWR Snapshots
•
AWR stored in Workload Repository (WR) schema.
• WR schema resides in the SYSAUX tablespace.
• A snapshot is a set of performance statistics
captured at a certain time in the database.
•
•
•
•
•
Used for computing the rate of change of a statistic.
Identified by unique snapshot sequence # (snap_id).
Generated every 60 minutes by default.
interval parameter to change snapshot frequency.
Manual snapshots can be taken using the
database control or a PL/SQL procedure.
Metrics and Thresholds
•
•
Metrics are a set of statistics for certain system
attributes.
• Calculated and stored by the Automatic Workload
Repository (AWR).
• Results displayed in Enterprise Manager through the
All Metrics page under Related Links on the
Database Home page.
Thresholds are the boundary values against which the
metric values are compared.
Statistics Collection Process
•
•
•
•
•
Oracle Database 10g metrics can be tracked using
AWR.
Two categories of Usage metrics- Database feature
usage and High water mark (HWM) value of certain
database attributes.
MMON tracks and records the database feature usage
and HWM statistics on a weekly basis.
Statistics are recorded in AWR snapshots.
To review statistics, dba_feature_usage_statistics view
and dba_high_water_mark_statistics view or
Enterprise Manager.
How to use AWR reports?
AWR reports are generated using awrrpt.sql,
awrrpti.sql, awrddrpt.sql, and awrddrpi.sql in
$ORACLE_HOME/rdbms/admin directory.
Reports as html pages or text reports.
awrrpt.sql - all available AWR snapshots.
awrrpti.sql - statistics for a range of snapshot ids
on a specified database and instance
awrddrpt.sql - statistics of a particular SQL
statement for a range of snapshot ids.
awrddrpi.sql - statistics of a SQL statement for a
range of snapshot ids on a specified database
and instance.
Using AWR reports -1
Using AWR reports -2
AWR reports for Comparisons
Advisory Framework
Oracle Database 10g has server components called
advisors to provide feedback about resource utilization
and performance.
Automatic Database Diagnostic Monitor (ADDM)
SQL Tuning Advisor, SQL Access Advisor
SGA Advisor,
PGA Advisor
Buffer Cache Advisor, Library Cache Advisor
Segment Advisor
Undo Advisor
Database Advisors
Above
database advisors have certain
attributes in common.
An advisor can be launched in one of two
modes depending on time available for
completing the advisory task.
Limited Mode or Comprehensive Mode
Some advisors support both modes.
Automatic Database
Diagnostic Monitor (ADDM)
•
•
•
•
•
ADDM provides proactive and reactive features
for monitoring
Statistical information is automatically captured
from the SGA
Stored inside the workload repository in the
form of snapshots in sixty (60) minute intervals.
Snapshots are then written to disk
Similar to STATSPACK snapshots, but are
more detailed.
ADDM Performance Monitoring
•
ADDM initiates the MMON process to run automatically
on every database instance
•
•
•
•
•
For every snapshot taken, ADDM triggers an analysis of the
period corresponding to the last two snapshots.
Helps the ADDM to proactively monitor the instance and detect
bottlenecks before they become catastrophic.
Analysis results are stored inside the workload repository.
Accessible through the EM console.
ADDM can be manually invoked using the runad
PL/SQL procedure and by the
$ORACLE_HOME/rdbms/admin/addmrpt.sql
procedure.
Automatic Shared Memory
Management (ASMM)
•
Commonly tuned System Global Area (SGA)
components are - database buffer cache, the shared
pool, the large pool, and the Java pool.
• ASMM enables Oracle Database 10g to
automatically determine appropriate values within
total SGA limits.
• DBA can simply mention the total amount of SGA
memory to an instance using the sga_target .
• Oracle database will automatically distribute this
memory among various sub-components.
How does ASMM work?
With Automatic SGA memory management enabled,
the sizes of different components are flexible to
resize to the needs of the workload without additional
intervention.
• The internal tuning algorithm monitors the workload
performance & increases the shared pool as needed
to reduce the number of parses.
ASMM uses a new Memory Manager (MMAN)
background process.
• Coordinates the sizing of the memory components,
acts as a memory broker.
• Tracks all memory components & pending resize
operations.
•
•
Enable ASMM - EM
Memory Advisor through EM -1
•
Memory Advisor can be used only when the ASMM
is disabled.
Three advisors - for Shared pool in SGA, Buffer
Cache in SGA, and PGA.
Memory Advisor through EM -2
Automatic Storage Management
•
Automatic Storage Management (ASM) for efficient
management of disk drives with 24/7 availability.
• Helps the DBA from potentially managing thousands
of database files across multiple database instances
by creating disk groups.
• Disk groups are comprised of disks and files on
them.
• ASM will not eliminate any existing database
functionalities
• With ASM, the DBA only needs to manage a smaller
number of disk groups.
• ASM also serves as a cluster file system for RAC
configurations.
ASM Advantages
•
•
•
In a nutshell, we can have a mixture of ASM files;
Oracle managed files and manually managed files
• Existing files can be migrated to ASM if needed.
ASM prevents accidental file deletion by eliminating
the file system interface.
Provides raw disk I/O performance for all files,
striping them across multiple storage arrays.
Reduces the cost of managing storage with a
clustered volume manager and integrated file system
functionality.
ASM vs. Oracle 9i Storage
Automatic SQL Tuning Features
SQL Tuning Advisor and SQLAccess Advisor
•
•
SQL Tuning Advisor provides tuning advice for SQL
statements with out modifying any statement.
For complex applications and large databases, use
SQLAccess Advisor.
• Provides advice on indexes, materialized views
and materialized view logs for a given work
load.
• Provides advice on database schema issues
and determines optimal data access paths.
Using Automatic SQL Tuning tools
•
•
For both tuning tools- create a task, run the Advisor,
generate the recommendations and implement them.
• The user can accept or reject the
recommendations.
• Advisor tools available through Oracle Enterprise
Manager 10g (OEM) and from SQL command
prompt.
Helps the DBA to save time in application SQL tuning
efforts over methods used with Oracle 9i and prior.
SQLAccess Advisor
Used for applications with complex queries on large
sets of data.
Recommend a combination of indexes, materialized
views, and materialized view logs.
Recommends how to optimize materialized views to be
refreshable and benefit from general query rewrites.
Recommends the use of bitmap and B-tree indexes.
B-tree indexes are used mainly in data warehouses
or large databases to index unique or near-unique
keys.
Bitmap indexes improve response time for adhoc
queries.
Very little space compared to conventional indexes.
SQL Tuning Advisor
•
•
•
•
SQL Tuning Advisor provides automatic tuning
advice for SQL statements.
Takes one or more SQL statements as input and
invokes the automatic tuning optimizer to perform
SQL tuning with out actually modifying any
statement.
Output is a series of advice or recommendations
along with the rationale behind each
recommendation and its expected benefits.
The user can accept the recommendations or reject
them.
SQL Tuning Advisor - STS
•
•
•
For tuning multiple SQL statements, a SQL Tuning Set
(STS) is created.
STS can be created from command line or Oracle
Enterprise Manager 10g.
SQL Tuning Sets can be handled through EM or
managed with DBMS_SQLTUNE package
procedures.
For using SQL Tuning Set APIs, the developer needs
ADMINISTER ANY SQL TUNING SET system
privilege.
Controlling a Tuning Task
•
Control the scope and duration of a tuning task
• Scope of the task -limited or comprehensive.
• With the limited option, the SQL Tuning Advisor
produces recommendations based on analysis of
statistics, access paths, and SQL structure.
• SQL Profile recommendations are not generated.
• With comprehensive option, the SQL Tuning
Advisor does everything under limited scope and
SQL profiling. User can also set the time limit of a
tuning task (default value 30 minutes).
Deploying SQL Tuning Advisor
SQL Tuning Advisor from EM
•
In EM, using Advisor Central- SQL Tuning
Advisor link.
• DBMS_SQLTUNE package by anyone with
DBA role and ADVISOR privilege.
SQL Tuning Advisor using EM-1
•In EM, SQL Tuning Advisor-> Top SQL link.
SQL Tuning Advisor using EM- 2
•Choose the SQL & click Run SQL Tuning Advisor
SQL Tuning Advisor using EM-3
•Select Scope
•Choose
Schedule
SQL Tuning Advisor using EM-4
•When the SQL Tuning task’s status is COMPLETED,
select the task and click View Recommendations.
SQLAccess Advisor
SQLAccess Advisor
• Will recommend a combination of indexes,
materialized views, and materialized view logs.
• Can be run from EM using the SQLAccess Advisor
Wizard or by invoking the DBMS_ADVISOR
package.
SQL Tuning with SQLAccess Advisor
• 4 steps->create a task, define workload, generate
recommendations, & implement them.
• A task has all the information relating to the
recommendation process and its results.
• To create a task, use the wizard in EM or the
DBMS_ADVISOR.QUICK_TUNE.
• For hands-on approach, use
DBMS_ADVISOR.CREATE_TASK procedure.
Executing the Task
•
•
•
•
Create a task and link to a workload.
Use the DBMS_ADVISOR.EXECUTE_TASK
procedure to generate the recommendations.
To view the recommendations, use
• DBA_ ADVISOR_RECOMMENDATIONS
• USER_ADVISOR_RECOMMENDATIONS
• Get a script using
DBMS_ADVISOR.GET_TASK_SCRIPT
• EM to get recommendations.
Recommendations are stored in the SQLAccess
Advisor repository.
• Repository has benefits being managed by the
server, support of historical data etc.
Implementing SQLAccess
Advisor Recommendations
•
•
•
SQL Access Advisor creates a set of recommendations.
• Lets the user decide whether to implement all of its
recommendations, or some, or none.
In EM - Select the required recommendations.
• You are given a choice on how to implement the
recommendations.
• Schedule a job in the EM to execute the script and
implement the recommendations.
For do-it-yourself DBAs
• SQLAccess Advisor generates a SQL script to be used
any time.
• DBA can edit SQL, naming conventions etc.
Advisor Task Implementation-EM-1
Advisor Task Implementation-EM-2
Advisor Task Implementation-EM-3
Advisor Task Implementation-EM-4
Deploying SQLAccess Advisor
Uses for SQLAccess Advisor
Generally used in large database/data warehouse
environments.
Advantages
• DBA can tune parts of the database using
selective workloads.
• Quick and easy to use tool, which helps to build
a pattern of usage over a time frame.
• DBA gets to decide and select the
recommendations to be implemented.
• Identify parts of the system which needs tuning,
that would have been left out by ordinary tuning
procedures.
Server Generated Alerts
•
•
•
A server-generated alert is a notification message
from the server of an impending problem.
• Generated whenever a database metric does not
match expected values
• Or thresholds levels (warning / critical levels) on
different metrics are reached
• Or when the problem condition has been cleared
Notification has error/alert condition, and may contain
suggestions for correcting the problem.
MMON regularly schedules monitoring actions.
Server Generated Alerts
•
•
•
•
•
Threshold levels can be internally set, customer
defined, or customer altered from preset values.
Threshold alerts (stateful alerts) automatically cleared
on fixing the alert condition.
Stateful alerts stored in dba_outstanding_alerts and
moved to dba_alert_history when cleared.
EM can be customized to send these messages to
pager or email addresses.
A message about the alert written to Oracle Database
alert log.
When you get an alert !
Follow the recommendations it provides.
Run ADDM or another advisor as needed to
get a more detailed diagnostics of system or
object behavior.
You can run a corrective script on receiving
an alert.
Clear the alerts as a part of alert
management.
Alerts Management Using EM
•
Alerts can be managed using Oracle Enterprise
Manager console.
•
EM can be invoked from a Web browser, from client
installation or from the database server itself.
•
Using EM, you can schedule different monitoring jobs
to be run on the database or have the database send
you an alert for the specified events.
Alerts Management Using EM -1
Alerts Management Using EM -2
Alerts Management Using EM -3
Alerts Management Using EM -4
Clearing of Alerts
•
•
•
•
•
Oracle clears most of the alerts automatically when
the cause of the alert disappears.
Certain alerts need to be acknowledged by the DBA
and require corrective measures.
After taking the necessary corrective actions,
acknowledge the alert by clearing it or purging it.
Clearing an alert sends it to the Alert History; purging
an alert removes it from the Alert History.
Viewable from the home page of EM under Related
Links.
Data Pump
•
•
•
•
•
New high-speed infrastructure for data and
metadata movement called Data Pump a.k.a.
DBMS_DATAPUMP.
Provides high-speed data load and unload
capability to existing tables.
Platform independent flat files can be moved
between multiple servers.
Use the new network mode to transfer data
using database links.
Parallelism for Data Pump in the Enterprise
Edition.
Data Pump Architecture
Data Pump Benefits
Detach from a long running job and reattach with out
affecting the job.
Space needed for an export job can be estimated
using the ESTIMATE ONLY parameter.
Enables the DBA to monitor jobs from multiple locations, stop
the jobs and restart them later.
Prevents the destination directory from running out of space.
Data Pump also supports fine-grained object selection
using the EXCLUDE, INCLUDE and CONTENT
parameters.
Remapping of data during export and import
processes.
Names of source data files, source schema names, and
source tablespaces can be changed to different names at the
target system.
Grid Control
A web-based system for managing Oracle
products, host systems, and applications.
Unified console for monitoring distributed
application servers.
Application server administrators can use Grid
Control to
Check the status and performance of servers.
Manage system and software configurations.
Manage application servers, and availability of
applications.
Grid Control & Schematic
Security Features - Overview
Oracle Security features include
Virtual
Private Database (VPD)
Fine Grained Auditing (FGA)
Database encryption/decryption
Oracle Label Security & Oracle Identity
Management
Oracle Advanced Security in Oracle Database
10g Release 2.
•
Combination of network encryption, database
encryption and strong authentication
Security Features (continued..)
Transparent Data Encryption
Encrypts data.
Uses DES, AES etc.
Backward compatibility with
DBMS_OBFUSCATION_TOOLKIT and
DBMS_CRYPTO
Network Encryption
Support for RC4, DES, 3DES , AES
Data Integrity
Using MD5 , SHA-1 Algorithms
Data Authentication
PKI, Kerberos, RADIUS (Remote Authentication
Dial-In User Service) , Secure Sockets Layer (SSL
with digital certificates)
Recoverability Features
Flashback features for quick and efficient
recovery from human errors
Flashback
Query, Flashback Versions Query –
row level
Flashback Transaction Query – transaction
level
Flashback Drop, Flashback Table – table level
Flashback Database – database level
Restore Points to guarantee database can be
recovered to any pre-set point in time
Recovery Manager (RMAN)
RMAN available as command-line and EM for
backups and recovery.
Flash Recovery Area
A single directory on disk or ASM disk group to
keep all recovery-related files. (control, data,
archive log, RMAN backup set files etc.)
Automatic channel failover
When faced with errors during disk backup or
restore, RMAN will try to complete as much job as
possible
Block Media Recovery
Allows RMAN to fix a corrupted block on backup
Keeps the data file online
Keeps non-affected data available for read/update.
Wrapping it up -1
•
•
•
•
A quick overview of the automatic manageability features
of Oracle Database 10g.
Review of Grid Control, Enterprise Manager etc.
These automatic database management features of
Oracle Database 10g are
• Meant to reduce the time spent on routine DBA tasks.
• Focus on more challenging issues for the enterprise.
Oracle Database 10g replaces the tedious system and
database administration tasks with a few simple steps
from the EM or command line interface.
Wrapping it up -2
•
•
•
Use the security features of Oracle Database 10g
along with proper planning to make your databases
compliant with regulatory requirements.
Improved recoverability features with Flashback and
RMAN.
Detailed explanation given in Oracle Documentations,
related Oracle Database 10g books, and references
given here.
Better Life with Oracle 10g
Manageability features
Improve the performance of mission critical
applications
For your business, it will result in
Manage more databases and applications
Be more valuable to the organization
Get more sleeping time.
Fewer failures & Faster response times
Lower development cost
By judicious utilization of automatic management
features of Oracle Database 10g, a DBA can
drastically reduce the time spent on routine
administrative tasks.
Thank you
References
• Oracle Database 10g Insider Solutions,
Sams Publishing, Sep. 2005
• Oracle Database 10g Documentation (online).
• Oracle Technology Network.
• Easy Oracle Automation, Rampant TechPress,
Dec. 2004.
• Get this presentation and similar articles at
http://www.dbatrends.com/Downloads.htm
•
Contact Info:
•
Personal website: http://www.dbatrends.com
• Email
arunioug at dbatrends dot com
=====================================
Questions
&
Answers