Archive for December, 2006

Last warning, I moved my blog – Son uyarı, taşındım

Saturday, December 30th, 2006

In 2007 because of some technical reasons I am moving my Oracle Blog to here http://tonguc.wordpress.com Please dont forget to add my new blog to your rss reader http://reader.google.com :)

I will move and consolidate my Oracle related posts indexed here http://tonguc.blogspot.com and detailed here http://tonguc.oracleturk.org in several category series like;

- Oracle Expanded Supplied Packages with 10g Series
Like DBMS_APPLICATION_INFO, UTL_COMPRESS, DBMS_DB_VERSION etc.

- Oracle New Dictionary Enhancements with 10g Series
Like V$OSSTAT, V$SYSMETRIC_HISTORY, V$ACTIVE_SESSION_HISTORY etc.

- Oracle Built-in Functions Series
Like VSIZE, GREATEST, EXTRACT, NVL2, COALESCE etc.

- Oracle SQL Extentions Series
Like Analytic SQL, SQL Model Clause, Regular Expressions, Hierarchical Queries(Oracle Trees) etc.

- Oracle Database Concepts Series
Like ACID properties, Transaction Management, Concurrency, Read Consistency, Locking Mechanisms, Redo, Undo(Rollback), Latch, Enqueue etc.

- There are more than one NUMBER and Character Native Type Series
Like Other Character Datatypes, Other Numeric Datatypes, LOB Datatypes, RAW and LONG RAW Datatypes, ROWID and UROWID Datatypes, XML Datatypes, and also Data Conversion

- There are more than one TABLE Type Series
Like Partitioned Tables, Nested Tables, Temporary Tables, Object Tables, External Tables, Index Organized Tables(IOT)

- There are more than one INDEX Type Series
Like Unique and Nonunique Indexes, Composite Indexes, Function-Based Indexes, Reverse Key Indexes, Bitmap Indexes, Bitmap Join Indexes, Domain Indexes and also Indexes and Nulls

- Oracle Best Practices Series
Like Backup and Recovery with Recovery Manager, High Availability with Data Guard and Real Application Clusters, Automatic Manageability Features like Automatic Storage Management(ASM) and Automatic Segment Space Management(ASSM)

- Oracle Business Intelligence and Extraction, Transformation, Loading(ETL) Series
Like Materialized Views, Table Compression, Parallel Execution, OLAP Capabilities, Data Mining

- Oracle Content Management Series
Like XML in Oracle, LOBs, Oracle Text, Oracle Ultra Search, Oracle interMedia, Oracle Spatial

- Oracle Security Series
Like User Resource Limits and Profiles, Privileges and Roles, Fine-Grained Access(FGA) Control

- Oracle Information Integration Series
Like Distributed SQL, Oracle Streams, Oracle Transparent Gateways and Generic Connectivity

All these topics mentioned above which I plan to study during 2007 is very easy to get immediately familiar with by reading this chapter and guide;

Oracle® Database Concepts 10g Release 2 (10.2)
Chapter 1 Introduction to the Oracle Database

Also other important series will be;

- Oracle Linux and Shell Scripting Series
- Oracle Express Edition(XE) and Application Express Series

This migration will take some time and for me it will be really a great opportunity to study Oracle deeper. So this was the last warning and ending for this blog domain, waiting to meet you at the new one http://tonguc.wordpress.com :)

Best regards,
Tonguç

closing 2006, planning 2007

Saturday, December 23rd, 2006

2006 was a great year for me, hope 2007 will be greater :)

I wish to have the oppotunities to meet more friends, have more challenging projects, and spend more time with my family and friends..

With the start of this blog on January 2006 I forced myself to study Oracle more than ever and now I am happy with the outcomes after all that hard time. 121 Posts in General and 395 posts in Oracle Category; more than one Oracle post a day during 2006 :)

2007 the blogging stuff will of course continue but because of some technical reasons I am moving to here http://tonguc.wordpress.com dont forget to add me to your rss reader :)

Also in 2007 I will try to have OCM degree , more Internship support for young software engineers in my company, maybe meeting someone I admire for long time, a book in Turkish discussing how a starter get details of Oracle database concepts and features,maybe also a similar post like this ;)

So this is my last post here, but previous enteries will remain. I wish everyone a healthy, successfull and happy new year :)

Why this blog, internal educations or summer internship programmes?

Saturday, December 23rd, 2006

