Wednesday, January 30, 2008

PHOUG Presentation by Tim Gorman

I had the opportunity tonight of assisted to the PHOUG meeting which included a presentation by Tim Gorman about "Scaling to Infinity: Partitioning Data Warehousing in Oracle".

I have to be honest this is the first time I hear about Tim, but he really surprised me, what a great presentation and presenter. I can see Tim have a lot of Data Warehousing experience and enjoy sharing his knowledge. I will try to summarize below the points that Tim covered.

Tim sees 3 Mayor errors on DW design.

A) Ignore the Basic Requirements for DW and design what is familiar
B) Fail to portray data changes over time.
C) Fail to Utilize partitioning from the beginning.

- Reporting and analysis applications are responsible for presenting data in the format that works best for end users and their query / analysis tools (very ofter what end users want is a simple spreadsheet, hundreds of columns wide.

- Reporting and analysis applications do not enforce business rules.

- Do not build a data model to enforce referential integrity and / or business rules. Normalization is intended for use in process oriented operational systems and not in a DW.

- Provide very simple data representation, with one degree of normalization for flexibility.

Time-variant data, who cares?

There are two major types of queries from business intelligence appliances to the data warehouse databases. Point in time (What is the present situation) and trend analysis (How things looks now versus 3 months ago). Dimension tables are usually designed to be point int time while fact tables are more trend analysis.

Every Data Warehouse has at least one slowly-changing dimension usually involving people.

The Virtuous Cycle

Using EXCHANGE PARTITION for loads enables:
- Elimination of ETL load windows and 24x7 availability for queries.
- Direct path loads
- Bitmap indexes and bitmap-join indexes.

Exchange partition is the basic technique of a bulk-loading new data into a temporary "Load table" which is then indexed , analyzed and then "published" all at once to the end user using the EXCHANGE PARTITION operation.

Final Recommendations

1.- Use dimensional data models for the "presentation" to end users.
2.- Base the database design on time-variant data structures.
3.- Use partitioning

Friday, January 18, 2008

Notes from Oracle RAC Customer Summit

Hello Everybody

I had the opportunity this week of assisting to a Real Application Cluster Customer Summit in the new Oracle office of Bridgewater NJ. In the meeting was one of the product managers for Real application Cluster, members of he RACPACK and representation from Oracle Consulting.

I was a very interesting meeting where Oracle was basically asking their non RAC customers what can we do for you to start using it, and to the current customers what can we do for you be more comfortable using it.

They did emphasis on virtualization and the hardware becoming cheaper, the different ways that you can virtualize (server split (VMWARE) or server aggregations (GRID)). They went through the advantages and disadvantages of each one, in summary server split does not offer business continuity, scalability across servers, performance (high overhead) and reduction in the management burden and with the prices of the hardware and they becoming more powerful it almost a no brainier to use grid.

However Server split virtualization has its niche, It is good for systems with smaller workloads, test, development environments and non critical applications where you can justify the price tag involved with using RAC. while GRID works best for larger workloads and business critical applications.

Grid aims to provide dynamic resource provisioning and automation, For Oracle grid is evolving, the first version of grid (GRID 1.0) is the typical 2 nodes cluster database, once their customers start feeling comfortable with the and it's potential they wan to leverage the full potential of grid and evolve into what they call GRID 2.0. Oracle is looking into incorporate to it policy based service level automation.

In the meeting Oracle also spoke about ASM and Clusterware giving us some tips:

- They say that SAN based redundancy is commonly used but when that is not available ASM is a good option.
- They clarified that contrary to what people think ASM stripping in conjunction with SAN stripping does not hurt performance.
- They said there is a benefit in using ASM redundancy when using extended clusters (Clusters separated geographically).
- When using ASM 2 different LUNS should not map back to the same spindle.
- LUN provisioning should be done in a complimentary manner to ASM.
- Redundancy for private network is highly recommended, most customers use a pair of dedicated switches for it.
- Jumbo frames can be used to reduce the private network traffic and CPU overhead (1500 bps to 9k).
- They recommend to use workload management by service and to partition similar workloads by service.




Tuesday, January 15, 2008

Some Oracle 10g Tuning tips


Some Oracle 10g Tuning tips

AWR

In Oracle10g the Automatic Workload repository is the primary component of Common Manageability Infrastructure (CMI). It is the successor for the Statspack. While the Statspack is still available with 10g, just a few improvements are planned to it; therefore AWR is the preferred mechanism for diagnosing database problems.

AWR provides data used by other CMI components, such as system generated alerts and the advisors. The AWR consist of 2 main components:

- In-memory statistics

- Repository snapshot.

In-memory statistics are gathered once a second on active sessions. They are not written to the database and are aged out of memory as new statistics are generated. In memory statistics are accessed through the view V$ACTIVE_SESSION_HISTORY which queries the ASH (Active Session History) circular buffer area of the SGA (System Global Area)

AWR relies on MMON which wakes up every hour and statistics collection into the repository snapshot (you can modify the collection interval), AWR snapshot provides a persistent view of database statistics.

A script is provided ($ORACLE_HOME/rdbms/admin/awrrpt.sql) to generate a report using repository snapshot. There is also an awrrpti.sql report as well, which has essentially the same output but allows you to define and report on a specific instance.

ADDM

The Automatic Database Diagnostic Monitor (ADDM) uses the snapshot information of AWR to automatically identify performance problems and make recommendations to correct them. ADDM is the predecessor of the Oracle expert tool. ADDM functionality is embedded into the kernel making performance impact near negligible. ADDM analysis is performed every time an AWR snapshot is taken. in addition ADDM can automatically fix certain problems.

To allow use of ADDM, a PL/SQL interface called DBMS_ADVISOR has been provided. This interface may be called directly through the supplied script $ORACLE_HOME/rdbms/admin/addmrpt.sql. Besides this PL/SQL package a number of views allow you to retrieve the results of any actions performed with the DBMS_ADVISOR API.

When the parameter STATISTICS_LEVEL is set to TYPICAL or ALL, the database will automatically schedule the AWR to be populated every 60 min. To create snapshots out of this interval you need to use the dbms_workload_repository.create_snapshot () package.

To be useful in diagnosing a particular problem, the snapshots needs to be created before and after the situation you wish to examine.

The following views are available for querying ADDM information.

View

Description

DBA_ADVISOR_ACTIONS

Actions associated with all recommendations

DBA_ADVISOR_COMMANDS

Commands used by advisor in DB for specifying recommended actions

DBA_ADVISOR_DEF_PARAMETERS

Parameters and default values for all tasks in the database.

DBA_ADVISOR_DEFINITIONS

Properties of all the advisors in the database

DBA_ADVISOR_DIRECTIVES

Not documented

DBA_ADVISOR_FINDINGS

Findings discovered by all advisors

DBA_ADVISOR_JOURNAL

Journal entries for all tasks

DBA_ADVISOR_LOG

Current state of all tasks along with execution specific data such as progress monitoring and completion status

DBA_ADVISOR_OBJECT_TYPES

Object types used by all advisors

DBA_ADVISOR_OBJECTS

Objects currently referenced by all advisors

DBA_ADVISOR_PARAMETERS

Parameters and their current value for all tasks

DBA_ADVISOR_PARAMETERS_PROJ

Not documented

DBA_ADVISOR_RATIONALE

Rationales for all recommendations

DBA_ADVISOR_RECOMMENDATION

Result of complemented diagnostics tasks with action recommendation for the problems identified in each run

DBA_ADVISOR_SQLA_REC_SUM

Recommendation rollup information for all workload objects after analysis

DBA_ADVISOR_SQLA_WK_MAP

Workload references for all tasks

DBA_ADVISOR_SQLA_WK_STMTS

Workload objects after analysis

DBA_ADVISOR_SQLW_COLVOL

Not documented

DBA_ADVISOR_SQLW_JOURNAL

Journal entries for all workload

DBA_ADVISOR_SQLW_PARAMETERS

Workload parameters and their current values

DBA_ADVISOR_SQLW_STMTS

Rows that correspond to all statements in the workload

DBA_ADVISOR_SQLW_SUM

Aggregate picture of all SQL workload

DBA_ADVISOR_SQLW_TABLES

Cross-references between workload statements and tables references on it.

DBA_ADVISOR_SQLW_TABVOL

Not documented

DBA_ADVISOR_SQLW_TEMPLATES

Aggregate picture of all SQL workload template objects

DBA_ADVISOR_TASKS

Information about all tasks in the DB

DBA_ADVISOR_TEMPLATES

Information about all templates in the DB

DBA_ADVISOR_USAGE

Information for each type of advisor


SQL Tuning Advisor

This is feature automates the entire SQL tuning process. It analyzes the SQL statements and executes a complete analysis of the statements.

The advisor can be administered with the procedures in the DBMS_SQLTUNE package. To use the API the user must be granted DBA role, SELECT_CATALOG_ROLE role and the ADVISOR privilege.

Running SQL Tuning advisor using DBMS_SQLTUNE package is a two-step process. First you create a tuning task and then you execute the task. The CREATE_TUNING_TASK function returns the task name that you have provided or generates a unique task name. You can use the task name to specify this task when using other API’s.

Check for chaining rows

To see if you have chaining problems, run utlchain.sql script that Oracle provides and is in /$ORACLE_HOME/rdbms/admin subdirectory. You should check for chaining on a weekly basis and fix any problems immediately.

Analyze table customers;

List chained rows;

Then run the following query accessing the CHAINED_ROWS table to check the customer table chaining:

Select HEAD_ROWID from CHAINED_ROWS where TABLE_NAME = ‘CUSTOMER’;

If no rows are returned, then you don’t have a chaining problem. If there is a chaining problem then the query will return the head_rowid for all chained rows. You can also use the “count(*)” against the CHAINED_ROWS table to find the number of chained rows. In V$SYSSTAT, the “table fetch continue row” is an indicator of chained rows as well.

To avoid row chaining, set PCTFREE correctly, the default is set to 10.

Increasing the log file size and LOG_CHECKPOINT_INTERVAL for speed

If you want to speed up large numbers of INSERTs, UPDATEs, and DELETEs, increase the sizes of your log files and make sure they are on the fastest disk. Previously, you could also increase the LOG_CHECKPOINT_INTERVAL if it was set such that it would checkpoint prior to log switch, but this parameter is being deprecated and currently is set to zero (which indicates switching based on redo log being full).

Determining if redo log file size is a problem

There could be 2 problems with the size of the redo log files:

A) Batch jobs that do not have enough total redo space to complete or are so fast that the online redo logs wrap (cycle through all the logs and start writing to the first one again) before they are archived to the offline redo logs.

