* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download SQL Tuning Advisor - University System of Georgia
Tandem Computers wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
Microsoft Access wikipedia , lookup
Ingres (database) wikipedia , lookup
Concurrency control wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Oracle Database wikipedia , lookup
Relational model wikipedia , lookup
Database model wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Oracle10g and Banner Rock Eagle 2005 – Admin Computing/Data Mgmt Track Thu., Oct. 27, 2005, 9:30 Presented by: John Morgan, SunGard SCT Higher Education Introduction Oracle10g is here! The ‘g’ is for ‘grid’ End of the RBO Major changes in management structure Many other new and changed features What you’ll hopefully take away from the session Ideas for what to do to get ready Resources for planning www.sungardsct.com 2 A Brief Interlude…. Presentation first given at Summit 2005 Some of you may not have been able to join us there But, Oracle10g Release 2 is now out, so new info for everyone Hawaii references left in Maybe it will make Georgia feel a bit like Honolulu www.sungardsct.com 3 A Brief Geologic History of Hawaii Hawaiian islands formed as tectonic plate moves over hot spot in ocean floor Newest island being formed is Loihi www.sungardsct.com 4 A Brief Geologic History of Oracle Oracle releases formed as world moves past new ideas coming out of Redwood Shores Newest release being formed is Oracle10g www.sungardsct.com 5 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 6 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 7 Installing Oracle10g Only 2 CDs 10g software Companion CD Lightweight install takes < 20 minutes Far lower resource consumption during upgrade (CPU, memory, disk) Pre-install checks to validate OS level, necessary patches, available resources www.sungardsct.com 8 Create Database With DBCA Database Configuration Assistant Quick setup using pre-configured database Use template feature to create identical databases (empty or with data) on multiple machines Automatically sets up Common tasks such as backup LDAP server Shared Servers Enterprise Manager Many best practices for db management www.sungardsct.com 9 Upgrade Database With DBUA Database Upgrade Assistant GUI tool for doing Oracle10g upgrade Integrated with Oracle Universal Installer (OUI) Much faster than export/import method Much less prone to error than manual method Significant improvements from old Database Migration Assistant www.sungardsct.com 10 Can Your Database Be Upgraded? Direct upgrade from 8.0.6, 8.1.7.x, 9.0.x and 9.2.0.x If you are at any other release, either: First upgrade to one of the above Resign yourself to using export/import Before upgrade, update your 10g to latest patch level Currently 10.1.0.4 for most platforms 10.1.0.3 latest for OpenVMS and Tru64 UNIX 10.1.0.5 available over next few months www.sungardsct.com 11 Prior to Upgrade… Run Pre-Upgrade Information Utility on existing db ?/rdbms/admin/utlu101i.sql Analyzes Tablespace sizes (e.g., SYSTEM tbs >= 466 MB) Initialization parameters (e.g., COMPATIBLE >= 9.2.0) Database components Redo logs at least 4 MB XML output used by DBUA for auto configuration www.sungardsct.com 12 Component Registry Stores version/status of each installed component (e.g., JAVAVM) Allows automation of conditional upgrades Accessible through DBA_SERVER_REGISTRY Used primarily by DBUA, but also used by various rdbms/admin scripts www.sungardsct.com 13 New Options for STARTUP/OPEN Prepares DB instance for upgrade Sets RESTRICTED SESSION Disables system triggers Suppresses “normal” errors Flags database that upgrade in progress Syntax: ALTER DATABASE OPEN UPGRADE; ALTER DATABASE OPEN DOWNGRADE; STARTUP UPGRADE STARTUP DOWNGRADE www.sungardsct.com 14 Upgrading With DBUA Performs pre-upgrade checks Creates new mandatory tablespace SYSAUX Recompiles invalid objects Uses parallel option – default of NUMCPUS - 1 Optional database backup step Can run in silent mode Good if you’re running upgrade against multiple copies of same database www.sungardsct.com 15 SYSAUX Tablespace In 8i/9i, a number of new tablespaces added for Oracle components SYSAUX intended to: Reduce proliferation of tablespaces Move non-core components out of SYSTEM Size determined by DBUA Minimum of around 500 MB Autoextend a good idea DBA specifies datafile location only www.sungardsct.com 16 Enterprise Manager Automatically setup by DBUA Now completely web-based – no client install! Use to setup Database Flash Recovery area Ability to ‘flash’ database back to previous point-in-time without manually doing a restore Automatic backups using Oracle-defined backup strategy www.sungardsct.com 17 Post Upgrade DBUA checks status with utlu101s.sql Uses component registry to verify success For any components that failed, description of manual steps provided to DBA Change COMPATIBLE and OPTIMIZER_MODE parameters Automate tasks with new advisors www.sungardsct.com 18 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 19 Oracle Intelligent Infrastructure Automatic Workload Repository (AWR) Data warehouse of information about your database Automatic maintenance tasks Tasks such as statistics collection now automated through DBMS_SCHEDULER Server-generated Alerts Proactively sent to OEM-defined administrator Advisory infrastructure ADDM, SQL Tuning and others www.sungardsct.com 20 Enterprise Manager GUI interface to advisors and AWR Intuitive and easy to use DBAs of all experience levels Advisor recommendations can be implemented by the click of a button This is NOT your father’s Oldsmobile! www.sungardsct.com 21 Automatic Workload Repository Advisor recommendations based on contents Self-managing – old data purged Default retention 7 days, snapshot interval 1 hour Longer retention and more frequent snapshots may be better, but at cost of disk space Classes of data captured include: BASE STATISTICS (e.g., physical reads) SQL STATISTICS (e.g., CPU per SQL stmt) METRICS (e.g., logical reads/sec) ACTIVE SESSION HISTORY www.sungardsct.com 22 Active Session History (ASH) Active sessions sampled every second Collected in memory; selected samples sent to AWR Accesses kernel structures directly for low overhead v$active_session_history Sampled data includes SID SQL ID Program, Module, Action Wait event# Object, File, Block Actual wait time www.sungardsct.com 23 Advisors Automatic Database Diagnostic Monitor (ADDM) Overall database performance and problem monitor SQL Tuning Advisor Tuning advice for problem SQL statements SQL Access Advisor Schema issues (e.g., missing indexes) PGA Advisor Monitors PGA usage and suggests parameter changes www.sungardsct.com 24 Advisors (cont.) SGA Advisor Buffer Cache Advisor Predicts hit ratios for different sizes Library Cache Advisor Predicts hit ratios for different sizes Segment Advisor Analyzes growth trends for objects Undo Advisor Given a desired flashback period, suggests parameter values and disk space requirements www.sungardsct.com 25 ADDM Automatic Database Diagnostic Monitor Performance expert in a box Integrates all managers together Automatic database-wide performance diagnostic Real-time results using the Time Model Pinpoints root cause and non-problem areas Provides information instead of raw data Runs proactively www.sungardsct.com 26 SQL Tuning Advisor Use to tune individual statements Good candidates are poor performers flagged by ADDM Use in conjunction with SQL Access Advisor E.g., before adding index recommended by SQL Tuning Advisor, check with Access Advisor Recommendations can be implemented via SQL Profiles Stored execution plans No code change required www.sungardsct.com 27 PGA Advisor and SGA Advisor Together make recommendations about memory allocation Rather than size individual caches, use automated memory management PGA_AGGREGATE_TARGET SGA_TARGET Rough guideline for OLTP Start with 80% of memory in SGA, 20% in PGA www.sungardsct.com 28 Segment Advisor Run from OEM Run periodically and review recommendations Single-click operation to implement recommendation Segment and tablespace level Benefits No more export/import to resize segments Online operation while normal database activity continues Better space utilization Faster data access www.sungardsct.com 29 Managers Automatic Segment Space Management Automatic Undo Management Automatic Storage Management www.sungardsct.com 30 Automatic Segment Space Management No more FREELISTS, PCTUSED Specify at tablespace creation CREATE TABLESPACE data DATAFILE '/u02/oracle/data/data01.dbf‘ SIZE 50M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; Must use locally managed tablespace Improved performance Oracle benchmark of 35% improvement over manual with large insert operations www.sungardsct.com 31 Automatic Undo Management Replacement for manually-tuned ROLLBACK UNDO_MANAGEMENT=AUTO Best practice: enable auto-extend on UNDO tablespace Set UNDO_RETENTION for Flashback operations Floor for retention time Use Undo Advisor to review/implement recommendations www.sungardsct.com 32 Automatic Storage Management (ASM) Oracle’s own file system/volume manager Use only for database files Provides Mirroring Automatic load-balancing Striping Disks may be added/dropped online Single ASM instance can manage multiple databases Use separate ORACLE_HOME www.sungardsct.com 33 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 34 Migrate to LMT Not really a new feature (available in 9i) Must use LMTs to take advantage of many 10g automatic management features Migrate a tablespace using PL/SQL package DBMS_SPACE_ADMIN.TABLESPACE_MIGRATE_TO_LOCAL Use AUTOALLOCATE to let Oracle determine segment sizes Especially consider LMT for TEMPORARY tablespace Improves performance by reducing dictionary contention www.sungardsct.com 35 Automatic Statistics Gathering Statistics now gathered automatically Runs during defined maintenance windows New package DBMS_SCHEDULER Uses “secret” procedure GATHER_DATABASE_STATS_JOB_PROC On-demand gathering available through DBMS_STATS ANALYZE does not gather full information required by CBO; consider it deprecated www.sungardsct.com 36 Flashback Table Command New concept of RECYCLEBIN View contents with *_RECYCLEBIN views Recover tables inside flashback retention window FLASHBACK TABLE foo TO BEFORE DROP; If you’re really sure, specify PURGE option DROP TABLE bar PURGE; Or, empty everybody’s trash cans PURGE DBA_RECYCLEBIN; Dropped tables show up in views such as user_tab_privs Exclude ‘BIN$%’ if you don’t want to see them www.sungardsct.com 37 Fewer Invalidations Primarily affects stored procedures and views that access tables via synonyms Almost everything in SCT Banner Changes to underlying tables DO NOT cause invalidation of dependent objects Good Faster upgrades Bad Possible that issues will not be apparent at compile time, but rather at run time www.sungardsct.com 38 Manual SQL Tuning Best practice is to use SQL Tuning Advisor But, sometimes the command line beckons Enter the DBMS_SQLTUNE package Statement to be tuned provided as argument in procedure call Once the tuning task completes, same recommendations available as would be provided by SQL Tuning Advisor www.sungardsct.com 39 Manual SQL Tuning Example -- Create the tuning task DECLARE my_sqltext CLOB; BEGIN my_sqltext := 'SELECT * FROM sales ' || 'WHERE prod_id = 10 AND cust_id = 100 '; DBMS_SQLTUNE.CREATE_TUNING_TASK( sql_text => my_sqltext, user_name => 'SH', time_limit => 60, scope => 'COMPREHENSIVE', task_name => 'test_tuning_task'); END; www.sungardsct.com 40 Manual SQL Tuning Example (cont.) -- Start the tuning task begin dbms_sqltune.execute_tuning_task (task_name => 'test_tuning_task'); end; -- Once complete, review the recommendation set long 1000 longchunksize 1000 linesize 100 select dbms_sqltune.report_tuning_task('test_tuning_task') from dual; www.sungardsct.com 41 PL/SQL Optimizing Compiler Out of box faster PL/SQL execution in 10g Default behavior is aggressive optimization Available levels 0 – Pre-10g behavior 1 – Conservative mode, small change, little effect on compile times 2 – Default level, very aggressive, maximum code transformation, most impact on compile times ALTER SYSTEM SET PLSQL_OPTIMIZE_LEVEL=0; Biggest impact is conversion to bulk operations such as FORALL www.sungardsct.com 42 PL/SQL Compiler Warnings Ability to generate warnings at compile time Three categories: SEVERE, PERFORMANCE, INFORMATIONAL Use ALL as shorthand for all three ERROR keyword to treat warning as error Examples: ALTER SYSTEM SET PLSQL_WARNINGS='ENABLE:ALL'; ALTER PROCEDURE foo COMPILE PLSQL_WARNINGS='ENABLE:PERFORMANCE'; ALTER SESSION SET PLSQL_WARNINGS='ENABLE:SEVERE','ERROR:06002'; www.sungardsct.com 43 Miscellaneous Other Changes Cross-platform transportable tablespaces Same-endian only Data pump expdp/impdb replacements for exp/imp 60% faster than exp, 15-45 times faster than imp Renaming tablespaces ALTER TABLESPACE foo RENAME TO bar; Flush buffer cache Useful in benchmark scenarios ALTER SYSTEM FLUSH BUFFER_CACHE; www.sungardsct.com 44 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 45 SCT Banner and Oracle10g Oracle10g tested with SCT Banner 7.2 No support for SCT Banner 6.x or 7.x prior to 7.2 10gR1 definitely supported with 7.2 Support of 10gR2 expected, but pending completion of system test Very few issues found during porting/testing <30 objects changed <5 changed for performance Testing concentrated on CBO www.sungardsct.com 46 Unexpected Behavior of Shared Servers Default value of SHARED_SERVERS is 0 Means use dedicated servers But, if you use DBCA, you may end up with SHARED_SERVERS=1 Worst of both worlds Oracle will constantly be spawning and shutting down new servers Leads to intermittent database slowdowns Either use dedicated servers, or pre-spawn a more reasonable number of shared servers www.sungardsct.com 47 Changes Thus Far for 10g Multiple declarations of a variable within the same scope raise PL/SQL exception If using Pro*COBOL 10, specify PICX=VARCHAR2 Pro*C does not recognize multiple layers of EXEC SQL INCLUDE Explicit type conversions (TO_NUMBER) necessary in some programs Pro*COBOL variable names >30 characters must be shortened LEVEL only valid inside SELECT … CONNECT BY www.sungardsct.com 48 Oracle10g and CBO RBO no longer supported Still present, but Oracle will not fix bugs or enhance SQL Tuning Advisor and SQL Profiles are preferred way of resolving performance issues identified Testing conducted at SunGard SCT and at beta sites New Mexico Highlands University University of Illinois Villanova University University of Richmond www.sungardsct.com 49 CBO Testing Status On the whole, few problems found System-wide, OPTIMIZER_MODE=FIRST_ROWS Expected to give best OLTP performance For batch, OPTIMIZER_MODE=ALL_ROWS Other parameters OPTIMIZER_DYNAMIC_SAMPLING = 2 OPTIMIZER_INDEX_CACHING = 90 OPTIMIZER_INDEX_COST_ADJ = 30 www.sungardsct.com 50 Gathering Statistics Automated statistics gathering on by default Right after database is built it may take some time to catch up For testing at SunGard SCT, DBMS_STATS.GATHER_DATABASE_STATS invoked manually to get to good state Locked statistics Depending on 10g version and how you upgraded, schema statistics may be locked To manually gather statistics, use DBMS_STATS.UNLOCK_SCHEMA_STATS first www.sungardsct.com 51 Gathering Statistics (cont.) System stats (CPU, disk, memory usage) are not gathered by default DBMS_STATS.GATHER_FIXED_OBJECTS_STATS DBMS_STATS.GATHER_SYSTEM_STATS These statistics should be gathered while system is under normal load www.sungardsct.com 52 SPVADDS Issue SPVADDS and similar views and SQL can cause an ORA03113 at runtime Only happens under CBO Can be cleared with a RULE hint Even better, small change to the code also clears error and leaves CBO in charge www.sungardsct.com 53 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 54 RMAN Improvements Backup security Password-based encryption of backup sets Transparent encryption/decryption Better compression Unused blocks below high-water mark compressed Integrated tape backup Compatible with major tape drives and libraries Both database and non-Oracle files www.sungardsct.com 55 PL/SQL Conditional Compilation Problem of code that must work despite schema objects being different E.g., Position Control package accesses Finance tables if present Currently solved with dynamic SQL (DBMS_SQL or NDS) 10gR2 introduces PL/SQL conditional compilation Inclusion of bounded code determined at object compile time Much more elegant solution to problem Similar to C precompiler feature www.sungardsct.com 56 Conditional Compilation Example set serveroutput on alter session set plsql_ccflags = 'finance:true'; create or replace procedure checkvers is rel varchar2(10); begin $if $$finance $then select furvers_release into rel from furvers where furvers_stage_date = (select max(furvers_stage_date) from furvers); dbms_output.put_line('Finance release is ' || rel); $else dbms_output.put_line('Finance is not installed'); $end end checkvers; / www.sungardsct.com 57 Improved Security Enhancements to Oracle’s PKI infrastructure Requires Advanced Security Option Transparent data encryption Includes key management infrastructure Transparent to applications Store username/password in Oracle wallet Eliminates username/password on batch command-line Supports triple DES (168-bit) and 128, 192, and 256-bit AES www.sungardsct.com 58 Direct SGA Access When database performance problems occur, how do you diagnose? Run SQL query of v$ information, or OEM access to do the same But if database is really sick, query may not run in reasonable time Solution: OEM Memory Access Mode Directly accesses SGA to diagnose problem www.sungardsct.com 59 Native XML Query XML Query is emerging standard query language W3C recommendation expected late 2005 Oracle will be first mainstream commercial database to support XML Query Ability to mix XML Query and SQL in same query www.sungardsct.com 60 Project Columbus Also known as HTML DB Release 2 Targeted to all developers, not just those developing HTML DB-based apps Browser-based - no client install! Operations include: Browse/create db objects Run ad hoc SQL and PL/SQL Edit stored procedures View data GUI tool to build queries www.sungardsct.com 61 Other Release 2 Features AWR diff reporting Compare database metrics from two times Automatic Segment Advisor Recommendations must still be reviewed Regular expression support for Perl extensions Automatic Undo Management No need to set UNDO_RETENTION, even if using Flashback ASM supports transportable tablespaces between sameendian databases www.sungardsct.com 62 Other Release 2 Features (cont.) DB_FILE_MULTIBLOCK_READ_COUNT automatically tuned Optimal value platform/environment dependent AUTOTRACE uses DBMS_XPLAN Includes FGAC predicate information DBMS_OUTPUT improvements Unlimited buffer size, and 32K line size www.sungardsct.com 63 Topics of Discussion Tools for building/upgrading Overview of database management features Miscellaneous other features SCT Banner and Oracle10g Oracle10g Release 2 new features Wrap-up and Q&A www.sungardsct.com 64 Useful Resources Oracle Technology Network http://www.oracle.com/technology Free registration Documentation (current and previous releases), white papers, sample code Ask Tom http://asktom.oracle.com Oracle OpenWorld presentations http://www.oracle.com/openworld/sanfrancisco/conference/index.html www.sungardsct.com 65 Summary Start getting ready for 10g Review documentation and other web resources Build a database and play Port local mods to find issues early Be sure to check out new management features Automation of many tasks means less time spent on database administrivia Familiarize yourself with the advisors BEFORE you go into production www.sungardsct.com 66 Get Ready! www.sungardsct.com 67 Questions & Answers www.sungardsct.com 68 Thank You! John Morgan [email protected] www.sungardsct.com 69 SunGard, the SunGard logo, SCT, and Banner, Campus Pipeline, Luminis, PowerCAMPUS, SCT Matrix, SCT Plus, and SCT PocketRecruiter are trademarks or registered trademarks of SunGard Data Systems Inc. or its subsidiaries in the U.S. and other countries. All other trade names are trademarks or registered trademarks of their respective holders. © SunGard 20045 www.sungardsct.com 70