I have given a two day “application express development” education based on the “2 Day Plus Application Express Developer Guide” and a four day “10g sql statements and application tuning” education based on “Oracle® Database Performance Tuning Guide 10g Release 2 (10.2)” Parts I,II and IV, Thomas Kyte’s Expert-One-On-One and Jonathan Lewis’s Practical Oracle and Cost Based Optimizer Fundamentals books. These are internal educations planned by Turkcell Akademi for Turkcell employees and I am choosen as an internal educator some years ago related on Oracle educations.

My comany is the largest company in Turkey with ~30million customers and ~3000 employees. We use Oracle database on Unix systems. It always suprises me how people behave when learning about the feautes I mention in these internal educations. These features are nothing magic or very unknown really, all of them are mentioned in the strating document for Oracle database Concepts Guide which can be accessed freely from http://tahiti.oracle.com. But it seems that people really does not have a need or want to investigate and read these, the standart acuse is everytime-everybody is very stressed and busy, no time for something new which will make their life easier unfortunately.

So these internal educations are a plathform which I meet with lots of different people with different profiles and backgrounds work on Oracle in their daily work life. I show them how to use Application Express and build web based database apllicaitons in minutes, easily. We talk on 10046/10053 sql trace techniques, autotrace and custom tools like Mr.Kyte’s runstats or Mr.Unal’s itrprof. Also new feautes of 10g like Regular Expressions, dbms_errlog, flashback and recyclebin. Some things which are not new but unfortunately needs mentioning like other table and index types rather than heap table and b*tree, analytical functions, merge and insert all statements, pipelined functions, hierarchical sql, plsql bulk operations, xmltype, large object support, oracle text, intermedia and spatial options and even partitioning and materialized views.

Also fundamental things like using otn, tahiti, installing XE in minutes and using for tests during the education, NULL values and their uncertainities with Oracle and of course Transaction and Exception management techniques. And some things different like “Question Authority” from Mr.Kyte and “Google Search Syndrome”.

These educations are not my primary responsibility but I always work hard for the content because after my six years with Turkcell I believe that it is a must that I have to give this extra time to improve the efficiency by showing employees how Oracle can be effectively used. I use Oracle database and tools for the last 8 years, but I feel like a student still when I read a post in Mr.Lewis blog on CBO, Mr.Kyte’s experimentational answers on asktom or Mr.Feuerstein’s poetry like plsql code. This feeling is very special I know.

Turkcell is one of the biggest customer of Oracle world wide and seeing how this inefficiency is becoming as a company culture is my primary motivation in this fight. Two things made me sad during my recent educations; 1) oracle dba and developers are not coming, attendants are coming from operation groups and their primary focus is writing performant reporting sql statements with tricks like exist versus in or hinting. when I start talking on sql trace or analytical functions this is usually percieved as overloading by most of the group members unfortunately 2) a story begins here; Einstein told one of his collegues one day that if he can make the waiteress surving them understand the relativity theorem only with the material on the table they are having lunch, it is a proof than that he understood all. This comment was shared with me because I am not always able to educate people with making things more simple. This is always in my mind, I know simple is always the best. The challenge is how can I make an analytical function or sql model clause subject simple to be educated. I know this is not impossible, for this challenge I use the experimentation technique of Mr.Kyte’s. I give attendants the chance to experiment the features mentioned on XE they installed on Sql*Plus with simple scnerios mostly taken from tahiti documentation set, otn sample code sections or Mr.Daniel’s library psoug. But last time this also didn’t help, I had several hard time in class, this showed me I need extra time to work on some examples of the education.

So what is the moral of this story than; I must confest that my primary concern is not my company’s inefficiency with my collegues’s limited Oracle knowledge degree, it is my own knowledge degree in fact. It is really a great challenge to work on a topic and educate it or write and publish an articale to internet by knowing that it can be accessed and criticised by Mr.Kyte or Mr.Lewis :) I love this feeling, I love learning, I love sharing. And this is why this blog, internal educations or summer internship programmes are important for me.

After all, I know some of my collegues will read this post and I hope to meet more Oracle dba and developers in the scheduled internal educations for new challenges.

Oracle 10g Product Family-August 2006 Oracle Whitepaper

Monday, December 18th, 2006

This paper summaries the five oracle editions, the advanced options and the management pack of Oracle;
The editions:
Standard Edition One,Standard edition, Entreprise Edition, Personal Edition, Express Editions
The options:
RAC, Partitioning, Advanced Security, Label Security, OLAP, Data Mining, Spatial
The management packs:
Change management, Diagnostic, Tuning and Configuration Management Packs