B) Very long running jobs that are spending a large amount of time switching online redo logs. Long running jobs are often much faster when the entire job fits into a single online redo log. For the online transaction processing (OLTP) type of environment, smaller online redo log are usually better. Optimal online redo log switch should happen every half hour (no counting the long running batch jobs that shorten this time)

Use the query below to determinate if there is a problem, it shows the time between log switches.

SQL> l

select b.recid,

to_char(b.first_time,'DD-MON-YY HH:MI:SS') start_time, a.recid,

to_char(a.first_time,'DD-MON-YY HH:MI:SS') end_time,

round(((a.first_time - b.first_time)*25)*60,2) minutes

from v$log_history a, v$log_history b

where a.recid = b.recid+1

order by a.first_time a


Determining the size of your log files and checkpoint interval

SQL> l

1 select a.member, b.*

2 from v$logfile a, v$log b

3* where a.group# = b.group#

Friday, January 11, 2008

Discussion of the Oracle Global Executive Survey

A couple of weeks ago I got a survey from Oracle where you rated several divisions of the company separated (Support, Consulting, Education, Sales, etc). I filled it and this morning I found an invitation in my Inbox from Keith Block (Oracle Executive Vice President) thanking me for filling the survey and inviting me for a conference call at 11am today where he was going to to talk about the result of the survey and what Oracle plans to do.

