<?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-29074266</id><updated>2012-01-29T10:57:29.307-08:00</updated><category term='SQL'/><title type='text'>J2EE and Oracle Performance Musings</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>38</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-29074266.post-2886568903087180714</id><published>2009-12-20T12:49:00.000-08:00</published><updated>2009-12-20T13:01:37.717-08:00</updated><title type='text'>Review Of IBM WebSphere eXtreme Scale 6 by Packt Publishing</title><content type='html'>This is a quick few notes on a new book I've started reading through, as per the title of this blog post. The general prognosis is that this is a very respectable piece of material, specifically I like:-&lt;br /&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;The fact that the book has been reviewed by the chief technical architect behind WebSphere eXtreme scale, Billy Newport, this would suggest that technical content is pretty water tight.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The author has chosen to write the book in such a way that it is highly accessible to its audience. By this I mean that Anthony Chaves explains WebSphere eXtreme scale from first principles and provides coding examples throughout the book which do not mandate the use of the WebSphere application server.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The book contains chapters that represent all the main use case areas for the product culminating in a final "Putting it all together" chapter.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;All in all this is a very good book, and I would think that anyone wishing to cover the same subject material would struggle to write something that is more comprehensive than this.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-2886568903087180714?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/2886568903087180714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=2886568903087180714' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2886568903087180714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2886568903087180714'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/12/review-of-ibm-websphere-extreme-scale-6.html' title='Review Of IBM WebSphere eXtreme Scale 6 by Packt Publishing'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-3021229192556886115</id><published>2009-11-30T12:19:00.000-08:00</published><updated>2009-12-22T14:46:38.852-08:00</updated><title type='text'>JEE Batch Process Design Part 1</title><content type='html'>&lt;div style="text-align: justify;"&gt;A project I worked on recently used J2EE to implement batch processes. The architecture consisted of a WebSphere application server (version 6.1), Oracle database and a Java client to invoke the  batch processes. On initiation, the client retrieves a list of jobs from the database via the application server. The list of jobs was then partitioned into equal sized 'Chunks', calls to a batch control session bean were invoked by threads fired off from the Java client, a chunk of jobs is attached to each thread. On receiving the jobs, the batch control bean invokes other beans to carry out the business logic of the application for each job within the chunk via a loop. In fact this architecture mirrored a batch process solution that can be found devx, to the extent I suspect that this is where it originated from in the first place.&lt;br /&gt;&lt;br /&gt;Under this architecture scale out is achieved via IIOP load balancing, whereby the WebSphere workload manager distributes calls made to the batch control bean amongst the nodes in the cluster, or cell to use WebSphere parlance, in a round robin manner. If the CPU capacity of the servers that make up the cell are not uniform, a configurable load balance weighting can be used to redress this inbalance. Refer to &lt;a href="http://www-01.ibm.com/support/docview.wss?rs=180&amp;amp;uid=swg21219567"&gt;this link&lt;/a&gt; from IBM for further details on load balance weighting. WebSphere extended deployment adds further intelligence into the process of distributing the workload via traffic shaping.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Whilst this design and architecture worked, it struck me that there were several ways in which this could be improved on:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The client should be as light weight as possible, it should invoke the batch process and report on whether it suceeded or failed. Thus leveraging the qualities of the service the application server provides as much as possible. Specifically, the WebSphere launch client did not in itself provide the same qualities of service as the application server itself, namely workload management, fail over transaction support etc.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The application should only use transaction context within the application server.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The client prohibits end user application to Java.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Using RMI requires the application server RMI boot strap and RMI registry ports to be open.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A core design pattern should implement the business logic, such that a uniform design principle for followed for all batch jobs.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Threading should be handled within the application server.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Inversion of control should be used to decouple the business logic from the batch 'Framework'.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Although the software used JDBC batching, much better performance and scalability could be realised using oracle.sql.array for array processing.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Raw JDBC was used for persistance, a better design practise would be to externalise all SQL in the application and configuration.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;For scale out, each node would acquire its configuration, storing the configuration in an LDAP server, a database, JDNI store etc would be much more cluster friendly.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;An XML cache was used to store fixed domain configuration data, whilst this was more efficient than making frequent trips out to the database, a more light weight solution would have been preferable. When in full flight, 20% of each batch processes CPU usage was down to XPath calls associated with this cache.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;If you are a sizeable WebSphere shop for which batch processes form a significant part of your IT infrastructure back bone, there is a compelling argument for looking at WebSphere Compute grid. If you are already a major Spring user, Spring batch may worth looking at. However, I'm not going to address the debate of which option is the best fit, suffice it to say both are options available for consideration. Whilst writing this posting, I couldn't help but feel that WebSphere Compute Grid answered a lot of the difficult questions that batch process design asked out of the box.&lt;br /&gt;&lt;br /&gt;The salient features of my design are:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Batch invocation via synchronous web service calls.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The web service would use JMS, by placing messages on a JMS queue, message driven beans on each node instigate the batch processing, this is the primary mechanism by which scale out is achieved.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;In addition to the message driven beans facilitating scale out, they provide a means by which the batch process execution is detached from the client, therefore, anything adverse that happens to the client does not affect the batch, this was a conscious design decision.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Once the message driven had received a message to initiate the processing of the batch, high throughput on each node would be achieved through calls to methods annotated with the JEE6 @asynchronous annotation. I considered this to be the most light weight option available for this purpose, more light weight than a combination of using JMS and message driven beans.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I was considering using Spring, but as Glassfish 3 is fully JEE 6 compliant, and JEE 6 has virtually closed the gap with Spring in terms of Inversion of Control capabilities. I therefore elected to forego Spring in favour of using JEE 6. Also, at the time of writing this posting , Glassfish 3 was the only JEE 6 compliant application server available.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Implementation of the business logic using the strategy pattern.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Use of the command pattern in order to determine which strategy is required to implement the strategy.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Solidity and maturity of a JEE application for transaction management via JTA.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The use of JEE6 singleton beans annotated for initialisation on application startup for caching fixed domain data.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;iBatis and oracle array processing using the oracle.sql.array class. To achieve raw performance, many people may consider a caching grid style solution at first. However, conventional caching wisdom does not apply to true batch processing, in that the same data item is rarely used more than once during the processing of a batch. Therefore any type of cache, regardless of where it is used in the technology stack will be of limited benefit. If any benefit at all is derived from caching, it will be through write behind and the caching of fixed domain data. iBatis is a "Half way house" solution, in that it is not a full blown object relational mapping framework nor is it as free form as using raw JDBC.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Firstly the strategy pattern. I will not steal anyone's thunder on this, as both Snehal Antani of IBM and a colleague and the Java technical architect of the team in which I work have both proposed this. Below is the essence of the strategy pattern in UML class form. By the way, if anyone want a free UML modelling tool, I can strongly recommend Eclipse Galileo with the modelling bundle, which I used to produce this. Double click on the image to obtain a larger version:-&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_m6bFoKebmps/SxQ3NhX6xJI/AAAAAAAAAPk/sGMKQhtNa-A/s1600/Stategy.jpeg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 172px;" src="http://3.bp.blogspot.com/_m6bFoKebmps/SxQ3NhX6xJI/AAAAAAAAAPk/sGMKQhtNa-A/s400/Stategy.jpeg" alt="" id="BLOGGER_PHOTO_ID_5410009757815325842" border="0" /&gt;&lt;/a&gt;Here is a UML class diagram to represent the command pattern:-&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_m6bFoKebmps/SxRAQuP5sVI/AAAAAAAAAP0/VCzfqMFkFmE/s1600/Command.jpeg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 210px;" src="http://2.bp.blogspot.com/_m6bFoKebmps/SxRAQuP5sVI/AAAAAAAAAP0/VCzfqMFkFmE/s400/Command.jpeg" alt="" id="BLOGGER_PHOTO_ID_5410019708415619410" border="0" /&gt;&lt;/a&gt;The software architecture consists of the following components:-&lt;br /&gt;&lt;br /&gt;1. A web service client and service generated using Axis 2 and Eclipse.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;2. On the application server, the skeleton for the web service will instigate the BatchControl session bean, the batch delegate. A stand alone java client could invoke this directly.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;3. It will be assumed that only one batch process of a given type will run at the same time, therefore the polling port type only needs the batch process name and not a handle.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;4. The batch execution strategy will comprise of three steps:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Get workload step, this will obtain a partition ('Chunk') of jobs to be processed.&lt;/li&gt;&lt;li&gt;Process workload step, this will use asynchronous method calls to process the jobs obtained from the get workload step.&lt;/li&gt;&lt;li&gt;Output the processed results step.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;6. Whilst the batch is running, the client will poll the batch control bean at a frequency determined by a configurable polling period. The polling operation will return the number of jobs processed and the total number of jobs that make up the workload. Another as yet specified web service will allow the last execution of a batch process to be reported on in terms the number of individual jobs that failed and were processed successfully within the batch.&lt;br /&gt;&lt;br /&gt;The concept of processing jobs in 'Chunks' will be retained, the three steps of get workload, process workload and output results will be iterated around in 'Chunk' size partitions of the  the workload until the total workload is processed.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;This is illustrated in the UML sequence diagram below.&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_m6bFoKebmps/SzFDxL6BM9I/AAAAAAAAAQk/y3nNnpZhnoc/s1600-h/process_batch.jpeg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 273px;" src="http://1.bp.blogspot.com/_m6bFoKebmps/SzFDxL6BM9I/AAAAAAAAAQk/y3nNnpZhnoc/s400/process_batch.jpeg" alt="" id="BLOGGER_PHOTO_ID_5418186338992206802" border="0" /&gt;&lt;/a&gt;1. Execute batch process.&lt;/div&gt;&lt;div&gt;2. Place the name of the batch process on the execute batch topic of the batch message queue.&lt;/div&gt;&lt;div&gt;3. Execute the get workload element of the batch strategy.&lt;/div&gt;&lt;div&gt;4. Execute the process workload element of the batch strategy.&lt;/div&gt;&lt;div&gt;5. Execute the output results element of the batch strategy.&lt;/div&gt;&lt;div&gt;6. Poll the web service for batch completion.&lt;/div&gt;&lt;div&gt;7. Call the batch delegate to establish whether or not the batch process is still running.8. Return the number of jobs processed and to process to the web service skeleton.&lt;br /&gt;&lt;div&gt;8. Return the number of jobs processed and to process to the web service skeleton.&lt;br /&gt;&lt;div&gt;9. Return the number of jobs processed and to process to the web service stub.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;I am yet to established how to track the progress of the batch processes, the problem being around the ability to store state globally across the cluster representing the total number of jobs that the batch is going to process and the total number of jobs processed. The obvious way to do this is to store this in the database, however, for performance reasons I would like to avoid making trips out to the database unless absolutely necessary. A nice solution would be if Glassfish supported something similar to WebSphere's DistributedMap, then as each node in the cluster completes a 'Chunk' of jobs, it will put to this to the hash map, from which the batch delegate (batch control bean) can work out how much of the workload has been processed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;The UML class diagram below illustrates the fleshed out design, click on it to enlarge.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_m6bFoKebmps/SzFGWh9clJI/AAAAAAAAAQ8/TWo6JtTLvso/s1600-h/batch+architecture.jpeg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 325px;" src="http://2.bp.blogspot.com/_m6bFoKebmps/SzFGWh9clJI/AAAAAAAAAQ8/TWo6JtTLvso/s400/batch+architecture.jpeg" alt="" id="BLOGGER_PHOTO_ID_5418189179590579346" border="0" /&gt;&lt;/a&gt;In future postings I will elaborate on the architecture and design with the intention of providing a code skeleton for the prototype.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-3021229192556886115?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/3021229192556886115/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=3021229192556886115' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/3021229192556886115'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/3021229192556886115'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/11/jee-batch-process-design-part-1.html' title='JEE Batch Process Design Part 1'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_m6bFoKebmps/SxQ3NhX6xJI/AAAAAAAAAPk/sGMKQhtNa-A/s72-c/Stategy.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-9028900963147665817</id><published>2009-11-13T12:12:00.000-08:00</published><updated>2009-11-13T12:33:08.291-08:00</updated><title type='text'>Eclipse Findbugs Plugin &amp; Double Checked Locking</title><content type='html'>This code sample below is for the creation of a singleton object:-&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt; public static SqlConfiguration getSqlConfig(String fileName) {&lt;br /&gt;       if (sqlConfigSingleton == null) {&lt;br /&gt;           synchronized(SqlConfiguration.class) {&lt;br /&gt;               if (sqlConfigSingleton == null) {&lt;br /&gt;                   try {&lt;br /&gt;                       parseXmlConfigFile(fileName);&lt;br /&gt;                   } catch (JDOMException e) {&lt;br /&gt;                       log.severe(e.getMessage());&lt;br /&gt;                   } catch (IOException e) {&lt;br /&gt;                       log.severe(e.getMessage());&lt;br /&gt;                   }&lt;br /&gt;                   sqlConfigSingleton = new SqlConfiguration();&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;There are many reasons as to why the code is wrong, the most obvious one being that creation of the SqlConfiguration object and write to sqlConfigSingleton can be performed out of order. But this is not what impressed me, what impressed me was the fact that findbugs picked this up:-&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;Bug:&lt;/b&gt; Possible doublecheck on  com.sqlstress.test.SqlConfiguration.sqlConfigSingleton&lt;br /&gt;&lt;b&gt;Pattern&lt;/b&gt;  &lt;b&gt;id:&lt;/b&gt; DC_DOUBLECHECK, &lt;b&gt;type:&lt;/b&gt; DC, &lt;b&gt;category:&lt;/b&gt;  MT_CORRECTNESS&lt;br /&gt;&lt;br /&gt;&lt;p style="text-align: justify;"&gt;This method may contain an instance of double-checked locking.  This idiom is  not correct according to the semantics of the Java memory model.  For more  information, see the web page &lt;a href="http://www.cs.umd.edu/%7Epugh/java/memoryModel/DoubleCheckedLocking.html"&gt;http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Impressive right down to the fact a link is proivded to an artcile that discusses this in detail.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-9028900963147665817?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/9028900963147665817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=9028900963147665817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/9028900963147665817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/9028900963147665817'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/11/eclipse-findbugs-plugin-double-checked.html' title='Eclipse Findbugs Plugin &amp; Double Checked Locking'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-2651653995897468849</id><published>2009-10-11T14:08:00.000-07:00</published><updated>2009-10-11T14:32:39.717-07:00</updated><title type='text'>XML Based Database Stress Test Tool</title><content type='html'>&lt;div style="text-align: justify;"&gt;If you refer to this &lt;a href="http://docs.google.com/View?id=dc8vt6g5_0d7wjxkhf"&gt;link&lt;/a&gt;, you will see an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;xml&lt;/span&gt; file containing example configuration information for a little tool I have been writing in Java. The aim of this is to stress test databases by executing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; statements concurrently using Java threads. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;xml&lt;/span&gt; file may seem vaguely reminiscent of an &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;iBatis&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;xml&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt; maps, however my tool's configuration document contains information specific to tuning. Connections to the database are provided by a connection factory class, they can be: via a thin or thick &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;JDBC&lt;/span&gt; driver (with or without use of the Oracle database resident connection pool) or use connection pooling, facilitated by the Oracle Universal Connection Pool. The code is largely complete, however, before I put it into the public domain, I want it to be pristine in terms of good coding practise, design and documentation. One of my colleagues at work has reviewed it , and its not in bad shape, the only problem being that my class model for storing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQL&lt;/span&gt; objects is not very &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;OO&lt;/span&gt;, at present as I use one &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;SQL&lt;/span&gt; statement class containing logic to work out how the execute method should be performed, i.e.:-&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;A stored procedure, function or package call will require the use of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;JDBC&lt;/span&gt; callable statement.&lt;/li&gt;&lt;li&gt;A select statement will return a result set, where as a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;DML&lt;/span&gt; statement will not.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;xml&lt;/span&gt; file allows the user to specify whether &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;dml&lt;/span&gt; statements are to be run using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;JDBC&lt;/span&gt; batching or whether oracle.sql.ARRAY is to be used to perform array processing. Also, in order t to simulate the effect of hard parsing, the code can force this by putting randomly generated numbers in query hint text, dependant on whether value binding is set to soft or hard.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Hence, I'm in the process of modifying the code to use a Java interface for the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;SQL&lt;/span&gt; Statement class, with &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_16"&gt;separate&lt;/span&gt; implementation classes for callable statements, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;DML&lt;/span&gt; statements and select statements, these will be created by a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;SQL&lt;/span&gt; statement factory class depending on what the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;xml&lt;/span&gt; file contains. Once this work is complete, I will update my blog and publish the source code via google doc links.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-2651653995897468849?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/2651653995897468849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=2651653995897468849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2651653995897468849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2651653995897468849'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/10/xml-based-database-stress-test-tool.html' title='XML Based Database Stress Test Tool'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-5364468384838254373</id><published>2009-10-11T10:29:00.000-07:00</published><updated>2009-10-11T14:30:33.605-07:00</updated><title type='text'>"Larry Ellison - What The Hell Is Cloud Computing?"</title><content type='html'>&lt;div style="text-align: justify;"&gt;I found &lt;a href="http://www.youtube.com/watch?v=0FacYAI6DY0"&gt;this&lt;/a&gt; amusing posting on YouTube in which Larry Ellison states that IT is the only industry that is more fashion driver than women's fashion retail, when canvassed for his views on "The cloud". Not only do we work in an industry more fashion driven than women's fashion retail, we work in an industry in which staple technologies such as the RDBMS and J2EE are pronounced as being dead on a regular basis. Recently there was an article on the theserverside.com proclaiming that programming was dead, needless to say it was treated with great derision. This thing about a particular technology being pronounced as dead reminds me of a quote from the late comedian George Burns:-&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"Every morning I read the orbituary column. If I don't see my name there I go ahead and have breakfast"&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In summary Larry, you are not an idiot.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-5364468384838254373?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/5364468384838254373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=5364468384838254373' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/5364468384838254373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/5364468384838254373'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/10/larry-ellison-what-hell-is-cloud.html' title='&quot;Larry Ellison - What The Hell Is Cloud Computing?&quot;'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-2114703537629826641</id><published>2009-10-11T10:12:00.000-07:00</published><updated>2009-10-11T14:31:14.983-07:00</updated><title type='text'>IBM and Oracle Performance Wars</title><content type='html'>&lt;div style="text-align: justify;"&gt;I see from www.spec.org that Oracle have &lt;a href="http://www.spec.org/jAppServer2004/results/res2009q2/"&gt;posted&lt;/a&gt;  some  impressive SPECjAppServer2004 results for the second quarter of 2009. To summarise, 28463.30 JOPS on 17 nodes, 136 cores and 68 chips, putting into the shade IBM's result of 22643.13 JOPS on 16 nodes, 128 cores and 32 chips, posted &lt;a href="http://www.spec.org/jAppServer2004/results/res2008q4/"&gt;here&lt;/a&gt;. I'm sure that this has not escaped the attention of Andrew Spyker and his team at IBM.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;On the same theme, IBM are rumoured to be bringing out a competitor to Exadata 2 called DB2 Pure Scale as &lt;a href="http://www.theregister.co.uk/2009/10/05/ibm_db2_pure_scale/"&gt;reported by The Register&lt;/a&gt;. On some of The Register articles, IBMers have jumped on the comments thread to extol the virtues of DB2, and whilst I'm not for a second criticising it as a product, who actually uses it ?. I live and work in the Uk, if I go to www.jobswatch.co.uk and look for DB2 dba jobs, there have been seventeen job adverts for DB2 DBAs in the last three months, versus three hundred and sixty nine for Oracle DBAs, if this web site is to be believed that is.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-2114703537629826641?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/2114703537629826641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=2114703537629826641' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2114703537629826641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2114703537629826641'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/10/ibm-and-oracle-performance-wars.html' title='IBM and Oracle Performance Wars'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-2807567691033597446</id><published>2009-09-25T13:54:00.000-07:00</published><updated>2009-10-08T00:22:57.903-07:00</updated><title type='text'>A DBA Utilities Package Using Java Stored Procedures</title><content type='html'>&lt;div style="text-align: justify;"&gt;I wanted to blog on Java stored procedures, the problem being that all I could come up with was something really contrived such as the infamous ATM machine example that always gets trotted out in training course material. Fortunately I came up with the requirement for a general purpose DBA utilities package, the requirements of which included:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A "Poor mans" data guard using data pump&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The ability to rotate alert logs etc&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The ability to produce data pump exports, compress them and maintain an archive, i.e. if you wanted seven days worth of dmp files, when you reached seventh file, as soon as the newest one is produced, the oldest one would be purged.&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;My main motivation for writing this was to develop a utility package that was portable across Windows and Unix, hence saving the effort in having to maintain multiple scripts.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;The second two requirements is where Java stored procedures came in. Although a full desemination of Java stored procedures is beyond the scope of a simple blog posting, I'll bullet point some of more salient points:-&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The ability to run Java within the database was introduced with Oracle 8i.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;10g supports code compiled with the J2SE 1.4 JDK and 11g supports code compiled with the J2SE 1.5 JDK.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;All Java methods to be wrapped by PL/SQL need to be declared as public (obviously !) and static.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The embedded JVM run time uses a different security model compared to the conventional JVM outside the database. Permissions are granted via certain database roles such as JAVASYSPRIV, more fine grained permissions can be granted using the DBMS_JAVA PL/SQL package.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Java in the database scales using sessions rather than threads.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; SQL is run via an embedded JDBC driver.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Oracle 11g JVM furnishes a JIT compiler, prior to this, Java had to be compiled ahead of time using NCOMP.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;System classes are shared between sessions so as to reduce memory and general resource overheads.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;Here is my Java class, much of the code comes courtesy of the &lt;a href="http://www.exampledepot.com/"&gt;Java almanac&lt;/a&gt;. I've omitted the use of featues such as annotations, the string builder class and the Java foreach loop, so as to make the code portable between 10 and 11g. Also, note that I've had to remove the original dump file after it has been compressed as the Oracle JVM does not remove the compressed file after the zip stream is closed.&lt;/div&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;import java.io.*;&lt;br /&gt;import java.text.SimpleDateFormat;&lt;br /&gt;import java.util.Arrays;&lt;br /&gt;import java.util.Comparator;&lt;br /&gt;import java.util.Date;&lt;br /&gt;import java.util.zip.GZIPInputStream;&lt;br /&gt;import java.util.zip.GZIPOutputStream;&lt;br /&gt;&lt;br /&gt;public class FileUtils {&lt;br /&gt;/**&lt;br /&gt;*&lt;br /&gt;* This is utility code to be used by the dbutilspkg PL/SQL package, it will purge&lt;br /&gt;* and files from the specified by directory that have:-&lt;br /&gt;*&lt;br /&gt;* 1) Are suffixed by bak.zip&lt;br /&gt;* 2) If there are more than NumFilesToKeep files in the directory with the bak.zip&lt;br /&gt;*    extension, it will purge the oldest files, such that only NumFilesToKeep #&lt;br /&gt;*    of files remain.&lt;br /&gt;*&lt;br /&gt;* @param  Directory      directory containing the compressed dump&lt;br /&gt;*                        files to scan.&lt;br /&gt;* @param  NumFilesToKeep number of compressed dump files to keep&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;public static void PurgeDmpFiles(String Directory, long  NumFilesToKeep) throws Exception {&lt;br /&gt;int DumpFiles = 0;&lt;br /&gt;int StrLen;&lt;br /&gt;&lt;br /&gt;     File files[] = new File(Directory).listFiles();&lt;br /&gt;&lt;br /&gt;Arrays.sort( files, new Comparator()&lt;br /&gt; {&lt;br /&gt;  public int compare(final Object o1, final Object o2) {&lt;br /&gt;   return new Long(((File)o1).lastModified()).compareTo&lt;br /&gt;    (new Long(((File) o2).lastModified()));&lt;br /&gt;  }&lt;br /&gt; } );&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &amp;lt; files.length; i++) {&lt;br /&gt; StrLen = files[i].getName().length();&lt;br /&gt;&lt;br /&gt; if (StrLen &amp;gt; 7) {&lt;br /&gt;  if ( files[i].getName().substring(StrLen - 7, StrLen).equals("bak.zip") ) {&lt;br /&gt;   DumpFiles++;&lt;br /&gt;      System.out.println("Found a gzipped dump file");&lt;br /&gt;                 System.out.println("&amp;lt;&amp;lt;" + files[i].getName() + "&amp;gt;&amp;gt;");&lt;br /&gt;&lt;br /&gt;   if ( DumpFiles &amp;gt; NumFilesToKeep ) {&lt;br /&gt;          System.out.println("Deleting a dump file");&lt;br /&gt;    files[i].delete();&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/**&lt;br /&gt;*&lt;br /&gt;* Java code to gzip a file based on code from the Java Almanac, note that because&lt;br /&gt;* the JVM embedded in the Oracle RDBMS does not remove the original file after the&lt;br /&gt;* zip stream has been closed, this has had to be coded for.&lt;br /&gt;*&lt;br /&gt;* @param  fileName       absolue path of file to zip&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;public static void GzipFile(String fileName) {&lt;br /&gt;try {&lt;br /&gt;       // Create the GZIP output stream&lt;br /&gt;       String outFilename = fileName + ".Z";&lt;br /&gt;       GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outFilename));&lt;br /&gt;&lt;br /&gt;       // Open the input file&lt;br /&gt;       FileInputStream in = new FileInputStream(fileName);&lt;br /&gt;&lt;br /&gt;        // Transfer bytes from the input file to the GZIP output stream&lt;br /&gt;       byte[] buf = new byte[1024];&lt;br /&gt;       int len;&lt;br /&gt;       while ((len = in.read(buf)) &amp;gt; 0) {&lt;br /&gt;            out.write(buf, 0, len);&lt;br /&gt;       }&lt;br /&gt;       in.close();&lt;br /&gt;&lt;br /&gt;       // Complete the GZIP file&lt;br /&gt;       out.finish();&lt;br /&gt;       out.close();&lt;br /&gt;&lt;br /&gt;              File finalFile = new File(fileName + "bak.zip");&lt;br /&gt;              File tempFile  = new File(fileName + ".Z");&lt;br /&gt;&lt;br /&gt;              tempFile.renameTo(finalFile);&lt;br /&gt;&lt;br /&gt;       boolean success = (new File(fileName).delete());&lt;br /&gt; if (!success) {&lt;br /&gt;  System.err.println("Unable to delete uncompressed dmp file: " + fileName);&lt;br /&gt; }&lt;br /&gt;} catch (IOException e) {&lt;br /&gt; System.err.println(e.getMessage());&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;/**&lt;br /&gt;*&lt;br /&gt;* Java code to un-gzip a file.&lt;br /&gt;*&lt;br /&gt;* @param  fileName       absolue path of file to zip&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;public static void UnGzipFile(String fileName) {&lt;br /&gt;try {&lt;br /&gt;       // Open the compressed file&lt;br /&gt;       GZIPInputStream in = new GZIPInputStream(new FileInputStream(fileName));&lt;br /&gt;&lt;br /&gt;       // Open the output file&lt;br /&gt;       String outFilename = "outfile";&lt;br /&gt;       OutputStream out = new FileOutputStream(outFilename);&lt;br /&gt;&lt;br /&gt;       // Transfer bytes from the compressed file to the output file&lt;br /&gt;       byte[] buf = new byte[1024];&lt;br /&gt;       int len;&lt;br /&gt;&lt;br /&gt; while ((len = in.read(buf)) &amp;gt; 0) {&lt;br /&gt;            out.write(buf, 0, len);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       // Close the file and stream&lt;br /&gt;       in.close();&lt;br /&gt;       out.close();&lt;br /&gt;   } catch (IOException e) {&lt;br /&gt;  System.err.println(e.getMessage());&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;/**&lt;br /&gt;*&lt;br /&gt;* Java code to rotate a file if its length exceeded the specified&lt;br /&gt;* rotation size (bytes).&lt;br /&gt;*&lt;br /&gt;* @param  fileName       absolue path of file to zip&lt;br /&gt;* @param  RotateSize     size threshhold for file rotation&lt;br /&gt;*&lt;br /&gt;*/&lt;br /&gt;public static void RotateFile(String FileName, long RotateSize) {&lt;br /&gt;   File file = new File(FileName);&lt;br /&gt;   if ( file.exists() ) {&lt;br /&gt; if ( file.length() &amp;gt;= RotateSize ) {&lt;br /&gt;         SimpleDateFormat dateformatMMDDYYYYHHmm = new SimpleDateFormat("MMddyyyyHHmm");&lt;br /&gt;         StringBuffer nowMMDDYYYYHHmm = new&lt;br /&gt;      StringBuffer( dateformatMMDDYYYYHHmm.format( new Date() ) );&lt;br /&gt;         File rotatedFile = new File(FileName + "." + nowMMDDYYYYHHmm);&lt;br /&gt;         // Rename file (or directory)&lt;br /&gt;         file.renameTo(rotatedFile);&lt;br /&gt;         System.out.println("File rotated");&lt;br /&gt; }&lt;br /&gt; else {&lt;br /&gt;         System.out.println("File below rotation size");&lt;br /&gt; }&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;       System.out.println("File not rotated");&lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Below is my PL/SQL package that uses the FileUtils class, if you read the comment banner at the top of package, instruction is provided for compiling and loading the Java class. You can create the source in SQLPLUS via the CREATE JAVA SOURCE command, however my preference is to always write the source in Eclipse, compile it and then load it into the database via loadjava. My apologies for anyone reading this using Google Chrome, for some reason the formatting of the PL/SQL goes awry, Firefox, however, has no such problem.&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;CREATE OR REPLACE PACKAGE BODY DbUtilsPkg AS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;/*==========================================================================*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Name:        DbUtilsPkg (BODY)                                        */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Version:     1.0                                                      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Description: This package includes useful DBA utilities, namely:-     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                 1) A procedure, pump_backup_db, to data pump export      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                    full databases, gzip the dmp files on successful      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                    completion and then remove any obsolete dmp files     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                    , depending on the number of dump file to retain      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                    parameter value specified.                            */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                 2) Rotate log files once they have exceeded the          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                    specified file rotation size.                         */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Special Notes                                                         */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    ~~~~~~~~~~~~~                                                         */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    The "DpCopySchema" procedure is intended to function as a poor mans   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    data guard, as such the destination schemas objects are dropped. I    */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    have elected against dropping the schema, as this would require       */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    the password of the destination schema to be reset afterwards, for    */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    security purposes this package does not handle or manage any          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    passwords.                                                            */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    The source code for this, with the exception of the procedures to     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    drop schema objects comes coutesy of Dani Rey from Trivadis AG,       */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    refer to: http://danirey.wordpress.com .                              */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Dependencies                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    ~~~~~~~~~~~~                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    This package is dependant upon the FileUtils java class, the source   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    code for this should be compiled using the version 5 JDK as follows   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    :-                                                                    */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    javac FileUtils.java                                                  */&lt;br /&gt;/*                                                                          */&lt;br /&gt;/*    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */&lt;br /&gt;/*    !!! NOTE !!! Use the J2SE 1.4 JDK javac for Oracle 10g                */&lt;br /&gt;/*                 Use the J2SE 1.5 JDK javac for Oracle 11g                *                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br /&gt;/*    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     */&lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    This will result in to java classes being produced: FileUtils$.class  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    and FileUtils$1.class, these then need to be loaded into the          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    database as follows:-                                                 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    loadjava r -f username/password FileUtils.class FileUtils$1.class     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Should you wish to debug the java, messages displayed via             */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    System.out.println will appear on the SQPLUS command line, if the     */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Java is wrapped with PL/SQL  after DBMS_JAVA.SET_OUTPUT(&amp;lt;bufferSize&amp;gt;) */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    and set serveroutput on are issued/                                   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Note that the security model for executing Java within the database   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    differs slightly from that used by PL/SQL, therefore, in order to be  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    able to write to files, DBMS_JAVA must be used to grant the pre-      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    requisite permissions to the relevant users:-                         */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    EXEC DBMS_JAVA.grant_permission('SCHEMA-NAME',                        */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                   'java.io.FilePermission',              */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                   '&amp;lt;&amp;lt;ALL FILES&amp;gt;&amp;gt;',                       */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                   'read ,write, execute, delete');       */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Grant JAVASYSPRIVS to the relevant user will grant blanket file CRUD  */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    permissions.                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Additionally, the following object permissions are required, unless   */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    this package is run as SYS or SYSTEM or a user with he DBA role       */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;/*    privilege:-                                                           */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    1) SELECT on V$DATABASE                                               */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    2) EXECUTE on DBMS_DATAPUMP                                           */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    3) SELECT privilege on DBA_USERS                                      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    4) execute privilege on DBMS_FLASHBACK                                */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    5) EXP_FULL_DATABASE sys privilege                                    */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*       Not to be confused with EXPORT FULL DATABASE.                      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    6) CREATE TABLE privilege                                             */&lt;br /&gt;/*    7) SELECT privilege on DBA_DIRECTORIES.                               */&lt;br /&gt;/*    8) SELECT privilege on V$PARAMETER.                                   */&lt;br /&gt;/*    9) For the schema copy utility:-                                      */&lt;br /&gt;/*       i)   A database link connecting the destination to the source      */&lt;br /&gt;/*            schema must exist.                                            */&lt;br /&gt;/*       ii)  The destination schema must have IMP_FULL_DATABASE and        */&lt;br /&gt;/*            EXP_FULL_DATABASE privileges.                                 */&lt;br /&gt;/*       iii) The source schema must have IMP_FULL_DATABASE and             */&lt;br /&gt;/*            EXP_FULL_DATABASE privileges.                                 */&lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    History                                                               */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    ~~~~~~~                                                               */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    Author       Date        Change Description                           */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    ===========  ==========  =========================================    */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*    C. J. Adkin  21/09/2009  Initial version created                      */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*                                                                          */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;/*==========================================================================*/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;  PROCEDURE PumpBackupDb (PumpDirectory    IN VARCHAR2,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;                          DmpFilesToRetain IN NUMBER DEFAULT 7) IS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br /&gt;      DirectoryExists     NUMBER;               &lt;br /&gt;      DpHandle            NUMBER;               &lt;br /&gt;      DoP                 NUMBER;&lt;br /&gt;      DbName              VARCHAR2(32);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;      JobState            VARCHAR2(32);&lt;br /&gt;      DmpFileAbsolutePath VARCHAR2(100);&lt;br /&gt;      DmpFileName         VARCHAR2(100);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br /&gt;  BEGIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;      DBMS_OUTPUT.ENABLE(1000000);   &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('Start time : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));&lt;br /&gt;      --&lt;br /&gt;      BEGIN&lt;br /&gt;          SELECT 1&lt;br /&gt;          INTO   DirectoryExists&lt;br /&gt;          FROM   dba_directories&lt;br /&gt;          WHERE  directory_name = PumpDirectory;&lt;br /&gt;    &lt;br /&gt;      EXCEPTION&lt;br /&gt;          WHEN NO_DATA_FOUND THEN&lt;br /&gt;              DBMS_OUTPUT.PUT_LINE('Data pump directory '||PumpDirectory||' does not exist');&lt;br /&gt;              RAISE;&lt;br /&gt;      END;&lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      SELECT name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &lt;br /&gt;      INTO   DbName                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         &lt;br /&gt;      FROM   v$database;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DmpFileName := DbName||'_FULL_'||TO_CHAR(SYSDATE, 'DDMMYYYYHH24MI');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('Openning data pump job');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DpHandle := DBMS_DATAPUMP.OPEN (operation =&amp;gt; 'EXPORT' ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;                                      job_mode  =&amp;gt; 'FULL'   );                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('Adding data pump dmp file');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_DATAPUMP.ADD_FILE (handle    =&amp;gt; DpHandle ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;                              filename  =&amp;gt; DmpFileName||'.dmp',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;                              directory =&amp;gt; PumpDirectory);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('Adding data pump log file');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_DATAPUMP.ADD_FILE (handle    =&amp;gt; DpHandle ,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;                              filename  =&amp;gt; DmpFileName||'.log',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;                              directory =&amp;gt; PumpDirectory,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   &lt;br /&gt;                              filetype  =&amp;gt; DBMS_DATAPUMP.ku$_file_type_log_file);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &lt;br /&gt;      --&lt;br /&gt;      SELECT value&lt;br /&gt;      INTO   DoP&lt;br /&gt;      FROM   v$parameter&lt;br /&gt;      WHERE  name = 'cpu_count';&lt;br /&gt;      --&lt;br /&gt;      IF DoP &amp;gt; 1 THEN&lt;br /&gt;          DBMS_DATAPUMP.SET_PARALLEL(handle =&amp;gt; DpHandle,&lt;br /&gt;                                     degree =&amp;gt; DoP);&lt;br /&gt;      END IF;&lt;br /&gt;      --&lt;br /&gt;      DBMS_DATAPUMP.START_JOB(DpHandle);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_DATAPUMP.WAIT_FOR_JOB(DpHandle, JobState);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_DATAPUMP.DETACH(DpHandle);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      --                                      &lt;br /&gt;      SELECT directory_path&lt;br /&gt;      INTO   DmpFileAbsolutePath&lt;br /&gt;      FROM   dba_directories&lt;br /&gt;      WHERE  directory_name = PumpDirectory;&lt;br /&gt;      --&lt;br /&gt;      DBMS_OUTPUT.PUT_LINE(DmpFileAbsolutePath);&lt;br /&gt;      --&lt;br /&gt;      GzipFile(DmpFileAbsolutePath||'\'||DmpFileName||'.dmp');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      PurgeDumpFiles(DmpFileAbsolutePath, DmpFilesToRetain);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('End time :   '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));&lt;br /&gt;&lt;br /&gt;      EXCEPTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;          WHEN OTHERS THEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;             --dbms_datapump.stop_job(DpHandle);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br /&gt;             RAISE;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         &lt;br /&gt;  END;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      &lt;br /&gt;  -------------------------------------------------------------------------------                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &lt;br /&gt;  PROCEDURE PumpCopySchema(sourceSchema      IN VARCHAR2,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   &lt;br /&gt;                           destinationSchema IN VARCHAR2,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   &lt;br /&gt;                           databaseLink      IN VARCHAR2,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   &lt;br /&gt;                           debug             IN BOOLEAN := FALSE) IS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        &lt;br /&gt;      handle                  NUMBER;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      message                 VARCHAR2(2000);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;      flashbackSCN            NUMBER;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      logfileName             VARCHAR2(200);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;      destinationSchemaExists NUMBER;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;      jobState                user_datapump_jobs.state%TYPE;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;  BEGIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('Start time : '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));&lt;br /&gt;      dbms_output.put_line('verify whether destination schema '||destinationSchema||' already exists');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br /&gt;      SELECT COUNT(username)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;      INTO   destinationSchemaExists                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        &lt;br /&gt;      FROM   dba_users                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      &lt;br /&gt;      WHERE  username = destinationSchema                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   &lt;br /&gt;      AND    username NOT IN ('SYS','SYSTEM','DBSNMP','DIP','EXFSYS','OUTLN','TSMSYS');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      IF ( destinationSchemaExists = 0 ) THEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE ('---&amp;gt; !!! Source schema does not exist !!!');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br /&gt;      ELSE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE ('open datapump job over database link '||databaseLink);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          handle := dbms_datapump.open (operation =&amp;gt;    'IMPORT',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;                                        job_mode =&amp;gt;     'SCHEMA',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;                                        remote_link =&amp;gt;  databaseLink);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          IF debug = TRUE THEN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;              DBMS_OUTPUT.PUT_LINE('set logfile parameter');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;              logfileName := 'datapump_'||to_char(SYSDATE,'YYYYMMDD')||'.log';                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br /&gt;               --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;              DBMS_DATAPUMP.ADD_FILE (handle    =&amp;gt;   handle,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;                                      filename  =&amp;gt;   logfileName,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;                                      directory =&amp;gt;  'DATA_PUMP_DIR',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br /&gt;                                      filetype  =&amp;gt;   dbms_datapump.ku$_file_type_log_file);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;          END IF;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE('set FLASHBACK_SCN parameter');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_DATAPUMP.SET_PARAMETER (handle =&amp;gt;   handle,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;                                       name   =&amp;gt;   'FLASHBACK_SCN',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;                                       value  =&amp;gt;   dbms_flashback.get_system_change_number);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_DATAPUMP.SET_PARAMETER (handle =&amp;gt;   handle,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;                                       name   =&amp;gt;   'TABLE_EXISTS_ACTION',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;                                       value  =&amp;gt;   'TRUNCATE' );                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE ('define SCHEMA_LIST');&lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &lt;br /&gt;          DBMS_DATAPUMP.METADATA_FILTER (handle =&amp;gt; handle,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;                                         name   =&amp;gt; 'SCHEMA_LIST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;                                         value  =&amp;gt; ''''||sourceSchema||'''');  &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE ('define schema remapping');              &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      &lt;br /&gt;          DBMS_DATAPUMP.METADATA_REMAP (handle    =&amp;gt; handle,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;                                        name      =&amp;gt; 'REMAP_SCHEMA',                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;                                        old_value =&amp;gt; sourceSchema,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              &lt;br /&gt;                                        value     =&amp;gt; destinationSchema);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          --&lt;br /&gt;          DBMS_OUTPUT.PUT_LINE('start datapump job');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_DATAPUMP.START_JOB (handle);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     &lt;br /&gt;          --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;          DBMS_OUTPUT.PUT_LINE ('wait for job to finish');                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       &lt;br /&gt;          DBMS_DATAPUMP.WAIT_FOR_JOB (handle, jobState);&lt;br /&gt;      END IF;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         &lt;br /&gt;      --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    &lt;br /&gt;      DBMS_OUTPUT.PUT_LINE('End time :   '||TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));&lt;br /&gt;      --&lt;br /&gt;      EXCEPTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;          WHEN OTHERS THEN              &lt;br /&gt;              IF sqlcode = 31631 THEN&lt;br /&gt;                  DBMS_OUTPUT.PUT_LINE ('Caught ORA-31631, ensure that both source and destination ' ||&lt;br /&gt;                                        'schemas have IMP_FULL_DATABASE and EXP_FULL_DATABASE '      ||&lt;br /&gt;                                        'privileges');&lt;br /&gt;              ELSE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;                  DBMS_OUTPUT.PUT_LINE (SQLERRM);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br /&gt;              END IF;&lt;br /&gt;  END; &lt;br /&gt;  ----------------------------------------------------------------------------                                                                                                                                                              &lt;br /&gt;  PROCEDURE PurgeDmpFiles (Directory      VARCHAR2,                                                                                                                                                                                        &lt;br /&gt;                           NumFilesToKeep NUMBER)&lt;br /&gt;  IS LANGUAGE JAVA&lt;br /&gt;  NAME 'FileUtils.PurgeDmpFiles(java.language.String, long)';                                                                                                                                                                                         &lt;br /&gt;  ----------------------------------------------------------------------------                                                                                                                                                              &lt;br /&gt;  PROCEDURE GzipFile       (FileName   VARCHAR2)&lt;br /&gt;  IS LANGUAGE JAVA&lt;br /&gt;  NAME 'FileUtils.GzipFile(java.language.String)';                                                                                                                                                                                                                                                                                                                                                                                &lt;br /&gt;  ----------------------------------------------------------------------------                                                                                                                                                              &lt;br /&gt;  PROCEDURE RotateFile     (FileName   VARCHAR2,                                                                                                                                                                                            &lt;br /&gt;                            RotateSize NUMBER)             &lt;br /&gt;  IS LANGUAGE JAVA&lt;br /&gt;  NAME 'FileUtils.RotateFile(java.language.String, long)';                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br /&gt;END DbUtilsPkg;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Use cases for Java stored procudures include:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The need to integrate the database with other systems and middle ware components which have APIs accessible from Java.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;"A better PL/SQL", I mainly use PL/SQL as a wrapper for SQL in order to leverage the flow control constructs that PL/SQL gives you. PL/SQL does have object extensions, however, I find these 'clunky' compared to those in Java. Java also supports some basic language features that PL/SQL does not, such as enumeration.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Moving some of the business logic out of the middle tier and closer to the data in order to improve performance and scalability by reducing network round trips between the middle tier and the database.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A way to leverage skills of Java programmers within the database.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Accessing operating system commands from within the database.&lt;/li&gt;&lt;/ul&gt;There is a wealth of material available on OTN regarding Java stored procedures which goes significantly beyond the simple example presentation here, including sample code and case studies, for further reading refer to:-&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/technology/sample_code/tech/java/jsp/oracle9ijsp.html"&gt;OTN: Samples Corner: Java Stored Procedures&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://www.oracle.com/technology/tech/java/jsp/index.html"&gt;OTN: Oracle JVM and Java Stored Procedures&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://forums.oracle.com/forums/forum.jspa?forumID=65"&gt;OTN: Oracle JVM Forum&lt;/a&gt; &lt;/li&gt;&lt;li&gt;&lt;a href="http://db360.blogspot.com/"&gt;360 Degree Programming Blog&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-2807567691033597446?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/2807567691033597446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=2807567691033597446' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2807567691033597446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/2807567691033597446'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/09/dba-utilities-package-using-java-stored.html' title='A DBA Utilities Package Using Java Stored Procedures'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-7397437216943316710</id><published>2009-07-15T14:42:00.000-07:00</published><updated>2009-07-15T14:51:16.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL Server Clustered Tables versus Oracle Index Only Tables</title><content type='html'>&lt;div align="justify"&gt;A SQL Server clustered table and an Oracle index only table are essentially the same thing, a table that instead of being heap organised, is stored in sorted order. In the case of Oracle a B*Tree is used and a doubly linked list for SQL Server. But here is the interesting bit, in Oracle due to the expense of secondary index lookups, the use of index organised tables is the excpetion rather than the rule, however if you refer to &lt;a href="http://blogs.technet.com/tnspot/archive/2007/06/27/spotlight-video-on-demand-kimberly-l-tripp-indexing-creation-with-sql-server-2005.aspx"&gt;this&lt;/a&gt; presentation from Kimberley Tripp, in SQL Server the use of clustered indexes is encouraged a lot more than their counterparts in Oracle. I can only assume that this is because SQL Server does not have an equivalent to Oracle's table lookup by rowid. In short this took me a bit by surprise.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-7397437216943316710?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/7397437216943316710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=7397437216943316710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7397437216943316710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7397437216943316710'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/07/sql-server-clustered-tables-versus.html' title='SQL Server Clustered Tables versus Oracle Index Only Tables'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-1926903994900640880</id><published>2009-07-14T14:29:00.000-07:00</published><updated>2009-07-14T14:55:01.798-07:00</updated><title type='text'>Sane San . . . Sane Virtualization ?</title><content type='html'>&lt;div style="text-align: justify;"&gt;James Morle published an article some time ago entitled &lt;a href="http://www.blogger.com/www.oaktable.net/getFile/34"&gt;"Sane SAN"&lt;/a&gt;, it discussed the practicalities allocating database storage from a SAN. One of the points it touched on was the danger of being given an amount of storage without knowing how many physical spindles it was spread across. This was before virtualization took off, the problem being that there may be several layers of virtualization before you get down to the physical disks. For example, Hewlett Packard produce something called the Enterprise Virtual Array, this aggregates trays of storage into virtual arrays. With another product called SVM, which, off the top of my head stands for something like storage virtual manager, these virtual arrays can be pooled into virtual SANs.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;On the subject of virtualization, the "Oracle Storage Guy" &lt;a href="http://oraclestorageguy.typepad.com/oraclestorageguy/2008/10/to-rac-or-not-to-rac-reprise.html"&gt;compares&lt;/a&gt; the price performance of Oracle RAC versus Oracle standard edition on clustered VMWare, with some caveats, clustered VMWare comes out the winner. This provides serious food for thought as to where it is best to carry out the clustering in the technology stack.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-1926903994900640880?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/1926903994900640880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=1926903994900640880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1926903994900640880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1926903994900640880'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/07/sane-san-sane-virtualization.html' title='Sane San . . . Sane Virtualization ?'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-7925901311857639903</id><published>2009-03-03T13:42:00.000-08:00</published><updated>2009-03-03T13:49:08.098-08:00</updated><title type='text'>Oracle 11.1.0.7.0 and cell physical IO interconnect byt-es</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've been playing around with 11.1.0.7.0 and noticed the system statistic "cell physical IO interconnect byt" in a statspack report. There are no references to this statistic on metalink whatsoever, however there is a reference on Kevin Closson's blog stating that this is an exadata related statistic, not that I dispute Kevin's information, but I'm not using exadata, this is something I'll try to bottom out with Oracle support.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-7925901311857639903?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/7925901311857639903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=7925901311857639903' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7925901311857639903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7925901311857639903'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/03/oracle-111070-and-cell-physical-io.html' title='Oracle 11.1.0.7.0 and cell physical IO interconnect byt-es'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-3479735658769500276</id><published>2009-02-16T14:21:00.000-08:00</published><updated>2009-02-16T14:33:14.514-08:00</updated><title type='text'>SQL Server Cross Training For Oracle Professionals</title><content type='html'>&lt;div style="width: 425px; text-align: left;" id="__ss_1035225"&gt;&lt;div style="text-align: justify;"&gt;This is a presentation I prepared for some of my colleagues at NSB Retail Systems before we became part of British Telecom. The aim of this was to provide cross training into SQL Server for Oracle professionals. The information was correct as of SQL Server version 2000, since then SQL Server has evolved to incorporate the following changes (to name but four), however the core concepts are still very much the same:-&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;there have been numerous transact SQL enhancements&lt;/li&gt;&lt;li&gt;The internals have been exposed somewhat via dynamic management views&lt;/li&gt;&lt;li&gt;Query Analyzer, Enterprise Manager and OLAP Analysis manager have been consolidated into "Management studio".&lt;/li&gt;&lt;li&gt;There is a new database tuning advisor&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a style="margin: 12px 0pt 3px; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; display: block; text-decoration: underline;" href="http://www.slideshare.net/chris1adkin/sql-server-training?type=powerpoint" title="Sql Server Training"&gt;Sql Server Training&lt;/a&gt;&lt;object style="margin: 0px;" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=sql-server-training-1234818466295948-2&amp;amp;stripped_title=sql-server-training"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=sql-server-training-1234818466295948-2&amp;amp;stripped_title=sql-server-training" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;"&gt;View more &lt;a style="text-decoration: underline;" href="http://www.slideshare.net/"&gt;presentations&lt;/a&gt; from &lt;a style="text-decoration: underline;" href="http://www.slideshare.net/chris1adkin"&gt;chris1adkin&lt;/a&gt;. (tags: &lt;a style="text-decoration: underline;" href="http://slideshare.net/tag/sql_server"&gt;sql_server&lt;/a&gt;)&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-3479735658769500276?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/3479735658769500276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=3479735658769500276' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/3479735658769500276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/3479735658769500276'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/02/sql-server-cross-training-for-oracle.html' title='SQL Server Cross Training For Oracle Professionals'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-7146295479771183515</id><published>2009-02-16T04:07:00.001-08:00</published><updated>2009-03-03T13:42:40.392-08:00</updated><title type='text'>Oracle, DB Time and Performance Baselines</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've been tasked at work with investigating performance baselines. Fortunately, as we use 10g and have paid for the diagnostics and tuning packs, base lines (or preserved snapshots) can easily be created with dbms_workload_repository.create_baseline. However, there are couple of things that would be really nice to have that are not available, namely:-&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;1. The ability for Enterprise Manager to generate notifications when the db time of a database deviates from that of a specified baseline by a specified threshold. This can be worked around via the custom metrics that the enterprise manager framework allows you to create. I'm a tad surprised that this functionality does not exist as db time is the cornerstone of the Oracle performance infrastructure from 10g onwards.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;2. Consider the scenario where you have an existing production database and you want to test the impact of adding new functionality and / or adding an increased load to production database. Obviously you don't want to do this without some prior testing, fortunately you have a test environment with hardware that is identical to production. You test the changes on test and after some tuning you deem the changes satisfactory to go into production, also you have used dbms_workload_repository to create a baseline on test. At this stage it would be really nice to have the ability to export the baseline from the test environment and import it into production. This ability does exist but it is not documented, here is the solution as proposed by Oracle support, the speed at which Oracle support came back with suggests the solution is something that other people have asked for before. Here it is:-&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;Though AWR data can be exported and imported for transporting it into other databases&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;this is not supported by oracle and this is to be used only for troubleshooting purposes,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;This is implemented with an internal package which is created with the script awrextr.sql&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;which is under $ORACLE_HOME/rdbms/admin&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;The steps to follow are &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;To download the data into a data pump dumpfile, you would use the  procedure AWR_EXTRACT:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;     DBMS_SWRF_INTERNAL.AWR_EXTRACT (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       dmpfile   =&gt; 'awr_data.dmp',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       dmpdir    =&gt; 'TMP_DIR',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       bid       =&gt; 302,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       eid       =&gt; 305);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;dmpfile     =&gt; The name of the target file for the data is mentioned here. This is a Data Pump export&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;                      file. If non filename is given, the default value awrdat.dmp is used.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;dmpdir     =&gt; The directory object where the dumpfile is written. In this case, you may have defined&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;                      a directory TMP_DIR as /tmp.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;bid            =&gt;  The snapshot ID of the beginning snapshot of the period.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;eid           =&gt;  The end snapshot ID.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;Once you dump the AWR data to the dumpfile awr_data.dmp to the new location and load it using another procedure in&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;the same package,&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;First we need to load  the AWR data to a temporary staging area before loading into the SYS schema. In this case, the data&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;will be loaded to AWR_TEST schema initially.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;    DBMS_SWRF_INTERNAL.AWR_LOAD (&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       SCHNAME =&gt; 'AWR_TEST',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       dmpfile =&gt; 'awr_data',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;       dmpdir =&gt;  'TMP_DIR');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;After staging, the data is moved into the SYS schema:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;begin&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;    DBMS_SWRF_INTERNAL.MOVE_TO_AWR (SCHNAME =&gt; 'TEST');&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;end;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;Once this is completed, the AWR data can be used for any performance analysis or you can build a central repository of&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman; font-style: italic;"&gt;AWR data collected from multiple databases&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-7146295479771183515?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/7146295479771183515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=7146295479771183515' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7146295479771183515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7146295479771183515'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/02/oracle-db-time-and-performance.html' title='Oracle, DB Time and Performance Baselines'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-409220608628082376</id><published>2009-02-02T04:47:00.001-08:00</published><updated>2009-02-02T14:38:40.653-08:00</updated><title type='text'>The Death Of ESBs</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've just watched &lt;a href="http://www.infoq.com/presentations/soa-without-esb"&gt;"Does My Bus Look Big In This"&lt;/a&gt; on infoq, this infers that by adopting Enterprise Service Buses we are effectively brushing our spaghetti under the carpet by putting it all in "one box".  It also makes a compelling case for "Guerilla SOA", i.e. picking the small winable integration battles, rather than a monolithic campaign of putting an ESB in and all of its associated middleware. I wonder if many of the big ESB and middleware players are cogniscent of the fact there might be a major sea change coming in the world of SOA.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-409220608628082376?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/409220608628082376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=409220608628082376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/409220608628082376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/409220608628082376'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/02/death-of-esbs.html' title='The Death Of ESBs'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-616792543233372009</id><published>2009-01-24T13:33:00.001-08:00</published><updated>2009-01-24T13:51:50.548-08:00</updated><title type='text'>Efficient Oracle Database Usage By Java and J2EE Applications</title><content type='html'>&lt;div style="text-align: justify;"&gt;In case you haven't guessed, I like producing presentations. In the next two weeks or so, I intend to produce a new presentation on the the "&lt;span style="font-style: italic;"&gt;Efficient Use of Oracle By J2EE and Java Applications".&lt;/span&gt; To whet the appetite this will include:-&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;1. Connection management best practices:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;        Connection pool usage&lt;/li&gt;&lt;li&gt;        Setting the connection pool min and max settings to be the same to avoid connection storms&lt;/li&gt;&lt;li&gt;        Oracle 11g server side connection pooling&lt;/li&gt;&lt;li&gt;        Using the 11g to throttle connection rates&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;2. Efficient cursor management&lt;br /&gt;&lt;ul&gt;&lt;li&gt;        The statement Vs preparedStatement API.&lt;/li&gt;&lt;li&gt;        Avoiding hard parsing&lt;/li&gt;&lt;li&gt;        Avoiding soft parsing&lt;/li&gt;&lt;li&gt;        Parameters that affect parsing: session_cached_cursors, &lt;/li&gt;&lt;li&gt;        cursor_space_for_time and cursor_sharing&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;3. Minimizing network round trips and leveraging bulk operations&lt;br /&gt;&lt;ul&gt;&lt;li&gt;        The JDBC fetch size&lt;/li&gt;&lt;li&gt;        Statement batching in JDBC&lt;/li&gt;&lt;li&gt;        The Oracle array interface&lt;/li&gt;&lt;li&gt;        Leveraging Oracle bulk operations&lt;/li&gt;&lt;li&gt;        Intelligent Oracle statement feature usage, specifically usage of: merge &lt;/li&gt;&lt;li&gt;        statements, in line views, in line PL/SQL functions, sub query factoring.&lt;/li&gt;&lt;li&gt;        The client side result cache&lt;/li&gt;&lt;li&gt;        Programming and design styles for minimizing application 'Chatter'&lt;/li&gt;&lt;li&gt;        Caching&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;4. Design and coding according to the putting the processing close to resource that requires it, specifically:-&lt;br /&gt;&lt;ul&gt;&lt;li&gt;        Do not be precious about Java or the database; it is not necessarily a good&lt;/li&gt;&lt;li&gt;        thing to do everything in the database.&lt;/li&gt;&lt;li&gt;        Do not re-invent database functionality in Java&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;5. Best practices for logger buffer usage&lt;br /&gt;&lt;ul&gt;&lt;li&gt;        JDBC auto commit.&lt;/li&gt;&lt;li&gt;        Batch and asynchronous commits as introduced in Oracle 10g.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Watch this space . . .&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-616792543233372009?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/616792543233372009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=616792543233372009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/616792543233372009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/616792543233372009'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/01/efficient-oracle-database-usage-by-java.html' title='Efficient Oracle Database Usage By Java and J2EE Applications'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-6898600423577462415</id><published>2009-01-23T08:49:00.001-08:00</published><updated>2009-01-23T08:57:19.890-08:00</updated><title type='text'>J2EE Batch Processing Design and Tuning presentation here !!!</title><content type='html'>As promised here is my presentation on J2EE batch processing. There may be material on the Internet and blogosphere that covers some of the individual areas I touch on in greater detail. However as a piece of material that aggregates this in one place, I don't think its bad.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="width:540px;margin:auto;"&gt;&lt;object style="margin:0px" width="538" height="341"&gt;&lt;param name="movie" value="http://static.slideshare.net.s3.amazonaws.com/swf/egowidget2.swf"/&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slideshare.net.s3.amazonaws.com/swf/egowidget2.swf" flashVars="feedurl=user/chris1adkin&amp;widgettitle=Slideshows by User: chris1adkin" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="538" height="341"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br/&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;text-align:left;"&gt;&lt;a href="http://www.slideshare.net/?src=egowidget"&gt;&lt;img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/&gt;&lt;/a&gt; | &lt;a href="http://www.slideshare.net/widgets/presentation-pack" title="Get your Presentation Pack"&gt;Get your Presentation Pack&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-6898600423577462415?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/6898600423577462415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=6898600423577462415' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/6898600423577462415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/6898600423577462415'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/01/j2ee-batch-processing-desing-and-tuning.html' title='J2EE Batch Processing Design and Tuning presentation here !!!'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-4983431157172241999</id><published>2009-01-21T11:16:00.000-08:00</published><updated>2009-01-21T14:29:43.377-08:00</updated><title type='text'>Presentation On J2EE Batch Processing and Tuning</title><content type='html'>I have spent much of my time recently on a project focusing on the volume and performance testing of J2EE (Websphere app server) batch processes using a Oracle 10g database for persistence. I will shortly be posting a presentation which will cover some salient points that emerged from this work via slideshare.net.&lt;br /&gt;&lt;br /&gt;I wrote the presentation for several reasons:-&lt;br /&gt;&lt;br /&gt;1. To capture key lessons learned on the project from a technical point of view.&lt;br /&gt;&lt;br /&gt;2. To capture information on batch process design considerations as there is not much information in the public domain.&lt;br /&gt;&lt;br /&gt;3. To produce some "joined up" information on tuning J2EE software using Oracle, mainly because most J2EE material stops short of the database at the JDBC level and most database tuning material stops short of application server at JDBC but from the other direction. There is material "out there" but not in one place presented in a manner that covers the whole software stack.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;In this day and age most databases are 'fronted' by an application server and we have long since moved on from all the business logic residing within the database and the database being the main focal point of integration. Very few applications are islands and the 'glue' used to join applications up is almost as important as the applications themselves, therefore a more all encompassing approach needs to be taken when tuning and performance monitoring the software stack.&lt;br /&gt;&lt;br /&gt;These are the main points I will cover:-&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;1. Batch process architecture and design considerations.&lt;br /&gt;&lt;br /&gt;2. The batch process design used on my project&lt;br /&gt;&lt;br /&gt;3. Available monitoring and tuning tools for tuning J2EE architectures using Oracle.&lt;br /&gt;&lt;br /&gt;4. Tuning findings&lt;br /&gt;&lt;br /&gt;5. Conclusions&lt;br /&gt;&lt;br /&gt;As everyone always likes to skip to the end of a book before reading the rest, I will touch on some of the conclusions from this work, namely:-&lt;br /&gt;&lt;br /&gt;1. Why Martin Fowler's first law on distributed Object architectures is well founded.&lt;br /&gt;&lt;br /&gt;2. Dangers of swamping a J2EE application server with too many threads.&lt;br /&gt;&lt;br /&gt;3. Avoiding 'Chatty' designs.&lt;br /&gt;&lt;br /&gt;4. Although row by row processing is a concern, it is not always the end of the world in terms of performance and only a genuine concern if it prevents performance and scalability targets from being reached.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-4983431157172241999?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/4983431157172241999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=4983431157172241999' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/4983431157172241999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/4983431157172241999'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/01/presentation-on-j2ee-batch-processing.html' title='Presentation On J2EE Batch Processing and Tuning'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-8450717038291092787</id><published>2009-01-15T11:21:00.000-08:00</published><updated>2009-01-15T13:59:33.975-08:00</updated><title type='text'>The Basics That Undermine RAC Scalability And Availability</title><content type='html'>&lt;div align="justify"&gt;I'm writing this post as one of the things I hope to get into in the near future is Oracle RAC. There are two reasons for adopting Oracle RAC:-&lt;br /&gt;&lt;br /&gt;1. Scalability&lt;br /&gt;&lt;br /&gt;Cluster inter-connect traffic and performance is a major factor here. As such Infiband is being touted as the up and coming inter-connect fabric. Also if you google Joel Goodman Oracle, you will most probably find references to presentations and papers on how uncached sequences without noorder specified can degrade performance via the pinging of blocks across the inter-connect. Other than this, the same factors that influence performance and scalability for a single instance application also apply to RAC. Specifically, these are the "usual suspects" that the Oracle Real World performance include in most of the material they present at Oracle Open World, namely:-&lt;br /&gt;&lt;br /&gt;1. Good schema design&lt;br /&gt;2. Efficient connection management&lt;br /&gt;3. Efficient cursor management&lt;br /&gt;&lt;br /&gt;Therefore, my first question is this, how many RAC sites test their applications in single instance environments for scalability around these three factors. Also, how many sites test the scalability of their clusters as they add nodes. Interestingly according to Julian Dyke’s book on 10g RAC and Linux, Oracle actually turn cache fusion off in their RAC TCP bench marks.&lt;br /&gt;&lt;br /&gt;A further recommendation is that your application has some intelligence when connecting to database services, such that the workload directed at specific nodes, leads to a minimal amount of cluster inter-connect traffic. Without any evidence to back it up, there are probably applications out there which use tables to implement things best described as application level semaphores or tables which occupy very few blocks with flag like columns, which if placed on a RAC cluster will slay the inter-connect.&lt;br /&gt;&lt;br /&gt;2. High availability&lt;br /&gt;&lt;br /&gt;It is recommended that there is adequate capacity in the cluster to soak up the workload created when one or more nodes fails. Technical issues aside, a cluster is not a panacea for high availability and this can be undermined by several factors:-&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;Poor testing of changes applied to a cluster.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;Lack of a realistic test cluster.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;A lack of tight change management procedures and processes.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div align="justify"&gt;In short, as I alluded to all of this, it begged the question, how many RAC sites carry out all of this work when implementing RAC, there is no way of knowing suffice it to say that the answer is probably less than 100%.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-8450717038291092787?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/8450717038291092787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=8450717038291092787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/8450717038291092787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/8450717038291092787'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2009/01/basics-that-undermine-rac-scalability.html' title='The Basics That Undermine RAC Scalability And Availability'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-7585514817958968609</id><published>2008-12-26T14:11:00.000-08:00</published><updated>2008-12-27T08:47:39.975-08:00</updated><title type='text'>Nuances Of JDBC Connection Pools</title><content type='html'>&lt;div style="text-align: justify;"&gt;There was a particular piece of code I was tuning a while back which highlighted some of the quirks of JDBC connection pooling. A piece of PL/SQL created and executed an INSERT SELECT statement based upon the parameters it was called with from a WebSphere application server. The statement was bind friendly, but due to bind peeking a lot of on the fly re-optimizations were taking place which hit performance.&lt;br /&gt;&lt;br /&gt;A common misconception with Oracle is that execution plans are only re-generated when a hard parse takes place or when an execution plan is aged out of the shared pool, this is not the case, &lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2124.htm"&gt;v$sql_shared_cursor&lt;/a&gt; gives numerous reasons as to why re-optimizations and also the generation of child cursors take place. However, as per a previous posting I made, this view does not capture bind peeking activity.&lt;br /&gt;&lt;br /&gt;As a quick fix, and yes I know this solution was only really a crutch, I placed an execute immediate statement at the top of the code to set cursor_sharing to force. I could have also fixed this using the hint opt_param('_optim_peek_user_binds', 'false'), with the benefit of hind sight and the rule of thumb that the scope of the fix should match the scope of the problem, this may have been a better way to have gone.&lt;br /&gt;&lt;br /&gt;I did not realise at the time that this alter session would affect other SQL statements executed by the application server that reused this particular connection from the pool, with disastrous results on performance. In particular, a batch process which executed the same statement with different binds multiple times was not being re-optimized at execution time, when in fact Oracle had just cause to do this. Fortunately this particular scenario was constrained to one test environment I was working on. The resolution to the problem was to put another execute immediate statement at the bottom of the stored procedure to set cursor_sharing back to what is was set to before.&lt;br /&gt;&lt;br /&gt;A popular technique to avoid database access and solve mutating trigger problems is to use a PL/SQL array declared in a PL/SQL package specfication. Indeed, the other nuance of JDBC connection pooling is that if an SQL call from the Java code intialises such a variable, and then the connection is released in the Java code, subsequent calls from the same Java thread, may not necessarily reuse the same connection from the JDBC connection pool and thus not see the data cached in the PL/SQL package.&lt;br /&gt;&lt;br /&gt;Good Java programming practice dictates that you should always lazily grab resources and then release them as soon as they are no longer required, incresing the likelihood that threads may use many different connections from the JDBC connection pool. Also note that when obtaining a JDBC connection in Java code, what you are in fact doing is obtaining a handle to a connection from the pool . New connections to the database should only be made:-&lt;br /&gt;&lt;br /&gt;1. After the application server starts up&lt;br /&gt;&lt;br /&gt;2. In the minimum and maximum connection settings for the pool are not the same and the application server needs to grow the size of the pool up to the maximum setting.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-7585514817958968609?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/7585514817958968609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=7585514817958968609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7585514817958968609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/7585514817958968609'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2008/12/nuances-of-jdbc-connection-pools.html' title='Nuances Of JDBC Connection Pools'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-8810280469987048630</id><published>2008-12-26T13:27:00.001-08:00</published><updated>2008-12-26T13:27:29.214-08:00</updated><title type='text'>A Presentation On Trouble Shooting Bad Execution Plans In Oracle</title><content type='html'>&lt;div style="width:425px;text-align:left" id="__ss_873022"&gt;&lt;a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/chris1adkin/oracle-sql-tuning-presentation?type=powerpoint" title="Oracle Sql Tuning"&gt;Oracle Sql Tuning&lt;/a&gt;&lt;object style="margin:0px" width="425" height="355"&gt;&lt;param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=oracle-sql-tuning-1230324983128347-2&amp;stripped_title=oracle-sql-tuning-presentation" /&gt;&lt;param name="allowFullScreen" value="true"/&gt;&lt;param name="allowScriptAccess" value="always"/&gt;&lt;embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=oracle-sql-tuning-1230324983128347-2&amp;stripped_title=oracle-sql-tuning-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"&gt;View SlideShare &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/chris1adkin/oracle-sql-tuning-presentation?type=powerpoint" title="View Oracle Sql Tuning on SlideShare"&gt;presentation&lt;/a&gt; or &lt;a style="text-decoration:underline;" href="http://www.slideshare.net/upload?type=powerpoint"&gt;Upload&lt;/a&gt; your own.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-8810280469987048630?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/8810280469987048630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=8810280469987048630' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/8810280469987048630'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/8810280469987048630'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2008/12/presentation-on-trouble-shooting-bad.html' title='A Presentation On Trouble Shooting Bad Execution Plans In Oracle'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-1661022718459644117</id><published>2008-12-23T02:38:00.000-08:00</published><updated>2008-12-23T15:28:59.178-08:00</updated><title type='text'>Performance Bottlenecks In The J2EE App Server That Can Throttle The Database</title><content type='html'>&lt;div align="justify"&gt;I mentioned in my post about layered architectures that I would discuss factors that can throttle throughput from the J2EE application server to the database (or persistence layer). To start of with, I will focus of the ethos of designing distributed object architectures, in the words of Martin Fowler:-&lt;/div&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;em&gt;". . . Hence, we get to my First Law of Distributed Object Design: Don't distribute your objects!"&lt;/em&gt;&lt;/div&gt;&lt;br /&gt;&lt;div align="justify"&gt;Distributing components between J2EE application servers in the J2EE world, involves the use of remote method invocation (RMI) calls to remote interfaces, assuming we are talking about synchronous communication here. Remote method calls to beans deployed to remote servers incurs the following performance overheads:-&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Copy by value&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Network latency&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Every incoming RMI call needs to be serviced by its own Java thread&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Servicing incoming connections from the TCP-IP stack causes context switches&lt;/li&gt;&lt;/ul&gt;&lt;p align="justify"&gt;The original text behind this design ethos appears in Martin's book "&lt;em&gt;Patterns Of Enterprise Architecture&lt;/em&gt;", there is also a very similar article that Martin has published in Dr Dobbs journal which can be found &lt;a href="http://www.ddj.com/showArticle.jhtml?articleID=184414966"&gt;here&lt;/a&gt;. &lt;/p&gt;&lt;p style="text-align: justify;"&gt;If all the beans are deployed to the same application server, this will eliminate all the bottlenecks except for that of copy by value. However, as you will see, the overhead of pass by copy is still significant and will both increase heap utilisation and extend the part of major garbage collection that looks for dangling objects on the heap. On the last project I worked on at the time of writing this, we found that:-&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The &lt;a href="http://www.oracle.com/technology/products/oem/pdf/SMPerf.pdf"&gt;10g database time&lt;/a&gt; (not to be confused with wall clock time) was low.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Average number of sessions from &lt;a href="http://www.oracle.com/technology/products/oem/pdf/SMPerf.pdf"&gt;ADDM&lt;/a&gt; reports was low.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The CPU on the WebSphere server was maxed out.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;Profiling the code with a Java profiler revealed that 50% of the CPU time was being expended on a method with a name like com.ibm.CORBA.util.copyObject. This was because the business logic or domain beans were calling the database access beans via remote interfaces, which uses pass by value.&lt;/div&gt;&lt;p align="justify"&gt;For the benefit of anyone reading this who is not that familiar with the J2EE world, I will elaborate on pass by reference, pass by value and remote and local homes. One of the original design goals being the J2EE standard was to present a framework in which distributed applications could easily be produced, this was based on CORBA and the synchronous communications method was RMI. Prior to the EJB 2.1 standard, it was assumed that when one enterprise bean called another bean, the 'other' bean was always remote, hence a remote interface and copy by value was always used. However, as time went by people realised that despite this, a lot of applications used beans that were deployed to the same J2EE app server and hence suffered this performance penalty for no added benefit. Thus, in the EJB 2.1 standard 'local' interfaces came about. Beans talking to each other using local interfaces use the much more efficient pass by reference method of passing object references rather than whole objects by value. &lt;/p&gt;&lt;p align="justify"&gt;Fortunately with WebSphere there is an option available on the Object Request Broker (ORB),    to turn pass by reference 'On', this forces all the beans deployed to the same EJB container using the same class loader to use pass by reference, irrespective of whether they have been coded to use remote interfaces. In the case of the application that I was looking at, this had the rather large impact of:-&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Reducing batch process run times by 50%.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Reducing CPU consumption on the server hosting the WebSphere application server by 50%.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Doubling the 10g db time that a batch process spent in the database.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Increasing the average number of sessions active whilst the batch process was running, again this is an Oracle 10g time metric which is the database time divided by the actual elapsed "walk clock" time.&lt;/li&gt;&lt;/ul&gt;&lt;p align="justify"&gt;Setting the class loader policy on for the application server to single also helps. In tuning WebSphere, I also looked at the:-&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;server JVM&lt;/li&gt;&lt;br /&gt;&lt;li&gt;client JVM&lt;/li&gt;&lt;br /&gt;&lt;li&gt;ORB with regard to the setting up a JNI reader thread pool and the fragment size&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;JDBC pool, both the size of the pool, pool utilization and cached statement discard rate.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;EJB container, specifically the EJB cache size&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Log4j logging level&lt;/li&gt;&lt;br /&gt;&lt;li&gt;number of batch process threads&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;turning off the diagnostic trace&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;To the best of my knowledge, the only thing I didn't look at was turning the PMI off completely.  For both the client and server JVM, I found that using the JVM otpions as used by IBM in  a &lt;a href="http://www.spec.org/osg/jAppServer2004/results/res2006q3/jAppServer2004-20060801-00032.html"&gt;Solaris SPECjAppserver2004 submission&lt;/a&gt; yielded the best results. Refer to &lt;a href="http://webspherecommunity.blogspot.com/"&gt;this link&lt;/a&gt; for a blog on which some of the IBMers who carry out this work write, in particular Andrew Spyker, WebSphere performance architect.&lt;br /&gt;&lt;/div&gt;&lt;p align="justify"&gt;However, out of all the things I looked at, I got the biggest bang for my buck from turning pass by reference to 'On' by a long chalk. This comes with a word of caution though, if your software is designed such that beans that receive RMI calls modify objects and the calling bean is not expecting this, wild and erratic application can result. It is for this very reason, or so I believe , that pass by reference is now turned 'Off' by default on WebSphere 6.1.&lt;/p&gt;&lt;p align="justify"&gt;This brings me on to J2EE clustering and shared nothing architectures. WebSphere network deployment, the clustered version of the WebSphere uses a shared nothing architecture, similar to that discussed in this article &lt;a href="http://www.theserverside.com/tt/articles/article.tss?l=ScalingYourJavaEEApplicationsPart2"&gt;here&lt;/a&gt;, which again re-iterates the point about distributed architectures and performance:-&lt;/p&gt;&lt;p align="justify"&gt;&lt;em&gt;"The most scalable architectures are sharing-nothing clusters. In such clusters, each node has the same functionalities, and knows nothing about the existence of other nodes. The load balancer will decide how to dispatch the requests to the back end server instances. It is rare that a load balancer will become a bottleneck, because a load balancer only need to do some very simple jobs, such as distributing requests, health checking, and session sticking. By adding more nodes, the computing ability of the cluster is increasing almost lineally, if the back end database or other information systems are powerful enough."&lt;/em&gt; &lt;/p&gt;&lt;p align="justify"&gt;With WebSphere network deployment, the same ear file is deployed to each node in the cluster, or cell, to use IBM terminology, workload distribution is managed in a round robin fashion via the workload manager. WebSphere eXtreme scale adds some extra intelligence to this by distributing the work load based on the current available capacity of nodes in the cluster.&lt;/p&gt;&lt;p align="justify"&gt;What exacerbated my original problem of the massive copy by object overhead was the batch processing design, which is fundamentally &lt;a href="http://www.devx.com/Java/Article/20791/1954?pf=true"&gt;this&lt;/a&gt;. The problem being that because Oracle is called for every individual item in the workload, there is heavy traffic between the business logic layer and the persistence layer. Accessing a database item by item is really inefficient in terms of:-&lt;/p&gt;&lt;p align="justify"&gt;1. Hard and soft parsing, in particular I found that setting the batch process thread count above 32 stressing the library cache pin mutex. Tanel Poder has written a good article on the library cache pin mutex and extended use of mutexes in 11g &lt;a href="http://blog.tanelpoder.com/2008/08/03/library-cache-latches-gone-in-oracle-11g/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;2. Latching&lt;/p&gt;&lt;p align="justify"&gt;3. Network round trips and network latency&lt;/p&gt;&lt;p align="justify"&gt;4. Physical and logical reads&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;5. JDBC calls&lt;/p&gt;&lt;p align="justify"&gt;Some people get very agitated about batch process designs that process the workload item by item and in principle this results in certain inefficiencies when accessing the database. However, the performance targets for the batch processes where the same as those for the system this new one was replacing, but with 200% of the workload and two years worth of "Database aging", i.e. the database had been artificially aged to give the appearance of the application having been in use for two years. In summary, all batch processes beat their  counter parts in the original application by at least a factor of 100%.&lt;br /&gt;&lt;/p&gt;&lt;p align="justify"&gt;The morals of this story are:-&lt;/p&gt;&lt;p align="justify"&gt;1. Distributed object architectures are bad for performance&lt;/p&gt;&lt;p align="justify"&gt;2. Your application needs to be profiled in order to work out where the time is going, in the example I have highlighted, the database was never the bottleneck.&lt;/p&gt;&lt;p align="justify"&gt;3. A holistic approach to looking at the architecture needs to be taken with regard to achieving good performance and scalability.&lt;/p&gt;&lt;p align="justify"&gt;I will get around to discussing approaches on alleviating the stresses that item by item oriented batch processing imposes on the Oracle database in a future post.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;p align="justify"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-1661022718459644117?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/1661022718459644117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=1661022718459644117' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1661022718459644117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1661022718459644117'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2008/12/performance-bottlenecks-in-j2ee-app.html' title='Performance Bottlenecks In The J2EE App Server That Can Throttle The Database'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-4933256512552609435</id><published>2008-12-01T13:12:00.000-08:00</published><updated>2008-12-21T13:50:15.511-08:00</updated><title type='text'>J2EE Layered Application Architectures and Performance</title><content type='html'>&lt;p align="justify"&gt;I have spent most of my career as a DBA focusing on performance. With most applications there is an intimate relationship between the design and architecture of the application and that of its performance and scalability. Generally speaking, if the design and architecture is wrong, getting an application to perform and scale can be akin to applying elastoplasts over the biggest holes. &lt;/p&gt;&lt;p align="justify"&gt;As an industry, IT has a patchy record for delivering projects on time and to budget, as such there are many projects out there that barely manage to cross the finishing line having met all of their functional requirements let alone performance requirements. Due to this, tuning can be reactive and end up becoming a battle against the architecture and design.&lt;br /&gt;&lt;br /&gt;There was a time when most applications consisted of a client and business logic written directly in the database using stored procedures. Indeed the database software formed the largest part of the application stack. However, more recent architectural trends have been heavily influenced by:-&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The internet, Web 2.0 has firmly established itself and Web 3.0 is around the corner&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Service Oriented Architectures (SOA)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Software as a service (SAAS)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Event driver architectures&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Extreme transaction processing&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Grid architectures&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Mash ups&lt;/li&gt;&lt;/ul&gt;&lt;p align="justify"&gt;Indeed, there was a time when the database was a focal point of integration efforts, now the industry is moving towards integration via XML based middleware. &lt;a href="http://martinfowler.com/bliki/DatabaseThaw.html"&gt;Here&lt;/a&gt; is one such article on this very subject from design and architecture luminary Martin Fowler. In the current climate "integration architects" are highly sort after people.&lt;/p&gt;&lt;p align="justify"&gt;Cloud computing is on its way and just as during the old web 1.0 days, to quote a marketing tag line from Sun. "We were into intranets when most people thought this was a typo", there will also be internal clouds as well. Therefore if you have an interest in performance and tuning, it is highly likely that you will have some involvement in the areas outside the database and find that the database is being under utilised because of what is happening in the layers above it. Cary Millsap made a &lt;a href="http://nocoug.org/download/2006-11/Why_You_Can"&gt;presentation&lt;/a&gt; at Oracle Open World 2007 highlighting the importance of establishing application profiles when tuning.&lt;/p&gt;&lt;p align="justify"&gt;One of the most prevalent software architectures today uses a combination of layering and tiering, a tier being a layer that is physically deployed on a separate server as opposed to a layer. What is paramount about the tier-ing / layering design approach is that it provides a "clean separation of concerns". Layering can also be vertical, i.e. swathes of development for particular functional areas which cut through the horizontal layers. Classically, the 'Horizontal' layers are:-&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Presentation&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Business logic (or domain)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Integration&lt;/li&gt;&lt;/ul&gt;&lt;p align="justify"&gt;Architects in the finance world prefer tiers, in that each tier can reside in its own DMZ (de-militarised zone) and hence provide maximum security. My interest in application architecture has developed from the bottom up, i.e. from the database upwards. However, the integration layer is not always an RDBMS, it can be:-&lt;br /&gt;&lt;br /&gt;1. A web service&lt;br /&gt;&lt;br /&gt;2. A message queue&lt;br /&gt;&lt;br /&gt;3. Distributed object cache (which may be transactional)&lt;br /&gt;&lt;br /&gt;4. An enterprise service bus adapter or message broker&lt;br /&gt;&lt;br /&gt;5. Java Connection Architecture connection&lt;/p&gt;&lt;p&gt;6. etc . . .&lt;/p&gt;In fact with XA distributed transactions, a transaction can span multiple end points below the integration layer.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Some patterns are almost de facto in certain layers and tiers, such as model view controller in the presentation tier, session facade in the business logic or domain tier, to name but two. Also, there are frameworks and third party libraries that take a lot of the effort out of having to crank out boiler plate code and the code behind the application infrastructure, e.g.:-&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;1. Apache struts and Java Server Faces for the presentation layer&lt;/p&gt;&lt;p&gt;2. Spring for the whole application or specific layers&lt;/p&gt;&lt;p&gt;3. Log 4j for logging&lt;/p&gt;&lt;p&gt;4. Apache commons, which is a common utilities library&lt;/p&gt;&lt;p&gt;However, whatever you do you should never; code business logic into the presentation layer or explicitly code details of the integration layer into the business logic or domain layer. &lt;/p&gt;&lt;p align="justify"&gt;When looking at the performance of such architectures one needs to establish a profile of where particular activities spend their time within the various layers or tiers and the networks involved in connecting any tiers. If a J2EE application server is involved in the application stack, something known as the "carrot model" should be understood. All J2EE application servers use the following set of components that form a pipe line from the 'front' of the application server to the 'back', these are:-&lt;/p&gt;&lt;p&gt;1. Object request broker used for J2EE clients.&lt;/p&gt;&lt;p&gt;2. Web container&lt;/p&gt;&lt;p&gt;3. Enterprise Java Bean Container&lt;/p&gt;&lt;p&gt;4. JDBC Pool or JCA connectors.&lt;/p&gt;&lt;p align="justify"&gt;The WebSphere application server has a http server built into the web container, however, this is only really recommended for testing purposes so you will probably have an http server outside of the J2EE application server. What the "carrot model" represents is that component utilisation is usually quite high at the 'front' of the application server and gradually dwindles off as you get towards the JDBC connection pool or JCA connectors, hence the analogy of a carrot, thick at one end and thin at the other. Note that ORB is only used for J2EE clients, web clients will utilise the web container http server or external http server directly.&lt;/p&gt;&lt;p align="justify"&gt;A lot of texts refer to the effort and careful consideration that needs to go into designing the layers of the applications architecture. I would add that the same level of consideration needs to be given to where processing should be carried out. In the simplest of architectures with a J2EE application server on one machine and a database on another, there is still scope for the network to become the bottleneck by excessive calls being made to the database to carry out the processing of business logic and also standing data lookup. In one example, a stateless bean used to access fixed domain data was the most utilised bean in the application until a standing data cache in the application server was implemented. In another example, a stored procedure was called to validate individual items within individual records, using fixed domain data cached in the application server. By carrying the validation entirely within the application server, the process concerned ran faster, required fewer threads than before with lower CPU consumption on both of the servers hosting the application server and the database. &lt;/p&gt;&lt;p align="justify"&gt;There is equal scope for poor performance and scalability to be present by design with vertical layering also. One particular design trend is to develop specific functional areas with an API implemented using a session facade. Tools such as Apache Axis and also the J2EE application server itself make exposing stateless session beans as a web service easy and straight forward. Consider two separate beans used to implement the APIs for two different functional areas, if these areas are tightly coupled and they are to be used in a service oriented architecture, there is going to be a significant amount of XML to Java serialisation that takes place involving the two respective web services, that might be avoided, if the API was provided by a single bean.&lt;/p&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;I strongly advise people to read the IBM red book &lt;a href="http://www.redbooks.ibm.com/abstracts/sg247497.html?Open"&gt;"Designing and Coding Applications for Performance and Scalability in WebSphere Application Server"&lt;/a&gt;. This is one of the best texts I have come across in the area of designing and writing scalable and well performing J2EE applications. If I had my way, this would be mandatory reading material for all developers, designers and architects on J2EE development projects.&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;In the not too distant future I will post an article on my experiences of the specific things that can stifle utilisation of the database server when a J2EE application is used.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-4933256512552609435?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/4933256512552609435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=4933256512552609435' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/4933256512552609435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/4933256512552609435'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2008/12/j2ee-layered-application-architectures.html' title='J2EE Layered Application Architectures and Performance'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-1979173289696358827</id><published>2008-11-04T13:49:00.000-08:00</published><updated>2008-11-04T14:06:21.297-08:00</updated><title type='text'>The Rise Of MySql From The Low End</title><content type='html'>At the time of writing this, the penultimate bog entry from Jonathan Schwartz on the Sun web site refers to innovation loving a crisis, the crisis being the turmoil in the global economy. From this, it is not too difficult to make the mental leap and arrive at the inference that software with no license costs is going to be very attractive at present. Now, this comes from Jonathan's latest blog entry (again latest at the time of writing this):-&lt;br /&gt;&lt;br /&gt;&lt;em&gt;"The third is the need for change - one executive to whom I spoke recently said her &lt;strong&gt;&lt;u&gt;entire discretionary budget was consumed by one proprietary vendor's price increase&lt;/u&gt;&lt;/strong&gt;. So she's out looking for an alternative, &lt;strong&gt;&lt;u&gt;and MySQL fits the bill&lt;/u&gt;&lt;/strong&gt;. Which is to say, necessity's the mother of invention - and there's a lot of necessity going around right now."&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;br /&gt;Makes you wonder if MySql is going to start biting Oracle at it's ankles around the lower end of the market more than ever before.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/29074266-1979173289696358827?l=wollatondba.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://wollatondba.blogspot.com/feeds/1979173289696358827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=29074266&amp;postID=1979173289696358827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1979173289696358827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/29074266/posts/default/1979173289696358827'/><link rel='alternate' type='text/html' href='http://wollatondba.blogspot.com/2008/11/rise-of-sql-server-from-low-end.html' title='The Rise Of MySql From The Low End'/><author><name>Chris Adkin</name><uri>http://www.blogger.com/profile/14506026605015116618</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='http://bp3.blogger.com/_m6bFoKebmps/SIYKEn19HXI/AAAAAAAAAA4/92jPL-C3340/S220/Image029.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-29074266.post-7315366794301461084</id><published>2008-10-13T13:27:00.000-07:00</published><updated>2008-10-13T14:19:16.554-07:00</updated><title type='text'>"The Performance Hacker"</title><content type='html'>&lt;div align="justify"&gt;I've just read the Oracle Real World Performance Group's Open World 2008 presentations entitled "Current Trends in Real World Database Performance". The bit about the performance hacker was interesting. Tuning via initialisation parameters is a bad practice with little or no mileage to gained, unless parameters have been grossly mis-configured in the first place. At the extreme end of the performance hacker spectrum are those that dabble with initialisation parameters that most DBAs will never have any cause to change in their entire careers, such as spin_count (_spin_count from 8i), worse still are those that dabble with the '_' parameters without direction from Oracle support. In most sessions Oracle's Graham Wood gives at the UKOUG conferences, he always mentions that the scope of a fix should match the scope of the problem. You need to get to the root cause of the problem, although the use of hints is no where near as bad as hacking initialisation parameters, it is fixing the symptoms of the problem rather than directly addressing the problem itself.&lt;/div&gt;&lt;br /&gt;Of the other characteristics that define the "Performance hacker", they like to indulge in tuning via the internet. There are, however, some excellent sources of information on the internet and in blog sphere regarding tuning:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The Real World Performance Group&lt;/li&gt;&lt;li&gt;The Optimizer Group Blog&lt;/li&gt;&lt;li&gt;Jonathan Lewis's blog &lt;/li&gt;&lt;li&gt;Wolfgang Breitlings web site etc&lt;/li&gt;&lt;/ul&gt;&lt;div align="justify"&gt;The trick is to prefer sources of information from organisations and individuals that provide clearly worked through test cases in order to demonstrate their points. Sites that make grandiose claims without backing them up with worked examples should be avoided like the plague.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;If you are completely new to Oracle you may have a tuning advisor view