Javapolis RADRace winner application and Oracle ADF on OTN

Sunday, December 17th, 2006
JavaPolis is the largest Java event in Europe. JavaPolis 2006 takes place between December 11th and 15th in Antwerp (Belgium) at the venue MetroPolis. http://www.javapolis.com/confluence/display/JP06/Home

Here is the full story of the RADRace

And the OTN Resources on Oracle Application Development Framework

Oracle ADF is an end-to-end J2EE framework that simplifies development by providing out of the box infrastructure services and a visual and declarative development experience.

Hacking the APEX error page by Patrick Wolf

Friday, December 15th, 2006

Patrick has a blog on ApEX, one of my favorites. Today I saw his post on the error page problem. The post consists two demo applications and the sources, as always, to clarify the solution. Great work, thank you Patrick :) check the solution -> Hacking the APEX error page!
Don’t forget to check out his ApexLib framework solutions!

Oracle JDeveloper – An IDE Worth a Second Look

Friday, December 15th, 2006

Some integrated development environments (IDE) are more integrated than others. Oracle JDeveloper is much more than a Java programming tool. Integrated into its core Java IDE are a host of other IDEs such as:

XML development – visual editors for XSD, XSLT, XQuery, WSDL, and support for debugging XSLT
Web development – visual editors for CSS, as well as WYSIWYG editors for HTML, JSP, JSF (pages and config) and ADF Faces (a k a Apache MyFaces Trinidad), Struts (config) and Applets and an HTTP Analyzer for analysis of the packets sent across the wire for Web Services and Web applications
J2EE development – wizards for EJB, Web Services, and the built-in OC4J Application Server to deploy J2EE artifacts quickly, as well as very easy remote debugging of both Web and J2EE applications. JDeveloper also provides an IDE for Oracle TopLink – one of the premium tools for object-relational mapping
Database development – editors and diagrammers for tables, database browsers, SQL worksheets, data viewer for all JDBC-powered databases as well as programming and debugging support for PL/SQL – the Oracle database’s stored procedural language
UML modeling – diagrammers for activity, class (with code synchronization), sequence and use case diagrams
Integration – visual modeling, testing. and deploying Web Services, BPEL processes, and ESB services

If you haven’t looked at Oracle JDeveloper in a while, you’ll definitely want to take a second look now. Installation only takes unzipping an archive. Oracle JDeveloper 10.1.3.1 is free and available for download at: http://oracle.com/technology/jdev

Reference

http://java.sys-con.com/read/313602.htm

Oracle JDeveloper 10.1.3.1.0 Feature Matrixhttp://www.oracle.com/technology/products/jdev/101/collateral/101/featurematrix_10131.html

How to open ApEx applications on local XE instance to remote clients?

Thursday, December 14th, 2006

One of my colegues asked this, if you run this with sys at XE;

begin
DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
COMMIT ;
end;

it is done :) to check the ip and port status netstat from command prompt can be used, initially;

D:\>netstat -an

Active Connections

Proto  Local Address          Foreign Address        State
..
TCP    127.0.0.1:8080         0.0.0.0:0              LISTENING
..

Then

..
TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING
..

Or instead of SQL you can use XE administration frontend as mentioned in the below documentation to change this http setting.

References
Oracle® Database Express Edition Installation Guide

http://www.oracle.com/technology/software/products/database/xe/files/install.102/b25144/toc.htm

OTN Discussion Forums » Oracle Database XE » Oracle Database 10g Express Edition

http://forums.oracle.com/forums/forum.jspa?forumID=251&start=0

OTN Discussion Forums » Database » Application Express

http://forums.oracle.com/forums/forum.jspa?forumID=137

Magic number Cost is very closely related with Time

Wednesday, December 13th, 2006

This is a demostration of what is mentioned on this post of Mr.Lewis; http://jonathanlewis.wordpress.com/2006/12/11/cost-is-time/
First you must start using system statistics as mentioned in my previous post.

SELECT pname, pval1 FROM sys.aux_stats$ WHERE sname = ‘SYSSTATS_MAIN’;

PNAME PVAL1
—————————— ———-
CPUSPEEDNW 491,366552
IOSEEKTIM 10
IOTFRSPEED 4096
SREADTIM 10,204
MREADTIM 12,883
CPUSPEED 236
MBRC 28
MAXTHR 6822912
SLAVETHR

9 rows selected.

execute dbms_random.seed(0)