They received 7000 surveys, Keith invited several of the managers from the different organizations for them to explain what are they doing with the results of it on each area. Below are outlines the main points per organization.

Support

- They improve and use more the collaboration tool and offer a more personalized support experience.

- They are encouraging customers to use their configuration manager feature.

- They are building support capabilities inside the product in order to have proactive diagnostic.

Development

Here they focused only in application development.

- Lifetime support policy for the applications.
- They are working so you can monitor all your different application from Grid Control.
- They are working on having a common reporting tool for all your applications.
- They are focusing in tasks that aim to reduce the cost of ownership of their customers.
- They are architecting the integration between the different applications, the idea is for the
delivery of this to be a prepackaged integration product.
- They spoke about the Oracle Fusion application and how they expect it to be a plug-in to any existing application you may have.

Relationships

Apparently several customers have complained because they have to deal with many different Oracle reps for the different technologies, Keith acknowledged the issue and explained that there are several sales models, but they opted for having several reps with deep knowledge about the technology they represent. Keith explained that Oracle have a huge portfolio of products and it is impossible for a single person to get to know well all of them. Keith vision is that the sales reps would become trusted advisers inside the customer organization.




Sunday, January 6, 2008

Oracle 10g Installation and upgrade tips

Installing & Upgrading Oracle10g.

