Oracle Online Features - Golfing Instead of Working on Weekends Oracle World 2003 – Session 36769 Sep 2003 Denny Wong Consultant Database Services.

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

Refeng Wu CQ5 WCM System Administrator
The Architecture of Oracle
1 Don’t Shut Down That Database! Use Oracle 9i Online Object Redefinition Instead Chris Lawson Performance Solutions Roger Schrag Database Specialists,
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Overview of Database Administrator (DBA) Tools
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 2 Overview of Database Administrator (DBA) Tools.
Oracle Architecture. Instances and Databases (1/2)
High Availability Group 08: Võ Đức Vĩnh Nguyễn Quang Vũ
15 Copyright © 2004, Oracle. All rights reserved. Monitoring and Managing Memory.
SQL Server 2005 features for VLDBs. SQL Server 2005 features for VLDBs aka (it’s fixed in the next release)
12 Copyright © Oracle Corporation, All rights reserved. Managing Indexes.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
Oracle Architectural Components
Harvard University Oracle Database Administration Session 5 Data Storage.
Backup, Integrity Check and Index and Statistics Maintenance
10 Copyright © 2006, Oracle. All rights reserved. Automatic Shared Memory Management.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Module 9: Managing Schema Objects. Overview Naming guidelines for identifiers in schema object definitions Storage and structure of schema objects Implementing.
Oracle Database Administration Database files Logical database structures.
CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.
Database Administration TableSpace & Data File Management
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Oracle9i Database Administrator: Implementation and Administration 1 Chapter 9 Index Management.
Basic Oracle Architecture
The protection of the DB against intentional or unintentional threats using computer-based or non- computer-based controls. Database Security – Part 2.
Oracle9i Performance Tuning Chapter 2 Tuning the Buffer Cache.
Copyright © Oracle Corporation, All rights reserved. 1 Oracle Architectural Components.
An Oracle server:  Is a database management system that provides an open, comprehensive, integrated approach to information management.  Consists.
Module 16: Performing Ongoing Database Maintenance
Oracle9i Performance Tuning Chapter 12 Tuning Tools.
The Self-Managing Database: Automatic SGA Memory Management Tirthankar Lahiri Senior Manager, Distributed Cache & Memory Management Oracle Corporation.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Outline Introduction to Oracle Memory Structures SGA, PGA, SCA The Specifics of the System Global Area (SGA) Structures Overview of Program Global Areas.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Objectives Database triggers and syntax
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
13 Copyright © Oracle Corporation, All rights reserved. Maintaining Data Integrity.
Working with SQL Server Database Objects Faculty: Nguyen Ngoc Tu.
PL/SQLPL/SQL Oracle11g: PL/SQL Programming Chapter 9 Database Triggers.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 9 Database Triggers.
Managing Schema Objects
Chapter 1Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 1 Backup and Recovery Overview MSCD642 Backup and Recovery.
Oracle Architecture - Structure. Oracle Architecture - Structure The Oracle Server architecture 1. Structures are well-defined objects that store the.
Oracle9i Performance Tuning Chapter 4 Tuning the Shared Pool Memory.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Unit 6 Seminar. Indexed Organized Tables Definition: Index Organized Tables are tables that, unlike heap tables, are organized like B*Tree indexes.
1 11g NEW FEATURES ByVIJAY. 2 AGENDA  RESULT CACHE  INVISIBLE INDEXES  READ ONLY TABLES  DDL WAIT OPTION  ADDING COLUMN TO A TABLE WITH DEFAULT VALUE.
20 Copyright © 2006, Oracle. All rights reserved. Best Practices and Operational Considerations.
Dr. Stephan Bühne SAP Solution Center Walldorf Oracle 9i: Features for SAP Which new Oracle 9i features are helpful for a SAP customer? Dr. Stephan Bühne.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
Oracle Database Architectural Components
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Chapter 21 SGA Architecture and Wait Event Summarized & Presented by Yeon JongHeum IDS Lab., Seoul National University.
How To Pass Oracle 1z0-060 Exam In First Attempt?
Initialization Parameters
Using Data Dictionary and Dynamic Performance Views
Maximum Availability Architecture Enterprise Technology Centre.
Oracle9i Developer: PL/SQL Programming Chapter 8 Database Triggers.
Index Index.
Prof. Arfaoui. COM390 Chapter 9
Which new Oracle 9i features are helpful for a SAP customer?
Presentation transcript:

Oracle Online Features - Golfing Instead of Working on Weekends Oracle World 2003 – Session Sep 2003 Denny Wong Consultant Database Services