drop table t1 purge;
create table t1 as select
rownum id,
trunc(dbms_random.value(1,50)) n1,
rpad(’x’,100) padding
from dba_source ;
create unique index ui_t1_id on t1(id);

exec dbms_stats.gather_table_stats(user,tabname =>’T1′,cascade => true,estimate_percent => null,granularity => ‘default’,method_opt => ‘for all columns size 1′ );

alter system flush shared_pool ;

explain plan set statement_id ‘xyz’ for select n1, padding from t1 where id > 100;

select * from table(dbms_xplan.display(’plan_table’,’xyz’));

————————————————————————–
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
————————————————————————–
| 0 | SELECT STATEMENT | | 154K| 15M| 137 (17)| 00:00:02 |
|* 1 | TABLE ACCESS FULL| T1 | 154K| 15M| 137 (17)| 00:00:02 |
————————————————————————–

cost : 137
SREADTIM : 10.204
time : 2

in the post time is mentioned to be calculated as -> round(cost * SREADTIM / 1000, 3) and ;

select round(137 * 10.204 / 1000, 3) time from dual ;

TIME
———-
1,398

Mr.Lewis explains this difference between 2 and 1,398 as; “Oracle got as close as it could because it’s reporting to the second – and it’s rounding up, rather than rounding to the nearest second.”

References

http://tonguc.oracleturk.org/index.php?s=cost+estimated+time

Migrating to System Statistics

Wednesday, December 13th, 2006

Following tests were made on Oracle XE;

– connect with SYS in this first session and start gathering
– initially system statistics are not available
SELECT pname, pval1 FROM sys.aux_stats$ WHERE sname = ‘SYSSTATS_MAIN’;

PNAME                               PVAL1
—————————— ———-
CPUSPEED
CPUSPEEDNW                        495,977
IOSEEKTIM                              10
IOTFRSPEED                           4096
MAXTHR
MBRC
MREADTIM
SLAVETHR
SREADTIM

9 rows selected.

SELECT TO_CHAR(sysdate,’DD-MON-YY HH24:MI:SS’) “Stop” FROM dual;
exec dbms_stats.gather_system_stats(’start’);

– in this period we will create some load from another HR session

– may use this to sleep this session for 3 minutes
– exec dbms_lock.sleep(180);

– connect with HR in this second session
– to simulate an olap load
create table tab_stress_me nologging parallel 2 as
select * from dba_source order by 1,2,3;
EXEC DBMS_STATS.gather_table_stats(user, ‘tab_stress_me’, estimate_percent => 50, block_sample => FALSE, degree => 2, granularity => ‘ALL’, cascade => TRUE) ;
commit;
drop table tab_stress_me purge;
execute dbms_random.seed(0)
create table t1 nologging parallel 2 as select
rownum                id,
trunc(dbms_random.value(1,50))    n1,
rpad(‘x’,100)            padding
from    dba_source ;
create unique index pk_t1_id on t1(id) nologging parallel 2;
EXEC DBMS_STATS.gather_table_stats(user, ‘t1′, estimate_percent => 50, block_sample => FALSE, degree => 2, granularity => ‘ALL’, cascade => TRUE) ;
commit;

– to simulate an oltp load
BEGIN
FOR i IN 1 .. 1000 LOOP
FOR c IN (select n1, padding from t1 where id = i) LOOP
NULL;
END LOOP;
END LOOP;
END;
/
drop table t1 purge;

– return to the session connected with SYS and stop gathering
exec dbms_stats.gather_system_stats(’stop’);
SELECT TO_CHAR(sysdate,’DD-MON-YY HH24:MI:SS’) “Stop” FROM dual;
commit;

– system statistics are now available
SELECT pname, pval1 FROM sys.aux_stats$ WHERE sname = ‘SYSSTATS_MAIN’;

PNAME                               PVAL1
—————————— ———-
CPUSPEED                              496
CPUSPEEDNW                        495,977
IOSEEKTIM                              10
IOTFRSPEED                           4096
MAXTHR                            7029760
MBRC                                   88
MREADTIM                           26,065
SLAVETHR
SREADTIM                              4,8

9 rows selected.

References

Understanding System Statistics by Jonathan Lewis

http://www.oracle.com/technology/pub/articles/lewis_cbo.html

AskTom “CPU costing, mreadtim < sreadtim”

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:67994814192949

Oracle® Database Performance Tuning Guide 10g Release 2 (10.2) – 14.4 System Statistics

http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14211/stats.htm#sthref1468

Playing With System Statistics

http://oraclesponge.blogspot.com/2005/12/playing-with-system-statistics.html