- The most common Oracle10g installation can be performed with just one CD.

- On Linux and Unix you may use the runInstaller -ignoreSysPrereqs flag to continue with the Oracle install even if the flavor of Linux is not certified by Oracle.

- Starting 10g the Oracle client can only be installed from a separate CD.

- Personal Edition is only available for Windows and does not include RAC.

- If you choose a started database based in one if the schemes available (Transaction processing, General Purpose or Data Warehouse) DBCA will run in no interactive mode, if you use advance it will run in interactive mode.

- Database Control (EM) is installed by default if you install a preconfigured database, for custom you have the option not to install it.

- OUI allows you to choose 3 types of storage File system, ASM and Raw devices.

- If you choose ASM and an ASM instance is not installed already Oracle will create one for you.

- In 10g you may enable automatic database backup during install using the backup and recovery options screen.

- The default disk quota for Flash back is 2GB.

- While installing you have the option to provide separate password for each administrative user or provide one password for all.

- The EM Webstage and Apache, which were installed with Oralce9i, are not longer installed with the Oracle10g.

- In 10g the disk requirements for install are now less.

- The installation is simplified, you can install the software and create the database just with the default settings.

- Oracle10g requires a minimum of 512MB minimum for an instance with database control and 256MB without database control and about 2.5GB HD.

- The Oracle10g Companion CD includes:
- Database examples.
- JPublisher.
- Legato.
- Natively compiled Java libraries.
- Oracle text-supplied knowledge bases.
- Oracle HTTP Server (Different Oracle Home).
- Oracle Apex
(Different Oracle Home).

Configuring Oracle 10g.

- 10g includes a new SYSAUX tablespace to store all auxiliary metadata.

- DBCA can setup the flash recovery area, clone a database, setup Database control and grid control, register automatically LDAP, implement backup and recovery, create management repository and services.

- Cloning a database using DBCA templates saves time in database creation, because copying an already created seed database's files to the correct location takes less time than creating them.

- DBCA Templates are stored in $ORACLE_HOME/assistants/dbca/templates directory, they can be easily shared and can be copied from one machine to another.

- There are 2 types of templates seed and nonseed, seed templates have the extension .dbc and include the data files of an existing database. Nonseed templates has the extension .dbt and does not include data files.

- When creating a database template for cloning DBCA will shutdown the database and start it in mount state.

- In 10g the instance parameters are categorized into basic and advanced, in most of the cases modification of the basic parameters is enough to setup and tune the database.

- The compatible parameter is irreversible, once you set it you can no change it's value to one that is less than the previous value. To lower the value you will need to do a point in time recovery of the databases.

- Have you ever wonder how Oracle knows if you are using or not some of the enterprise features of the license?. What about Looking here

SQL> l 1 select name, detected_usages DU, last_usage_date 2 from dba_feature_usage_statistics 3* where currently_used = 'TRUE'

- If you want to know the high watermark usage of various attributes such as number of tablespaces, concurrent connections, number of user indexes, etc. Then this is the query you need.

SQL> l 1* select NAME, VERSION, HIGHWATER, LAST_VALUE, DESCRIPTION from dba_high_water_mark_statistics SQL>

If you don't see the information populated in the table all you have to do is execute the following package.

exec dbms_stats.gather_database_stats

- Oracle 10g provides a utility script $ORACLE_HOME/rdbms/admin/ultu10i.sql to perform pre-upgrade validation on the database to be upgraded. DBUA will also automatically run this tool. This scripts needs to be run as SYSDBA before you plan to perform a manual upgrade.

- Oracle uses the DBMS_REGISTRY package to determinate the objects to be upgrades. In 10g the cmpdbmig.sql script determinate which components are in the database by performing specifics callouts to the components REGISTRY. Versions of Oracle prior to 9.2 does not have components REGISTRY in this case the upgrades automatically creates and populates the component REGISTRY. You can query the components using the view DBA_REGISTRY.

- If you get any errors during the upgrade "Manually only" the utl101s.sql scripts provides the name of specific scripts to run to fix the failed component.

- Run the script $ORACLE_HOME/rdbms/admin/utlrp.sql at to end to recompile all objects.