Introduction Take a system outage at 7pm on a weekday? No, because …  I nternet applications  Nightly batch jobs  Users from other countries  7x24 retail systems  Users work late during month-end  so on...

Introduction As a Result... You must work on the weekend Well, you can still go golfing on the weekend because … The regular system outage is between 1am - 5am on Saturday

Introduction Oracle9i Online Features Create/Rebuild Indexes Online ALTER TABLE/INDEX VALIDATE STRUCTURE ONLINE ALTER INDEX REBUILD COMPUTE STATISTICS ONLINE Dynamic SGA Online Table Redefinition

Oracle9i (Enhancements) Create/Rebuild Indexes Online Oracle extended these capabilities in 9i Reverse-key index Function-based index Key-compressed index IOT secondary index Limitations Parallel DML not supported while the index is being rebuilt Bitmap and Cluster indexes can’t be rebuilt online

Oracle9i (Enhancements) ANALYZE TABLE VALIDATE STRUCTURE ONLINE Users can still perform DML on the table ANALYZE TABLE VALIDATE STRUCTURE ONLINE Verify the integrity of data blocks/rows (e.g. rows belong to the correct partition)

Oracle9i (Enhancements) ANALYZE INDEX VALIDATE STRUCTURE ONLINE Verify the structure of the index (e.g. Check block corruption) When to rebuild an index? Cannot use the ONLINE option  SELECT DEL_LF_ROWS / LF_ROWS “Wasted” FROM INDEX_STATS  Rebuild the index If “Wasted” > 0.2, or  If index node utilization < 60% (PCT_USED < 60)

Oracle9i (Enhancements) ALTER INDEX REBUILD COMPUTE STATISTICS ONLINE An index should be analyzed after it has been rebuilt. “ALTER INDEX REBUILD ONLINE” followed by “ANALYZE INDEX” “ALTER INDEX REBUILD COMPUTE STATISTICS”  But, users cannot perform DML on the table “ALTER INDEX REBUILD COMPUTE STATISTICS ONLINE” is available in Oracle9i  Users can perform DML on the table

Oracle9i (New Features) Dynamic SGA In database tuning, it may require adjusting the buffer cache or shared pool size Requires an instance restart, challenging for 7x24 systems Dynamic SGA components Buffer cache (DB_CACHE_SIZE) Shared pool (SHARED_POOL_SIZE) Large pool (LARGE_POOL_SIZE) in Oracle9i Release 2

Oracle9i (Dynamic SGA) E.g., increase the buffer cache size from 32M to 64M dynamically

Oracle9i (Dynamic SGA) SGA_MAX_SIZE SGA is basically made up of memory components, such as buffer cache, shared pool, large pool, java pool, etc... SGA_MAX_SIZE limits the maximum size the SGA can grow dynamically

Oracle9i (Dynamic SGA) SGA_MAX_SIZE Example SGA_MAX_SIZE = 208M Sum of all memory components = 200M Increase the shared pool by another 16M will fail because there is only 8M (208M - 200M) available

Oracle9i (Dynamic SGA) Granule A piece of contiguous memory that Oracle allocates in SGA If SGA < 128M, the granule size will be 4M otherwise it will be 16M Oracle allocates space in SGA by multiples of granules V$SGA views containing Dynamic SGA information … next slide -->

Oracle9i (Dynamic SGA) V$SGA V$SGA_DYNAMIC_COMPONENTS  Dynamic SGA component name, size, granule size, etc … V$SGA_DYNAMIC_FREE_MEMORY  Amount of SGA memory can be grown dynamically V$SGA_CURRENT_RESIZE_OPS  SGA resize operations currently in progress V$SGA_RESIZE_OPS  Last 100 SGA resize operations

Oracle9i (Online Table Redefinition) Online Table Redefinition Allows you to redefine a table structure while users are performing DML on the table Online Table Redefinition Capabilities Reorganize a table Drop/add columns Change a heap (regular) table to an IOT Change a non-partitioned table to a partition table So on...

Oracle9i (Online Table Redefinition) Online Table Redefinition The whole redefinition process involves a number of DBMS_REDEFINITION procedure calls  CAN_REDEF_TABLE– Check if the table can be redefined  START_REDEF_TABLE– Start the redefinition process  SYNC_INTERIM_TABLE– Synchronize data modifications (Optional)  FINISH_REDEF_TABLE– Finish the redefinition process  ABORT_REDEF_TABLE– Abort the redefinition process

