<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6478526690046112130</id><updated>2012-01-05T13:46:04.671-08:00</updated><category term='logging'/><category term='flash'/><category term='bug'/><category term='free'/><category term='measurement'/><category term='1Z0-001'/><category term='ORA-06508'/><category term='meta data'/><category term='data warehouse'/><category term='listener'/><category term='upgrade'/><category term='WHERE CURRENT OF'/><category term='outer join'/><category term='query'/><category term='tnsnames'/><category term='ANSI'/><category term='SIMPLE_INTEGER'/><category term='consultants'/><category term='Forms and Reports'/><category term='schema owner'/><category term='FGA'/><category term='ORM'/><category term='roll back'/><category term='no data found'/><category term='license'/><category term='ORA-12535'/><category term='semantics'/><category term='virtual drop'/><category term='SQLCA'/><category term='POJO'/><category term='logical modeling'/><category term='ORDER BY'/><category term='variables'/><category term='patch'/><category term='guest OS'/><category term='foreign key'/><category term='LOGON'/><category term='type'/><category term='wizard'/><category term='reports developer. Report Builder'/><category term='exams'/><category term='loadjava'/><category term='brute force'/><category term='TNS_ADMIN'/><category term='WHENEVER'/><category term='policy'/><category term='fetch'/><category term='correlated subquery'/><category term='streams'/><category term='report server'/><category term='ROWID'/><category term='TOAD'/><category term='concurrency'/><category term='test suite'/><category term='referential integrity'/><category term='drivers'/><category term='view'/><category term='recompile'/><category term='code changes'/><category term='short circuit'/><category term='shutdown'/><category term='SECUREFILE'/><category term='unit testing'/><category term='design'/><category term='NVL'/><category term='statistics'/><category term='NOCOPY'/><category term='ORA-01502'/><category term='execution path'/><category term='Microsoft'/><category term='inserts'/><category term='password verify function'/><category term='use cycle'/><category term='SimpleDB'/><category term='password validation'/><category term='DTO'/><category term='application'/><category term='sync'/><category term='logo'/><category term='drop'/><category term='Oracle client'/><category term='auditing'/><category term='host OS'/><category term='DBAs'/><category term='associative array'/><category term='compilation'/><category term='lookup'/><category term='error message'/><category term='temporary tables'/><category term='range partitioning'/><category term='course'/><category term='tuning'/><category term='Oracle 9i'/><category term='multi instancing'/><category term='constants'/><category term='NEXTVAL'/><category term='Oracle 10g client'/><category term='scripts'/><category term='update'/><category term='alias'/><category term='ORA-01017'/><category term='exam'/><category term='shell script'/><category term='tricks'/><category term='EXECUTE'/><category term='specification'/><category term='transaction'/><category term='TO_CHAT'/><category term='LONG'/><category term='connect'/><category term='stub'/><category term='levels'/><category term='inner query'/><category term='optimize'/><category term='engine'/><category term='body'/><category term='bitmap index'/><category term='files'/><category term='data dictionary'/><category term='create'/><category term='private'/><category term='lookup table'/><category term='CPUs'/><category term='CREATE JOB'/><category term='log'/><category term='source code'/><category term='ORA-01034'/><category term='architect'/><category term='native compilation'/><category term='exclamation point'/><category term='EF'/><category term='BigTable'/><category term='log writer'/><category term='PL/SQL tables'/><category term='assignment'/><category term='nightly process'/><category term='Oracle books'/><category term='replication'/><category term='universal installer'/><category term='ORA-04068'/><category term='password change'/><category term='installation'/><category term='documentation'/><category term='REM'/><category term='C'/><category term='PL/SQL'/><category term='DB Visualizer'/><category term='PL/SQL table'/><category term='side effects'/><category term='storage'/><category term='alignment'/><category term='sqlplus'/><category term='TO_DATE'/><category term='10g'/><category term='row-level locks'/><category term='BFILENAME'/><category term='SQL query result cache'/><category term='exceptions'/><category term='sysda'/><category term='encryption'/><category term='Oracle home'/><category term='queries'/><category term='standard'/><category term='SQL Server Express'/><category term='WITH CHECK OPTON'/><category term='profiles'/><category term='Reports 6i'/><category term='application context'/><category term='function'/><category term='DCL'/><category term='HTML documentation'/><category term='installer'/><category term='WHERE'/><category term='performance'/><category term='SGA'/><category term='timing'/><category term='Enterprise Manager'/><category term='timed out'/><category term='Schema Spy'/><category term='DAO'/><category term='PASSWORD_REUSE_TIME'/><category term='Cassandra'/><category term='warnings'/><category term='REMARKS'/><category term='late software'/><category term='yearly'/><category term='run time'/><category term='ORA-00600'/><category term='amatuer'/><category term='VAX'/><category term='complex views'/><category term='overload'/><category term='schema'/><category term='parameters'/><category term='ORA-00060'/><category term='Oracle 11g'/><category term='callback'/><category term='owner'/><category term='handler'/><category term='user'/><category term='CouchDB'/><category term='case'/><category term='new account'/><category term='TNSADMIN'/><category term='datacenter'/><category term='reproduce'/><category term='explicit'/><category term='rollback'/><category term='Oracle expert'/><category term='permissions'/><category term='clusters'/><category term='synonym'/><category term='GRANT'/><category term='substitution variable'/><category term='Spfile'/><category term='FGAC'/><category term='DB2'/><category term='SQL Developer'/><category term='GNU license'/><category term='errors'/><category term='strong typing'/><category term='messages'/><category term='requirements'/><category term='Reports Server'/><category term='prototype'/><category term='nested loops'/><category term='users'/><category term='insert scripts'/><category term='inline'/><category term='complex'/><category term='connection'/><category term='dual'/><category term='trace'/><category term='Oracle 10g'/><category term='fast'/><category term='scratch paper'/><category term='CURRENT_DATE'/><category term='career path'/><category term='delete'/><category term='destination'/><category term='Enterprise Architect'/><category term='OCI'/><category term='permissions issue'/><category term='analysis'/><category term='contexts'/><category term='script'/><category term='versions'/><category term='forms'/><category term='open'/><category term='count'/><category term='assumptions'/><category term='guardian'/><category term='default'/><category term='access path'/><category term='hard-coded'/><category term='ADO'/><category term='debug'/><category term='implicit cursor'/><category term='personal'/><category term='empty'/><category term='tool'/><category term='CBO'/><category term='Express Edition'/><category term='NULL'/><category term='Index-by tables'/><category term='derived data'/><category term='thin'/><category term='DBMS_LOB'/><category term='OLE DB'/><category term='views'/><category term='SQL common area'/><category term='monitoring'/><category term='Coherence'/><category term='USER_SOURCE'/><category term='instance'/><category term='Java'/><category term='award'/><category term='source'/><category term='express'/><category term='DDL'/><category term='ACCEPT'/><category term='END'/><category term='predicate'/><category term='certification'/><category term='tests'/><category term='ORA-02266'/><category term='hacks'/><category term='POCO'/><category term='ODBC'/><category term='tablespace'/><category term='definer’s rights'/><category term='command line'/><category term='DBA team'/><category term='failure'/><category term='UTL_FILE'/><category term='diagnosis'/><category term='REF CURSOR'/><category term='deadlock'/><category term='test bed'/><category term='nested table'/><category term='indexes'/><category term='subquery'/><category term='FAQ'/><category term='package'/><category term='legal notice'/><category term='TIP'/><category term='database access'/><category term='redo'/><category term='development'/><category term='production'/><category term='uCertify'/><category term='callout'/><category term='ORA-28007'/><category term='upper'/><category term='updates'/><category term='Windows'/><category term='F5 Corporation'/><category term='background_dump_test'/><category term='sessions'/><category term='classification'/><category term='defect'/><category term='locks'/><category term='Oracle Warehouse Builder'/><category term='package initialization'/><category term='SELECT'/><category term='Tom Kyte'/><category term='11g'/><category term='sparse'/><category term='Schema name'/><category term='Oracle Express Edition'/><category term='virtual'/><category term='developer'/><category term='priority'/><category term='invoker’s rights'/><category term='bind variables'/><category term='uncompiled'/><category term='training'/><category term='BULK COLLECT'/><category term='sponsors'/><category term='IBM'/><category term='self study'/><category term='packages'/><category term='deduplication'/><category term='sqlplusw'/><category term='table'/><category term='OCP'/><category term='oraca'/><category term='SPOOL'/><category term='appliance'/><category term='DBMS_OUTPUT'/><category term='refactor'/><category term='report builder'/><category term='TRUNCATE'/><category term='field'/><category term='GTT'/><category term='EXISTS'/><category term='XMLType'/><category term='format'/><category term='top tested loops'/><category term='native dynamic SQL'/><category term='test team'/><category term='database technologies'/><category term='pass'/><category term='CHAR'/><category term='constraints'/><category term='pass by value'/><category term='report'/><category term='problems'/><category term='joins'/><category term='ACS'/><category term='foreign keys'/><category term='FALSE'/><category term='COMMIT'/><category term='hot rollover'/><category term='tnsnames.ora'/><category term='profit'/><category term='framework'/><category term='error'/><category term='account'/><category term='NUMBER'/><category term='dependencies'/><category term='high quality'/><category term='loop'/><category term='UNION'/><category term='client'/><category term='MapReduce'/><category term='archiver'/><category term='SQL*Net'/><category term='Oracle magazine'/><category term='ROWCOUNT'/><category term='Oracle'/><category term='IDE'/><category term='triggers'/><category term='harness'/><category term='scalars'/><category term='green'/><category term='B-Tree index'/><category term='Oracle XE'/><category term='child records'/><category term='virtual machine'/><category term='SQLCODE'/><category term='staging'/><category term='JSON'/><category term='sqlglm()'/><category term='FOR'/><category term='comments'/><category term='repository'/><category term='hardware'/><category term='purge'/><category term='embedded'/><category term='recovery'/><category term='data modeler'/><category term='candidates'/><category term='online upgrade'/><category term='WITH CHECK OPTION'/><category term='stored procedures'/><category term='error code'/><category term='DBMS_HPROF'/><category term='deployment'/><category term='migration'/><category term='Larry Ellison'/><category term='refresh'/><category term='version'/><category term='db writer'/><category term='SQL*Plus'/><category term='JDBC'/><category term='dummay data'/><category term='propaganda'/><category term='Base Table'/><category term='clone'/><category term='temp table'/><category term='VO'/><category term='servers'/><category term='ORA-01848'/><category term='GROUP BY'/><category term='server'/><category term='sysdba'/><category term='exception'/><category term='Akdora'/><category term='timeout'/><category term='DBMS_METADATA'/><category term='score'/><category term='test data'/><category term='problem'/><category term='install'/><category term='SQL*Loader'/><category term='templates'/><category term='outer query'/><category term='sqlldr'/><category term='extproc'/><category term='Export'/><category term='Pro*C'/><category term='BFILE'/><category term='SQL'/><category term='VARCHAR2'/><category term='initialize'/><category term='ampersand'/><category term='pass by reference'/><category term='CM'/><category term='temp tables'/><category term='functions'/><category term='column'/><category term='open source'/><category term='syntax'/><category term='initialization'/><category term='Pro*C Programmer&apos;s Guide'/><category term='insert'/><category term='localhost'/><category term='validation'/><category term='AUTHID CURRENT_USER'/><category term='quality assurance'/><category term='FOR UPDATE'/><category term='MongoDB'/><category term='LOC'/><category term='test'/><category term='UTL_MAIL'/><category term='policy_function'/><category term='DOM'/><category term='DECLARE'/><category term='computer center'/><category term='fix data'/><category term='RAC'/><category term='cursor'/><category term='cursors'/><category term='spaces'/><category term='PL/SQL block'/><category term='advertisement'/><category term='subtypes'/><category term='business logic'/><category term='duplication'/><category term='pinning'/><category term='Oracle error'/><category term='SQL script'/><category term='replicate'/><category term='reports'/><category term='MySQL'/><category term='SYSTEM'/><category term='slow'/><category term='security'/><category term='optimizer'/><category term='Oracle reports'/><category term='PL/SQL function result cache'/><category term='VARRAY'/><category term='ORA-1405'/><category term='labels'/><category term='USER_TABLES'/><category term='WHEN OTHERS'/><category term='compile'/><category term='ORA-14551'/><category term='ksdwrt'/><category term='details'/><category term='InnoDB'/><category term='batch'/><category term='DML'/><category term='JDK'/><category term='OTN'/><category term='MERGE'/><category term='escape'/><category term='timing study'/><category term='session'/><category term='certificate'/><category term='dependency'/><category term='operations'/><category term='busy'/><category term='DBA'/><category term='OCA'/><category term='integrity'/><category term='multithreaded'/><category term='service name'/><category term='locking'/><category term='PostgresSQL'/><category term='UNIX'/><category term='sandbox'/><category term='pricing'/><category term='rules'/><category term='contract'/><category term='elevator'/><category term='European Commission'/><category term='admin'/><category term='cache'/><category term='debugging'/><category term='IF'/><category term='degradation'/><category term='environment'/><category term='ORA-03113'/><category term='collection'/><category term='ROWTYPE'/><category term='BEGIN'/><category term='types'/><category term='Reports Builder'/><category term='evidence'/><category term='C++'/><category term='tables'/><category term='HAVING'/><category term='compression'/><category term='procedures'/><category term='UNION ALL'/><category term='SMTP'/><category term='PLS_INTEGER'/><category term='unit test'/><category term='OLTP'/><category term='ORACLE_HOME'/><category term='enterprise'/><category term='liason'/><category term='parallel'/><category term='FORALL'/><category term='explain plan'/><category term='authorization'/><category term='database'/><category term='Windows 7'/><category term='grants'/><category term='fine grained access control'/><category term='aborting'/><category term='variable'/><category term='sqlnet.ora'/><category term='primary key'/><category term='ALTER TABLE'/><category term='stored procedure'/><category term='REST'/><category term='FOR LOOP'/><category term='records'/><category term='relational'/><category term='sys'/><category term='very large database'/><category term='SQL Plus'/><category term='SQLERRM'/><category term='precision'/><category term='expression'/><category term='data sets'/><category term='draft'/><category term='physcial design'/><category term='NoSQL'/><category term='constraint'/><category term='ADO.NET'/><category term='sequences'/><category term='mode'/><category term='implicit'/><category term='user_objects'/><category term='BSON'/><category term='DBMS_SQL'/><category term='ORA-12203'/><category term='FORCE'/><category term='NDS'/><category term='password reuse'/><category term='ROWNUM'/><category term='redo logs'/><category term='editioning view'/><category term='data'/><category term='profiling'/><category term='password'/><category term='REP-1247'/><category term='PL/SQL Developer'/><category term='deferred'/><category term='discovery'/><title type='text'>Oracle Development</title><subtitle type='html'>Programming applications that use the Oracle database.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default?start-index=101&amp;max-results=100'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>205</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6025769785452447629</id><published>2012-01-05T13:41:00.001-08:00</published><updated>2012-01-05T13:46:04.724-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='package'/><category scheme='http://www.blogger.com/atom/ns#' term='code changes'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle error'/><title type='text'>Divide and Conquer</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-DBPUCsOoqNs/TwYZNwMrzGI/AAAAAAAACF0/mm0Nnc0rrKs/s1600/Calendar.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 307px;" src="http://3.bp.blogspot.com/-DBPUCsOoqNs/TwYZNwMrzGI/AAAAAAAACF0/mm0Nnc0rrKs/s320/Calendar.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5694266502923668578" /&gt;&lt;/a&gt;My customer is doing an acceptance test of my latest code changes. Things are not working well. Initiially I found that they were getting blocked by one of the business rules in the system. Then I determined they were running the wrong scripts. Finally the code was getting an Oracle error.&lt;br /&gt;&lt;br /&gt;The pressure was mounting. I got on a conference call with a bunch of managers. I needed to figure this out fast. The script that was bombing was not huge. But the SQL in it was massive. Lots of joins and unions and large predicates. Ouch. How was I going to figure this out?&lt;br /&gt;&lt;br /&gt;Then I decided to try to find a shortcut. The call stack said a function in a PL/SQL package was actually generating the exception. I checked and found we got lucky. There were only two places where the script accessed the package. Bamm. We were trying to construct a date with a value that is sometimes aritificially too large.&lt;br /&gt;&lt;br /&gt;Sometimes you can get saved by a little divide and conquery.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6025769785452447629?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6025769785452447629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6025769785452447629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6025769785452447629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6025769785452447629'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2012/01/divide-and-conquer.html' title='Divide and Conquer'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-DBPUCsOoqNs/TwYZNwMrzGI/AAAAAAAACF0/mm0Nnc0rrKs/s72-c/Calendar.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7491105510222676981</id><published>2011-12-14T10:24:00.000-08:00</published><updated>2011-12-14T10:30:24.827-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='dependencies'/><category scheme='http://www.blogger.com/atom/ns#' term='documentation'/><title type='text'>The Usual Suspects</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-m9GqPwW_Vng/TujqEIBgF0I/AAAAAAAACEI/38ZYUnxJIfQ/s1600/Suspects.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 227px;" src="http://3.bp.blogspot.com/-m9GqPwW_Vng/TujqEIBgF0I/AAAAAAAACEI/38ZYUnxJIfQ/s320/Suspects.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5686051886149408578" /&gt;&lt;/a&gt;We had a big database job that runs slowly at night. Sometimes it needs to be killed to keep the show running. My boss wanted me to work on this problem. He had a lot of ideas. So did I. My plan was to isolate what is slow, then figure out how to make it fast. I got overruled by the boss.&lt;br /&gt;&lt;br /&gt;My first task was to document what this big database job does. Done. I got a document that explains in English what the purpose of each part of the job is. Then I was told to find out how each of the parts is related.&lt;br /&gt;&lt;br /&gt;I did a bunch of analysis. I determined what pieces depend on which other ones. After some deep analysis, I figured out what are the inputs and outputs for each of the jobs. This was hard because the package that runs the job is 7k lines of code. That package makes use of a lot of other helper packages that are a lot more than 7k lines.&lt;br /&gt;&lt;br /&gt;Now my new tasking is to figure out if we can roll any of the many cursors up into a small number of cursors. I have have to determine whether some database indexes could make the job run faster. I have the option to isolate some SQL and pass it off to some DBAs for analysis and tuning.&lt;br /&gt;&lt;br /&gt;Who knows where all this is going to end up. We might get some performance gains. Then again, I might be just running around in circles. I would love to be given the mission to just make this thing fast. But somebody else higher up on the food chain wants to drive the task with their ideas. Frustrating. Let's hope this does not turn out to be a fail. My time is money - literally.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7491105510222676981?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7491105510222676981/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7491105510222676981' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7491105510222676981'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7491105510222676981'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/12/usual-suspects.html' title='The Usual Suspects'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-m9GqPwW_Vng/TujqEIBgF0I/AAAAAAAACEI/38ZYUnxJIfQ/s72-c/Suspects.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1174853888723964804</id><published>2011-12-09T14:42:00.000-08:00</published><updated>2011-12-09T14:47:34.070-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='log'/><category scheme='http://www.blogger.com/atom/ns#' term='variable'/><category scheme='http://www.blogger.com/atom/ns#' term='alignment'/><category scheme='http://www.blogger.com/atom/ns#' term='debugging'/><category scheme='http://www.blogger.com/atom/ns#' term='field'/><title type='text'>Record Types</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-EhaxV6q-5eg/TuKO7_yh7JI/AAAAAAAACDY/S3sAxePohZ0/s1600/Records.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://1.bp.blogspot.com/-EhaxV6q-5eg/TuKO7_yh7JI/AAAAAAAACDY/S3sAxePohZ0/s320/Records.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5684262841081785490" /&gt;&lt;/a&gt;Today is the last day for a developer on our project. He moved his family away, and has a new job far away. The company asked him to fix one troubling bug before he left. He was going crazy and asked me for some help. He set up some debugging in a PL/SQL package where he dumped out some contents to a log file. But they were just not making sense.&lt;br /&gt;&lt;br /&gt;I took a look at his log. One of the variables was zero. He insisted that the source column for that variable was non-zero in the database. Then he started randomly asking whether this or that was the cause of the problem. I told him we should not guess, and inspect the place where the variable is initialized.&lt;br /&gt;&lt;br /&gt;I found a nice routine which loaded the data from a table. It puts it into an object which is a custom record type. We select a bunch of fields into this object. The order of the select clause is supposed to match the order of records in the field. So I checked the one field in question. Oh oh. It was out of alignment.&lt;br /&gt;&lt;br /&gt;Somebody added a new field at the end of the record. However the put the query for this new field in the middle of the SQL statement. Bamn. That's the problem. This was problably not a great design. We should make the select more explicit to put the value into fields of the record type. Maybe an idead for a redesign.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1174853888723964804?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1174853888723964804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1174853888723964804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1174853888723964804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1174853888723964804'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/12/record-types.html' title='Record Types'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-EhaxV6q-5eg/TuKO7_yh7JI/AAAAAAAACDY/S3sAxePohZ0/s72-c/Records.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2441647062897635360</id><published>2011-12-06T11:24:00.000-08:00</published><updated>2011-12-06T11:28:05.610-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='requirements'/><category scheme='http://www.blogger.com/atom/ns#' term='procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='hacks'/><category scheme='http://www.blogger.com/atom/ns#' term='tables'/><title type='text'>Package Analysis</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-3A4n607suxc/Tt5r7sTAeeI/AAAAAAAACC0/8nW5kFBAa60/s1600/Analysis.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://3.bp.blogspot.com/-3A4n607suxc/Tt5r7sTAeeI/AAAAAAAACC0/8nW5kFBAa60/s320/Analysis.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5683098453035481570" /&gt;&lt;/a&gt;We got this big PL/SQL package that contains code which runs every night. The thing does a lot of stuff such as probem detection/correction, business rule implementation, and metadata regeneration. The code has been growing over the years. This past year the job start running too long. We tried some hacks but did not get very far. We are still attempting some hacks to get the darn thing to complete on time.&lt;br /&gt;&lt;br /&gt;Luckily I got assigned the task to analyze this monster. I started by documenting what each part of the massive job does. It was a reverse requirements analysis task. Then I started to catalog which tables each of the procedures used, and which tables got modified by the procedures. I am starting to come up with an understanding of what procedures depend on what other ones. Isn't there some software that can do this automatically for me? If not, might be time to write some.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2441647062897635360?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2441647062897635360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2441647062897635360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2441647062897635360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2441647062897635360'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/12/package-analysis.html' title='Package Analysis'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-3A4n607suxc/Tt5r7sTAeeI/AAAAAAAACC0/8nW5kFBAa60/s72-c/Analysis.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8818292599033077563</id><published>2011-10-18T14:19:00.000-07:00</published><updated>2011-10-18T14:23:25.745-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 10g'/><category scheme='http://www.blogger.com/atom/ns#' term='universal installer'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>Slow Install</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-k6vaEH3cRmo/Tp3tiUEJufI/AAAAAAAACBU/N4yxn-fVR6U/s1600/Universal.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 320px;" src="http://2.bp.blogspot.com/-k6vaEH3cRmo/Tp3tiUEJufI/AAAAAAAACBU/N4yxn-fVR6U/s320/Universal.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5664945080059410930" /&gt;&lt;/a&gt;My customer gave me a new laptop today. Even though I do most of my work in a virtual machine, I sometimes need to access the database right off the laptop. So I decide to install the Oracle 10g client. We are currently at 10.2.0.1.&lt;br /&gt;&lt;br /&gt;I found the install media on a network drive. When I launched the executable, it was a while for the Universal installer to come up. Then each step of the installer was painfully slow. Here is the real sad part. I have been in the middle of this install for over two hours now. Progress bar reads 92% complete.&lt;br /&gt;&lt;br /&gt;Not sure if this is due to the media being on a network drive. I plan to downloaded the media to my desktop if I ever need to do this again. I also chose a customer install, and checked a bunch of things that looked cool in the client. I might try that again, but will do the bare bones install first. Then I came come back later in install the goodies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8818292599033077563?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8818292599033077563/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8818292599033077563' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8818292599033077563'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8818292599033077563'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/10/slow-install.html' title='Slow Install'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-k6vaEH3cRmo/Tp3tiUEJufI/AAAAAAAACBU/N4yxn-fVR6U/s72-c/Universal.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1423939802014939534</id><published>2011-09-22T11:27:00.000-07:00</published><updated>2011-09-22T11:31:07.500-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tool'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Plus'/><category scheme='http://www.blogger.com/atom/ns#' term='exceptions'/><title type='text'>Script Failure</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-PGKmwvHMm1I/Tnt-EbGTlCI/AAAAAAAACAc/OUf7nx8pxGs/s1600/Fail.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 266px; height: 320px;" src="http://2.bp.blogspot.com/-PGKmwvHMm1I/Tnt-EbGTlCI/AAAAAAAACAc/OUf7nx8pxGs/s320/Fail.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5655252371552572450" /&gt;&lt;/a&gt;A developer was writing a script to set up some configuration data via script. He complained that the script was completing successfully, but the data was not getting inserted. He asked for help. His thought was that the success should mean that the records should be inserted.&lt;br /&gt;&lt;br /&gt;Immediately I pointed out that running the script and seeing success means that the script did not throw any exceptions that were not caught. We looked at his script and saw that it was eating any exceptions. The developer floudered around some more. I later advised him to forget about the script, move over to SQL*Plus, and manually execute the SQL statements one at a time.&lt;br /&gt;&lt;br /&gt;Bingo. In SQL*Plus, he found that some constraints were being violated and causing exceptions to be thrown. This taught me two things. You shouuld not jump to the script until you are sure your raw SQL is good. You should also not rely on some tool to execute your script if you are not in full command of what it is doing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1423939802014939534?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1423939802014939534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1423939802014939534' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1423939802014939534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1423939802014939534'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/09/script-failure.html' title='Script Failure'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-PGKmwvHMm1I/Tnt-EbGTlCI/AAAAAAAACAc/OUf7nx8pxGs/s72-c/Fail.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5529834694708639760</id><published>2011-09-15T10:13:00.000-07:00</published><updated>2011-09-15T10:17:51.800-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='FAQ'/><category scheme='http://www.blogger.com/atom/ns#' term='sqlldr'/><title type='text'>SQL Loader to the Rescue</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-QfuGlLymxy4/TnIyfMPKE6I/AAAAAAAACAU/xJ2D0tYvW38/s1600/Loader.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 226px;" src="http://3.bp.blogspot.com/-QfuGlLymxy4/TnIyfMPKE6I/AAAAAAAACAU/xJ2D0tYvW38/s320/Loader.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5652635993745527714" /&gt;&lt;/a&gt;I gave myself an action item to try to do some hands on SQL Loader practice. It turns out it is not that hard for default loading from file. I specified the filename, used absolute positioning, and loaded stuff into my database table.&lt;br /&gt;&lt;br /&gt;The reference I used to learn how to do this was the SQL Loader &lt;a href="http://www.orafaq.com/wiki/SQL*Loader_FAQ"&gt;FAQ&lt;/a&gt;. You should check it out. The FAQ goes over a lot of common scenarios, and how you use SQL Loader to accomplish your work. Good stuff I tell you.&lt;br /&gt;&lt;br /&gt;So far I only tried SQL loading files with 10 to 15 records. The next step is to try to load 10k to 15k records and beyong. I got a good feeling about it. They say that SQL Loader is optimized to handle the big jobs. I should have already known this. The team on my project that loads huge files from the mainframe primarily uses SQL Loader to do the job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5529834694708639760?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5529834694708639760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5529834694708639760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5529834694708639760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5529834694708639760'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/09/sql-loader-to-rescue.html' title='SQL Loader to the Rescue'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-QfuGlLymxy4/TnIyfMPKE6I/AAAAAAAACAU/xJ2D0tYvW38/s72-c/Loader.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8278882559483233224</id><published>2011-09-14T22:20:00.000-07:00</published><updated>2011-09-14T22:25:06.936-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL script'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='dummay data'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Loader'/><title type='text'>Huge Script</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-oAhsXOIybdE/TnGLM9avf7I/AAAAAAAACAM/nulzyJmR__w/s1600/Huge.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 191px; height: 320px;" src="http://2.bp.blogspot.com/-oAhsXOIybdE/TnGLM9avf7I/AAAAAAAACAM/nulzyJmR__w/s320/Huge.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5652452062088101810" /&gt;&lt;/a&gt;I had a task to deal with a large amount of data for our customer. Being the programmer that I am, I got a couple files with the data. Then I ran them through a custome &lt;a href="http://enableassertions.blogspot.com/"&gt;Java&lt;/a&gt; program to extract out the data of interest. Finally I stuck the data in a massive SQL script to do some work.&lt;br /&gt;&lt;br /&gt;I did all my tests with some dummy data. Then when I got the actual data in the script, I ran one last smoke test to ensure the thing worked. It did not. The script kept hanging without inserting a single record. I called my DBA. He told me I should have used SQL*Loader. Well I prefer custom PL/SQL. Plus I needed to implement some logic for each of the inserts.&lt;br /&gt;&lt;br /&gt;There was a tight deadline for this work to be completed. I decided to split the script up into a number of smaller scripts that actually did complete. The original script had about 300,000 lines in it. I found that 20,000 and 30,000 line scripts worked fine. So my plan is to break the big mamma up into 10 separate script. I will test them out and let you know how I fare.&lt;br /&gt;&lt;br /&gt;New action item for self - learn how to do stuff with SQL*Loader.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8278882559483233224?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8278882559483233224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8278882559483233224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8278882559483233224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8278882559483233224'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/09/huge-script.html' title='Huge Script'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-oAhsXOIybdE/TnGLM9avf7I/AAAAAAAACAM/nulzyJmR__w/s72-c/Huge.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1919064302621166019</id><published>2011-07-27T10:50:00.000-07:00</published><updated>2011-07-27T11:10:03.645-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='command line'/><category scheme='http://www.blogger.com/atom/ns#' term='upgrade'/><title type='text'>Oracle 11g Express Edition</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-oV-fGljvvWc/TjBS43aR2gI/AAAAAAAAB-4/QtP8AV9Zohg/s1600/Express.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 320px;" src="http://3.bp.blogspot.com/-oV-fGljvvWc/TjBS43aR2gI/AAAAAAAAB-4/QtP8AV9Zohg/s320/Express.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5634094270740814338" /&gt;&lt;/a&gt;Recently I had to upgrade my company laptop to Windows 7. This was a painful ordeal that lasted a whole weekend. The upgrade consisted of a reimaging of my machine. One byproduct was that my Oracle 10g database was wiped off the machine. Ooops. I forgot to back that thing up.&lt;br /&gt;&lt;br /&gt;I decided to reinstall Oracle after the upgrade. It was interesting to see that Oracle had an 11g version of their Express Edition free database. The latest version is 11.2, which is currently in Beta.&lt;br /&gt;&lt;br /&gt;I was pleased with how fast I could install the Express Edition database. This thing was actually at Express speeds. I was also reminded that Express Edition does not come with much. You get a command line SQL tool. You get tools to start, stop, backup, and restore the database. That is it. Looks like I need to polish off my command line DBA command line programming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1919064302621166019?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1919064302621166019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1919064302621166019' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1919064302621166019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1919064302621166019'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/07/oracle-11g-express-edition.html' title='Oracle 11g Express Edition'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-oV-fGljvvWc/TjBS43aR2gI/AAAAAAAAB-4/QtP8AV9Zohg/s72-c/Express.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5010938998767322999</id><published>2011-07-12T20:24:00.000-07:00</published><updated>2011-07-12T20:30:54.908-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='evidence'/><category scheme='http://www.blogger.com/atom/ns#' term='measurement'/><category scheme='http://www.blogger.com/atom/ns#' term='tests'/><category scheme='http://www.blogger.com/atom/ns#' term='variables'/><category scheme='http://www.blogger.com/atom/ns#' term='harness'/><title type='text'>The Trigger Project</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-E77fA4DqZrg/Th0P-cBIrtI/AAAAAAAAB9Q/dpD58a6lz10/s1600/Project.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 128px; height: 128px;" src="http://1.bp.blogspot.com/-E77fA4DqZrg/Th0P-cBIrtI/AAAAAAAAB9Q/dpD58a6lz10/s320/Project.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5628672674630250194" /&gt;&lt;/a&gt;There has been a lot of drama on our project based on performance problems we are having in production. Some people are attributing the performance issues to the number of triggers we have in the database. That sounds like nonsense to me. I deal in hard facts. There was a total lack of evidence to back up this theory. So I have decided to run some tests in our database to measure the overhead of adding triggers to DML.&lt;br /&gt;&lt;br /&gt;I wrote a harness script that updates 10,000 records. It commits the change every update. The thing runs at a good speed. It takes around a minute to complete. The table currently has no triggers on it. Then I added one trigger that did nothing in the body of the trigger. I was shocked to find the harness took over 20% longer to run with the trigger.&lt;br /&gt;&lt;br /&gt;I had another developer present when I ran the test. He could not believe the results either. Then he had some suggestions to vet the results. I ran the tests a couple more time. Looks like the first run was a fluke. He also suggested I run the tests locally on a database on my machine to eliminate irrelevant variables.&lt;br /&gt;&lt;br /&gt;So next I plan to move the tests over to a local database on my machine. This way the network is not a factor. Other uses on the database are also eliminated from the equation. Next I am going to time having a lot of triggers on a table. I will implement some cascading triggers. When I am done, I will have a lot of empirical evidence to back up my opinoin that triggers in and of themselves have no impact on performance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5010938998767322999?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5010938998767322999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5010938998767322999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5010938998767322999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5010938998767322999'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/07/trigger-project.html' title='The Trigger Project'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-E77fA4DqZrg/Th0P-cBIrtI/AAAAAAAAB9Q/dpD58a6lz10/s72-c/Project.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2720894126111799141</id><published>2011-07-08T07:13:00.000-07:00</published><updated>2011-07-08T07:22:58.501-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='timing study'/><title type='text'>Triggers Did It</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-qafEHIJAE9Y/ThcSvIq17vI/AAAAAAAAB9A/tulg76Wc2Jg/s1600/Trigger.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 237px;" src="http://3.bp.blogspot.com/-qafEHIJAE9Y/ThcSvIq17vI/AAAAAAAAB9A/tulg76Wc2Jg/s320/Trigger.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5626986860413054706" /&gt;&lt;/a&gt;&lt;br /&gt;A job that runs at night has been taking too long every night this week. This causes pain as the system administrators call up our DBAs or help desk in the middle of the night. Obviously we have a problem. I would call it a performance problem. What makes this unique is the response I heard from this. Developers told me a manager decided there would be no new database triggers implemented due to the performance problem.&lt;br /&gt;&lt;br /&gt;WTF? This made little sense. Who correlated our performance problem to the presence of triggers? I attended a meeting hosted by this very manager. So I asked about this new "no triggers" edict. He said that he has inspected the PL/SQL source code. He found many database triggers. He also saw triggers firings that caused other triggers to fire as well. Therefore they were suspects in the performance problem.&lt;br /&gt;&lt;br /&gt;I said that by this logic, we would find many stored procedures in our source code. The stored procedures get exectured. The code runs slow. Therefore we should not use stored procedures. Obviously this argument does not hold up.&lt;br /&gt;&lt;br /&gt;Rather than being an obnoxious developer who shoots down ideas, I decided to later pitch a plan to get to the actual root cause of the performance problem. We should find out what pieces of the code are taking a long time to execute. Then would should drill down into the slow pieces and find out why. If we do that and find some database triggers to blame, I agree we should optimize them.&lt;br /&gt;&lt;br /&gt;I come to find that there is a proposal to do the very thing I recommend. Our manager clarified that we cannot add database triggers without analyzing the performance impact. I am all for that. I run timing studies all the time on slow code. We need to use logic and hard evidence to deal with tough and frustrating problems such as performance. If not, we might as well chirp "add more indexes" like any other lackey and get nowhere.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2720894126111799141?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2720894126111799141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2720894126111799141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2720894126111799141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2720894126111799141'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/07/triggers-did-it.html' title='Triggers Did It'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-qafEHIJAE9Y/ThcSvIq17vI/AAAAAAAAB9A/tulg76Wc2Jg/s72-c/Trigger.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2018853884783316643</id><published>2011-07-06T13:38:00.000-07:00</published><updated>2011-07-06T13:43:20.252-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='discovery'/><category scheme='http://www.blogger.com/atom/ns#' term='recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='TOAD'/><category scheme='http://www.blogger.com/atom/ns#' term='use cycle'/><category scheme='http://www.blogger.com/atom/ns#' term='servers'/><title type='text'>From the Trenches</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-75YoUDTiATE/ThTHzbb4myI/AAAAAAAAB8o/EUshvER5rS4/s1600/Trench.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="http://4.bp.blogspot.com/-75YoUDTiATE/ThTHzbb4myI/AAAAAAAAB8o/EUshvER5rS4/s320/Trench.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5626341520844561186" /&gt;&lt;/a&gt;I have been following a seminar on how to be a DBA. These talks give you hands on advice. They are geared towards individuals who find themselves appointed as a DBA by accident. While I am not formally a DBA, I often do some light DBA tasks. So I thought I would study up.&lt;br /&gt;&lt;br /&gt;When you start a DBA job, you obviously need to find out what servers and databases you are responsible for. But another important discovery is to find which databases you are not supposed to manage. You should gain info on your systems by talking to actual users. If they are not available, rely on knowledge from developers and testers of the system.&lt;br /&gt;&lt;br /&gt;I found out about a nice option in TOAD where you are execute a query against many databases at once. My tool of choice is an old copy of PL/SQL Developer. So far I only log into one database at a time to run queries.&lt;br /&gt;&lt;br /&gt;Make sure you find out the cycles of use by the business. This will help you scope out the best time for backups of the database. Speaking of backups, make sure you can recover using the backups. Test out a restore to a different system. It is no good to do backups if in the end they do not work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2018853884783316643?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2018853884783316643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2018853884783316643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2018853884783316643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2018853884783316643'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/07/from-trenches.html' title='From the Trenches'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-75YoUDTiATE/ThTHzbb4myI/AAAAAAAAB8o/EUshvER5rS4/s72-c/Trench.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2574618945088555489</id><published>2011-07-01T11:02:00.000-07:00</published><updated>2011-07-01T11:07:57.279-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GTT'/><category scheme='http://www.blogger.com/atom/ns#' term='transaction'/><category scheme='http://www.blogger.com/atom/ns#' term='rollback'/><category scheme='http://www.blogger.com/atom/ns#' term='session'/><category scheme='http://www.blogger.com/atom/ns#' term='redo'/><title type='text'>Global Temporary Tables</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-PuwkvBJo1RY/Tg4LybWgPvI/AAAAAAAAB8Q/A-1pnuQ4kKc/s1600/Temporary.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 274px;" src="http://2.bp.blogspot.com/-PuwkvBJo1RY/Tg4LybWgPvI/AAAAAAAAB8Q/A-1pnuQ4kKc/s320/Temporary.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5624445945595838194" /&gt;&lt;/a&gt;Our system uses temporary tables at times. It makes the data access simpler across different processes such as apps, procedures, and reports. Temporary in this sense means that a table is created, popoulated, used, and then dropped. However there is another type of temporary table in Oracle.&lt;br /&gt;&lt;br /&gt;Global temporary tables (GTT) are implemented by Oracle. The are fast in that they have no redo or rollback. They operate in one of two ways. They either lose their data at the end of a transaction, or the end of a session. Which way is determined when you create the table.&lt;br /&gt;&lt;br /&gt;GTTs themselves are static. The table structure is created once and remains in place always. It is the data that is transient. The data is private per session. No statistics are gathered on these tables. The data resides in the TEMP tablespace. They are cached in the buffer cache.&lt;br /&gt;&lt;br /&gt;GTTs have been available since Oracle 8i. I would recommend you be familiar with them. You never know when you might find a table in your database that is a GTT.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2574618945088555489?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2574618945088555489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2574618945088555489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2574618945088555489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2574618945088555489'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/07/global-temporary-tables.html' title='Global Temporary Tables'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-PuwkvBJo1RY/Tg4LybWgPvI/AAAAAAAAB8Q/A-1pnuQ4kKc/s72-c/Temporary.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6447597286965515072</id><published>2011-06-16T00:28:00.000-07:00</published><updated>2011-06-16T00:32:03.506-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='password change'/><category scheme='http://www.blogger.com/atom/ns#' term='password validation'/><category scheme='http://www.blogger.com/atom/ns#' term='new account'/><title type='text'>Password and Login Woes</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/--dslez1YNbc/Tfmwvm6Ta9I/AAAAAAAAB74/quCHk6w1n98/s1600/Login.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 274px; height: 184px;" src="http://1.bp.blogspot.com/--dslez1YNbc/Tfmwvm6Ta9I/AAAAAAAAB74/quCHk6w1n98/s320/Login.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5618716342066834386" /&gt;&lt;/a&gt;A couple things have changed in our system. The big change is a move to Oracle 11g on the back end. The security folks also changed our password validation function. The end result is that new accounts and old ones that get their password changed get locked. Doh.&lt;br /&gt;&lt;br /&gt;Our apps rely on the Oracle 10g client on the workstation. We use the Oracle provider to manage accounts whose passwords expire. The password change dialog comes up automatically when the password has expired. New accounts get set with a temporary password which starts out expired.&lt;br /&gt;&lt;br /&gt;Now when our users try to change their password in these scenarios, the password change hangs. Dang. Some DBAs and testers tried to do some debugging of this problem. At first they thought it was the new password verification function. However the problem persisted when those changes were backed out. Now a developer needs to get in there and figure out what is wrong.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6447597286965515072?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6447597286965515072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6447597286965515072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6447597286965515072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6447597286965515072'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/06/password-and-login-woes.html' title='Password and Login Woes'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/--dslez1YNbc/Tfmwvm6Ta9I/AAAAAAAAB74/quCHk6w1n98/s72-c/Login.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6237281563909714388</id><published>2011-05-17T11:01:00.000-07:00</published><updated>2011-05-17T11:06:12.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 10g'/><category scheme='http://www.blogger.com/atom/ns#' term='Express Edition'/><category scheme='http://www.blogger.com/atom/ns#' term='UTL_FILE'/><category scheme='http://www.blogger.com/atom/ns#' term='GRANT'/><title type='text'>Directory Assistance</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-2MlZiPGjAPg/TdK4KrNpJRI/AAAAAAAAB7E/1vK4kudXA48/s1600/Directory.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 306px; height: 320px;" src="http://4.bp.blogspot.com/-2MlZiPGjAPg/TdK4KrNpJRI/AAAAAAAAB7E/1vK4kudXA48/s320/Directory.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5607746979567838482" /&gt;&lt;/a&gt;I got a new project that I am developing. And I needed to crunch some data for it. What better way to do that than using an Oracle database? So I installed the Oracle 10g Express Edition on my laptop. I did not need any great power.&lt;br /&gt;&lt;br /&gt;One of the first tasks I needed to complete was to load in some data from a file. The logic to parse the data was a bit involved. Therefore I decided to write it in PL/SQL. To use the UTL_FILE pacakge to access the file, I needed to create a directory object.&lt;br /&gt;&lt;br /&gt;The web user management tool provided by Oracle 10g Express edition did not list CREATE ANY DIRECTORY as one of the grants it could assign. Therefore I dropped down to the command line to get that job done. Next my stored procedure could not see UTL_FILE. I had to log in as SYS and grant access to this package. Wow that is a lot of work to read a little file. I guess this is not your standard use of an Oracle database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6237281563909714388?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6237281563909714388/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6237281563909714388' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6237281563909714388'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6237281563909714388'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/directory-assistance.html' title='Directory Assistance'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-2MlZiPGjAPg/TdK4KrNpJRI/AAAAAAAAB7E/1vK4kudXA48/s72-c/Directory.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1412846250917169202</id><published>2011-05-11T07:27:00.000-07:00</published><updated>2011-05-11T07:32:32.703-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sqlplus'/><category scheme='http://www.blogger.com/atom/ns#' term='ORA-01034'/><category scheme='http://www.blogger.com/atom/ns#' term='ORACLE_HOME'/><title type='text'>Oracle Not Available</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-2mxLO9GltlQ/TcqdGnkTRaI/AAAAAAAAB60/_3BqU8kq4-I/s1600/Available.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 257px;" src="http://2.bp.blogspot.com/-2mxLO9GltlQ/TcqdGnkTRaI/AAAAAAAAB60/_3BqU8kq4-I/s320/Available.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5605465423242020258" /&gt;&lt;/a&gt;I had to return to a project I worked on last year. The first order of business was to ensure I could still run the program. Immediately the thing died with an ORA-01034: ORACLE not available.&lt;br /&gt;&lt;br /&gt;The program was just running sqlplus, having it execute a script that had a single EXIT statement in it. I was able to successfully execute the sqlplus statement from the UNIX command prompt. Why was the program not able to do the same without error?&lt;br /&gt;&lt;br /&gt;I googled around and found that this error happens when your ORACLE_HOME and ORACLE_SID do not match. These environment variables seemed good. I was pulling my teeth trying to figure this out. Eventually I found that the program was sourcing a different profile. This profile pointed to the wrong Oracle home. Dang.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1412846250917169202?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1412846250917169202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1412846250917169202' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1412846250917169202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1412846250917169202'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/oracle-not-available.html' title='Oracle Not Available'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-2mxLO9GltlQ/TcqdGnkTRaI/AAAAAAAAB60/_3BqU8kq4-I/s72-c/Available.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1753168469353081986</id><published>2011-05-09T08:09:00.001-07:00</published><updated>2011-05-09T08:16:43.693-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='11g'/><category scheme='http://www.blogger.com/atom/ns#' term='ACS'/><category scheme='http://www.blogger.com/atom/ns#' term='execution path'/><category scheme='http://www.blogger.com/atom/ns#' term='optimizer'/><category scheme='http://www.blogger.com/atom/ns#' term='bind variables'/><title type='text'>Adaptive Cursor Sharing</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-VOl6gk8zEZM/TcgDqplHpaI/AAAAAAAAB6s/Whtxc4qCmCI/s1600/Adapt.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 218px;" src="http://4.bp.blogspot.com/-VOl6gk8zEZM/TcgDqplHpaI/AAAAAAAAB6s/Whtxc4qCmCI/s320/Adapt.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5604733767513515426" /&gt;&lt;/a&gt;We are going to Oracle 11g in our customer's system. One of our DBAs took a look at the new features for 11g. The developers were supposed to see whether we could take advantage of these features. So far I only took a look at the first feature mentioned. That is Adaptive Cursor Sharing (ACS).&lt;br /&gt;&lt;br /&gt;There are specific requirements for ACS to kick in. You need to be doing an EXECUTE IMMEDIATE in your PL/SQL. You also need to be using bind variables. Finally I hear that if you use too many bind variables (15 or more), then ACS will be skipped.&lt;br /&gt;&lt;br /&gt;The optimizer may use different execution paths based on the values in the bind variables. Skewed column data may cause the execution to  be suboptimal. Normally the optimizer makes use of histogram data generated from gathering statics.&lt;br /&gt;&lt;br /&gt;With ACS, the database tries to determine which values for bind variables work best with certain execution paths. Then it would use this information in the future to choose the best execution path. We get this benefit automatically in 11g. It can be disabled. I am thinking we shall not and try to get the benefit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1753168469353081986?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1753168469353081986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1753168469353081986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1753168469353081986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1753168469353081986'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/adaptive-cursor-sharing.html' title='Adaptive Cursor Sharing'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-VOl6gk8zEZM/TcgDqplHpaI/AAAAAAAAB6s/Whtxc4qCmCI/s72-c/Adapt.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6248556438092291127</id><published>2011-05-06T12:31:00.000-07:00</published><updated>2011-05-06T12:31:00.394-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='free'/><category scheme='http://www.blogger.com/atom/ns#' term='datacenter'/><category scheme='http://www.blogger.com/atom/ns#' term='pricing'/><category scheme='http://www.blogger.com/atom/ns#' term='express'/><category scheme='http://www.blogger.com/atom/ns#' term='multi instancing'/><title type='text'>Database Costs</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-EMo6Vnjah0M/TcGps9_nB5I/AAAAAAAAB6M/g-cp59til3Y/s1600/Costs.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 214px;" src="http://2.bp.blogspot.com/-EMo6Vnjah0M/TcGps9_nB5I/AAAAAAAAB6M/g-cp59til3Y/s320/Costs.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5602946001446307730" /&gt;&lt;/a&gt;I just looked a the pricing structure of Microsoft's SQL Server platform. Some versions mimic the Oracle cost. There is a free express version of SQL Server. The developer edition also has no cost. The minimal web version of the database costs $3k. Workgroup goes for $7k. Enterprise comes in at $27k. And the Datacenter edition is a whopping $54k.&lt;br /&gt;&lt;br /&gt;There are other fees that might bring the total cost a lot higher. If you install a separate copy on a virtual machine, you might need another license. Here is one good way to save costs. Use multi instancing. This is similar to Oracle database instances. They all have their own CPU, memory, and disk allocated. However the SQL Server instances all share the same operating system and physcial machine. There is no extra cost for an additional instance in terms of licensing.&lt;br /&gt;&lt;br /&gt;Here is a final tip that I learned at a seminar I watched today. Do not keep the default install options for Microsoft's SQL Server. This is especially important if you are installing the production database. I wonder if the same holds true for Oracle.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6248556438092291127?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6248556438092291127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6248556438092291127' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6248556438092291127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6248556438092291127'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/database-costs.html' title='Database Costs'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-EMo6Vnjah0M/TcGps9_nB5I/AAAAAAAAB6M/g-cp59til3Y/s72-c/Costs.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6233608496089642565</id><published>2011-05-05T12:26:00.000-07:00</published><updated>2011-05-05T12:26:00.405-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='operations'/><category scheme='http://www.blogger.com/atom/ns#' term='liason'/><category scheme='http://www.blogger.com/atom/ns#' term='guardian'/><title type='text'>Roles of the DBA</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-zmMV0Oe379I/TcGobngQirI/AAAAAAAAB6E/kSkdeUbjc8o/s1600/Roles.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 259px;" src="http://2.bp.blogspot.com/-zmMV0Oe379I/TcGobngQirI/AAAAAAAAB6E/kSkdeUbjc8o/s320/Roles.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5602944603839826610" /&gt;&lt;/a&gt;Today I continue sharing some things I learned watching a seminar about becoming a DBA. There are two main types of DBAs: (1) the development DBA and (2) the operational DBA. The seminar I watched focues on the operational DBA.&lt;br /&gt;&lt;br /&gt;This type of DBA needs strong customer service skills. You will be talking to a lot of people. In fact, you will be the liason between many groups. Consider yourself the point of contact for all things support related.&lt;br /&gt;&lt;br /&gt;Take responsibility. A DBA is the guardian of the data. You must own your platform like you own a house. Uptime is your responsibility.&lt;br /&gt;&lt;br /&gt;One major part of a DBA's responsibility is to guard against SQL injection attacks. Apps must sanitize user input. Many web apps do not. The result is that hackers can send in SQL statements, and maybe even compromise your database box.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6233608496089642565?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6233608496089642565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6233608496089642565' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6233608496089642565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6233608496089642565'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/roles-of-dba.html' title='Roles of the DBA'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-zmMV0Oe379I/TcGobngQirI/AAAAAAAAB6E/kSkdeUbjc8o/s72-c/Roles.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1315270867959206045</id><published>2011-05-04T12:20:00.000-07:00</published><updated>2011-05-04T12:24:56.853-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='staging'/><category scheme='http://www.blogger.com/atom/ns#' term='sandbox'/><category scheme='http://www.blogger.com/atom/ns#' term='career path'/><category scheme='http://www.blogger.com/atom/ns#' term='users'/><category scheme='http://www.blogger.com/atom/ns#' term='draft'/><title type='text'>Surprise. You are the DBA.</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-iOrOpCDT-5I/TcGnDVp_V_I/AAAAAAAAB58/M4QlYvRRIS8/s1600/DBA.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 303px; height: 226px;" src="http://4.bp.blogspot.com/-iOrOpCDT-5I/TcGnDVp_V_I/AAAAAAAAB58/M4QlYvRRIS8/s320/DBA.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5602943087220316146" /&gt;&lt;/a&gt;I just finished watching a seminar on becoming a DBA. It seems a lot of times people get drafted into the DBA role. This is not a bad thing always. The DBA is a good career path. But I also saw a lot of potential for DBA pain.&lt;br /&gt;&lt;br /&gt;You need to keep your boss happy in any job. But the DBA must keep the user happy. Otherwise you will suffer. There are ways to set up your environment to increase the chance of succes.&lt;brt /&gt;&lt;br /&gt;Have a sandbox to try out new technologies. Put your development database on a separate physical machine. Be ready to restore a production backup to the test environment. And have a staging database that mimics everything you see in production if your project has the cash.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1315270867959206045?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1315270867959206045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1315270867959206045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1315270867959206045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1315270867959206045'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/surprise-you-are-dba.html' title='Surprise. You are the DBA.'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-iOrOpCDT-5I/TcGnDVp_V_I/AAAAAAAAB58/M4QlYvRRIS8/s72-c/DBA.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1459457105245314272</id><published>2011-05-02T07:34:00.000-07:00</published><updated>2011-05-02T07:39:49.757-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='replication'/><category scheme='http://www.blogger.com/atom/ns#' term='degradation'/><title type='text'>Performance Redux</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-Uec601ogUUo/Tb7CLUIx48I/AAAAAAAAB50/AedvtNQj3P8/s1600/Performance.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 213px;" src="http://3.bp.blogspot.com/-Uec601ogUUo/Tb7CLUIx48I/AAAAAAAAB50/AedvtNQj3P8/s320/Performance.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5602128486135358402" /&gt;&lt;/a&gt;&lt;br /&gt;We continue to have performance problems with our nightly processes. I extracted some SQL that could run during the day. However a manager shot that idea down. It would look too suspicious to the customer. My next idea is to replicate the performance problem.&lt;br /&gt;&lt;br /&gt;The production operations are taking a whopping 5 to 6 seconds per action. Each action has a number of updates and inserts. I got a small (500 record) sample in development. There is was only taking a tenth of a second to complete.&lt;br /&gt;&lt;br /&gt;I ramped up the volume to 5000 records. Things slowed down a little bit to three tenths of a second per action. Now I want to try just a bit more data to see if preformance in develpment degrades futher.&lt;br /&gt;&lt;br /&gt;Once I can recreate the problem&lt;, I can start with the performance debug. I think I might log the different parts of the action to see where we are spending most of the time. Then it will be time for that magic SQL performance work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1459457105245314272?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1459457105245314272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1459457105245314272' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1459457105245314272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1459457105245314272'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/05/performance-redux.html' title='Performance Redux'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-Uec601ogUUo/Tb7CLUIx48I/AAAAAAAAB50/AedvtNQj3P8/s72-c/Performance.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1773310773874937095</id><published>2011-04-18T20:08:00.000-07:00</published><updated>2011-04-18T20:16:39.709-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='indexes'/><category scheme='http://www.blogger.com/atom/ns#' term='records'/><category scheme='http://www.blogger.com/atom/ns#' term='triggers'/><title type='text'>Performance Problems</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-G4GAHsFb76w/Taz9ADuMMfI/AAAAAAAAB5U/fQb57HDLa4c/s1600/Slow.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 298px;" src="http://3.bp.blogspot.com/-G4GAHsFb76w/Taz9ADuMMfI/AAAAAAAAB5U/fQb57HDLa4c/s320/Slow.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5597126614355554802" /&gt;&lt;/a&gt;We have a database job that runs every night. It takes care of all kinds of tasks. For example, it detects and resolves data problems. It also implements certain time based business requirements. Lately this job has been taking a lot of time to complete.&lt;br /&gt;&lt;br /&gt;I traced one certain part of the job that was taking all night. It was looping through a ton of records, then doing a bunch of updates on them. The algorithm to do the updates was painfully inefficient. I replaced all of this with single SQL updates of all the records at once. The job that took all night completed in 10 minutes.&lt;br /&gt;&lt;br /&gt;The job was doing well for a while. Then it got slow again. Another developer started to look at it. All he came up with was that there were a lot of triggers on the tables involved.&lt;br /&gt;&lt;br /&gt;I hate when somebody tries to solve a performance problem and asks if we can add some indexes to make it faster. Ouch. The latest analysis felt like this type of solution. Sure you don't want to do a lot of work in triggers for updates that happen frequently. But triggers, lots of them, or complicated ones do not always mean slow performance.&lt;br /&gt;&lt;br /&gt;Performance tuning is quite a deep subject. Maybe we need to send some of our developers to training on performance analysis and tuning. That might get us past the old "add indexes" solutions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1773310773874937095?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1773310773874937095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1773310773874937095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1773310773874937095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1773310773874937095'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/04/performance-problems.html' title='Performance Problems'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-G4GAHsFb76w/Taz9ADuMMfI/AAAAAAAAB5U/fQb57HDLa4c/s72-c/Slow.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7553375950224228734</id><published>2011-04-10T02:17:00.000-07:00</published><updated>2011-04-10T02:22:04.303-07:00</updated><title type='text'>Pains from a Hack</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-59WPgsnk9zI/TaF1wmg4y2I/AAAAAAAAB4s/3-BD5ioJJ4M/s1600/Rollback.bmp"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 122px;" src="http://2.bp.blogspot.com/-59WPgsnk9zI/TaF1wmg4y2I/AAAAAAAAB4s/3-BD5ioJJ4M/s320/Rollback.bmp" border="0" alt=""id="BLOGGER_PHOTO_ID_5593881690003524450" /&gt;&lt;/a&gt;I got assigned to work a curious bug in the system. The customer said a bunch of data was in the wrong state. I called our customer and got some more info. The best help they gave me was some examples in production.&lt;br /&gt;&lt;br /&gt;I studied the audits and found the bad state transition. Then I poured over our database packages to find out why this was happening. Then I found the guilty party.&lt;br /&gt;&lt;br /&gt;Somebody was making a call to some existing procedures in our packages. They found out they needed to set some data to an intermediate value first for the code to work. However when the code encountered an error, the package code left the data in the bad intermediate state.&lt;br /&gt;&lt;br /&gt;Fail. I took out the &lt;a href="http://black-of-hat.blogspot.com/"&gt;hack&lt;/a&gt;. then I modified the packages to work with the new data pattern. Couldn't the original programmer have done this? Do the hard work up front. It will save everybody some pain. Next I started looking into why there was an error in the first place. That's a story for another time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7553375950224228734?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7553375950224228734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7553375950224228734' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7553375950224228734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7553375950224228734'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/04/pains-from-hack.html' title='Pains from a Hack'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-59WPgsnk9zI/TaF1wmg4y2I/AAAAAAAAB4s/3-BD5ioJJ4M/s72-c/Rollback.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7725330473391579363</id><published>2011-03-31T11:02:00.000-07:00</published><updated>2011-03-31T11:15:56.827-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='localhost'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Developer'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 11g'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Plus'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>Making the Connection</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-S0YNhptyVFY/TZTB4JAFS8I/AAAAAAAAB4E/cALSxl1NdjQ/s1600/Connection.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 240px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5590306207706729410" border="0" alt="" src="http://4.bp.blogspot.com/-S0YNhptyVFY/TZTB4JAFS8I/AAAAAAAAB4E/cALSxl1NdjQ/s320/Connection.jpg" /&gt;&lt;/a&gt;I got a call for help from a fellow developer. She had installed the Oracle 11g client. And she could not connect via SQL*Plus or SQL Developer. So I went over to see what was wrong.&lt;br /&gt;&lt;br /&gt;The first problem was that she was using the SQL*Plus that comes with the client. This is different than the old Windows sqlplusw. You only get asked for username and password. If you only enter those two, SQL*Plus assumes you are trying to connect to a local database on your workstation. It turns out she was getting a TNS protocol adaptor error.&lt;br /&gt;&lt;br /&gt;I had her type in username@Dbname. That did the trick. She was able to get into SQL*Plus. Then we looked at her connection in SQL Developer. She was using the default that also tried to connect to localhost on port 1521. She typed in the actual host name and port. Then she was good to go for SQL Developer. She could have alternatively changed the connection type to TNS. We set up a TNS_ADMIN variable that points to a "tnsnames.ora" file. That would have made life easier.&lt;br /&gt;&lt;br /&gt;Just now I got another email for help from a different developer. He was wondering whether we have PL/SQL Developer on our new machines. I told him to try out Oracle's SQL Developer. Let's see how he fares.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7725330473391579363?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7725330473391579363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7725330473391579363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7725330473391579363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7725330473391579363'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/making-connection.html' title='Making the Connection'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-S0YNhptyVFY/TZTB4JAFS8I/AAAAAAAAB4E/cALSxl1NdjQ/s72-c/Connection.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-269630069458551146</id><published>2011-03-30T06:59:00.001-07:00</published><updated>2011-03-30T07:08:24.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle home'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL Developer'/><category scheme='http://www.blogger.com/atom/ns#' term='OCI'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Net'/><title type='text'>No Place Like Home</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-PQCdL0Np6vY/TZM3VmU1xWI/AAAAAAAAB3k/eEJFm060JxI/s1600/Home.bmp"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 306px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5589872406701655394" border="0" alt="" src="http://1.bp.blogspot.com/-PQCdL0Np6vY/TZM3VmU1xWI/AAAAAAAAB3k/eEJFm060JxI/s320/Home.bmp" /&gt;&lt;/a&gt;After having installed the new Oracle 11g client, I wanted to put PL/SQL Developer on my machine. Ooops. I forgot that my PL/SQL Developer required a bunch of passwords for installation. I dug up my printout with all those passwords. Once I installed PL/SQL Developer, I launched it hoping to execute some queries. No luck. It kept complaining that SQL*Net was not installed.&lt;br /&gt;&lt;br /&gt;This seemed vaguely familiar. I googled this problem. Some people recommended that I hack up the Oracle entries in the Windows registry. That did not seem too encouraging. Instead I tried applying some settings in the PL/SQL Preferences tab. I hard coded the Oracle Home directory in there. Still no help.&lt;br /&gt;&lt;br /&gt;Finally I did some more googling on the problem. Someone smart advised me to put in the full path for the OCI Library. Bamm. That did the trick. I am recording my experience here so I can come back the next time I install PL/SQL Developer and maybe a new Oracle client.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-269630069458551146?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/269630069458551146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=269630069458551146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/269630069458551146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/269630069458551146'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/no-place-like-home.html' title='No Place Like Home'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-PQCdL0Np6vY/TZM3VmU1xWI/AAAAAAAAB3k/eEJFm060JxI/s72-c/Home.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7630601100316595307</id><published>2011-03-25T16:18:00.000-07:00</published><updated>2011-03-25T16:22:51.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle 11g'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='sqlplusw'/><category scheme='http://www.blogger.com/atom/ns#' term='client'/><title type='text'>First Look at 11g</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-UL5BGmeiqfc/TY0jw5iQaZI/AAAAAAAAB3c/TOlXoRttsDg/s1600/sqlplus.jpg"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 205px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5588162035621849490" border="0" alt="" src="http://3.bp.blogspot.com/-UL5BGmeiqfc/TY0jw5iQaZI/AAAAAAAAB3c/TOlXoRttsDg/s320/sqlplus.jpg" /&gt;&lt;/a&gt;We finally got around to installing the Oracle 11g client for our new development. This is an upgrade from Oracle 10g. Our first test was to try to log into the 10g database uses the 11g client. But we could not find the Windows &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus client (&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;sqlplusw&lt;/span&gt;.&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;exe&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;&lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;Doh&lt;/span&gt;. Oracle is no longer shipping this product. They want you to use &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; Developer. Weak. I am contemplating bringing the one from the 10g client. Come on Oracle. We like &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;sqlplusw&lt;/span&gt;. Yeah they ship the normal &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus. The &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;DBAs&lt;/span&gt; use it. But us developers want our Windows version.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7630601100316595307?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7630601100316595307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7630601100316595307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7630601100316595307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7630601100316595307'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/first-look-at-11g.html' title='First Look at 11g'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-UL5BGmeiqfc/TY0jw5iQaZI/AAAAAAAAB3c/TOlXoRttsDg/s72-c/sqlplus.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7647922236984522234</id><published>2011-03-18T21:04:00.001-07:00</published><updated>2011-03-18T21:08:36.375-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='constraint'/><category scheme='http://www.blogger.com/atom/ns#' term='tool'/><category scheme='http://www.blogger.com/atom/ns#' term='log'/><category scheme='http://www.blogger.com/atom/ns#' term='inserts'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><title type='text'>Script Mystery</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/-h46DdPhtgiQ/TYQraUo4IcI/AAAAAAAAB20/xLiJQGcTf0U/s1600/Exception.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5585637169063010754" border="0" alt="" src="http://4.bp.blogspot.com/-h46DdPhtgiQ/TYQraUo4IcI/AAAAAAAAB20/xLiJQGcTf0U/s320/Exception.jpg" /&gt;&lt;/a&gt;I got to work and had a lot of email to deal with. Another developer dropped back and said he was having problem with a script he wrote. It was supposed to insert 180+ records. But only 15 records were working. I told him I was busy, but he should run the thing from &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus to ensure some tool as not confusing him.&lt;br /&gt;&lt;br /&gt;Later the developer returned and said he needed help badly. People were calling him asking him for the completed script. I took a look and indeed only 15 records were in the table after he ran the script. I went &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;through&lt;/span&gt; he whole script and found an exception handler at the end. It logged and error and exited.&lt;br /&gt;&lt;br /&gt;The developer thought the script was running successfully. But the exception handler was masking the true error. A primary key constraint was being violated. As soon as he got rid of the duplicate inserts in his code, the thing worked fine. You can start with another sample script to speed development. But make sure you know what you are starting with.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7647922236984522234?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7647922236984522234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7647922236984522234' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7647922236984522234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7647922236984522234'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/script-mystery.html' title='Script Mystery'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-h46DdPhtgiQ/TYQraUo4IcI/AAAAAAAAB20/xLiJQGcTf0U/s72-c/Exception.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6150722405322449880</id><published>2011-03-16T19:54:00.001-07:00</published><updated>2011-03-16T20:01:45.310-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='ORA-06508'/><category scheme='http://www.blogger.com/atom/ns#' term='timing'/><category scheme='http://www.blogger.com/atom/ns#' term='Akdora'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Could Not Find Program Unit Being Called</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-YUX-RZ3feh4/TYF4FuVHKZI/AAAAAAAAB2s/in9Qp2skgGo/s1600/Find.png"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 214px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5584877052647385490" border="0" alt="" src="http://1.bp.blogspot.com/-YUX-RZ3feh4/TYF4FuVHKZI/AAAAAAAAB2s/in9Qp2skgGo/s320/Find.png" /&gt;&lt;/a&gt;I was told to write a stand alone script to clear out a backlog of work that needed done. It was caused by a slow nightly process that had to get aborted. I coded a new procedure in one of our packages. My script was very simple. It logged the start and end times of the script. The only other thing it did was call the stored procedure with the correct parameters.&lt;br /&gt;&lt;br /&gt;Now I wanted to make sure the performance of the stand alone script was acceptable. So I looked in the log to see the start and end times. I was shocked to find tons of ORA-06508 errors being logged by one of the triggers in the database. Now this error means some stored procedure could not be found, or was invalid. This darn trigger was calling all kinds of procedures in many different packages. I guess I could have recompiled them all.&lt;br /&gt;&lt;br /&gt;I did find a gem of an idea on &lt;a href="http://akdora.wordpress.com/2009/09/11/ora-06508plsql-could-not-find-program-unit-being-called/"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;Akdora&lt;/span&gt;&lt;/a&gt;'s blog. Instead of just logged the error message in the exception handler, you can store the output of &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;DMBS&lt;/span&gt;_&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;UTLITY&lt;/span&gt;.FORMAT_ERROR_STACK. This tells you exactly what object is missing or invalid. Thanks &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;Akdora&lt;/span&gt;. You helped me get the problem solved and still get home in time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6150722405322449880?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6150722405322449880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6150722405322449880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6150722405322449880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6150722405322449880'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/could-not-find-program-unit-being.html' title='Could Not Find Program Unit Being Called'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-YUX-RZ3feh4/TYF4FuVHKZI/AAAAAAAAB2s/in9Qp2skgGo/s72-c/Find.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7691559170071606487</id><published>2011-03-16T07:55:00.000-07:00</published><updated>2011-03-16T08:00:47.455-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='IDE'/><title type='text'>PL/SQL Review</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/-bJv8tgx004w/TYDQk6h1YOI/AAAAAAAAB2k/JMQJqTUnKZE/s1600/Blocks.gif"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 228px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5584692870544449762" border="0" alt="" src="http://3.bp.blogspot.com/-bJv8tgx004w/TYDQk6h1YOI/AAAAAAAAB2k/JMQJqTUnKZE/s320/Blocks.gif" /&gt;&lt;/a&gt;I just went through a recap of the PL/&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; programming language. It was good. PL/&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; is the programming language for the Oracle database. It can improve application performance but compiling stored procedure code into the database.&lt;br /&gt;&lt;br /&gt;PL/&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; is arranged in blocks. Blocks with names are procedures or functions. You can run PL/&lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; from the Oracle &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus tool. You can also run it through an &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;IDE&lt;/span&gt; like Oracle &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; Developer.&lt;br /&gt;&lt;br /&gt;I hear that new developers continue to come into the PL/&lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; programming community.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7691559170071606487?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7691559170071606487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7691559170071606487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7691559170071606487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7691559170071606487'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/plsql-review.html' title='PL/SQL Review'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-bJv8tgx004w/TYDQk6h1YOI/AAAAAAAAB2k/JMQJqTUnKZE/s72-c/Blocks.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4664298018136036637</id><published>2011-03-14T12:09:00.001-07:00</published><updated>2011-03-14T12:13:16.338-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UNIX'/><category scheme='http://www.blogger.com/atom/ns#' term='F5 Corporation'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='monitoring'/><title type='text'>Oracle Database Firewall</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-rtqyR52uyG8/TX5oAHDAXTI/AAAAAAAAB2M/_OAOv7Cbllg/s1600/Firewall.png"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 256px; FLOAT: left; HEIGHT: 256px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5584014939086937394" border="0" alt="" src="http://1.bp.blogspot.com/-rtqyR52uyG8/TX5oAHDAXTI/AAAAAAAAB2M/_OAOv7Cbllg/s320/Firewall.png" /&gt;&lt;/a&gt;Oracle has released a database firewall product. It analyzes &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; to determine whether to block or log the activity. This functionality comes from F5 Corporation, with which Oracle has struck a partnership.&lt;br /&gt;&lt;br /&gt;Normally this is the territory of database activity monitoring products. Companies with these products are downplaying the security of the Oracle database firewall.&lt;br /&gt;&lt;br /&gt;There are ways to get around the firewall. For example, our UNIX guys log into their UNIX accounts on the machine that hosts the database. Then they use a local connection to the database. Once they do that, all they &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; bypasses the firewall. &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;Ooops&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4664298018136036637?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4664298018136036637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4664298018136036637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4664298018136036637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4664298018136036637'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/oracle-database-firewall.html' title='Oracle Database Firewall'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-rtqyR52uyG8/TX5oAHDAXTI/AAAAAAAAB2M/_OAOv7Cbllg/s72-c/Firewall.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3975713821815769755</id><published>2011-03-04T21:29:00.000-08:00</published><updated>2011-03-04T21:33:48.329-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='row-level locks'/><category scheme='http://www.blogger.com/atom/ns#' term='slow'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>Users are Blocked</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/-9y1SWzObRSA/TXHKS1jnDEI/AAAAAAAAB1k/ve5CI_kL3tw/s1600/Blocked.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 284px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5580463838251650114" border="0" alt="" src="http://2.bp.blogspot.com/-9y1SWzObRSA/TXHKS1jnDEI/AAAAAAAAB1k/ve5CI_kL3tw/s320/Blocked.jpg" /&gt;&lt;/a&gt;I was working on some low priority customer problems for a manager. Then all holy heck broke loose. I was getting emails and calls like crazy. The system supporting all our customers was slowing down to a crawl. That should not be possible as we have massive hardware.&lt;br /&gt;&lt;br /&gt;The &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; team was on hand to monitor what was going on. User row-level locks were in contention. Our applications were hanging. The &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; teams used some tools to identify one of the first locks that happened in the morning. I knew the business logic behind the &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;We got in touch with the user. She killed her application that had been hung all morning. This automatically released the locks and the system returned to a normal state. The lead &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; asked us developers to look at the locking strategy used by the application. He recommended a potential redesign of the app. I took a note, then ran off to the next set of emergencies.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3975713821815769755?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3975713821815769755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3975713821815769755' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3975713821815769755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3975713821815769755'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/03/users-are-blocked.html' title='Users are Blocked'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-9y1SWzObRSA/TXHKS1jnDEI/AAAAAAAAB1k/ve5CI_kL3tw/s72-c/Blocked.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6126065501028719368</id><published>2011-02-28T08:19:00.000-08:00</published><updated>2011-02-28T08:23:57.570-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='host OS'/><category scheme='http://www.blogger.com/atom/ns#' term='guest OS'/><category scheme='http://www.blogger.com/atom/ns#' term='GNU license'/><title type='text'>VirtualBox</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/-z0RHMJ34lmk/TWvLJHcz22I/AAAAAAAAB1U/WXJV2eUa-2U/s1600/VirtualBox.png"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5578775920907639650" border="0" alt="" src="http://1.bp.blogspot.com/-z0RHMJ34lmk/TWvLJHcz22I/AAAAAAAAB1U/WXJV2eUa-2U/s320/VirtualBox.png" /&gt;&lt;/a&gt;A friend of mine asked me if I knew about Oracle's &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;VirtualBox&lt;/span&gt; software. I was ashamed that I did not. I consider myself an Oracle developer.&lt;br /&gt;&lt;br /&gt;&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;VirtualBox&lt;/span&gt; is a free open source product released under a GNU license. It does operating system &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;virtualization&lt;/span&gt;. You can run multiple copies of virtual operating systems at the same time.&lt;br /&gt;&lt;br /&gt;To start with, you need a host operating system such as Windows &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;XP&lt;/span&gt; or Windows 7 for the Windows platform. Then you can run all kinds of virtual guest operating systems with &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;VirtualBox&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Why would you want to do this?  Well you can test many platforms with just one physical host platform. &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;VirtualBox&lt;/span&gt; also can simulate &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;SMP&lt;/span&gt; up to 32 cores (which are all virtual). You can also take snapshots of the o/s state and restore to them.&lt;br /&gt;&lt;br /&gt;I like the idea of having a snapshot I can revert to if my o/s gets corrupted by some nasty virus.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6126065501028719368?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6126065501028719368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6126065501028719368' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6126065501028719368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6126065501028719368'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/02/virtualbox.html' title='VirtualBox'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-z0RHMJ34lmk/TWvLJHcz22I/AAAAAAAAB1U/WXJV2eUa-2U/s72-c/VirtualBox.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4631576566143980899</id><published>2011-01-27T11:15:00.000-08:00</published><updated>2011-01-27T11:19:26.059-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='production'/><category scheme='http://www.blogger.com/atom/ns#' term='delete'/><category scheme='http://www.blogger.com/atom/ns#' term='design'/><title type='text'>Keep Business Rules out of Triggers</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/TUHEd0EiYoI/AAAAAAAABzo/6HfZ-EwnaP4/s1600/Rule.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 230px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5566946630879568514" border="0" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/TUHEd0EiYoI/AAAAAAAABzo/6HfZ-EwnaP4/s320/Rule.jpg" /&gt;&lt;/a&gt;My old team needed some assistance with a problem that was happening in production. Rows from a database table were mysteriously disappearing when the users ran a certain application. The developers swore that their code did not delete these records.&lt;br /&gt;&lt;br /&gt;Since I trust nobody, I scanned the source code of all the database triggers in the system. Sure enough, there was a trigger on another table that deleted the records when a certain field got set to a value. Oh snap. This is just poor design. That's not what triggers are for.&lt;br /&gt;&lt;br /&gt;There are two lessons to learn from this. One is to practice solid design and keep business rules out of the database triggers. The second is that the client server developers need to keep an eye on the code in the database triggers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4631576566143980899?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4631576566143980899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4631576566143980899' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4631576566143980899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4631576566143980899'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/01/keep-business-rules-out-of-triggers.html' title='Keep Business Rules out of Triggers'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/TUHEd0EiYoI/AAAAAAAABzo/6HfZ-EwnaP4/s72-c/Rule.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1185146194782922929</id><published>2011-01-21T11:43:00.000-08:00</published><updated>2011-01-21T11:47:28.126-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='package'/><category scheme='http://www.blogger.com/atom/ns#' term='comments'/><category scheme='http://www.blogger.com/atom/ns#' term='CM'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle error'/><title type='text'>Promotion Woes</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/TTnh9K5-0kI/AAAAAAAABy4/hbkz2msKPbY/s1600/Version.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 240px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5564727255608775234" border="0" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/TTnh9K5-0kI/AAAAAAAABy4/hbkz2msKPbY/s320/Version.jpg" /&gt;&lt;/a&gt;I had to fix a problem they were having using a back end process in production. Seems a processing command was resulting in an Oracle error. I investigated and found that the key stored procedure was commented out of the package. So I &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;reenabled&lt;/span&gt; the procedure and thought we were good to go.&lt;br /&gt;&lt;br /&gt;I got a call from our &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;DBA&lt;/span&gt;. He said my code changes would not work in some of the other database &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;schemas&lt;/span&gt;. When I got in to work, I found that the other &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;schemas&lt;/span&gt; were missing a key column in the staging database table. That should never happen. We got a database configuration management &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-corrected"&gt;issue&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;So I thought we could just add the column everywhere. Some more analysis showed me this would not correct the whole problem. In the end I decided to recode the stored procedure to use another technique to &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-corrected"&gt;derive&lt;/span&gt; the necessary data using some assumptions. This whole episode made me a bit leery about the state of our databases.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1185146194782922929?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1185146194782922929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1185146194782922929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1185146194782922929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1185146194782922929'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2011/01/promotion-woes.html' title='Promotion Woes'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/TTnh9K5-0kI/AAAAAAAABy4/hbkz2msKPbY/s72-c/Version.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5236645723185689957</id><published>2010-12-01T12:16:00.000-08:00</published><updated>2010-12-01T12:21:20.338-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='amatuer'/><category scheme='http://www.blogger.com/atom/ns#' term='validation'/><category scheme='http://www.blogger.com/atom/ns#' term='ORA-01848'/><title type='text'>The Dreaded ORA-01848</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/TPatUDhsmXI/AAAAAAAABw8/zqD-bnm5Uzc/s1600/Calendar.gif"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 318px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5545810551208974706" border="0" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/TPatUDhsmXI/AAAAAAAABw8/zqD-bnm5Uzc/s320/Calendar.gif" /&gt;&lt;/a&gt;I got a phone call and email from the customer this morning. The new version of our software was bombing. The error was ORA-01848: day of year must be between 1 and 365. Ouch. That looks like such an amateur programming error.&lt;br /&gt;&lt;br /&gt;So I traced where we were doing the date stuff in our code. Turns out we were trying to compose a DATE value. The input to the date was some data in the database. Yep. The customer test data was invalid. I pointed this out to them. Some of their days were well over 365 in value.&lt;br /&gt;&lt;br /&gt;I got another call in the afternoon. They were still getting the ORA-01848. I walked them through to check whether the bay dates were fixed. They were. Must be something else. Made sure they were going to the right database. Yep. But there was only one place in the code where we did this date stuff.&lt;br /&gt;&lt;br /&gt;Finally it hit me. Maybe some of their dates were too small. Yep. Had some records where the day was 000 (minimum must be at least 001). Now I am crossing my fingers. The moral of the story might be for me to validate all the data before using it in any date calculations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5236645723185689957?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5236645723185689957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5236645723185689957' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5236645723185689957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5236645723185689957'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/12/dreaded-ora-01848.html' title='The Dreaded ORA-01848'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/TPatUDhsmXI/AAAAAAAABw8/zqD-bnm5Uzc/s72-c/Calendar.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1627246251430146030</id><published>2010-11-10T11:51:00.000-08:00</published><updated>2010-11-10T11:55:23.253-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='BEGIN'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><category scheme='http://www.blogger.com/atom/ns#' term='END'/><category scheme='http://www.blogger.com/atom/ns#' term='handler'/><title type='text'>Block Safety</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/TNr3wBXWbjI/AAAAAAAABwc/D4y-jTCxwEI/s1600/Blocks.gif"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 318px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5538011096177602098" border="0" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TNr3wBXWbjI/AAAAAAAABwc/D4y-jTCxwEI/s320/Blocks.gif" /&gt;&lt;/a&gt;I got a task to go find all transactions that have failed due to a bug, and retry them at night. It sounds simple enough. The retry really means to &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;reimplement&lt;/span&gt; the logic that the application would have done at the hands of a user.&lt;br /&gt;&lt;br /&gt;My only real concern was what would happen if one of those transactions ran into a problem at night. Sounds like a job for exception processing. At first I just stuck an EXCEPTION handler in the middle of the loop. Of course that resulted in compilation errors.&lt;br /&gt;&lt;br /&gt;Well what was I to do? Had to recall that the EXCEPTION is a part of a BEGIN-END pair. So I slapped a BEGIN-END block in the middle of my loop. Within that I added my exception handler. Now the code is rock solid. That is, even if there are some errors, this script will go on.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1627246251430146030?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1627246251430146030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1627246251430146030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1627246251430146030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1627246251430146030'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/11/block-safety.html' title='Block Safety'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TNr3wBXWbjI/AAAAAAAABwc/D4y-jTCxwEI/s72-c/Blocks.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3004706801387701757</id><published>2010-10-28T19:43:00.000-07:00</published><updated>2010-10-28T19:47:22.152-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='aborting'/><category scheme='http://www.blogger.com/atom/ns#' term='error message'/><category scheme='http://www.blogger.com/atom/ns#' term='Pro*C'/><category scheme='http://www.blogger.com/atom/ns#' term='failure'/><title type='text'>Home Made Locks</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/TMo03Sgv1yI/AAAAAAAABvk/okowwzOTzBY/s1600/Locks.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 216px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5533293216644716322" border="0" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/TMo03Sgv1yI/AAAAAAAABvk/okowwzOTzBY/s320/Locks.jpg" /&gt;&lt;/a&gt;I am working on some high priority problems my previous team is having. The customers are mad and want a fix yesterday. The applications keep aborting with the same error messages. I traced this down in the code to some object locking code.&lt;br /&gt;&lt;br /&gt;This was Oracle Pro*C code that implements locks with records in a locks database table. When the users need to obtain a lock, they try to insert a record in this table. If anybody else has already inserted a similar record (has a lock), then the second lock immediately fails.&lt;br /&gt;&lt;br /&gt;When the lock fails, the application displays an error message and aborts. This really irks our customer. So the first order of business is to make sure the application does not abort in this scenario. Next I figure we need the application to wait around a while until the lock might become free. why not let the Oracle database manage this contention? I figure somebody has already solved the queued lock problem. Why try to implement it again in our own &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-corrected"&gt;code&lt;/span&gt;, especially when our implementation will be substandard.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3004706801387701757?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3004706801387701757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3004706801387701757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3004706801387701757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3004706801387701757'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/10/home-made-locks.html' title='Home Made Locks'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/TMo03Sgv1yI/AAAAAAAABvk/okowwzOTzBY/s72-c/Locks.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2022756547792155667</id><published>2010-10-02T21:19:00.000-07:00</published><updated>2010-10-02T21:25:25.781-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='test data'/><category scheme='http://www.blogger.com/atom/ns#' term='tnsnames'/><category scheme='http://www.blogger.com/atom/ns#' term='replication'/><category scheme='http://www.blogger.com/atom/ns#' term='insert scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Plus'/><title type='text'>Database Links</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/TKgEYNwpMTI/AAAAAAAABus/SndAbQBWN8c/s1600/Link.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 306px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5523669757026971954" border="0" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/TKgEYNwpMTI/AAAAAAAABus/SndAbQBWN8c/s320/Link.jpg" /&gt;&lt;/a&gt;I need to create a lot of test data for unit testing some new code. Now I already had some good data in another database. So I used a tool to create some scripts that insert the data into the new database. There were some problems with this technique. My database tables have a lot of columns in them. The creation of insert scripts by the tool puts the whole insert statement on one line. This line turns out to be much too long for &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus to process. So I started to manually break up the lines. There had to be a better way.&lt;br /&gt;&lt;br /&gt;Database links came to the rescue. You create the objects by specifying which database to connect to. You also need to &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;provide&lt;/span&gt; &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;login&lt;/span&gt; credentials when creating the link. Then you can perform queries that access the tables from the other database through the link. This was awesome. The link itself becomes an object in your schema. I hear you can even connect to non-Oracle database. I have no need for that feature though.&lt;br /&gt;&lt;br /&gt;You do need to make sure the remote database you are linking to is in the &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;tnsnames&lt;/span&gt; file on your server. Remember to do a COMMIT after you run the query through the link to release the rollback segment in the other database. The link operates like a pointer. If you really wanted to, a link can be used as a poor man's replication technology. If you want to get some information on your links, check out the &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;DBA&lt;/span&gt;_DB_LINKS view.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2022756547792155667?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2022756547792155667/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2022756547792155667' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2022756547792155667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2022756547792155667'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/10/database-links.html' title='Database Links'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/TKgEYNwpMTI/AAAAAAAABus/SndAbQBWN8c/s72-c/Link.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3094477876453050016</id><published>2010-10-01T20:37:00.001-07:00</published><updated>2010-10-01T20:42:44.012-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='package initialization'/><category scheme='http://www.blogger.com/atom/ns#' term='test suite'/><category scheme='http://www.blogger.com/atom/ns#' term='shell script'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL*Plus'/><title type='text'>Commitment Woes</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/TKapCKDiPZI/AAAAAAAABuE/MNq9NyhWeio/s1600/Commit.gif"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 283px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5523287847540506002" border="0" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TKapCKDiPZI/AAAAAAAABuE/MNq9NyhWeio/s320/Commit.gif" /&gt;&lt;/a&gt;I ran a bunch of routines in a stored procedures to generate some data. Then I queried that database from the &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus tool I previously used to create the data. The checks showed the new data was there. Finally I logged into my operating system account, and ran some shell scripts that ran my whole test suite.&lt;br /&gt;&lt;br /&gt;The funny thing is that I could not see the results over in my &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus session. That was strange. The shell scripts call code that commit the changes. I had to take a break to analyze this oddity. Then it came to me. My &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus work had not been committed in the first place. Therefore the test suite in a separate session could not see the uncommitted changes. &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;Doh&lt;/span&gt;!&lt;br /&gt;&lt;br /&gt;If you thought that one was bad, listen to this story. I made some changes to the database. Then I called a stored procedure to run some jobs to process that data. Worked good the first time. Then I repeated the process. Changed up some data, called the exact stored procedure. This time the changes I made did not take. &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;WTF&lt;/span&gt;? I even did a commit but got wrong results. A lot of inspection got me the answer. The stored procedure was in a package that initialized some internal variables. This package initialization happens once per session. My jobs were being run by one &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;*Plus session. I needed to log out and log back in to get the package initialization to rerun and process the new data. Ouch. That's a tricky one.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3094477876453050016?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3094477876453050016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3094477876453050016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3094477876453050016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3094477876453050016'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/10/commitment-woes.html' title='Commitment Woes'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TKapCKDiPZI/AAAAAAAABuE/MNq9NyhWeio/s72-c/Commit.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2154860713557727243</id><published>2010-09-27T11:44:00.000-07:00</published><updated>2010-09-27T11:49:26.452-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UNIX'/><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='UTL_FILE'/><category scheme='http://www.blogger.com/atom/ns#' term='owner'/><title type='text'>Trouble with Groups</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/TKDmSxdfUXI/AAAAAAAABt0/smtuPrn5iJM/s1600/Group.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 240px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5521666353345286514" border="0" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/TKDmSxdfUXI/AAAAAAAABt0/smtuPrn5iJM/s320/Group.jpg" /&gt;&lt;/a&gt;I inherited some back end code. Most of it is written in PL/&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt;. That's the part I like. The problem is that I cannot get the darn thing to run to completion without errors. The latest issue is with a file that is generated.&lt;br /&gt;&lt;br /&gt;The developer uses the &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;UTL&lt;/span&gt;_FILE built in package to create a file and write to it. That sounds reasonable. However the Oracle database is hosted on a UNIX server. So when it creates the file, the thing is owned by user oracle and by the &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;oinstall&lt;/span&gt; group. I am not oracle. And I do not belong to the &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;oinstall&lt;/span&gt; group.&lt;br /&gt;&lt;br /&gt;Guess what? That means I cannot do anything with the file that got created by &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;UTIL&lt;/span&gt;_FILE. I cannot view the file contents. I cannot delete the file. Nor can I move it. This is just no fun. What am I supposed to do? My first reaction was to just become a member of the &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;oinstall&lt;/span&gt; group. However that raised some flags with the &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;DBAs&lt;/span&gt; and system &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-corrected"&gt;administrators&lt;/span&gt;. Although I agree this sounds wrong, what is a developer to do? I have put in a request for assistance with one of the &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;DBAs&lt;/span&gt;. Hopefully help is on the way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2154860713557727243?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2154860713557727243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2154860713557727243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2154860713557727243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2154860713557727243'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/09/trouble-with-groups.html' title='Trouble with Groups'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/TKDmSxdfUXI/AAAAAAAABt0/smtuPrn5iJM/s72-c/Group.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3357834946749441617</id><published>2010-09-17T10:45:00.000-07:00</published><updated>2010-09-17T10:50:56.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='foreign key'/><category scheme='http://www.blogger.com/atom/ns#' term='primary key'/><category scheme='http://www.blogger.com/atom/ns#' term='ORA-02266'/><category scheme='http://www.blogger.com/atom/ns#' term='tests'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Mysterious Foreign Key Issue</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/TJOpc-3XVlI/AAAAAAAABtE/YlHtwafRpTU/s1600/Keys.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 270px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5517940283835635282" border="0" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/TJOpc-3XVlI/AAAAAAAABtE/YlHtwafRpTU/s320/Keys.jpg" /&gt;&lt;/a&gt;I need to do a lot of unit tests of some database code soon. So I wrote a script that would reset all the data. This script had to remove a lot of records from some tables. I figured the quickest way to do that would be to truncate the tables. I carefully chose the order of the truncation to ensure that the tables with foreign key references would be chopped first.&lt;br /&gt;&lt;br /&gt;When I ran my script, I &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-corrected"&gt;kept&lt;/span&gt; getting an ORA-02266 error message. This is defined as "unique/primary keys in table referenced by enabled foreign keys". This seemed strange. This was happening even when there were no records in the foreign and primary key tables. At first I thought maybe some synonyms were resolving to the wrong tables. But even when I prefaced table names with their &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;schemas&lt;/span&gt;, I got the error.&lt;br /&gt;&lt;br /&gt;In the end I could not figure out what was going on. I replaced the TRUNCATE commands with DELETE statements. Those worked fine. Is this some sort of database error? Or maybe you just are not allowed to TRUNCATE tables with foreign key references. &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-corrected"&gt;Who&lt;/span&gt; knows?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3357834946749441617?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3357834946749441617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3357834946749441617' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3357834946749441617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3357834946749441617'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/09/mysterious-foreign-key-issue.html' title='Mysterious Foreign Key Issue'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/TJOpc-3XVlI/AAAAAAAABtE/YlHtwafRpTU/s72-c/Keys.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2761698181124988872</id><published>2010-08-25T09:55:00.001-07:00</published><updated>2010-08-25T10:26:53.660-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='users'/><category scheme='http://www.blogger.com/atom/ns#' term='explain plan'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle magazine'/><title type='text'>SQL Detective</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/THVLBQkzfEI/AAAAAAAABr8/E93C_gmTAXM/s1600/Detective.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5509392204158958658" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 273px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/THVLBQkzfEI/AAAAAAAABr8/E93C_gmTAXM/s320/Detective.jpg" border="0" /&gt;&lt;/a&gt;I saw some full page ads from Conquest Corporation in the latest issue of Oracle Magazine. They were compelling advertisements. So I decided to try and download two of their new products.&lt;br /&gt;&lt;br /&gt;Unfortunately, one of the download links did not work. The other one downloaded fine. However after installation, I could not figure out how to work the product. Was not sure what the heck the thing did either.&lt;br /&gt;&lt;br /&gt;This exercise was almost a bust. However I was given the opportunity to downloaded Conquest's flagship product. It is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Detective. Once again I was unsure from the hype what this tool did exactly. After downloading I found it to be like PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; Developer or Toad.&lt;br /&gt;&lt;br /&gt;Here are my first impressions. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Logon&lt;/span&gt; took a long time. The default layout is not intuitive. You type you &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; statement below the results window. You have to use a window &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;scroller&lt;/span&gt; to get more query results (I prefer a button). There were some positive features though. I like having an explain plan tab. You can also click the users node in the tree and figure out who has accounts in your database.&lt;br /&gt;&lt;br /&gt;The pricing page on the web was not intuitive either. I determined that the bare bones edition cost $136. For that price, I did not find any &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; Detective features which would make me abandon PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt; Developer, which I use for my customer's work. At least Conquest had a &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;compelling&lt;/span&gt; enough marketing in their ad to get me to give it a try.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2761698181124988872?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2761698181124988872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2761698181124988872' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2761698181124988872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2761698181124988872'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/sql-detective.html' title='SQL Detective'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/THVLBQkzfEI/AAAAAAAABr8/E93C_gmTAXM/s72-c/Detective.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6678894536920164814</id><published>2010-08-19T11:47:00.000-07:00</published><updated>2010-08-19T11:47:00.222-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='multithreaded'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Express'/><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Competition for MySQL</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/TGwq5Y5eReI/AAAAAAAABq8/jucVVrJlqOg/s1600/MySQL.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5506823609791694306" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 316px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/TGwq5Y5eReI/AAAAAAAABq8/jucVVrJlqOg/s320/MySQL.png" border="0" /&gt;&lt;/a&gt;MySQL was previously owned by Sun &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Microsystems&lt;/span&gt;. Then Oracle bought Sun. So now it is managed by Oracle. This is an open source product. However there are other offerings out there. Let look at one or two of them.&lt;br /&gt;&lt;br /&gt;The most direct competition from Microsoft would be their &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; Server Express. However that product is not as simple as it sounds. I want to call attention to another product. That is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQLLite&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQLLite&lt;/span&gt; is actually a library. There is no configuration required. You link in a database engine. The contents of the database are stored in a single file.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQLLite&lt;/span&gt; is implemented in C++. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;API&lt;/span&gt; to the database is low level. This thing was made with C programmers in mind. Good luck if you want to access it through some .NET code.&lt;br /&gt;&lt;br /&gt;You should realize that this is a scaled down database. It tries to implement most of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt;-92 standard. But it is still low power. You don't even want to try to access the database from multiple threads. Things will not go well. I must confess that I am not a MySQL expert. So I cannot as of yet compare &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQLLite&lt;/span&gt; with it. However I do have a personal project which is outgrowing Oracle Express Edition. MySQL may be my next bet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6678894536920164814?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6678894536920164814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6678894536920164814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6678894536920164814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6678894536920164814'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/competition-for-mysql.html' title='Competition for MySQL'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/TGwq5Y5eReI/AAAAAAAABq8/jucVVrJlqOg/s72-c/MySQL.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1686478427556256115</id><published>2010-08-18T11:12:00.000-07:00</published><updated>2010-08-18T11:17:36.127-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TIP'/><category scheme='http://www.blogger.com/atom/ns#' term='ODBC'/><category scheme='http://www.blogger.com/atom/ns#' term='profiling'/><category scheme='http://www.blogger.com/atom/ns#' term='OLE DB'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft'/><title type='text'>Tuning</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/TGwiuD4gL1I/AAAAAAAABq0/6-Cz07NN01k/s1600/Tuning.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5506814619078897490" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 142px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TGwiuD4gL1I/AAAAAAAABq0/6-Cz07NN01k/s320/Tuning.jpg" border="0" /&gt;&lt;/a&gt;I have written about Oracle database tuning in the past. How about we see how other players conquer this issue. Let us assume that we have Microsoft technologies on the front and back end. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Microsoft &lt;/span&gt;provides tier interaction profiling (TIP) to sort out performance issue.&lt;br /&gt;&lt;br /&gt;TIP adds code to profile your application. It records timing information. The actions timed are all those that result in a database hit. These include &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ODBC&lt;/span&gt;, and OLE DB. Those are all Microsoft database access technologies. Developers use frameworks that often abstract them from actual database code. TIP helps get the developer back in touch with the actual &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;database&lt;/span&gt; interaction.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1686478427556256115?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1686478427556256115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1686478427556256115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1686478427556256115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1686478427556256115'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/tuning.html' title='Tuning'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TGwiuD4gL1I/AAAAAAAABq0/6-Cz07NN01k/s72-c/Tuning.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1846274751419175332</id><published>2010-08-06T11:16:00.000-07:00</published><updated>2010-08-06T11:16:00.098-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ODBC'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='OCI'/><category scheme='http://www.blogger.com/atom/ns#' term='OTN'/><category scheme='http://www.blogger.com/atom/ns#' term='drivers'/><title type='text'>Oracle XE and JDBC Performance</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/TFmuqhiMHgI/AAAAAAAABqE/rDjdtKzFTVc/s1600/Performance.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5501620465389280770" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 214px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/TFmuqhiMHgI/AAAAAAAABqE/rDjdtKzFTVc/s320/Performance.jpg" border="0" /&gt;&lt;/a&gt;I am using an Oracle Express Edition database to prototype a very large data set application. My programming language is Java. I am using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;JDBC&lt;/span&gt; to get to the database.&lt;br /&gt;&lt;br /&gt;For starters I thought I needed to download the&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;JDBC&lt;/span&gt; drivers from Oracle. This required me to sign into the Oracle Technology Network. However the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;login&lt;/span&gt; kept saying my &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;password&lt;/span&gt; was wrong. It was a pain.&lt;br /&gt;&lt;br /&gt;I got the drivers. Now there are several flavors of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;JDBC&lt;/span&gt; drivers. Oracle says you should stay away from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;OCI&lt;/span&gt; version. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;Ok&lt;/span&gt;. There is also a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;JDBC&lt;/span&gt; driver that bridges to an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;ODBC&lt;/span&gt; driver. This is a slow configuration. I chose a thin &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;JDBC&lt;/span&gt; driver. By default it is auto committing each insert statement I make.&lt;br /&gt;&lt;br /&gt;So I did a quick timing test. I inserted 10,000 records into a small table. I stored the timestamp for each insert into the table. The whole thing took a total of 19 seconds. That is 500 records per second inserted. That feels pretty good since I a doing a commit after each insert, and this is the free edition of the Oracle &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_10"&gt;database&lt;/span&gt;. The only other test I might try is to see whether a PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;SQL&lt;/span&gt; script can load the data faster.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1846274751419175332?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1846274751419175332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1846274751419175332' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1846274751419175332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1846274751419175332'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/oracle-xe-and-jdbc-performance.html' title='Oracle XE and JDBC Performance'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/TFmuqhiMHgI/AAAAAAAABqE/rDjdtKzFTVc/s72-c/Performance.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5423259684160107080</id><published>2010-08-05T11:08:00.000-07:00</published><updated>2010-08-05T11:08:00.112-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Developer'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL Developer'/><category scheme='http://www.blogger.com/atom/ns#' term='TOAD'/><title type='text'>Query Tools</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/TFmstxmkzLI/AAAAAAAABp8/OjXFyv4A3vM/s1600/Toad.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5501618322218994866" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 270px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TFmstxmkzLI/AAAAAAAABp8/OjXFyv4A3vM/s320/Toad.jpg" border="0" /&gt;&lt;/a&gt;I am working on a new project that has a lot of data. So I know I will need some good tools. My database is Oracle XE, which comes with a limited command line tool. I decided to look around to see what other tools I could get.&lt;br /&gt;&lt;br /&gt;My current tool of choice is PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Developer. I checked their web site. A single user license goes for $180. Plus there is a $50 charge to installation media and documentation. There is a 30-day &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;trial&lt;/span&gt; period version available. But there is no free option. I passed on it.&lt;br /&gt;&lt;br /&gt;Next I tried &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; Developer form Oracle. It is free of charge. The thing requires the Java Development Kit. I already have that. So the downloaded was smaller. It installed fine. &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;However&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;when&lt;/span&gt; I queried a bunch of records, only the first 50 were shown. I had to keep sliding down the control on the side of the results window to get more data. Also the default display for the date columns was MM/DD/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;YYYY&lt;/span&gt;. This product was also out.&lt;br /&gt;&lt;br /&gt;Finally I tried Toad for Oracle Freeware. It is, as the name implies, totally free. The install states that it has the same functionality as Toad For Oracle Base Edition. I found it odd that I downloaded the installer. After installation, it said that there was a more recent version available. What? Luckily there was a button to get the whole result set in one swoop. Nice. I did not like that the query results did not append a record number to the left of each record. But I can live with that. Toad you are my tool of choice for now.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5423259684160107080?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5423259684160107080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5423259684160107080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5423259684160107080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5423259684160107080'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/query-tools.html' title='Query Tools'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TFmstxmkzLI/AAAAAAAABp8/OjXFyv4A3vM/s72-c/Toad.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5559198982585898147</id><published>2010-08-04T11:01:00.000-07:00</published><updated>2010-08-04T11:07:30.001-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Oracle XE'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle Express Edition'/><category scheme='http://www.blogger.com/atom/ns#' term='license'/><title type='text'>Choosing an Oracle Version</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/TFmrLkJ6reI/AAAAAAAABp0/_zRYGfRVrLE/s1600/Edition.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5501616634981952994" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 288px; CURSOR: hand; HEIGHT: 300px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/TFmrLkJ6reI/AAAAAAAABp0/_zRYGfRVrLE/s320/Edition.jpg" border="0" /&gt;&lt;/a&gt;I've got a hot new side project. There is a list of 170 million URLs I want to scrape from the web. I want to use Oracle to hold my data. What version of the database do I need? My first choice &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;was&lt;/span&gt; Oracle Express Edition, also known as Oracle XE. It is free. However it has a limit of 4 Gigabytes of user data. My first database table with 170 million records will blow past that limit.&lt;br /&gt;&lt;br /&gt;Next I took a quick look at the different Oracle Standard Edition offerings. They go from $180 to $350 per user, with a 5 user minimum. This cost is not astronomical. But my project is in a research mode right now. I don't want t0 shell out that kind of cash unless I have a money making opportunity. So I will &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;do a&lt;/span&gt; prototype with Oracle XE.&lt;br /&gt;&lt;br /&gt;Oracle XE comes with a Run &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; Command Line tool. It looks like a DOS box, and behaves like &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt;*Plus. That is too bare bones for me. Let's see what kind of tools there are out there that can help me. I am used to PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; Developer myself. However others swear by Toad. And Oracle has &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; Developer. Next time I will let you know my initial experience with these tools for my new project.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5559198982585898147?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5559198982585898147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5559198982585898147' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5559198982585898147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5559198982585898147'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/08/choosing-oracle-version.html' title='Choosing an Oracle Version'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/TFmrLkJ6reI/AAAAAAAABp0/_zRYGfRVrLE/s72-c/Edition.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-557323672331068513</id><published>2010-07-14T19:50:00.000-07:00</published><updated>2010-07-14T19:59:38.355-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IBM'/><category scheme='http://www.blogger.com/atom/ns#' term='appliance'/><category scheme='http://www.blogger.com/atom/ns#' term='OLTP'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='Larry Ellison'/><title type='text'>Oracle Sun Exadata Database Machine</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/TD53rL_DiAI/AAAAAAAABo0/IyFa1K1QCEs/s1600/Exadata.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 195px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5493960179273926658" border="0" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/TD53rL_DiAI/AAAAAAAABo0/IyFa1K1QCEs/s320/Exadata.jpg" /&gt;&lt;/a&gt;Larry Ellison recently bragged about the &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;Exadata&lt;/span&gt; Database Machine v2. This appliance was previously aimed at database warehousing use in version 1. Now it sets its target as online transaction processing systems. Version 2 is supposed to be twice as fast as v1. Larry says the thing outperforms the best machines from &lt;a href="http://ibm-tools.blogspot.com/"&gt;IBM&lt;/a&gt;. He seems to be taking personal initiative on this project.&lt;br /&gt;&lt;br /&gt;The &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;Exadata&lt;/span&gt; Database Machine has a number of parts. Of course is hosts an Oracle 11g database. It also has an &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;Exadata&lt;/span&gt; Storage Server from Sun. The storage server has 12 disks and 2 &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;CPUs&lt;/span&gt;. However the real power comes from the huge amount of flash storage in the storage server. We are talking a couple hundred Gigabytes here.&lt;br /&gt;&lt;br /&gt;The storage server component in this system is a smart one. It makes use of highly parallel operations. It can also do query processing itself. There is a speed gain from doing the processing close to where the data resides. The box also supports compression to drastically reduce data size.&lt;br /&gt;&lt;br /&gt;Although the system comes &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;preconfigured&lt;/span&gt;, you still need to do some fine tuning on the device. The cost can be a little more than $1M. However when you factor all the licensing and support costs, and get a bigger box, the cost can be a few million. This is obviously the high end &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;OLTP&lt;/span&gt; market. Oracle is going after the market previously dominated by manufacturers such as IBM and &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;EMC&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-557323672331068513?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/557323672331068513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=557323672331068513' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/557323672331068513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/557323672331068513'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/07/oracle-sun-exadata-database-machine.html' title='Oracle Sun Exadata Database Machine'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/TD53rL_DiAI/AAAAAAAABo0/IyFa1K1QCEs/s72-c/Exadata.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4716162558775788220</id><published>2010-07-09T21:22:00.000-07:00</published><updated>2010-07-09T21:27:14.152-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='consultants'/><category scheme='http://www.blogger.com/atom/ns#' term='defect'/><category scheme='http://www.blogger.com/atom/ns#' term='query'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA team'/><title type='text'>Performance Problems</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/TDf1gcsAFeI/AAAAAAAABoM/BwrELGLRD7w/s1600/Update.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 205px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5492128208406975970" border="0" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TDf1gcsAFeI/AAAAAAAABoM/BwrELGLRD7w/s320/Update.jpg" /&gt;&lt;/a&gt;There have been times recently when our production system has been painfully slow. The &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; Team took the lead to find out what was wrong. They could not isolate the problem. So they brought up the matter with Oracle Corporation.&lt;br /&gt;&lt;br /&gt;Oracle could find no defect with the database software. Their analysis resulted them in saying that there must be a defect in our source code. The only value add they provided was some queries which were taking a long time on average.&lt;br /&gt;&lt;br /&gt;This was most disappointing. Any monkey with a tool can &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;identify&lt;/span&gt; the worst performing queries in the system. Now this is not to say that a query might not be poor. However these &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; statements were doing updates using only a primary key in the WHERE clause.&lt;br /&gt;&lt;br /&gt;Sooner or later this problem will come around to our team. I told our project manager that I expected we would need a dedicated Oracle performance engineer. We used to have such individuals assigned to our project. They have since been replaced by consultants who are &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-corrected"&gt;competent&lt;/span&gt;, but not performance experts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4716162558775788220?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4716162558775788220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4716162558775788220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4716162558775788220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4716162558775788220'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/07/performance-problems.html' title='Performance Problems'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TDf1gcsAFeI/AAAAAAAABoM/BwrELGLRD7w/s72-c/Update.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-890963708445466031</id><published>2010-07-06T19:49:00.001-07:00</published><updated>2010-07-06T19:55:17.345-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='initialize'/><category scheme='http://www.blogger.com/atom/ns#' term='refactor'/><title type='text'>NULLs and OUT Params</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/TDPrVvWQOWI/AAAAAAAABns/wF0481hR9bs/s1600/Out.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 259px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5490991129414351202" border="0" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/TDPrVvWQOWI/AAAAAAAABns/wF0481hR9bs/s320/Out.jpg" /&gt;&lt;/a&gt;Recently I came across a big stored procedure in our code. I needed to make some changes to it. That's when I decided this procedure could not go on with its size and complexity. It was time to &lt;a href="http://susops.blogspot.com/2010/07/screaming-to-refactor.html"&gt;refactor&lt;/a&gt; it.&lt;br /&gt;&lt;br /&gt;After I broke the procedure into many procedures and functions, I ran some regression tests. Initially I broke the functionality. I went back to good old debugging techniques. I wrote out a bunch of variables to a table. The values were always NULL.&lt;br /&gt;&lt;br /&gt;Then it hit me. I had a bunch of OUT &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;params&lt;/span&gt; that were not initialized. Therefore they were NULL by default. You can avoid this by always initializing OUT parameters. These were numeric variables. Incrementing NULL lefts the values NULL when I had the bug. &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;Explicitly&lt;/span&gt; setting them to zero solved my problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-890963708445466031?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/890963708445466031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=890963708445466031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/890963708445466031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/890963708445466031'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/07/nulls-and-out-params.html' title='NULLs and OUT Params'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/TDPrVvWQOWI/AAAAAAAABns/wF0481hR9bs/s72-c/Out.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5508557743496120616</id><published>2010-07-01T12:04:00.000-07:00</published><updated>2010-07-01T12:08:24.497-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WHERE CURRENT OF'/><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='FOR UPDATE'/><title type='text'>Out of Sequence</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/TCzm0lGAqnI/AAAAAAAABnU/wEKhRb8gx5U/s1600/Sequence.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5489015836842699378" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 240px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/TCzm0lGAqnI/AAAAAAAABnU/wEKhRb8gx5U/s320/Sequence.jpg" border="0" /&gt;&lt;/a&gt;I want to follow up on my post from yesterday with more details. A junior developer had to write a PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; script that would update upwards of 10 million rows in the database. To make things run fast, she put FOR UPDATE in the cursor &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt;. Then the actual update used WHERE CURRENT OF. This sounds like a solid design.&lt;br /&gt;&lt;br /&gt;The problem was that a batching commit mechanism was added in the middle of the loop through the cursor. The result was that after the first batch was committed, the next iteration through the loop caused an ORA-01002: fetch out of sequence. The thing to know is that the FOR UPDATE works up until the next &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;commit&lt;/span&gt;. After that you are done with the FOR UPDATE cursor. But the script was coded so that it kept on trying to loop after the commit. Is there a solution for batch commits with a cursor? Yes. Don't use FOR UPDATE. Or break up your cursor into many cursors, each of which does a single COMMIT.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5508557743496120616?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5508557743496120616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5508557743496120616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5508557743496120616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5508557743496120616'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/07/out-of-sequence.html' title='Out of Sequence'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/TCzm0lGAqnI/AAAAAAAABnU/wEKhRb8gx5U/s72-c/Sequence.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4564015193975533528</id><published>2010-06-29T19:31:00.000-07:00</published><updated>2010-06-29T19:38:05.147-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='FOR UPDATE'/><category scheme='http://www.blogger.com/atom/ns#' term='column'/><category scheme='http://www.blogger.com/atom/ns#' term='NULL'/><category scheme='http://www.blogger.com/atom/ns#' term='exception'/><category scheme='http://www.blogger.com/atom/ns#' term='bug'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Hidden Errors</title><content type='html'>&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 300px; FLOAT: left; HEIGHT: 300px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5488388839639889682" border="0" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/TCqskif0NxI/AAAAAAAABnM/hPuidltSZVQ/s320/Exception.jpg" /&gt;We recently released a new version of our system to the customer. They needed us to fix a bug. The bug involved the application displaying too many records on some screens. The fix involved adding a new column to a table to remove the ambiguity of records. There was one final touch that was required. We needed to populate this column for all the existing records.&lt;br /&gt;&lt;br /&gt;One of our junior developers coded up a PL/&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; script to go through all the records and determine the value for the new column. With some guidance from a senior developer, she even made the script fast by using FOR UPDATE and WHERE CURRENT OF. Good stuff. There was just one problem. The customer complained that the darn thing did not work. There was a flurry of emails trying to figure out what was wrong.&lt;br /&gt;&lt;br /&gt;Finally I got dragged into a conference call to discuss this problem. At first a lot of people were taken aback that most of the records did not get the column populated. Finally I could not take it any more and I chimed in that we were required to not fill in all records, but only the ones where we could reasonably determined the value. The rest were to remain NULL. Another developer got &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;ahold&lt;/span&gt; of the script, checked out how it handled exceptions, and searched the production database for evidence of any problems. Sure enough an exception was raised. The script caught the exception, but handled it by logging the error to a table and exiting. The shell script that called the PL/&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;SQL&lt;/span&gt; script reported success and we were none the wiser.&lt;br /&gt;&lt;br /&gt;Now we get into the blame game as to why testers and developers did not detect the problem. A &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; chimed in with some sage advice. If we are going to trap errors, then we should use DBMS_OUTPUT to pipe a message to the screen informing a &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; that the thing bombed. Then we could deal with the problem immediately. In fact, it might have been better to leave the script bomb and report the exception to the command line. Then the customer would not have been the one to discover the error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4564015193975533528?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4564015193975533528/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4564015193975533528' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4564015193975533528'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4564015193975533528'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/06/hidden-errors.html' title='Hidden Errors'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/TCqskif0NxI/AAAAAAAABnM/hPuidltSZVQ/s72-c/Exception.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3262643361048225831</id><published>2010-05-27T08:15:00.000-07:00</published><updated>2010-05-27T08:23:26.987-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SimpleDB'/><category scheme='http://www.blogger.com/atom/ns#' term='MongoDB'/><category scheme='http://www.blogger.com/atom/ns#' term='BigTable'/><category scheme='http://www.blogger.com/atom/ns#' term='CouchDB'/><title type='text'>NoSQL on the Rise</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/S_6NBsscXJI/AAAAAAAABmE/2ppDY9oV6sA/s1600/NoSQL.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5475969257246055570" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 290px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/S_6NBsscXJI/AAAAAAAABmE/2ppDY9oV6sA/s320/NoSQL.JPG" border="0" /&gt;&lt;/a&gt;There is a relatively new movement called &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;NoSQL&lt;/span&gt;. It involves high performance databases for little to no cost. Social Networks have been using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;NoSQL&lt;/span&gt;. You might be able to use them too, depending on your specific database requirements.&lt;br /&gt;&lt;br /&gt;The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;NoSQL&lt;/span&gt; movement has different products from different vendors. Amazon created &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SimpleDB&lt;/span&gt;. It is data storage for key value pairs. And Google created &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;BigTable&lt;/span&gt;, open sourcing the data model for it.&lt;br /&gt;&lt;br /&gt;Some &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;NoSQL&lt;/span&gt; databases focus on storing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JSON&lt;/span&gt; objects. Examples of these databases are &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;CouchDB&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;MongoDB&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;CouchDB&lt;/span&gt; let's you use a REST &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;API&lt;/span&gt; to access the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;JSON&lt;/span&gt; data.&lt;br /&gt;&lt;br /&gt;These &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;NoSQL&lt;/span&gt; databases often have limitations. Some impose a time limit for queries to complete. Others return only partial data sets. These databases can hold a lot of data. But they often are poor for complicated queries.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3262643361048225831?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3262643361048225831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3262643361048225831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3262643361048225831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3262643361048225831'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/05/nosql-on-rise.html' title='NoSQL on the Rise'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/S_6NBsscXJI/AAAAAAAABmE/2ppDY9oV6sA/s72-c/NoSQL.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8282213513493989112</id><published>2010-05-20T10:04:00.001-07:00</published><updated>2010-05-20T10:08:59.385-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='brute force'/><category scheme='http://www.blogger.com/atom/ns#' term='records'/><category scheme='http://www.blogger.com/atom/ns#' term='VARRAY'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL table'/><title type='text'>Script Performance</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/S_VrljiOT_I/AAAAAAAABk8/M8iKmehiO6c/s1600/Collection.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5473399215076823026" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 191px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/S_VrljiOT_I/AAAAAAAABk8/M8iKmehiO6c/s320/Collection.png" border="0" /&gt;&lt;/a&gt;I had this script to write to correct some data. The script was going to affect about 20k records. One part of the script needed to mine through a table with 1B records. This needed to be done for each of the affected 20k records. So I knew that a brute force approach would never complete.&lt;br /&gt;&lt;br /&gt;So I thought perhaps I could &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;preprocess&lt;/span&gt; those 1B records. There were only a few thousand of those records that were of interest. If I could just load the couple thousand relevant records into memory, I could use that data to go though my batch.&lt;br /&gt;&lt;br /&gt;This seemed to be a good candidate for some type of collection. But what kind should I use? I don't do enough PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; to be very comfortable with collections. I read around and though maybe it could be a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;VARRAY&lt;/span&gt;. But I only had experience with PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; tables. What is a developer to do?&lt;br /&gt;&lt;br /&gt;In the end I needed to get this script coded ASAP. So I did the simplest programmatic approach. I created a temporary table with a few thousand records. This table represented the important data mined from the 1B record raw table. I am hoping that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; against this small temporary table will be very fast. We shall see when I ship the fix out to the production environment where the volumes are huge.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8282213513493989112?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8282213513493989112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8282213513493989112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8282213513493989112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8282213513493989112'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/05/script-performance.html' title='Script Performance'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/S_VrljiOT_I/AAAAAAAABk8/M8iKmehiO6c/s72-c/Collection.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5095649182797435114</id><published>2010-05-12T21:50:00.001-07:00</published><updated>2010-05-12T21:55:50.099-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JSON'/><category scheme='http://www.blogger.com/atom/ns#' term='BSON'/><category scheme='http://www.blogger.com/atom/ns#' term='recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='NoSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='concurrency'/><title type='text'>MongoDB</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/S-uFFcBraEI/AAAAAAAABjc/aqsDWk1n1jk/s1600/Mongo.png"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 320px; FLOAT: left; HEIGHT: 106px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5470612500840671298" border="0" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/S-uFFcBraEI/AAAAAAAABjc/aqsDWk1n1jk/s320/Mongo.png" /&gt;&lt;/a&gt;Previously I had written an overview of the &lt;a href="http://ora-pl-sql.blogspot.com/2010/03/rise-of-nosql.html"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;NoSQL&lt;/span&gt;&lt;/a&gt; movement. Today I want to talk a little more about a specification implementation. I will cover &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;NoSQL&lt;/span&gt; has some niche applications. Sometimes your information does not fit into a database schema. &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt; tries to provide high performance. This is in contrast to other &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;NoSQL&lt;/span&gt; implementations which are &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;gerared&lt;/span&gt; toward high concurrency.&lt;br /&gt;&lt;br /&gt;There are no transactions in &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;MonogoDB&lt;/span&gt;. You can't recover from an abrupt shutdown. &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt; is good if you need data quickly, and you access the data frequently. &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;JSON&lt;/span&gt; is used as the default data notation. Internally &lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt; uses &lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;BSON&lt;/span&gt; (binary &lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;JSON&lt;/span&gt;). &lt;span id="SPELLING_ERROR_12" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt; itself is written in C++.&lt;br /&gt;&lt;br /&gt;The use of &lt;span id="SPELLING_ERROR_13" class="blsp-spelling-error"&gt;MongoDB&lt;/span&gt; is very similar to using a traditional relational database. I have not played with it yet. Not sure that I will. You still need to know what the competition is using though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5095649182797435114?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5095649182797435114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5095649182797435114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5095649182797435114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5095649182797435114'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/05/mongodb.html' title='MongoDB'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/S-uFFcBraEI/AAAAAAAABjc/aqsDWk1n1jk/s72-c/Mongo.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3181820026115879321</id><published>2010-05-10T10:44:00.000-07:00</published><updated>2010-05-10T10:53:59.447-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CREATE JOB'/><category scheme='http://www.blogger.com/atom/ns#' term='COMMIT'/><category scheme='http://www.blogger.com/atom/ns#' term='ROWID'/><category scheme='http://www.blogger.com/atom/ns#' term='parallel'/><category scheme='http://www.blogger.com/atom/ns#' term='DML'/><title type='text'>Chunking for Performance</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/S-hGvgsIzQI/AAAAAAAABi0/fwmusgBVpb8/s1600/Chunks.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5469699529484324098" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 240px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/S-hGvgsIzQI/AAAAAAAABi0/fwmusgBVpb8/s320/Chunks.jpg" border="0" /&gt;&lt;/a&gt;So you have a lot of data you want to update. I am talking about the whole big table. How do you do it? Well in the good old days you found a way to divide and conquer. Pretty much you put some limiter in the WHERE clause of the update to do a small bunch at a time. That way the whole darn table did not get locked.&lt;br /&gt;&lt;br /&gt;The idea is similar in Oracle 11g Rel 2. However the bunching is supported in the system. You make use of the DBMS_PARALLEL_EXECUTE package. You choose a way to chunk up your data. That is, you divide up the data by some characteristic. However the new package does the work of splitting up your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;DML&lt;/span&gt; between different statements which operate in &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;parallel&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The procedures in the package do their own COMMIT on their parts. You also need to have the CREATE JOB &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;privilege&lt;/span&gt;, as a bunch of jobs will be scheduled on your behalf to get the job some in parallel. A common way to chunk up your data is by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;ROWID&lt;/span&gt;. However you can choose some other attribute of your data. On our project we use a generated ID to do the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;chunking&lt;/span&gt;. And previously we had used partitions to break up the chunks. Maybe it is time to rethink that plan.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3181820026115879321?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3181820026115879321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3181820026115879321' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3181820026115879321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3181820026115879321'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/05/chunking-for-performance.html' title='Chunking for Performance'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/S-hGvgsIzQI/AAAAAAAABi0/fwmusgBVpb8/s72-c/Chunks.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4619093127216768841</id><published>2010-04-27T19:29:00.000-07:00</published><updated>2010-04-27T19:34:03.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='DBA team'/><category scheme='http://www.blogger.com/atom/ns#' term='updates'/><title type='text'>Index Rebuild</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/S9edpz5zadI/AAAAAAAABh0/2VZC-wTjnYw/s1600/Index.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 154px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5465010014470236626" border="0" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/S9edpz5zadI/AAAAAAAABh0/2VZC-wTjnYw/s320/Index.jpg" /&gt;&lt;/a&gt;Yesterday our loading software came to a halt in the production environment. The &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; team came to the rescue and determined some tables had indexes that were just out of date. A quick real time rebuild got things rolling again.&lt;br /&gt;&lt;br /&gt;Now our &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; team is looking to be more proactive. We had a weekly job that rebuilds the indexes for some major tables. However we started looking for other tables to rebuild indexes for.&lt;br /&gt;&lt;br /&gt;The &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;DBAs&lt;/span&gt; told us that they were looking for tables that were frequently updated. I found one such example. A &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; chimed in and agreed the table I &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-corrected"&gt;identified&lt;/span&gt; was a trouble table from a prior performance issue.&lt;br /&gt;&lt;br /&gt;You would think that Oracle would have some built in support to keep indexes up to date.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4619093127216768841?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4619093127216768841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4619093127216768841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4619093127216768841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4619093127216768841'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/04/index-rebuild.html' title='Index Rebuild'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/S9edpz5zadI/AAAAAAAABh0/2VZC-wTjnYw/s72-c/Index.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1510146398787106031</id><published>2010-04-15T19:59:00.001-07:00</published><updated>2010-04-15T20:00:26.680-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fine grained access control'/><category scheme='http://www.blogger.com/atom/ns#' term='FGAC'/><category scheme='http://www.blogger.com/atom/ns#' term='policy_function'/><category scheme='http://www.blogger.com/atom/ns#' term='view'/><category scheme='http://www.blogger.com/atom/ns#' term='LOGON'/><title type='text'>Virtual Private Database</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7RXOll2bOJs/S8fSrcSfAzI/AAAAAAAABhc/vlAZxxmF1HQ/s1600/Virtual.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 186px;" src="http://2.bp.blogspot.com/_7RXOll2bOJs/S8fSrcSfAzI/AAAAAAAABhc/vlAZxxmF1HQ/s320/Virtual.jpg" alt="" id="BLOGGER_PHOTO_ID_5460564716979946290" border="0" /&gt;&lt;/a&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Oracle has a behind the scenes functionality called the virtual private database. It is also known as fine grained access control (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;FGAC&lt;/span&gt;). The database will modify queries automatically to present a partial view of a database table. There is policy_function which returns the WHERE clause that masks the query results.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This functionality can be as simple as hiding certain rows from a result set using a more restrictive WHERE clause. It can also mask out some columns. This effectively creates a customized virtual object that is generated on the fly. This is very similar to a view. It is just that each user gets a custom view.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;FGAC&lt;/span&gt; can implement row level security. As such you can lock down data as you see fit. An application context is set at sign on. This is accomplished via a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;LOGON&lt;/span&gt; trigger. The rest is plug and chug by the Oracle database. Essentially you are getting logical security with the virtual private database. Good stuff. We might be using this on our project at work to implement some of the customer’s data hiding business needs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1510146398787106031?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1510146398787106031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1510146398787106031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1510146398787106031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1510146398787106031'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/04/virtual-private-database.html' title='Virtual Private Database'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/S8fSrcSfAzI/AAAAAAAABhc/vlAZxxmF1HQ/s72-c/Virtual.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5487808805025452197</id><published>2010-04-14T17:09:00.000-07:00</published><updated>2010-04-14T17:10:01.911-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='temp tables'/><category scheme='http://www.blogger.com/atom/ns#' term='rollback'/><category scheme='http://www.blogger.com/atom/ns#' term='session'/><category scheme='http://www.blogger.com/atom/ns#' term='redo'/><category scheme='http://www.blogger.com/atom/ns#' term='private'/><title type='text'>Global Temporary Tables</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7RXOll2bOJs/S8ZZM3YcbSI/AAAAAAAABhU/EkBxrNto5Hk/s1600/Global.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 300px; height: 300px;" src="http://4.bp.blogspot.com/_7RXOll2bOJs/S8ZZM3YcbSI/AAAAAAAABhU/EkBxrNto5Hk/s320/Global.jpg" alt="" id="BLOGGER_PHOTO_ID_5460149675793083682" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt;"&gt;Global Temporary  Tables are a feature from Oracle 8i. The tables are managed by the database  server. They hold data which is private per session. The data is automatically  deleted at the end of the session.&lt;o:p&gt;&lt;/O:P&gt;&lt;/span&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt;"&gt;These tables can  improve query speed. This is because there is no redo or rollback information  collected. They also prevent private data sets from interfering with each other.  You can consider these tables the ultimate work tables.&lt;o:p&gt;&lt;/O:P&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-family: 'Arial','sans-serif'; font-size: 10pt;"&gt;Tom &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Kyte&lt;/span&gt;&lt;/span&gt; advises against their  use. However there is a difference between a temp table and a global temporary  table. A temp table is one you create on the fly to do some complex work on.  These global temporary tables are permanent tables which users can only see a  portion of the data.&lt;o:p&gt;&lt;/O:P&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5487808805025452197?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5487808805025452197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5487808805025452197' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5487808805025452197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5487808805025452197'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/04/global-temporary-tables.html' title='Global Temporary Tables'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/S8ZZM3YcbSI/AAAAAAAABhU/EkBxrNto5Hk/s72-c/Global.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5673908032711627144</id><published>2010-03-17T17:23:00.001-07:00</published><updated>2010-03-17T17:24:18.310-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cassandra'/><category scheme='http://www.blogger.com/atom/ns#' term='BigTable'/><category scheme='http://www.blogger.com/atom/ns#' term='JSON'/><category scheme='http://www.blogger.com/atom/ns#' term='REST'/><category scheme='http://www.blogger.com/atom/ns#' term='BSON'/><category scheme='http://www.blogger.com/atom/ns#' term='MapReduce'/><category scheme='http://www.blogger.com/atom/ns#' term='NoSQL'/><title type='text'>The Rise of NoSQL</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_7RXOll2bOJs/S6Fycwo1MfI/AAAAAAAABgU/uwk_yl4Fymg/s1600-h/NoSQL.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 310px;" src="http://4.bp.blogspot.com/_7RXOll2bOJs/S6Fycwo1MfI/AAAAAAAABgU/uwk_yl4Fymg/s320/NoSQL.jpg" alt="" id="BLOGGER_PHOTO_ID_5449762862513074674" border="0" /&gt;&lt;/a&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Recently I read about the Cassandra project. It is a distributed database. The goal is to store a large amount of data. It uses the Google &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;BigTable&lt;/span&gt; model (more on &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;BigTable&lt;/span&gt; later). The databases stores key value pairs. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Cassandra was created by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;FaceBook&lt;/span&gt;. It is used by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;FaceBook&lt;/span&gt;, Twitter, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Digg&lt;/span&gt;. It is an open source project managed by Apache. The intended use is large web applications. There are other projects similar to Cassandra. They are part of the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;NoSQL&lt;/span&gt; movement. Are these databases poised to replace the relational ones like Oracle, DB2, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt; Server? Let’s see what these &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;NoSQL&lt;/span&gt; databases have to offer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;NoSQL&lt;/span&gt; in general are data stores that do not impose a fixed structure for the data. Access to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;NoSQL&lt;/span&gt; databases tries to avoid joins. The technical term for these databases is structured storage. They have weak consistency. That means if you update a copy on your server, the update is not guaranteed to be propagated everywhere immediately. These type of databases also have very simple interfaces. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Let’s go over some other &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;NoSQL&lt;/span&gt; databases. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;Hadoop&lt;/span&gt; is a project with many &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;subprojects&lt;/span&gt;. One such &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;subproject&lt;/span&gt; is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;MapReduce&lt;/span&gt;, which is a framework for large data set distributed processing. Then there is Google’s &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;BigTable&lt;/span&gt;. It is a distributed storage system that can scale to a large size. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Next we have &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;MemCacheDB&lt;/span&gt;. It is a distributed key value storage system. Despite the name, it is not for caching. It is a persistent storage mechanism that uses the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;memcache&lt;/span&gt; protocol to access a &lt;st1:place st="on"&gt;&lt;st1:city st="on"&gt;Berkeley&lt;/st1:City&gt;&lt;/st1:place&gt; database on the back end. Another &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;NoSQL&lt;/span&gt; database is project &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;Voldemort&lt;/span&gt;. It is a distributed database providing key value storage. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;LinkedIn&lt;/span&gt; uses it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;CouchDB&lt;/span&gt; is an Apache project. It is a document oriented database. You query it using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;MapReduce&lt;/span&gt;. It has a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;RESTful&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;JSON&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;API&lt;/span&gt;. Note that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;CouchDB&lt;/span&gt; is written in the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;Erlang&lt;/span&gt; functional programming language. A similar offering is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;MongoDB&lt;/span&gt;. The name is a play on humongous. It is also a document oriented database. This one was written in C++. It collects &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;JSON&lt;/span&gt; documents and stored them in a binary &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;BSON&lt;/span&gt; format. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;I have covered a lot of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;NoSQL&lt;/span&gt; implementation. They mostly provided distributed storage. Although they scale very well for large data sets, their functionality is limited. They are not a replacement for relational databases. You still need &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;RDBs&lt;/span&gt; for transaction processing. Nonetheless it is good to know a bit about the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;NoSQL&lt;/span&gt; movement, and the problems it tries to solve.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5673908032711627144?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5673908032711627144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5673908032711627144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5673908032711627144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5673908032711627144'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/03/rise-of-nosql.html' title='The Rise of NoSQL'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/S6Fycwo1MfI/AAAAAAAABgU/uwk_yl4Fymg/s72-c/NoSQL.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4097214728413616949</id><published>2010-03-09T12:20:00.001-08:00</published><updated>2010-03-09T12:21:30.183-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hot rollover'/><category scheme='http://www.blogger.com/atom/ns#' term='virtual drop'/><category scheme='http://www.blogger.com/atom/ns#' term='editioning view'/><category scheme='http://www.blogger.com/atom/ns#' term='ORA-04068'/><category scheme='http://www.blogger.com/atom/ns#' term='online upgrade'/><title type='text'>Edition Based Redefinition</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_7RXOll2bOJs/S5atooacLsI/AAAAAAAABf8/dM6fQX16GXM/s1600-h/Redefine.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 320px;" src="http://3.bp.blogspot.com/_7RXOll2bOJs/S5atooacLsI/AAAAAAAABf8/dM6fQX16GXM/s320/Redefine.jpg" alt="" id="BLOGGER_PHOTO_ID_5446731712905883330" border="0" /&gt;&lt;/a&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Previously you could not compile any PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; that was currently being executed. If you did, the result would be an ORA-04068 “Existing state of packages has been discarded”. This restriction is lifted in Oracle 11g rel 2. You can now perform an online upgrade of an application. In other words you can patch code while users are executing the old version. You can also do some schema changes while users access the old version. The goal of this new capability is to ensure that downtime to users is minimized.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Objects in general fall into two categories. They are either &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;editionable&lt;/span&gt; or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;noneditionable&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Editionable&lt;/span&gt; objects includes functions, procedures, package, and so on. They can be easily upgraded online. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Noneditionable&lt;/span&gt; objects are things like database tables. Normally you cannot upgrade them online. However with a new object called an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;editioning&lt;/span&gt; view, you can even simulate changes to database tables while users are on the system running your apps.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;An &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;editioning&lt;/span&gt; view has specific limitations. You can only select from this view. Furthermore you can only reference one database table (and thus no joins are permitted). This view acts like a synonym in that it projects attributes from the underlying table. This view can have triggers. The trick is that this view can effectively hide columns from the user. This hiding operation is similar to dropping a column a table. The new kind of column drop is a virtual one. The column in the underlying table remains, but access to it has been shut off.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Here is the operational practice to use such &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;editioning&lt;/span&gt; views. You first rename the underlying table. Then you create an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;editioning&lt;/span&gt; view that has the same name as the old table. You drop the triggers on the original table. Recreate the triggers on the new view. Revoke any &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;privs&lt;/span&gt; on the base table. This is what we call a hot rollover. There are other similar features in Oracle 11g rel 2. Perhaps I will cover them in a future post.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4097214728413616949?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4097214728413616949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4097214728413616949' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4097214728413616949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4097214728413616949'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/03/edition-based-redefinition.html' title='Edition Based Redefinition'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/S5atooacLsI/AAAAAAAABf8/dM6fQX16GXM/s72-c/Redefine.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-978757853761272623</id><published>2010-03-08T14:35:00.001-08:00</published><updated>2010-03-08T14:36:13.028-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='foreign keys'/><category scheme='http://www.blogger.com/atom/ns#' term='unit testing'/><category scheme='http://www.blogger.com/atom/ns#' term='framework'/><category scheme='http://www.blogger.com/atom/ns#' term='JDK'/><category scheme='http://www.blogger.com/atom/ns#' term='patch'/><category scheme='http://www.blogger.com/atom/ns#' term='data modeler'/><title type='text'>SQL Developer</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_7RXOll2bOJs/S5V7sGGVmcI/AAAAAAAABfs/d6kym58zXf0/s1600-h/SQL-Developer.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 250px; height: 229px;" src="http://1.bp.blogspot.com/_7RXOll2bOJs/S5V7sGGVmcI/AAAAAAAABfs/d6kym58zXf0/s320/SQL-Developer.jpg" alt="" id="BLOGGER_PHOTO_ID_5446395321856137666" border="0" /&gt;&lt;/a&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;There is a new release of Oracle &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Developer available. It is version 2.1. This has two new big features. They are PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; unit testing and a Data Modeler/Viewer. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; unit testing part is a unit test framework. It allows you to share unit tests. It also let’s you run regression tests.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The Data Modeler/Viewer gives you read only access to a database schema. You can view the schema objects graphically. A benefit is the ability to browse the foreign keys between tables.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;To tell the truth, there is even a version 2.1.1 patch that is available now. The big v2.1 release is 94M large for the install. It requires the Java Development Kit v1.6 update 11.. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;This app is still free of charge. You can still edit PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; just like the older versions of the tool. And it still integrates with all kinds of source code control.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-978757853761272623?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/978757853761272623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=978757853761272623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/978757853761272623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/978757853761272623'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/03/sql-developer.html' title='SQL Developer'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/S5V7sGGVmcI/AAAAAAAABfs/d6kym58zXf0/s72-c/SQL-Developer.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7980715149873785865</id><published>2010-02-21T17:57:00.000-08:00</published><updated>2010-02-21T18:04:14.756-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='service name'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle home'/><category scheme='http://www.blogger.com/atom/ns#' term='TNS_ADMIN'/><category scheme='http://www.blogger.com/atom/ns#' term='tnsnames.ora'/><title type='text'>ORA-12154 Blues</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/S4HkrPfSWiI/AAAAAAAABes/YFRa3Gz8-VA/s1600-h/Gorilla.jpg"&gt;&lt;img style="MARGIN: 0px 10px 10px 0px; WIDTH: 292px; FLOAT: left; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5440881256383535650" border="0" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/S4HkrPfSWiI/AAAAAAAABes/YFRa3Gz8-VA/s320/Gorilla.jpg" /&gt;&lt;/a&gt;I assigned a developer a trouble ticket from the production environment. He said he was getting errors when trying to connect and reset his password. The specific error was ORA-12154, which translates to "&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;TNS&lt;/span&gt;: Could not resolve service name."&lt;br /&gt;&lt;br /&gt;This looked like a simple problem to correct. I ensured he had the &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;TNS&lt;/span&gt;_ADMIN environment variable set. I also ensured he had the right "&lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;tnsnames&lt;/span&gt;.&lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;ora&lt;/span&gt;" file on the network. That seemed strange.&lt;br /&gt;&lt;br /&gt;After I gave up, I called in our lead &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;DBA&lt;/span&gt;. He wanted to see how many Oracle homes there were on the guy's machine. There were &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-corrected"&gt;multiple&lt;/span&gt; ones due to the multiple products installed. The developer could not find an Oracle Home selector. But this did not turn out to be the problem either.&lt;br /&gt;&lt;br /&gt;The lead &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; and myself went through different ideas to get this guy running. Then I had a strange thought. What if this guy had a weird password that was screwing things up. I thought that could not be possible since we have a trigger that prevents bad passwords. However the &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; told me his profile did not enforces the password trigger. Sure enough the developer had an "at sign" character in his password. So the part of his password after the password gets treated as the host string. His &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;logon&lt;/span&gt; would never work.&lt;br /&gt;&lt;br /&gt;In the end we had a &lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;DBA&lt;/span&gt; reset his password. This just goes to show that an Oracle error message does not always identify the exact problem being encountered. You might need to team up with some &lt;span id="SPELLING_ERROR_10" class="blsp-spelling-corrected"&gt;competent&lt;/span&gt; individuals to figure out the problem. It might also involve thinking outside the box and trying things out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7980715149873785865?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7980715149873785865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7980715149873785865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7980715149873785865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7980715149873785865'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/02/ora-12154-blues.html' title='ORA-12154 Blues'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/S4HkrPfSWiI/AAAAAAAABes/YFRa3Gz8-VA/s72-c/Gorilla.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8201954202445711517</id><published>2010-02-09T14:24:00.000-08:00</published><updated>2010-02-09T14:33:28.470-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='open source'/><category scheme='http://www.blogger.com/atom/ns#' term='profit'/><category scheme='http://www.blogger.com/atom/ns#' term='European Commission'/><category scheme='http://www.blogger.com/atom/ns#' term='InnoDB'/><title type='text'>Sun Microsystems and the MySQL Community</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/S3HiqpyPWtI/AAAAAAAABdk/w3vMI0U5qBo/s1600-h/MySQL.png"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 316px; DISPLAY: block; HEIGHT: 320px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5436375447611857618" border="0" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/S3HiqpyPWtI/AAAAAAAABdk/w3vMI0U5qBo/s320/MySQL.png" /&gt;&lt;/a&gt;Oracle continues to work on acquiring Sun &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;Microsystems&lt;/span&gt;&lt;/span&gt;. The MySQL community has some opposition to this move. The complaints are led by the creator of MySQL. He sold out his share to Sun. But he thinks Oracle will work to dismantle the MySQL database in order to increase their profit share.&lt;br /&gt;&lt;br /&gt;The European Commission is still debating whether to block the &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;acquisition&lt;/span&gt;. Many current Oracle customers have written to the EU to encourage the approval of the merger. MySQL can fork a copy of the code because the project is open source.&lt;br /&gt;&lt;br /&gt;Oracle promises to spend money on MySQL development. It also is committed to not forcing customers to pay for a support contract for MySQL. The MySQL creator says he saw that Oracle bought out &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;&lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;InnoDB&lt;/span&gt;&lt;/span&gt; before, and the project development became stagnant.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8201954202445711517?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8201954202445711517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8201954202445711517' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8201954202445711517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8201954202445711517'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/02/sun-microsystems-and-mysql-community.html' title='Sun Microsystems and the MySQL Community'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/S3HiqpyPWtI/AAAAAAAABdk/w3vMI0U5qBo/s72-c/MySQL.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5433235559587281799</id><published>2010-01-07T14:46:00.001-08:00</published><updated>2010-01-07T14:50:12.606-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oraca'/><category scheme='http://www.blogger.com/atom/ns#' term='WHENEVER'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLCA'/><category scheme='http://www.blogger.com/atom/ns#' term='no data found'/><category scheme='http://www.blogger.com/atom/ns#' term='ANSI'/><category scheme='http://www.blogger.com/atom/ns#' term='SQLCODE'/><category scheme='http://www.blogger.com/atom/ns#' term='Pro*C'/><title type='text'>SQL Communications Area</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/S0ZkXpkWJdI/AAAAAAAABbM/PRUAJ3NJaLE/s1600-h/Darko.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5424133158672410066" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 219px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/S0ZkXpkWJdI/AAAAAAAABbM/PRUAJ3NJaLE/s320/Darko.jpg" border="0" /&gt;&lt;/a&gt;There is a structure in Pro*C called the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Communications Area. The structure variable is named &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;sqlca&lt;/span&gt;. The most useful field in the structure is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;sqlcode&lt;/span&gt;, which is the status variable. You access this variable with the fully qualified name like this "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;sqlca&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;sqlcode&lt;/span&gt;". The structure is defined in file &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;sqlca&lt;/span&gt;.h.&lt;br /&gt;&lt;br /&gt;The status variable (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;sqlcode&lt;/span&gt;) has three different types of values. Zero means the operation was a success. A positive value means the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQL&lt;/span&gt; statement executed but threw an exception. And a negative value means the statement did not execute. This variable is updated by Oracle after each &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;SQL&lt;/span&gt; statement.&lt;br /&gt;&lt;br /&gt;Normally you will get a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;sqlcode&lt;/span&gt; of 1403 if there is a No Data Found exception. However you can set the MODE to ANSI in your Pro*C &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;precompiler&lt;/span&gt;. This will result in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;sqlcode&lt;/span&gt; being set to 100 (instead of 1403) on No Data Found.&lt;br /&gt;&lt;br /&gt;The developer is able to independently define other status variables such as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;SQLSTATE&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;SQLCODE&lt;/span&gt;. This &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;SQLCODE&lt;/span&gt; is different than the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;sqlca&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;sqlcode&lt;/span&gt;. In addition to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;SQL&lt;/span&gt; Communication Area, there is an Oracle Communications Area. It has the variable name &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;oraca&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;You can trap Pro*C errors using the WHENEVER clause. There are different values used in association with the clause. Some of these are &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;SQLERROR&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;SQL&lt;/span&gt; WARNING, and NOT FOUND. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;SQLERROR&lt;/span&gt; equates to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;sqlcode&lt;/span&gt; being negative. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;SQL&lt;/span&gt; WARNING is when &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;sqlcode&lt;/span&gt; is positive or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;sql&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;sqlwarn&lt;/span&gt;[0] equals ‘W’. And NOT FOUND is a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;sqlcode&lt;/span&gt; of either 1403 or 100, depending on the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;precompiler&lt;/span&gt; MODE.&lt;br /&gt;&lt;br /&gt;It is possible to have more than one &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;sqlca&lt;/span&gt;. However there is only one active one at a time. My recent research into the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;SQL&lt;/span&gt; Communications Area was when the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;sqlcode&lt;/span&gt; was non zero for a trivial &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;SQL&lt;/span&gt; statement. It turned out that the value was 1403 which means No Data Found. It took a while for me to discover that one of the bind variables had an extra space at the end causing an update to fail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5433235559587281799?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5433235559587281799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5433235559587281799' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5433235559587281799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5433235559587281799'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2010/01/sql-communications-area.html' title='SQL Communications Area'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/S0ZkXpkWJdI/AAAAAAAABbM/PRUAJ3NJaLE/s72-c/Darko.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1869531946041357760</id><published>2009-12-16T13:57:00.001-08:00</published><updated>2009-12-16T13:58:22.465-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='embedded'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='native compilation'/><category scheme='http://www.blogger.com/atom/ns#' term='native dynamic SQL'/><title type='text'>SQL Review and Native Compilation</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SylX21JYTdI/AAAAAAAABaM/nWN8osC1TVQ/s1600-h/Native.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5415956626380705234" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 278px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SylX21JYTdI/AAAAAAAABaM/nWN8osC1TVQ/s320/Native.jpg" border="0" /&gt;&lt;/a&gt;I just started reading a new web site on PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; programming. It is actually hosted by Oracle. Today I read a review of the different ways to execute &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; in PL/.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt;. They are embedded &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt;, Native Dynamic &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt;, and the DBMS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;API&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Embedded &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQL&lt;/span&gt; is easy. You just code up the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;SQL&lt;/span&gt; like normal. There are some caveats like specifying the variable into which you select some data. But it is very natural. Here is a hint. Make sure you define aliases for the table you select from. Then use these aliases to qualify the columns you select.&lt;br /&gt;&lt;br /&gt;Native Dynamic &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;SQL&lt;/span&gt; is when you run the commands with an EXECUTE &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;IMMEDAITE&lt;/span&gt;. You should exercise care to protect against &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;SQL&lt;/span&gt; injection. I have written about this before. This style is fast than DBMS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;SQL&lt;/span&gt;. Note that DBMS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;SQL&lt;/span&gt; is the old way of executing dynamic &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;SQL&lt;/span&gt;. It is not entirely obsolete. If you do not know the return values until run time, this is the only option. But most times you can skip it.&lt;br /&gt;&lt;br /&gt;Now let’s talk briefly about native compilation. PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;SQL&lt;/span&gt; is interpreted. Normally it gets compiled down to M-code. The M-code is executed by the PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;SQL&lt;/span&gt; Virtual Machine (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;PVM&lt;/span&gt;). However for speed purposes you can go native. In the Oracle 9i and 10g days, native compilation would transform your PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;SQL&lt;/span&gt; to code in the C programming language. This C code would be compiled by a C compiler on the operating system. The result was a library that could run the code very fast on the machine.&lt;br /&gt;&lt;br /&gt;Things change up a little bit for native compilation in Oracle 11g. But let’s leave that for a future blog post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1869531946041357760?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1869531946041357760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1869531946041357760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1869531946041357760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1869531946041357760'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/sql-review-and-native-compilation.html' title='SQL Review and Native Compilation'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SylX21JYTdI/AAAAAAAABaM/nWN8osC1TVQ/s72-c/Native.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4254846792407534150</id><published>2009-12-11T20:27:00.001-08:00</published><updated>2009-12-11T20:29:03.255-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='problems'/><category scheme='http://www.blogger.com/atom/ns#' term='variable'/><category scheme='http://www.blogger.com/atom/ns#' term='Pro*C'/><category scheme='http://www.blogger.com/atom/ns#' term='DECLARE'/><title type='text'>Pro*C Mystery Revealed</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/SyMbzk_qszI/AAAAAAAABZs/m7IoK9XfEmw/s1600-h/Declaration.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5414201749947462450" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 238px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SyMbzk_qszI/AAAAAAAABZs/m7IoK9XfEmw/s320/Declaration.jpg" border="0" /&gt;&lt;/a&gt;Our customer said there were too many problems with our system. And development was not resolving problems fast enough. The customer shared their concerns with management. Management put the heat on team leads. Now my team lead wants more and more bugs fixed faster. I had to push back and say problems will be resolved when they get resolved. However I did attempt to be diligent in problem resolution. There was one last problem to resolve. The fix sounded simple when I determined the cause. But I was encountering some strange Pro*C behavior. Here is the code I was trying to use:&lt;br /&gt;&lt;br /&gt;void getType(char *pszType)&lt;br /&gt;{&lt;br /&gt;EXEC SQL BEGIN DECLARE SECTION;&lt;br /&gt;            char *pszLocalType = pszType; &lt;br /&gt;END SQL BEGIN DECLARE SECTION;&lt;br /&gt;&lt;br /&gt;EXEC SQL&lt;br /&gt;            SELECT type&lt;br /&gt;            INTO :pszLocalType&lt;br /&gt;            FROM myTable;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;No matter how many times I ran the code, I always ended up with an empty string. However I got an actual value when I ran the SQL manually from SQL*Plus. What gives? Can you spot the problem? It took a while for me to realize what I was doing wrong. The variable into which I was trying to retrieve the data was defined as a pointer to the memory passed into the function. I really needed to have some space defined within the DECLARE section to store the SQL results. Then I could copy the value to the calling function. Here is a slightly updated result that worked:&lt;br /&gt;&lt;br /&gt;void getType(char *pszType)&lt;br /&gt;{&lt;br /&gt;EXEC SQL BEGIN DECLARE SECTION;&lt;br /&gt;            char szLocalType[10+1];           &lt;br /&gt;END SQL BEGIN DECLARE SECTION;&lt;br /&gt;&lt;br /&gt;EXEC SQL&lt;br /&gt;            SELECT type&lt;br /&gt;            INTO :szLocalType&lt;br /&gt;            FROM myTable;&lt;br /&gt;&lt;br /&gt;Strcpy(pszType,szLocalType);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4254846792407534150?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4254846792407534150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4254846792407534150' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4254846792407534150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4254846792407534150'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/proc-mystery-revealed.html' title='Pro*C Mystery Revealed'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SyMbzk_qszI/AAAAAAAABZs/m7IoK9XfEmw/s72-c/Declaration.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2464862321974933872</id><published>2009-12-04T14:32:00.000-08:00</published><updated>2009-12-04T14:37:37.026-08:00</updated><title type='text'>SQL Injection</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SxmOEjqhxdI/AAAAAAAABZU/rdyo5wdnnLk/s1600-h/Injection.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5411512636206597586" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SxmOEjqhxdI/AAAAAAAABZU/rdyo5wdnnLk/s320/Injection.jpg" border="0" /&gt;&lt;/a&gt;SQL injection is an attack whereby the user gets to execute some command via a trick. You can prevent such behavior by using bind variables for arguments to SQL. You should also valid all inputs.&lt;br /&gt;&lt;br /&gt;There are some other techniques which limit the ability for a SQL injection attack. Limit the privs you give to any given user. Also use invoker rights via AUTHID CURRENT_USER to ensure that commands that do get through run at the right priority.&lt;br /&gt;&lt;br /&gt;Limit the number of routines that are exposed in a package specification. This will close the gap that a SQL injection hack can penetrate. Stay away from dynamic SQL. Get rid of debug messages and tracing. You don't want a hacker to know anything about the system you have developed.&lt;br /&gt;&lt;br /&gt;You can employ &lt;a href="http://verifcation-and-validation.blogspot.com/2009/04/fuzzing.html"&gt;fuzzing&lt;/a&gt; to test for SQL injection vulnerabilities. This will not prove you are secure, but can uncover some weaknesses. Test each parameter to your functions separately.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2464862321974933872?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2464862321974933872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2464862321974933872' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2464862321974933872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2464862321974933872'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/sql-injection.html' title='SQL Injection'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SxmOEjqhxdI/AAAAAAAABZU/rdyo5wdnnLk/s72-c/Injection.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2095995071682131128</id><published>2009-12-03T13:47:00.000-08:00</published><updated>2009-12-03T13:52:00.878-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='foreign key'/><category scheme='http://www.blogger.com/atom/ns#' term='delete'/><category scheme='http://www.blogger.com/atom/ns#' term='child records'/><category scheme='http://www.blogger.com/atom/ns#' term='quality assurance'/><title type='text'>Curse of the Trigger</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/Sxgx8k2sHzI/AAAAAAAABZE/xNQACH-c7Pc/s1600-h/Trigger.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5411129869040623410" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 285px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/Sxgx8k2sHzI/AAAAAAAABZE/xNQACH-c7Pc/s320/Trigger.jpg" border="0" /&gt;&lt;/a&gt;A tester found a problem in our application. I traced it back to some test configuration data in the database. That seemed like an easy fix. I wrote a one-time PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; script to delete the test data. I had our &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;DBA&lt;/span&gt; team &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;implement&lt;/span&gt; the fix in the tester's database.&lt;br /&gt;&lt;br /&gt;Luckily our &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DBA&lt;/span&gt; did a little quality assurance himself. He inspected the contents of my script. Then he checked whether the test records got deleted. They did not. It seems a trigger fired and prevent the delete. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Doh&lt;/span&gt;. I should have checked that.&lt;br /&gt;&lt;br /&gt;I like writing PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; code. So I was not worried that the results of promoting my fix were a failure. That just meant I could write more code. I researched the logic of the trigger. Then I added some more code to detect child records of the test data. I wrote code to move those record to depend on another foreign key. Bingo. I even stayed late at work knocking out the updated fix.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2095995071682131128?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2095995071682131128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2095995071682131128' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2095995071682131128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2095995071682131128'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/curse-of-trigger.html' title='Curse of the Trigger'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/Sxgx8k2sHzI/AAAAAAAABZE/xNQACH-c7Pc/s72-c/Trigger.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2430405004616165571</id><published>2009-12-02T19:37:00.001-08:00</published><updated>2009-12-02T19:44:35.422-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='trace'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_HPROF'/><category scheme='http://www.blogger.com/atom/ns#' term='optimize'/><title type='text'>Tracing and Profiling</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5410848946875390770" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 241px; CURSOR: hand; HEIGHT: 184px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SxcycwPN2zI/AAAAAAAABY0/X3zHYXpAKEQ/s320/Trace.jpg" border="0" /&gt;You can employ an Oracle trace to view the execution path of your PL/SQL. This can be enabled either by a session parameter or a compile switch within your code. The data is accessible through some Oracle views. You must run the "tracetab.sql" file in order to set up these views.&lt;br /&gt;&lt;br /&gt;A related topic is that of profiling. This is where you find out which portions of your code get executed the most. You can use this to choose which code you need to optimize. Profiling gets turned on and off with the DBMS_HPROF built in package.&lt;br /&gt;&lt;br /&gt;Just like with trace, you need to run the "dbmshprof.sql" script to set up the tables for profiling. There is even an option to view the profiling output in HTML form. Next time I am going to talk about the hot topic of SQL injection attacks. Until then, be good.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2430405004616165571?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2430405004616165571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2430405004616165571' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2430405004616165571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2430405004616165571'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/tracing-and-profiling.html' title='Tracing and Profiling'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SxcycwPN2zI/AAAAAAAABY0/X3zHYXpAKEQ/s72-c/Trace.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8439506261489925683</id><published>2009-12-01T14:45:00.000-08:00</published><updated>2009-12-01T14:49:59.582-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='USER_SOURCE'/><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_METADATA'/><title type='text'>Use the Source Luke</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5410402672543627538" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 223px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/SxWckKzJeRI/AAAAAAAABYk/h_nrjEbQAIY/s320/Source.gif" border="0" /&gt;PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; starts out as ASCII text files. Then you compile that source code into the database. Once it is there you can inspect what has been compiled. The old school way to do this is to inspect the USER_SOURCE view. Specifically you can query the TEXT column. It has your source code.&lt;br /&gt;&lt;br /&gt;There are more advanced ways to check up on the code in the database. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; Developer tool has a function to search PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; source code. You can also check out the ALL_ARGUMENTS view. It has parameter information for packages.&lt;br /&gt;&lt;br /&gt;One setting that helps control your ability to analyze source code is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;PLSCOPE&lt;/span&gt;_SETTING. This can be set at either the session of system level. This allows you to analyze identifiers. You access this data using views &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_4"&gt;such&lt;/span&gt; as ALL_IDENTIFIERS. Finally there is the DBMS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;METADATA&lt;/span&gt; built in package. You can use it to get object definitions. The output is in &lt;a href="http://xmlhome.blogspot.com/"&gt;XML&lt;/a&gt; format. Enjoy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8439506261489925683?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8439506261489925683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8439506261489925683' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8439506261489925683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8439506261489925683'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/12/use-source-luke.html' title='Use the Source Luke'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/SxWckKzJeRI/AAAAAAAABYk/h_nrjEbQAIY/s72-c/Source.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8650598880187738042</id><published>2009-11-30T13:10:00.001-08:00</published><updated>2009-11-30T13:16:25.156-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL function result cache'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL query result cache'/><title type='text'>Result Cache</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SxQ051DN3uI/AAAAAAAABYM/mAeB_WDDwQc/s1600/Result.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5410007220476567266" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 302px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SxQ051DN3uI/AAAAAAAABYM/mAeB_WDDwQc/s320/Result.jpg" border="0" /&gt;&lt;/a&gt;The result cache is a place in memory where Oracle stores results. Subsequent queries can then obtain these results quickly. This cache encompasses both &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; queries and PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; functions. Note that the cache can become invalid when the source data of the queries changes.&lt;br /&gt;&lt;br /&gt;The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; query result cache is stored in the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SGA&lt;/span&gt;. The results can be from just fragments of a query. You use the hint /*+ result_cache */ to advise Oracle that you would like to make use of the cache. Check out the DBMS_RESULT_CACHE built-in package to clear or inspect the contents of the cache.&lt;br /&gt;&lt;br /&gt;The PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; function result cache stores data across sessions. It also is stored in the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SGA&lt;/span&gt;. When defining a function, use the RELIES_ON clause to identify tables whose changes may invalidate the results of the cache.&lt;br /&gt;&lt;br /&gt;Next time I will start by explaining how you can extract your PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt; source code from the database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8650598880187738042?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8650598880187738042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8650598880187738042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8650598880187738042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8650598880187738042'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/result-cache.html' title='Result Cache'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SxQ051DN3uI/AAAAAAAABYM/mAeB_WDDwQc/s72-c/Result.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-545268003090106849</id><published>2009-11-23T22:47:00.000-08:00</published><updated>2009-11-23T22:51:58.777-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='package'/><category scheme='http://www.blogger.com/atom/ns#' term='lookup'/><category scheme='http://www.blogger.com/atom/ns#' term='business logic'/><category scheme='http://www.blogger.com/atom/ns#' term='fast'/><title type='text'>Keeping It Simple</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5407558275687229762" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 292px; CURSOR: hand; HEIGHT: 281px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SwuBmeyPqUI/AAAAAAAABX0/t1pTmNfSgm4/s320/Simple.gif" border="0" /&gt;My boss told me to help another team out on our project. They are behind schedule. And just recently, a review of their code showed they were missing some important stuff. Their team was clueless about this. Since I knew what was going on, I decided to help.&lt;br /&gt;&lt;br /&gt;First I helped out requirement team figure out what changes needed to be made. Then I went into design mode. The existing code in a PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; package that &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;implements&lt;/span&gt; a ton of business logic. We needed to store parameters for the logic in the database instead of hard coding a lot of the values.&lt;br /&gt;&lt;br /&gt;How does one get this done? This package gets called a lot. In other words, it needs to be fast. I can't have the code look up the values each time it needs them. I could be fancy and have the package load the values on initialization. But I want to make this simple as possible.&lt;br /&gt;&lt;br /&gt;Therefore I created a new record type that stores all the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;lookup&lt;/span&gt; values. Then I created a new procedure which loads the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;lookup&lt;/span&gt; values from the database. Then I pass this record around to the different functions that need the values. This should be simple enough for any developer to follow. I just want to code the stuff. I don't want to inherit another team's code. Good enough for now. The real fun comes when I need to thoroughly &lt;a href="http://verifcation-and-validation.blogspot.com/"&gt;test&lt;/a&gt; this stuff.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-545268003090106849?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/545268003090106849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=545268003090106849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/545268003090106849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/545268003090106849'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/keeping-it-simple.html' title='Keeping It Simple'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SwuBmeyPqUI/AAAAAAAABX0/t1pTmNfSgm4/s72-c/Simple.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-118064600658799703</id><published>2009-11-20T13:34:00.000-08:00</published><updated>2009-11-20T13:41:31.435-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BULK COLLECT'/><category scheme='http://www.blogger.com/atom/ns#' term='short circuit'/><category scheme='http://www.blogger.com/atom/ns#' term='engine'/><category scheme='http://www.blogger.com/atom/ns#' term='FORALL'/><category scheme='http://www.blogger.com/atom/ns#' term='inline'/><title type='text'>Bulk Binding and other Tuning Tricks</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/SwcLsH6mAAI/AAAAAAAABXs/VxnvjbO254s/s1600/Binding.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5406302730348527618" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 240px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/SwcLsH6mAAI/AAAAAAAABXs/VxnvjbO254s/s320/Binding.jpg" border="0" /&gt;&lt;/a&gt;As promised, here is a discussion on bulk binding and other misc performance tuning tips. The goal of bulk binding is to reduce the amount of times Oracle has to do a context switch between the PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; engines.&lt;br /&gt;&lt;br /&gt;There are two directions that bulk binding operates in. The first is when you want to put the data from a collection into the database. To do this you employ the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;FORALL&lt;/span&gt; statement. It will make the whole collection of elements be transferred to the database with one &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; context switch.&lt;br /&gt;&lt;br /&gt;The converse bulk binding technique is when you have data in the database you want to extract into a collection. This is where you use BULK COLLECT INTO a collection. Again the PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; engine only has to make one switch to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; engine.&lt;br /&gt;&lt;br /&gt;Here are some other ways to make PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt; run fast. Take advantage of the short circuit evaluation of expressions. If you know one part of an IF statement is sufficient for the whole decision, and this part occurs often, put that as the first check in your IF statement. Oracle will skip the rest of the checks for you. Another feature you can enable is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;inline&lt;/span&gt; subroutines. Instead of having your code jump to a separate subroutine, Oracle can place the full code of the subroutine right in your function/procedure. This can be controlled globally with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;PLSQL&lt;/span&gt;_OPTIMIZE_LEVEL parameter, or done a line at a time with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;PRAGMA&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;INLINE&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-118064600658799703?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/118064600658799703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=118064600658799703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/118064600658799703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/118064600658799703'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/bulk-binding-and-other-tuning-tricks.html' title='Bulk Binding and other Tuning Tricks'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/SwcLsH6mAAI/AAAAAAAABXs/VxnvjbO254s/s72-c/Binding.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5536751152719035567</id><published>2009-11-19T22:25:00.000-08:00</published><updated>2009-11-19T22:30:20.307-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PLS_INTEGER'/><category scheme='http://www.blogger.com/atom/ns#' term='SIMPLE_INTEGER'/><category scheme='http://www.blogger.com/atom/ns#' term='data sets'/><title type='text'>Tuning Tips</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SwY2g9D7WOI/AAAAAAAABXU/4ZwJ3-B9D1s/s1600/Tuning.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5406068342479608034" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 231px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SwY2g9D7WOI/AAAAAAAABXU/4ZwJ3-B9D1s/s320/Tuning.jpg" border="0" /&gt;&lt;/a&gt;Here are some good tips to make your PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; fast. Do not rely on implicit data type conversions. Also choose the smallest data type that will fit your data. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;PLS&lt;/span&gt;_INTEGER data type is good. The SIMPLE_INTEGER type is better. Smaller types are better.&lt;br /&gt;&lt;br /&gt;You should code less code per module for a small gain. The big boost will come from using a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; statement to do the work instead of a whole procedure worth of PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt;. I struggle with this. Our data sets are huge. I am sometimes afraid to do something huge with one &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; statement. The thing may never complete. Or it may bomb in the middle and get rolled back. At least my PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; routines can commit often and avoid redoing work on errors.&lt;br /&gt;&lt;br /&gt;I thought I could fit all of this into one post. But I have more to say. Look for me to cover bulk binding next time, along with some other misc tips.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5536751152719035567?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5536751152719035567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5536751152719035567' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5536751152719035567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5536751152719035567'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/tuning-tips.html' title='Tuning Tips'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SwY2g9D7WOI/AAAAAAAABXU/4ZwJ3-B9D1s/s72-c/Tuning.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1993742907738151547</id><published>2009-11-19T22:19:00.000-08:00</published><updated>2009-11-19T22:23:37.709-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='production'/><category scheme='http://www.blogger.com/atom/ns#' term='SYSTEM'/><category scheme='http://www.blogger.com/atom/ns#' term='run time'/><title type='text'>Interpreted and Native Compilation</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/SwY1JtZO2yI/AAAAAAAABXM/ZVODn-2FX8Y/s1600/Compilation.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5406066843625380642" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 311px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/SwY1JtZO2yI/AAAAAAAABXM/ZVODn-2FX8Y/s320/Compilation.jpg" border="0" /&gt;&lt;/a&gt;There are two types of PL/SQL compilation. The first is interpreted compilation, which is the default. Interpreted compilation is done at run time. It is good for development.&lt;br /&gt;&lt;br /&gt;The other type of compilation is native compilation. It has better performance. Therefore it is better suited for a production setting. Compiled code is stored in the SYSTEM schema. You can enable this by setting PLSQL_CODE_TYPE to NATIVE on a session or system level.&lt;br /&gt;&lt;br /&gt;Next time I will review some PL/SQL tuning techniques.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1993742907738151547?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1993742907738151547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1993742907738151547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1993742907738151547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1993742907738151547'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/interpreted-and-native-compilation.html' title='Interpreted and Native Compilation'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/SwY1JtZO2yI/AAAAAAAABXM/ZVODn-2FX8Y/s72-c/Compilation.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1145601631359404997</id><published>2009-11-17T20:22:00.000-08:00</published><updated>2009-11-17T20:29:10.728-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SECUREFILE'/><category scheme='http://www.blogger.com/atom/ns#' term='migration'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='deduplication'/><title type='text'>LOBs</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5405294479341601810" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 218px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SwN2sMOJRBI/AAAAAAAABW0/7CfBjj7kO4g/s320/LOB.jpg" border="0" /&gt;The plain old LOB is a new data type for the Oracle 11g database. It supports compression of the data. And it sports better performance. You get a LOB column when you define a column with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SECUREFILE&lt;/span&gt; keyword.&lt;br /&gt;&lt;br /&gt;Even with compression, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;LOBs&lt;/span&gt; may take up a lot of space. That is why Oracle has a feature called &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;deduplication&lt;/span&gt;. This will detect when there is more than one copy of a LOB in the database. It will then cause these to reference just one copy of the LOB. You enable this feature by modifying the column using the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DEDUPLICATE&lt;/span&gt; LOB keywords.&lt;br /&gt;&lt;br /&gt;Oracle now provides encryption which is done at the block level. You get to choose your encryption algorithm such as 3DES or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;AES&lt;/span&gt;. Note that you can specify the key length of the encryption (128, 192, or 256 bits). You enable encryption on a column by modifying it and using the ENCRYPT USING keywords.&lt;br /&gt;&lt;br /&gt;There is a promotion strategy to get old large object to use the new Oracle 11g type. This option allows the table with the old types to be available while the promotion is taking place. The promotion is accomplished with calls to the DBMS_REDEFINITION built in package.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1145601631359404997?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1145601631359404997/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1145601631359404997' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1145601631359404997'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1145601631359404997'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/lobs_17.html' title='LOBs'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SwN2sMOJRBI/AAAAAAAABW0/7CfBjj7kO4g/s72-c/LOB.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6486966562144331915</id><published>2009-11-11T12:32:00.000-08:00</published><updated>2009-11-11T12:33:14.248-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SELECT'/><category scheme='http://www.blogger.com/atom/ns#' term='default'/><category scheme='http://www.blogger.com/atom/ns#' term='type'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='column'/><category scheme='http://www.blogger.com/atom/ns#' term='NULL'/><title type='text'>ORA-01403 Even With NVL</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/Svsfa0cA9xI/AAAAAAAABWs/gU0W8G70HB8/s1600-h/Data.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5402946723574249234" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 239px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/Svsfa0cA9xI/AAAAAAAABWs/gU0W8G70HB8/s320/Data.jpg" border="0" /&gt;&lt;/a&gt;It was the night before the big release to our customer. Our internal test team was still finding some bugs in our software. Ouch that’s painful. One such error being reported was an ORA-01403 when they brought up a new screen. This was perplexing. I thought every single column in the SELECT statement was wrapped with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;NVL&lt;/span&gt; function. And I knew there was a record in the database that we were selecting from. What the heck was going on?&lt;br /&gt;&lt;br /&gt;Well the best way to debug weird bugs like this is to try things out. I knew there were some NULL column values in the record the testers were selecting. So I updated some test data and filled in some values. The problem went away. Was I losing my mind? Or perhaps the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;NVL&lt;/span&gt; was broken. I did not really write this code from scratch. I copy and pasted it from another application. It should have worked.&lt;br /&gt;&lt;br /&gt;That’s when it hit me. The guilty column was defined as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;evilCol&lt;/span&gt; CHAR(1). However the column being selected was written as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;NVL&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;evilCol&lt;/span&gt;, ‘NA’). Do you see the problem? The default for NULL values of the column was one which was too large to fit in the column given its definition. Oracle won’t replace a NULL with something that is too large to fit in the source column. Thus I got a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; warning that we had a NULL issue.&lt;br /&gt;&lt;br /&gt;Here is the real shame about this bug. I had previously fixed a bad &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;NVL&lt;/span&gt; default for another column being selected in this &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQL&lt;/span&gt; statement. However I did not go through every column to check whether there were other bad defaults. Shame on me. Luckily I went through all the column and their &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;NVL&lt;/span&gt; defaults this time. The hard lesson was learned. Be careful of the size (and type) of defaults you return using the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;NVL&lt;/span&gt; function. They might not match the column type you are selecting from.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6486966562144331915?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6486966562144331915/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6486966562144331915' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6486966562144331915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6486966562144331915'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/ora-01403-even-with-nvl.html' title='ORA-01403 Even With NVL'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/Svsfa0cA9xI/AAAAAAAABWs/gU0W8G70HB8/s72-c/Data.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8674567081688190271</id><published>2009-11-10T16:58:00.000-08:00</published><updated>2009-11-10T16:59:13.760-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DAO'/><category scheme='http://www.blogger.com/atom/ns#' term='EF'/><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='POCO'/><category scheme='http://www.blogger.com/atom/ns#' term='DTO'/><category scheme='http://www.blogger.com/atom/ns#' term='ADO'/><category scheme='http://www.blogger.com/atom/ns#' term='POJO'/><category scheme='http://www.blogger.com/atom/ns#' term='VO'/><category scheme='http://www.blogger.com/atom/ns#' term='ORM'/><title type='text'>The Microsoft Connection</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SvoMOXh9E6I/AAAAAAAABWc/_pupmpEc5GQ/s1600-h/Microsoft.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5402644143958463394" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 214px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SvoMOXh9E6I/AAAAAAAABWc/_pupmpEc5GQ/s320/Microsoft.jpg" border="0" /&gt;&lt;/a&gt;I used to be an exclusive Microsoft developer. That meant I normally interacted with Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Server. Yes I know. It is sacrilege. Just recently I subscribed to the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;MSDN&lt;/span&gt; magazine to read up on the latest Microsoft technologies. There were a lot of articles that referenced programming &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;APIs&lt;/span&gt; to access databases. I thought I would share some of them here to mix things up.&lt;br /&gt;&lt;br /&gt;The first topic is ADO.NET. We use it in some of the newer applications in our system. This is included with the .NET framework from Microsoft. It is used to access a relational database like Oracle. The technology started as an evolution of Active X Data Objects (ADO) from Microsoft. A data provider provides access to a data source. In the case of Oracle, the data provider is the Oracle Data Provider for .NET.&lt;br /&gt;&lt;br /&gt;A related topic is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;EF&lt;/span&gt;, which stands for Entity Framework. That is short for the ADO.NET Entity Framework. This is a set of data access &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;APIs&lt;/span&gt;. It is similar to the Java Persistence &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;API&lt;/span&gt;. An entity has a primary key. An entity data model maps data to a database schema. The programmer then uses either Entity &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt; or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;LINQ&lt;/span&gt; to Entities to access the entity data model. This abstraction allows the programmer to access the data independent of where the data is actually stored.&lt;br /&gt;&lt;br /&gt;Next we have &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;DTO&lt;/span&gt;, which stands for Data Transfer Objects. These were previously called &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;VO&lt;/span&gt;, or Value Objects. They implement a simple design pattern. They are used with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;DAO&lt;/span&gt;, which is short for Data Access Objects, another Microsoft technology. The main idea behind &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;DTO&lt;/span&gt; is that they just provide &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;accessors&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;mutators&lt;/span&gt;. There is no functionality provided other than get and set.&lt;br /&gt;&lt;br /&gt;Finally we have &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;POCO&lt;/span&gt;, which stands for Plain Old &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;CLR&lt;/span&gt; Objects. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;CLR&lt;/span&gt; is the Common Language &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_17"&gt;Run time&lt;/span&gt; from Microsoft. This term is a play on &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;POJO&lt;/span&gt;, or Plain Old Java Objects. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;POCO&lt;/span&gt; pokes fun at the complexity of accessing data using Java. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;POCO&lt;/span&gt; are simple access objects compared to hard to use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;ORM&lt;/span&gt; objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8674567081688190271?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8674567081688190271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8674567081688190271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8674567081688190271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8674567081688190271'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/microsoft-connection.html' title='The Microsoft Connection'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SvoMOXh9E6I/AAAAAAAABWc/_pupmpEc5GQ/s72-c/Microsoft.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1948848617577382317</id><published>2009-11-02T21:37:00.000-08:00</published><updated>2009-11-02T21:41:52.548-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBMS_LOB'/><category scheme='http://www.blogger.com/atom/ns#' term='LONG'/><category scheme='http://www.blogger.com/atom/ns#' term='BFILENAME'/><category scheme='http://www.blogger.com/atom/ns#' term='BFILE'/><title type='text'>LOBs</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5399747446326872786" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 229px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/Su_BsX8iytI/AAAAAAAABWE/reKE7jpeFWU/s320/LOB.jpg" border="0" /&gt;I want to start by talking about the LONG data type in Oracle. You can have at most one column of type LONG per table. This data is stored &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;inline&lt;/span&gt; (which means it is in the table, not referenced by the table). This column can store up to 2G of data.&lt;br /&gt;&lt;br /&gt;A LOB is a large unstructured data type. An example of a LOB is an image. Use the DBMS_LOB built-in package to deal with this data type.&lt;br /&gt;&lt;br /&gt;A related data type is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;BFILE&lt;/span&gt;. This represents an external LOB. You initialize columns of type &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;BFILE&lt;/span&gt; using the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;BFILENAME&lt;/span&gt; function to point to the actual file that is backed by the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;BFILE&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Finally let me mention temporary &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;LOBs&lt;/span&gt;. They last as long as your session. These types of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;LOBs&lt;/span&gt; are not associated with tables. They are good for transforming data. Next time I will continue to discuss &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;LOBs&lt;/span&gt;, with emphasis on performance and encryption.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1948848617577382317?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1948848617577382317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1948848617577382317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1948848617577382317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1948848617577382317'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/11/lobs.html' title='LOBs'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/Su_BsX8iytI/AAAAAAAABWE/reKE7jpeFWU/s72-c/LOB.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-7357781269581860773</id><published>2009-10-31T09:17:00.000-07:00</published><updated>2009-10-31T09:27:03.918-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='policy'/><category scheme='http://www.blogger.com/atom/ns#' term='FGA'/><category scheme='http://www.blogger.com/atom/ns#' term='application context'/><title type='text'>Fine Grained Access</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/SuxkD6EOrxI/AAAAAAAABV8/ZqUoNwVVZek/s1600-h/FGA.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5398800071599763218" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 314px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/SuxkD6EOrxI/AAAAAAAABV8/ZqUoNwVVZek/s320/FGA.gif" border="0" /&gt;&lt;/a&gt;Oracle allows you to set general access to functions in the database. You can also take the access &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;privs&lt;/span&gt; down to the table level. This is fine grained &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;access&lt;/span&gt; (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;FGA&lt;/span&gt;). When it is in place, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; statements get dynamically modified to restrict the results.&lt;br /&gt;&lt;br /&gt;Setting up conditional access requires the use of an application context and policy. The application context is a pair of attribute and value pairs. These can be set with the SET_CONTEXT procedure of the DBMS_SESSION package. You then define a policy on a table using the DBMS_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RLS&lt;/span&gt; package. The policy grants or revokes access to table data based on one or more attributes of the application context.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-7357781269581860773?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/7357781269581860773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=7357781269581860773' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7357781269581860773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/7357781269581860773'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/fine-grained-access.html' title='Fine Grained Access'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/SuxkD6EOrxI/AAAAAAAABV8/ZqUoNwVVZek/s72-c/FGA.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4230180736118320996</id><published>2009-10-29T15:19:00.000-07:00</published><updated>2009-10-29T15:26:42.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='packages'/><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='dependency'/><category scheme='http://www.blogger.com/atom/ns#' term='types'/><category scheme='http://www.blogger.com/atom/ns#' term='EXECUTE'/><category scheme='http://www.blogger.com/atom/ns#' term='DML'/><title type='text'>On Packages</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/SuoVCH37mJI/AAAAAAAABVs/xY-3hM5nlSE/s1600-h/Packages.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5398150229574523026" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 316px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/SuoVCH37mJI/AAAAAAAABVs/xY-3hM5nlSE/s320/Packages.jpg" border="0" /&gt;&lt;/a&gt;How do you test a &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;function&lt;/span&gt; from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt;*Plus command line? Well first you must define a variable. Then you can run the function, assigning its value to the variable as such:&lt;br /&gt;&lt;br /&gt;EXECUTE :my_var := my_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;proc&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;param&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;Note the semicolon in front of the variable name. When writing the function, you must remember that you can only use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; types. They cannot be PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; specific types. You must also use positional notation for parameters. Finally you must be logged in as the owner, or be granted EXECUTE &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;privilege&lt;/span&gt; on the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;function&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Here is a rule that is not specific to calling functions from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;SQL&lt;/span&gt;*Plus. The functions called from the SELECT statement are not allowed to do any &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;DML&lt;/span&gt;. That includes anything called by the function, including triggers. This is just like another rule enforced by Oracle. You cannot query the table that is changing in an UPDATE/DELETE statement.&lt;br /&gt;&lt;br /&gt;Now let's talk a little more about variables. A package body can have its own variables. These are private to the package. Variables exported in the specification are automatically initialized to NULL by Oracle.&lt;br /&gt;&lt;br /&gt;I will end with dependencies. Suppose procedure A depends on procedure B. Also assume that procedure B depends on &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_10"&gt;procedure&lt;/span&gt; C. Then we say that procedure A indirectly depends on procedure C. You can use "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;utldtree&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;sql&lt;/span&gt;" to set up the environment to trace dependencies.&lt;br /&gt;&lt;br /&gt;There is still a lot more to learn before I become an Oracle Certified Professional. Come along as I bring you on my journey.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4230180736118320996?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4230180736118320996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4230180736118320996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4230180736118320996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4230180736118320996'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/on-packages.html' title='On Packages'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/SuoVCH37mJI/AAAAAAAABVs/xY-3hM5nlSE/s72-c/Packages.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6226440382067353870</id><published>2009-10-24T10:34:00.000-07:00</published><updated>2009-10-24T10:40:16.186-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='subtypes'/><category scheme='http://www.blogger.com/atom/ns#' term='FOR LOOP'/><category scheme='http://www.blogger.com/atom/ns#' term='REF CURSOR'/><title type='text'>All About Cursors</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/SuM7YOLecPI/AAAAAAAABVU/Choutr-qlsg/s1600-h/Cursor.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5396222065829114098" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 189px; CURSOR: hand; HEIGHT: 193px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/SuM7YOLecPI/AAAAAAAABVU/Choutr-qlsg/s320/Cursor.JPG" border="0" /&gt;&lt;/a&gt;I am trying to study up to be an Oracle Certified Professional. It is difficult with all the craziness at work these days. To tell the truth, I am also finding that just reading training materials is not enough. I am not learning that much. It might be time to attend some more in person training.&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;On to the subject for today. That is cursors. You can use a FOR LOOP to make cursor use really easy. However if you do not, and make use of explicit cursors, just make sure you close your cursors when you are done with them.&lt;br /&gt;&lt;br /&gt;There are two type of REF &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CURSORs&lt;/span&gt;. These are the strong and weak cursors. Strong cursors return a specific type. Weak cursors can be used with any query. Both REF CURSOR types can be passed to &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;functions&lt;/span&gt; and procedures. You can think of the cursor as a pointer.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Let me close by briefly mentioning subtypes. A subtype is a subset of an existing type with some constraints applied. It can be used any place the more general type is it based on can be used. Here is an example of a subtype:&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;SUBTYPE small_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;num&lt;/span&gt;_type IS NUMBER(4) NOT NULL;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6226440382067353870?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6226440382067353870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6226440382067353870' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6226440382067353870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6226440382067353870'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/all-about-cursors.html' title='All About Cursors'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/SuM7YOLecPI/AAAAAAAABVU/Choutr-qlsg/s72-c/Cursor.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5416176599835486313</id><published>2009-10-20T19:16:00.001-07:00</published><updated>2009-10-20T19:22:20.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='nested table'/><category scheme='http://www.blogger.com/atom/ns#' term='VARRAY'/><category scheme='http://www.blogger.com/atom/ns#' term='associative array'/><title type='text'>Types of Collections</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/St5u_DvasVI/AAAAAAAABUs/xWST3ADZE8A/s1600-h/Array.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5394871433251434834" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 240px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/St5u_DvasVI/AAAAAAAABUs/xWST3ADZE8A/s320/Array.jpg" border="0" /&gt;&lt;/a&gt;I continue to read up on advanced PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; features. This is to get to the next level of Oracle certification. A recent chapter I read was about collections. These includes associative arrays, nested tables, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;varrays&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;An associative array is faster than a database table. You create one define as a TABLE OF &lt;type&gt; INDEXED BY &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;PLS&lt;/span&gt;_INTEGER. You can loop through it with the FIRST and NEXT functions. Access individual records and column like this: my_var(i).my_field.&lt;br /&gt;&lt;br /&gt;A nested table is a table within a table. This does seem a bit weird at first. You make a column in the outer table of type TABLE OF &lt;type&gt;. The outer table must be created with the NESTED TABLE keyword. You can insert many records in the sub table. This is done at the time of inserting recording in the outer table.&lt;br /&gt;&lt;br /&gt;Finally a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;VARRAY&lt;/span&gt; is created in a two stage process. First you define a type such as CREATE TYPE m_type AS &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;VARRAY&lt;/span&gt;(10) OF &lt;type&gt;. Then you can create a table with a column of your newly defined &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;VARRAY&lt;/span&gt; type.&lt;br /&gt;&lt;br /&gt;There are a couple ways to set the data in these collections. You can use a constructor. Maybe I will give you an example of that later. You can also get the data from the database. Finally you can assign one collection to another one.&lt;br /&gt;&lt;br /&gt;Get ready as next time I am going to cover cursors. This includes &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;REFCURSORS&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5416176599835486313?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5416176599835486313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5416176599835486313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5416176599835486313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5416176599835486313'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/types-of-collections.html' title='Types of Collections'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/St5u_DvasVI/AAAAAAAABUs/xWST3ADZE8A/s72-c/Array.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6357695479659403769</id><published>2009-10-12T22:56:00.001-07:00</published><updated>2009-10-12T23:00:43.069-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='callout'/><category scheme='http://www.blogger.com/atom/ns#' term='extproc'/><category scheme='http://www.blogger.com/atom/ns#' term='callback'/><category scheme='http://www.blogger.com/atom/ns#' term='loadjava'/><category scheme='http://www.blogger.com/atom/ns#' term='listener'/><title type='text'>Java and C Integration with Oracle</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/StQWjP4O6ZI/AAAAAAAABUU/HphRbIaZA2k/s1600-h/Java.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5391959448682949010" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 301px; CURSOR: hand; HEIGHT: 301px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/StQWjP4O6ZI/AAAAAAAABUU/HphRbIaZA2k/s320/Java.jpg" border="0" /&gt;&lt;/a&gt;I am brushing up to eventually take the exams to become an Oracle Certified Professional. One thing I need to learn is the techniques to mix C and Java code with my PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;There are two ways a cross language call can go. One is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;callout&lt;/span&gt;, where PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; calls with a C or Java function. The converse is the callback, where C/Java calls PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;An &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;extproc&lt;/span&gt; is one process per session that manages such calls. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;extproc&lt;/span&gt; needs to be configured with the listener for it all to work correctly. I am just speaking at a high level now and will not delve into the details.&lt;br /&gt;&lt;br /&gt;Let me briefly focus on Java here as it seems to be more popular. Java is stored and runs in the Oracle database. You use the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;loadjava&lt;/span&gt; command at the operating system level. You can specify either the Java class or source file with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;loadjava&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Next time I will briefly review good stuff like associative arrays, nested tables, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;varrays&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6357695479659403769?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6357695479659403769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6357695479659403769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6357695479659403769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6357695479659403769'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/java-and-c-integration-with-oracle.html' title='Java and C Integration with Oracle'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/StQWjP4O6ZI/AAAAAAAABUU/HphRbIaZA2k/s72-c/Java.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2252377090593128727</id><published>2009-10-09T20:42:00.001-07:00</published><updated>2009-10-09T20:46:43.643-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='views'/><category scheme='http://www.blogger.com/atom/ns#' term='tables'/><category scheme='http://www.blogger.com/atom/ns#' term='refresh'/><title type='text'>Materialized View</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/StACmniLMRI/AAAAAAAABT0/eua7NrDeW1o/s1600-h/Snapshot.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5390811616433090834" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 202px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/StACmniLMRI/AAAAAAAABT0/eua7NrDeW1o/s320/Snapshot.jpg" border="0" /&gt;&lt;/a&gt;The final topic I read about in my Oracle 11g book was materialized views. These were originally referred to as snapshots. They improve performance. They are like views in that they are built using a query of one or more tables. However they retain the query results from a specific moment in time. Unlike normal views, they do not get refreshed automatically every time you access the view.&lt;br /&gt;&lt;br /&gt;We use materialized views on my project. There is a lot of data to roll up that our applications cannot do in real time. However the customers do not need an up to the minute accurate &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;rollup&lt;/span&gt;. They want a reasonable approximation. Therefore we have two separate &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;materialized&lt;/span&gt; views. The &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;application&lt;/span&gt; will use one or the other, depending on which one is fresher. We alternate refreshing these two materialized views twice a day. It really works.&lt;br /&gt;&lt;br /&gt;I am contemplating going for my Oracle Certified Professional certification. That will require a lot of learning. Specifically I want to be certified in Advanced PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt;. So I will be sharing what I learn with you.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2252377090593128727?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2252377090593128727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2252377090593128727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2252377090593128727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2252377090593128727'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/materialized-view.html' title='Materialized View'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/StACmniLMRI/AAAAAAAABT0/eua7NrDeW1o/s72-c/Snapshot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6595786772042705012</id><published>2009-10-08T16:29:00.000-07:00</published><updated>2009-10-08T16:35:14.922-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='range partitioning'/><category scheme='http://www.blogger.com/atom/ns#' term='RAC'/><title type='text'>ASM and Partitioning</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/Ss52OysKjEI/AAAAAAAABTc/mPE3MFDt2XY/s1600-h/ASM.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5390375800506321986" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 283px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/Ss52OysKjEI/AAAAAAAABTc/mPE3MFDt2XY/s320/ASM.jpg" border="0" /&gt;&lt;/a&gt;I have to confess that I skipped a lot of chapter in the last Oracle 11g book that I read. This is because I am not a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;DBA&lt;/span&gt;. Most topics I defer to our actual &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;DBA&lt;/span&gt; team. But it is good to know a thing or two about Oracle database internals.&lt;br /&gt;&lt;br /&gt;One example is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ASM&lt;/span&gt;. It stands for Automatic Storage Management. This is a file and disk manager for Oracle files. Note that you don't need Real Application Clusters (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;RAC&lt;/span&gt;) to take advantage of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;ASM&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Partitioning is not a new topic. We have been using table partitioning in my project for many years now. This is the process of breaking a table into smaller chunks to improve performance. There are difference types of partitioning such as range, list, hash, composite, reference, and more.&lt;br /&gt;&lt;br /&gt;Range &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;partitioning&lt;/span&gt; is where you choose a column, and the values in the column determine which partition the records are placed. You define a range of values that the column takes on for each partition.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6595786772042705012?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6595786772042705012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6595786772042705012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6595786772042705012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6595786772042705012'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/asm-and-partitioning.html' title='ASM and Partitioning'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/Ss52OysKjEI/AAAAAAAABTc/mPE3MFDt2XY/s72-c/ASM.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-6658201428957982035</id><published>2009-10-07T17:00:00.000-07:00</published><updated>2009-10-07T17:07:58.724-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DBA'/><category scheme='http://www.blogger.com/atom/ns#' term='SYSTEM'/><category scheme='http://www.blogger.com/atom/ns#' term='sys'/><category scheme='http://www.blogger.com/atom/ns#' term='streams'/><category scheme='http://www.blogger.com/atom/ns#' term='sysdba'/><title type='text'>Important Users</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/Ss0sbUhAaBI/AAAAAAAABTE/gn3CKO-c3Z4/s1600-h/SysDBA.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5390013176907589650" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 173px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/Ss0sbUhAaBI/AAAAAAAABTE/gn3CKO-c3Z4/s320/SysDBA.jpg" border="0" /&gt;&lt;/a&gt;I am not a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;DBA&lt;/span&gt;. So I have never logged into a database as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SYS&lt;/span&gt; or SYSTEM. And I probably never will. That does not mean I should not know anything about them.&lt;br /&gt;&lt;br /&gt;In Oracle 11g, both the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SYS&lt;/span&gt; and SYSTEM accounts have the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DBA&lt;/span&gt; role. In addition, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SYS&lt;/span&gt; has the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SYSDBA&lt;/span&gt; role. Did that help you? Me neither. Time to get certified as an Oracle &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;DBA&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Here is something I can relate to. Oracle 11g has a technology called streams. This is used to replicate data. You have the database data in a server and it needs to get into another remote location. Stream it over there. Obviously there is more to it than that. But this is the idea.&lt;br /&gt;&lt;br /&gt;Another area of weakness in my Oracle knowledge is shared server processes. Oracle &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;recommends&lt;/span&gt; that you have one shared server process for every 10 connections into the database. We have a lot of users (connections). Therefore we will most likely want a lot of shared server processes. Luckily we have a lot of hardware to back the database.&lt;br /&gt;&lt;br /&gt;Next time I will provide an overview of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;ASM&lt;/span&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-6658201428957982035?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/6658201428957982035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=6658201428957982035' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6658201428957982035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/6658201428957982035'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/important-users.html' title='Important Users'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/Ss0sbUhAaBI/AAAAAAAABTE/gn3CKO-c3Z4/s72-c/SysDBA.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-3911998312676238929</id><published>2009-10-06T21:00:00.000-07:00</published><updated>2009-10-06T21:05:49.623-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HAVING'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle expert'/><category scheme='http://www.blogger.com/atom/ns#' term='GROUP BY'/><category scheme='http://www.blogger.com/atom/ns#' term='candidates'/><title type='text'>Passing My Test</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/SswSyi39g1I/AAAAAAAABSs/yEwSpnhiVhM/s1600-h/Test.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5389703513619923794" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 228px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SswSyi39g1I/AAAAAAAABSs/yEwSpnhiVhM/s320/Test.jpg" border="0" /&gt;&lt;/a&gt;We interview a lot of candidates for developer positions at my company. I only look for three technical &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;competencies&lt;/span&gt;: C++ programming, Windows framework programming, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; skills. Let me focus a little on the third trait.&lt;br /&gt;&lt;br /&gt;Now I don't need an Oracle expert for my team. We already have that. But I do need somebody who knows how to construct basic &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; statements. I need to see evidence of hands-on experience in this area. So I asked about the clauses in a SELECT statement.&lt;br /&gt;&lt;br /&gt;I want to hear that a candidate knows that GROUP BY treats the rows selected as one record or group. I also get impressed if the candidate can explain that HAVING restricts the results of GROUP BY.&lt;br /&gt;&lt;br /&gt;With that I have given away one third of the keys to our kingdom. Study up your C++ and Microsoft Foundation Classes programming, and you have yourself a job.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-3911998312676238929?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/3911998312676238929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=3911998312676238929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3911998312676238929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/3911998312676238929'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/passing-my-test.html' title='Passing My Test'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SswSyi39g1I/AAAAAAAABSs/yEwSpnhiVhM/s72-c/Test.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1695819157098269404</id><published>2009-10-05T21:52:00.000-07:00</published><updated>2009-10-05T21:56:39.825-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='schema'/><category scheme='http://www.blogger.com/atom/ns#' term='user'/><category scheme='http://www.blogger.com/atom/ns#' term='triggers'/><category scheme='http://www.blogger.com/atom/ns#' term='OCP'/><category scheme='http://www.blogger.com/atom/ns#' term='account'/><title type='text'>Oracle Certified Professional</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_7RXOll2bOJs/SsrNRWYmsWI/AAAAAAAABSU/FMnd5QQ0lfE/s1600-h/Certification.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5389345602052469090" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 214px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/SsrNRWYmsWI/AAAAAAAABSU/FMnd5QQ0lfE/s320/Certification.jpg" border="0" /&gt;&lt;/a&gt;Today I started reading up to study to be an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;OCP&lt;/span&gt;. My plan is to be an Oracle Certified Profession in PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; programming. I read the first and second chapters in the Oracle training for this exam. I will be sharing what I learned later.&lt;br /&gt;&lt;br /&gt;For now I continue discussing some things I learned reading a book on Oracle 11g. Triggers are associated with a single table. The trigger gets dropped automatically if the table is dropped.&lt;br /&gt;&lt;br /&gt;An Oracle user have some other names. It is called an account. It is also called a schema. This means the user has a password for authentication. The user potentially owns some database tables, as well as other database objects.&lt;br /&gt;&lt;br /&gt;Next time I will discuss some standard power user accounts in Oracle, as well as the clauses in a SELECT statement.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1695819157098269404?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1695819157098269404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1695819157098269404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1695819157098269404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1695819157098269404'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/oracle-certified-professional.html' title='Oracle Certified Professional'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/SsrNRWYmsWI/AAAAAAAABSU/FMnd5QQ0lfE/s72-c/Certification.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-556428481598435184</id><published>2009-10-04T06:48:00.000-07:00</published><updated>2009-10-04T06:53:20.529-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='db writer'/><category scheme='http://www.blogger.com/atom/ns#' term='log writer'/><category scheme='http://www.blogger.com/atom/ns#' term='archiver'/><category scheme='http://www.blogger.com/atom/ns#' term='redo logs'/><title type='text'>11g Background Processes</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/Ssin6VozaII/AAAAAAAABR0/UCmq3r0XhL4/s1600-h/Oracle.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5388741574831335554" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 234px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/Ssin6VozaII/AAAAAAAABR0/UCmq3r0XhL4/s320/Oracle.JPG" border="0" /&gt;&lt;/a&gt;The Oracle 11g database has familiar processes running in the background. Most of these processes were there in prior version of the database. However it seems like there are new names for these well known processes. Let's go over them.&lt;br /&gt;&lt;br /&gt;There is the database writer called &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;dbw&lt;/span&gt;0. Previously this was known as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;dbwr&lt;/span&gt;. There is also the log writer which writes to the &lt;a href="http://ora-pl-sql.blogspot.com/2009/10/oracle-database-11g.html"&gt;redo logs&lt;/a&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Pmon&lt;/span&gt; is the process monitor. Finally the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;archiver&lt;/span&gt; copies online redo logs to secondary storage (disk).&lt;br /&gt;&lt;br /&gt;Obviously there are a lot of other background processes that make up the database instance. I am not as interested in them as I am a PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; programmer, not a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;DBA&lt;/span&gt;. Next time I will go over simple ideas &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;such&lt;/span&gt; as triggers and users.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-556428481598435184?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/556428481598435184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=556428481598435184' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/556428481598435184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/556428481598435184'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/11g-background-processes.html' title='11g Background Processes'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/Ssin6VozaII/AAAAAAAABR0/UCmq3r0XhL4/s72-c/Oracle.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4263793400031787102</id><published>2009-10-03T17:35:00.000-07:00</published><updated>2009-10-03T17:40:18.668-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='11g'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Spfile'/><category scheme='http://www.blogger.com/atom/ns#' term='tablespace'/><category scheme='http://www.blogger.com/atom/ns#' term='VAX'/><category scheme='http://www.blogger.com/atom/ns#' term='instance'/><title type='text'>Oracle Database 11g</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5388537160557383010" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 194px; CURSOR: hand; HEIGHT: 194px" alt="" src="http://4.bp.blogspot.com/_7RXOll2bOJs/Ssft_3IDzWI/AAAAAAAABRc/jAhRqIzNcOA/s320/11g.jpg" border="0" /&gt;I recently picked up a book from the library titled Oracle Database 11g A Beginner's Guide. I was excited because I thought I could learn the new PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; features in 11g. Well this book did not specialize in PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt;. It also did not specialize in just 11g technologies. The book covered everything in Oracle 11g. That is just too broad. But I did learn a thing or two.&lt;br /&gt;&lt;br /&gt;Oracle first ran on a Digital VAX system. That is strange. I assumed it first ran on some flavor of UNIX. An instance is a set of processes in memory. I frequently hear about the Redo Logs from &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;DBAs&lt;/span&gt;. These are essentially transaction logs.&lt;br /&gt;&lt;br /&gt;Another common term &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DBAs&lt;/span&gt; use is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;tablespace&lt;/span&gt;. That is a fancy way of describes a disk file the databases uses. Another file of interest is the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;Spfile&lt;/span&gt;. It is the server parameter file. This file has &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;startup&lt;/span&gt; parameters in it.&lt;br /&gt;&lt;br /&gt;I will be blogging about this 11g book for a little bit. Next time I will cover the new names for the background processes in Oracle 11g.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4263793400031787102?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4263793400031787102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4263793400031787102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4263793400031787102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4263793400031787102'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/10/oracle-database-11g.html' title='Oracle Database 11g'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_7RXOll2bOJs/Ssft_3IDzWI/AAAAAAAABRc/jAhRqIzNcOA/s72-c/11g.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5403181812099950606</id><published>2009-09-19T12:00:00.001-07:00</published><updated>2009-09-19T12:06:26.540-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='queries'/><category scheme='http://www.blogger.com/atom/ns#' term='ALTER TABLE'/><category scheme='http://www.blogger.com/atom/ns#' term='stored procedure'/><title type='text'>Five Become One</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/SrUqWnl4PKI/AAAAAAAABQk/0KgWeyxbOc8/s1600-h/Programming.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5383255497664642210" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 240px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SrUqWnl4PKI/AAAAAAAABQk/0KgWeyxbOc8/s320/Programming.jpg" border="0" /&gt;&lt;/a&gt;I got a call from my team lead yesterday. He said he was swamped with the task that is due in a few days. He needed help writing a stored procedure to create a temporary table. The query was apparently all ready. It just needed to do it in PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt;. Although I was busy, I jumped at the opportunity.&lt;br /&gt;&lt;br /&gt;Later I got the specs for the task. It was more complicated than I thought. there were a total of 5 queries. This was tricky because each of the 5 queries produced different columns of results. However they all needed to be combined into a big table.&lt;br /&gt;&lt;br /&gt;I decided there was no way to CREATE a table AS SELECT FROM because there were multiple queries. So I determined the list of columns, and manually created the table with code. The create statement was so huge that I had to break the table creation down into one CREATE TABLE and multiple ALTER TABLE dynamic statements.&lt;br /&gt;&lt;br /&gt;It was quite a chore to handle all the cases where a row in the resultant big table was sparse. Then I ran into more trouble when my dynamic statements to update pieces of the resultant table choked on some NULL inputs. That required some custom logic. By the time I was done, my script was around 1000 lines long. I did not leave work until midnight. What a chore.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5403181812099950606?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5403181812099950606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5403181812099950606' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5403181812099950606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5403181812099950606'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/09/five-become-one.html' title='Five Become One'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SrUqWnl4PKI/AAAAAAAABQk/0KgWeyxbOc8/s72-c/Programming.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-2100005882398153337</id><published>2009-09-16T13:38:00.001-07:00</published><updated>2009-09-16T13:43:36.011-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='schema owner'/><category scheme='http://www.blogger.com/atom/ns#' term='logging'/><category scheme='http://www.blogger.com/atom/ns#' term='compilation'/><category scheme='http://www.blogger.com/atom/ns#' term='source code'/><title type='text'>Back To Basics</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_7RXOll2bOJs/SrFM6_XkPtI/AAAAAAAABQU/li3cHPQdOxs/s1600-h/Basics.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5382167606010855122" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 312px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://3.bp.blogspot.com/_7RXOll2bOJs/SrFM6_XkPtI/AAAAAAAABQU/li3cHPQdOxs/s320/Basics.jpg" border="0" /&gt;&lt;/a&gt;We have a new developer on our team. He is smart. He has a PhD in computer science. But there were some concepts he was not getting. So I had to break it down for him.&lt;br /&gt;&lt;br /&gt;There is a text file that contains the source code for an Oracle PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; package. You need to log in as the schema owner. Then you can compile the source code into the database. Once that is done, there is no relation between the source code file and the stored procedure in the database. The code gets stored within the database at compile time.&lt;br /&gt;&lt;br /&gt;My peer thought that he could somehow step through the source code file on the hard drive. That's not how you do thing. I recommended he just add some logging to his new functions. He later came back saying he encountered problems. It did not take long to diagnose the problem.&lt;br /&gt;&lt;br /&gt;I mentioned earlier that the source code upon compilation generates a package in the schema of the user logged in during compilation. We have users which access tables and packages in the main schema by use of synonyms. However you need to log in as the schema owner to modify that package. The code is not written to explicitly reference the schema owner. I have been doing these things for a long time and take them all for granted. Sometimes you need to step back and understand another person's &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;perspective&lt;/span&gt; to help them see the light.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-2100005882398153337?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/2100005882398153337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=2100005882398153337' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2100005882398153337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/2100005882398153337'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/09/back-to-basics.html' title='Back To Basics'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_7RXOll2bOJs/SrFM6_XkPtI/AAAAAAAABQU/li3cHPQdOxs/s72-c/Basics.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-1088673556132070284</id><published>2009-09-08T21:24:00.000-07:00</published><updated>2009-09-08T21:27:41.096-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UNIX'/><category scheme='http://www.blogger.com/atom/ns#' term='clusters'/><category scheme='http://www.blogger.com/atom/ns#' term='shutdown'/><category scheme='http://www.blogger.com/atom/ns#' term='RAC'/><category scheme='http://www.blogger.com/atom/ns#' term='compression'/><title type='text'>Oracle 11g Release 2</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5379318973269706466" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 276px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SqcuGvdChuI/AAAAAAAABPs/lMv1ipNYvkE/s320/Release2.png" border="0" /&gt;I have read some blurbs about the Oracle 11g Release 2 of the database. So I thought I would mention some things I have learned that are going to be in this release.&lt;br /&gt;&lt;br /&gt;You will be able to run 11g on a cluster of non-Unix machines. For example you could string together a couple Intel machines and spend less money. Conversely you can run 11g &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;RAC&lt;/span&gt; on a single machine, and still take advantage of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;RAC&lt;/span&gt; features.&lt;br /&gt;&lt;br /&gt;11g R2 has new and improved data compression. Anything that saves disk space is a good thing in my book as long as it works correctly. Finally you will be able to do a hot application upgrade in 11g without shutting down the system. That's hot.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-1088673556132070284?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/1088673556132070284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=1088673556132070284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1088673556132070284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/1088673556132070284'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/09/oracle-11g-release-2.html' title='Oracle 11g Release 2'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SqcuGvdChuI/AAAAAAAABPs/lMv1ipNYvkE/s72-c/Release2.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-4965994357454644472</id><published>2009-08-17T18:28:00.000-07:00</published><updated>2009-08-17T18:31:43.988-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='create'/><category scheme='http://www.blogger.com/atom/ns#' term='physcial design'/><title type='text'>Database Design</title><content type='html'>&lt;img id="BLOGGER_PHOTO_ID_5371109679441467058" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 214px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/SooDy8zFVrI/AAAAAAAABOU/AfzRzuSjoPg/s320/Tables.jpg" border="0" /&gt;We are getting down to the physical design of the new changes in our system. Here is where we need to figure out which database tables get the new columns. We may also create a new table or two.&lt;br /&gt;&lt;br /&gt;I am working with another team on a back end piece of the system. We will tie the front end to the back with some new database columns. They back end developers just thought we would add a column to an existing table.&lt;br /&gt;&lt;br /&gt;This approach normally makes sense. You add the column to the table that represents the object that is getting a new property. However you need to look deeper to see how the new data will be used. You might want to separate some data by creating a new table. It might make you queries easier and the system faster. We are going to have the design debate later this week. This is a just a specific instance of the greater problem of good database design.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-4965994357454644472?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/4965994357454644472/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=4965994357454644472' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4965994357454644472'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/4965994357454644472'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/08/database-design.html' title='Database Design'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/SooDy8zFVrI/AAAAAAAABOU/AfzRzuSjoPg/s72-c/Tables.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-5100546298127892418</id><published>2009-07-30T19:25:00.000-07:00</published><updated>2009-07-30T19:30:53.635-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='analysis'/><category scheme='http://www.blogger.com/atom/ns#' term='production'/><category scheme='http://www.blogger.com/atom/ns#' term='details'/><category scheme='http://www.blogger.com/atom/ns#' term='CPUs'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Speedy GROUP BY</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/SnJWPZNTgHI/AAAAAAAABNA/x4p1m_WQYZ8/s1600-h/Group.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5364444928616398962" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 283px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/SnJWPZNTgHI/AAAAAAAABNA/x4p1m_WQYZ8/s320/Group.jpg" border="0" /&gt;&lt;/a&gt;We had a big problem with our production system today. The customer determined we had not been transferring some files for a couple week. And those are some of our most crucial files. We had a big TO DO list to work this problem. I signed up to analyze the damage that was done to the business.&lt;br /&gt;&lt;br /&gt;At first I ran some queries on a pretty large set of data. Our server is a massive one with tons of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CPUs&lt;/span&gt; and memory. However these queries took a long time. I published the results. The managers wanted more details. They were looking for a way to spin the data to do the least amount of damage to our image. I told them this would take a long time. So I went home and brought my computer with me.&lt;br /&gt;&lt;br /&gt;Here was the surprising thing. When I ran the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; and divided up the result with a GROUP BY function, the queries seemed to run faster. Perhaps the database was able to split the pieces of the query amongst the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;CPUs&lt;/span&gt; better. Or maybe my prior query results were cached, and the database could take advantage of the result set. Whatever the reason, I was happy that my homework was not taking too long. I was able to knock out the tasks and move on to the next emergency. I even got time to eat dinner and watch a movie this evening. Thanks Oracle10g.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-5100546298127892418?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/5100546298127892418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=5100546298127892418' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5100546298127892418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/5100546298127892418'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/07/speedy-group-by.html' title='Speedy GROUP BY'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/SnJWPZNTgHI/AAAAAAAABNA/x4p1m_WQYZ8/s72-c/Group.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-70887608284925630</id><published>2009-07-28T17:48:00.000-07:00</published><updated>2009-07-28T17:52:20.776-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='packages'/><category scheme='http://www.blogger.com/atom/ns#' term='PL/SQL Developer'/><category scheme='http://www.blogger.com/atom/ns#' term='triggers'/><title type='text'>Back End Development</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/Sm-cXNhYHaI/AAAAAAAABMw/ZYMWJpcoIlU/s1600-h/Back-end.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5363677603802127778" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 248px; CURSOR: hand; HEIGHT: 320px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/Sm-cXNhYHaI/AAAAAAAABMw/ZYMWJpcoIlU/s320/Back-end.jpg" border="0" /&gt;&lt;/a&gt;My project at work seems to be loaded with too much to do with little resources. Yes I know that happens to everybody. But there is no way were are going to even be close to completing everything on time. My team leader has been tasked with trying to come up with a plan to get everything done. Today he had a brilliant idea. We could carve out the pieces of the newest changes that are for the back end. Then we could assign those to a junior PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; developer that we have.&lt;br /&gt;&lt;br /&gt;I gave this idea some thought. At first I thought there was maybe 10% of the work that needed to be done in PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; packages and database triggers. However on second thought, the number might be closer to 15-20%. Out PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt; developer has some work to do. However she could help out this latest development task.&lt;br /&gt;&lt;br /&gt;Here is the difficulty in this arrangement. The actual PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; coding is not difficult. The hard part is understanding the business. This is why we cannot give this part to some new developers on the team. The business of our customer takes a couple years to understand. I guess we could give the junior developer some hints, and let her code away. We shall see how this would pan out. I was hoping that I would get to do the back end work. I like writing PL/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SQL&lt;/span&gt; code. And I know the business inside out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-70887608284925630?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/70887608284925630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=70887608284925630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/70887608284925630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/70887608284925630'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/07/back-end-development.html' title='Back End Development'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/Sm-cXNhYHaI/AAAAAAAABMw/ZYMWJpcoIlU/s72-c/Back-end.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-8911761895683227875</id><published>2009-07-21T14:23:00.001-07:00</published><updated>2009-07-21T14:24:00.523-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='stored procedures'/><category scheme='http://www.blogger.com/atom/ns#' term='invoker’s rights'/><category scheme='http://www.blogger.com/atom/ns#' term='schema'/><category scheme='http://www.blogger.com/atom/ns#' term='owner'/><category scheme='http://www.blogger.com/atom/ns#' term='AUTHID CURRENT_USER'/><title type='text'>Definer and Invoker Rights</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_7RXOll2bOJs/SmYx2Gb95uI/AAAAAAAABL4/dxQj-QrjdvI/s1600-h/Invoker.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5361027211941766882" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 225px" alt="" src="http://2.bp.blogspot.com/_7RXOll2bOJs/SmYx2Gb95uI/AAAAAAAABL4/dxQj-QrjdvI/s320/Invoker.jpg" border="0" /&gt;&lt;/a&gt;In our system, we have the stored procedures owned by a central schema. Users have their own database accounts (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;schemas&lt;/span&gt;) where we stored temporary tables. The stored &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;procs&lt;/span&gt; frequently create these tables. One developer reported that a rewrite of some stored procedures broke this pattern. The stored procedure, owned by the central schema, was creating temp tables in the central schema. That is no good, as each user needs their own copy of the temp table.&lt;br /&gt;&lt;br /&gt;When I was asked for help, I said that we have the technology to make this work. We have it set up in the old stored procedures. However I referred the developer to our &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;DBA&lt;/span&gt; Team. The lead &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;DBA&lt;/span&gt; told us to set up invoker’s rights for the procedure. Normally we seemed to use whatever the default was. And it seemed to work before. We tried all kinds of debugging, but could not get this to work without using invoker’s rights.&lt;br /&gt;&lt;br /&gt;Definer’s rights s the default in Oracle. Whoever owns the stored procedure (the definer) has the credentials that determine what other code the stored &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;proc&lt;/span&gt; can call, and what tables and objects are used by default. This is not what we want on our project.&lt;br /&gt;&lt;br /&gt;You have the ability to override the default behavior and specify invoker’s rights. This is done by specifying the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;AUTHID&lt;/span&gt; CURRENT_USER keywords when creating the stored procedure. This causes the context of the current user to be used when a stored procedure is called. Sure enough when we made this change, the temporary tables started getting created in the calling users’ &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;schemas&lt;/span&gt;. Now we got some new stored &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;proc&lt;/span&gt; code to update.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-8911761895683227875?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/8911761895683227875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=8911761895683227875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8911761895683227875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/8911761895683227875'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/07/definer-and-invoker-rights.html' title='Definer and Invoker Rights'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7RXOll2bOJs/SmYx2Gb95uI/AAAAAAAABL4/dxQj-QrjdvI/s72-c/Invoker.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6478526690046112130.post-9146120107321370683</id><published>2009-06-25T18:28:00.001-07:00</published><updated>2009-06-25T18:29:28.982-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MySQL'/><category scheme='http://www.blogger.com/atom/ns#' term='PostgresSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='Schema Spy'/><category scheme='http://www.blogger.com/atom/ns#' term='Enterprise Architect'/><category scheme='http://www.blogger.com/atom/ns#' term='DB Visualizer'/><title type='text'>Automatic Documenation</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_7RXOll2bOJs/SkQkYmGEDTI/AAAAAAAABJQ/B5gjJJDRovA/s1600-h/Automatic.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5351442262184430898" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; WIDTH: 320px; CURSOR: hand; HEIGHT: 213px" alt="" src="http://1.bp.blogspot.com/_7RXOll2bOJs/SkQkYmGEDTI/AAAAAAAABJQ/B5gjJJDRovA/s320/Automatic.jpg" border="0" /&gt;&lt;/a&gt;How can you create an Entity Relationship diagram automatically from the structure of the Oracle database? Other databases have tools to do this such as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;PostgresSQL&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Autodoc&lt;/span&gt; and MySQL Workbench.&lt;br /&gt;&lt;br /&gt;I got some advice from some people for products to try. One of them is Schema Spy. Another is Enterprise Architect. A final one is DB Visualizer. Right now I use tools to execute &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt;. Somebody else on the database team generates documentation from the database. However I don’t think they use any specialized tools. I think they either user Oracle tools, or some custom written scripts to do the work.&lt;br /&gt;&lt;br /&gt;Our documentation is mainly text information on the database. This is normally based on the data dictionary. But it would be nice to have some fancier ER diagrams to use and show off. It might be time to ask for some new software to be purchased.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6478526690046112130-9146120107321370683?l=ora-pl-sql.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ora-pl-sql.blogspot.com/feeds/9146120107321370683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6478526690046112130&amp;postID=9146120107321370683' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/9146120107321370683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6478526690046112130/posts/default/9146120107321370683'/><link rel='alternate' type='text/html' href='http://ora-pl-sql.blogspot.com/2009/06/automatic-documenation.html' title='Automatic Documenation'/><author><name>Maintenance Man</name><uri>http://www.blogger.com/profile/11251164494419993264</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://bp3.blogger.com/_7RXOll2bOJs/RzDz9uI32rI/AAAAAAAAAAU/YtQkHJLbQ9k/s320/XeroSmiley.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_7RXOll2bOJs/SkQkYmGEDTI/AAAAAAAABJQ/B5gjJJDRovA/s72-c/Automatic.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