Oracle9i (Online Table Redefinition) Steps for Redefining a Table Online How to redefine a table online? Let’s walk through an example … Reorganize table EMPLOYEE and drop column OLD_SALARY Step 1) Verify the Table Step 2) Create the Interim Table Step 3) Start the Redefinition Process Step 4) Create Indexes, Constraints, Triggers and Grants on the Interim Table Step 5) Complete the Redefinition Process Step 6) The Final Step

Oracle9i (Online Table Redefinition) Step 1) Verify the Table Limitations of Online Table Redefinition. The table...  must have a primary key (prior to Oracle9i Release 2)  must not contain any LONG or FILE columns  cannot have any materialized view defined on it  must be defined within the same schema Execute the CAN_REDEF_TABLE procedure to verify  If the table cannot be redefined, it will raise an error

Oracle9i (Online Table Redefinition) Step 2) Create the Interim Table The interim table will ultimately become the new table All desired table definitions must be defined on the interim table  However indexes, constraints and triggers will be created later in step 4  In our example, we will reorganize table EMPLOYEE and drop column OLD_SALARY  continue …

Oracle9i (Online Table Redefinition)

Step 3) Start the Redefinition Process Execute the START_REDEF_TABLE procedure  It will create a materialized view and log –The log keeps track of any data modifications made by users  Then, it starts copying the data from EMPLOYEE to INTERIM  continue …

Oracle9i (Online Table Redefinition) If the original and interim table have different columns  Then, specify all the column names when calling the procedure

Oracle9i (Online Table Redefinition) Step 4) Create Indexes, Constraints, Triggers and Grants on the Interim Table Create after START_REDEF_TABLE is completed  What we define on the interim table will ultimately belong to the new table  Foreign key constraints must be created in disabled state

Oracle9i (Online Table Redefinition) Step 5) Complete the Redefinition Process Execute the FINISH_REDEF_TABLE procedure  Data Synchronization –Any data modifications recorded in the materialized log will be transferred to INTERIM  Switch Tables –EMPLOYEE will be locked –Switch the table names of EMPLOYEE and INTERIM –Drop the materialized view and log  continue...

Oracle9i (Online Table Redefinition)

Step 6) The Final Step EMPLOYEE has been redefined successfully  INTERIM is now the old copy of EMPLOYEE –Drop it to free up the space  Rename indexes, constraints and triggers on the new table –Rename index INTERIM_INDX created in step 4 –In Oracle9i Release 2, constraints and column names can be renamed continue...

Oracle9i (Online Table Redefinition)  Users are accessing the new EMPLOYEE table (without OLD_SALARY)  The whole table redefinition process is now completed

Oracle9i (Online Table Redefinition) Synchronize Data Modifications (Optional) Execute the SYNC_INTERIM_TABLE procedure  This procedure can be executed many times between START_REDEF_TABLE and FINISH_REDEF_TABLE  It propagates data modifications recorded in the materialized view log to the interim table –e.g. Execute SYNC_INTERIM_TABLE to propagate 5 million records to the interim table before creating the index continue...

Oracle9i (Online Table Redefinition) This synchronization is part of FINISH_REDEF_TABLE Calling SYNC_INTERIM_TABLE doesn’t affect the short period of time the original table is locked

Oracle9i (Online Table Redefinition) Abort the Redefinition Process (if necessary) E.g. You made a typo in the column name, or the tablespace ran out of space Execute the ABORT_REDEF_TABLE procedure  The procedure will drop the materialized view and log Re-start the redefinition process when the problem is fixed

Conclusion Oracle9i extended these online capabilities Create/Rebuild Indexes Online  Reverse-key, function-based and key-compressed indexes ALTER TABLE/INDEX VALIDATE STRUCTURE ONLINE  Examine the table/index without locking the table ALTER INDEX REBUILD COMPUTE STATICS ONLINE  Rebuild the index and collect statistics without locking the table

Conclusion Dynamic SGA Adjust buffer cache, shared pool and large pool dynamically SGA_MAX_SIZE limits the maximum size the SGA can grow dynamically Oracle allocates space in SGA by multiples of granules Online Table Redefinition Online capabilities  Reorganize a table  Change a heap table to IOT  Change a non-partitioned table to a partitioned table …

Conclusion Online Table Redefinition A number of procedure calls to redefine a table online  CAN_REDEF_TABLE  START_REDEF_TABLE  SYNC_INTERIM_TABLE  FINISH_REDEF_TABLE Create indexes, constraints and triggers on the interim table Rename indexes, constraints and triggers on the new table

Questions? Oracle Online Features – Golfing Instead of Working on Weekends Session Denny Wong Reference Sources Experience Oracle Metalink Oracle Technet