<?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:blogger='http://schemas.google.com/blogger/2008' 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-4267846662566950522</id><updated>2024-11-01T03:48:16.549-07:00</updated><category term="How To"/><category term="Database Script"/><category term="Oracle10g"/><category term="ALL_VIEWS"/><category term="AUDIT TRAIL"/><category term="AUDIT_TRAIL"/><category term="Apache Installation on Linux"/><category term="Auditing Oracle Database"/><category term="Auditing Table Data using Trigger"/><category term="Automatic Undo Retention Tuning"/><category term="Backup Using RMAN"/><category term="Backup amp; Recovery"/><category term="Backup-Restore Control File"/><category term="Buffer Cash"/><category term="CONTROLFILE AUTO BACKUP"/><category term="Cancel-Based Recovery"/><category term="Changing Hostname"/><category term="Changing Hostname on RHEL"/><category term="Clear"/><category term="Clear Buffer Cash and shared_pool"/><category term="Create Objects"/><category term="Create Public Synonym"/><category term="Create directory in Oracle"/><category term="DBA switch to another database user without a password"/><category term="DBA_VIEWS"/><category term="DBMS_JOB"/><category term="DBMS_LOCK"/><category term="DBMS_PACKEGE"/><category term="DBMS_STATS"/><category term="DBMS_UTILITY"/><category term="DB_FLASHBACK_RETENTION_TARGET"/><category term="DB_RECOVERY_FILE_DEST"/><category term="Data Dictionary and Dynamic performance view"/><category term="Database Backup"/><category term="Database Design"/><category term="Development life cycle of Database"/><category term="ER Diagram of HR System"/><category term="Enabling Archive Log"/><category term="Enabling the Archive Log"/><category term="Enabling the Archive Log in oracle 10 g"/><category term="Enterprise Manager"/><category term="Export And Import"/><category term="File Backup (tar)"/><category term="Flashback Recovery"/><category term="Full Database Backup Script"/><category term="GATHER_SCHEMA_STAT"/><category term="Grant Permission"/><category term="Grant Select/Execute"/><category term="How to recover forgotten root Password"/><category term="How to take file backup from Linux Server"/><category term="Htaccess in Linux"/><category term="Insert and Update (#039;amp;#039;)"/><category term="Installation On OEL 5.0"/><category term="Listener Broken pipe"/><category term="Listener-Broken Pipe Error"/><category term="Login in Oracle Without Password"/><category term="Managing Index"/><category term="Managing Tablespace"/><category term="Monotoring Session"/><category term="Monotoring Session And SQL"/><category term="Monotoring Session amp; SQL"/><category term="ORA-00018"/><category term="Optimize Oracle UNDO Parameters"/><category term="Oracle 10g Enterprise Manager"/><category term="Oracle To Wheel Group"/><category term="Oracle&#39;s export (exp)"/><category term="Oracle&#39;s export (exp) and import (imp)"/><category term="Oracle11g"/><category term="Oracle11g On OEL5.0"/><category term="PL/SQL Lock Timer"/><category term="Parameterized View in Oracle"/><category term="Partition Table"/><category term="Partition Table In Oracle"/><category term="Performace Tuning"/><category term="Problems And Solutions"/><category term="Proxy User in Oracle"/><category term="RECYCLE BIN"/><category term="RMAN Bacic"/><category term="RMAN Backup"/><category term="RMAN Configuration"/><category term="RMAN Recover"/><category term="Recover root Password"/><category term="Ref Cursor"/><category term="Run Script as a Oracle user"/><category term="SCP - Linux command"/><category term="SPLIT"/><category term="SPLIT Function"/><category term="SQL Optinization"/><category term="SQL Tuning Advisor"/><category term="SQL Tuning Advisor in Oracle 10g"/><category term="Schema Cleanup script"/><category term="Shared Pool"/><category term="Size Of SGA"/><category term="UNDO_RETENTION"/><category term="USER_LOCK"/><category term="USER_LOCK amp; DBMS_LOCK"/><category term="USER_LOCK.SLEEP"/><category term="UTL_FILE_DIR"/><category term="UTL_MATCH"/><category term="UTL_SMTP And UTIL_MAIL"/><category term="UTL_SMTP amp; UTL_MAIL"/><category term="Uninstall Oracle"/><category term="V$FIXED_TABLE"/><category term="Version amp; Compatibility"/><category term="Version amp; Compatibility of OS and Oracle"/><category term="Wrapping PL/SQL"/><category term="all_indexes"/><category term="db_recovery_file_dest_size"/><category term="dba_indexes"/><category term="dbora"/><category term="dbora Script for RHEL"/><category term="delete duplicate rows"/><category term="exp"/><category term="imp"/><category term="import (imp)"/><category term="limit exceeded for recovery files"/><category term="maximum number of sessions exceeded"/><category term="oradim in Linux"/><category term="scp"/><category term="tar command on Linux"/><category term="vDB_RECOVERY_FILE_DEST_SIZE"/><title type='text'>Tamim DBA</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>66</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-5292899594059842740</id><published>2010-10-26T00:15:00.000-07:00</published><updated>2010-10-26T01:45:55.854-07:00</updated><title type='text'>Basic Concept of Performance Tuning in Oracle</title><content type='html'>&lt;span style=&quot;font-weight:bold;&quot;&gt;Scope of Performance Tuning&lt;/span&gt;&lt;br /&gt;There is four main area for Performance Tuning. &lt;br /&gt;1. SQL Tuning   – Responsibility of the Developer&lt;br /&gt;2. Database Tuning  – Responsibility of the Database Administrator&lt;br /&gt;3. System Tuning  – Responsibility of the System Administrator&lt;br /&gt;4. Network Tuning  – Responsibility of the Network / LAN / WAN Administrator.&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;SQL Tuning&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;Find the problem to a single SQL &lt;/span&gt;&lt;br /&gt;You may be lucky and know already the exact SQL causing the problem. If so, move straight on to the second step. Otherwise, click on the link above for help on &lt;span style=&quot;font-style:italic;&quot;&gt;finding the problem SQL.&lt;/span&gt;&lt;br /&gt;Analyze the SQL to determine the nature of the problem &lt;br /&gt;Most performance problems are quite common and easy to fix. This section will describe some of these and how to spot them, and then go on to describe a more general analysis method.&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;Fix the problem.&lt;/span&gt;&lt;br /&gt;Almost every performance problem has a solution; it&#39;s just that some are more complex than others. In order of increasing complexity and expense, such fixes include:&lt;br /&gt;• Analyze the underlying table to give Oracle&#39;s Cost Based Optimizer the information it needs to resolve the SQL efficiently.&lt;br /&gt;• Add one or more hints to the SQL to encourage or discourage certain execution plans.&lt;br /&gt;• Minor changes to the SQL to encourage or discourage certain execution plans.&lt;br /&gt;• Restructure a poorly designed SQL that cannot be resolved efficiently.&lt;br /&gt;• Alter the underlying infrastructure. eg. Add or change (or even remove!) indexes; introduce clusters, partitions or index-organised tables; denormalize tables; use materialized views. Note that these actions venture outside the scope of this document, and should only be performed with the prior permission of (and preferably assistance from) the DBA and/or System Architect.&lt;br /&gt;• Refer the problem to the database administrator. Possible solutions here would include tuning the Oracle instance, restructuring or moving tablespaces, or archiving old data.&lt;br /&gt;• Refer the problem to the System Adminstrator. Possible solutions may include reconfiguration of existing hardware, or acquisition of new hardware.&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Database Tuning&lt;/span&gt;&lt;br /&gt;For optimum performance an Oracle database should be regularly tuned. Only tune a database after it has been up and running for a little while.&lt;br /&gt;• Tuning the cache hit ratio&lt;br /&gt;• Tuning the library cache&lt;br /&gt;• Tuning the log buffer&lt;br /&gt;• Tuning buffer cache hit ratio&lt;br /&gt;• Tuning sorts&lt;br /&gt;• Tuning rollback segments&lt;br /&gt;• Identifying missing indexes&lt;br /&gt;• Identifying index fragmentation&lt;br /&gt;• Identifying free list contention&lt;br /&gt;• Identify significant reparsing of SQL&lt;br /&gt;• Reducing database fragmentation&lt;br /&gt;• Rebuilding indexes&lt;br /&gt;• Reduce thrashing or poor system performance (or how to un-tune oracle?!)&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Operating System Tuning&lt;/span&gt; &lt;br /&gt;Tune your operating system according to your operating system documentation. For Windows platforms, the default settings are usually sufficient. However, the Solaris and Linux platforms usually need to be tuned appropriately. The following sections describe issues related to operating system performance: &lt;br /&gt;• Basic OS Tuning Concepts&lt;br /&gt;• Solaris Tuning Parameters&lt;br /&gt;• Linux Tuning Parameters&lt;br /&gt;• HP-UX Tuning Parameters&lt;br /&gt;• Windows Tuning Parameters&lt;br /&gt;• Other Operating System Tuning Information&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Network Tuning&lt;/span&gt;&lt;br /&gt;Network tuning is the performance optimization and tuning of SQL*Net based on an arbitrary UNP which could be TCP/IP, SPX/IP or DECnet. SQL*Net performance can be maximized by synchronization with tunable parameters of the UNP, for example, buffer size. &lt;br /&gt;&lt;br /&gt;SQL*Net transaction performance can be divided into components of connect time and query time, where &lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;Total SQL*Net (Net8) Transaction Time = Connect Time + Query Time&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Connect time can be maximized by calibration of tunable parameters of SQL*Net and the UNP when designing and implementing networks.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-style:italic;&quot;&gt;SQL*Net Performance &lt;/span&gt;&lt;br /&gt;For this discussion, SQL*Net performance and tuning analysis is based on two categories: &lt;br /&gt;• SQL*Net performance &lt;br /&gt;• SQL*Net tuning</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/5292899594059842740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/10/basic-concept-of-performance-tuning-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/5292899594059842740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/5292899594059842740'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/10/basic-concept-of-performance-tuning-in.html' title='Basic Concept of Performance Tuning in Oracle'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-3311913116334433880</id><published>2010-09-05T02:27:00.000-07:00</published><updated>2010-09-05T02:32:14.640-07:00</updated><title type='text'>Some useful Linux Command for DBA</title><content type='html'>ls: List files&lt;br /&gt;cp: Copy files&lt;br /&gt;mv: Move and rename files&lt;br /&gt;mkdir: Make a directory&lt;br /&gt;alias: Define command macros&lt;br /&gt;rm: Remove files and directories&lt;br /&gt;more: Page through output&lt;br /&gt;head: Show beginning of file contents&lt;br /&gt;tail: Show end of file contents&lt;br /&gt;df: Display filesystem space usage&lt;br /&gt;du: Display directory disk space usage&lt;br /&gt;cat: Show and concatenate files&lt;br /&gt;grep: Search for patterns in files&lt;br /&gt;chmod: Change permissions of files&lt;br /&gt;chown: Change owner of files&lt;br /&gt;zip: Compress and package files together&lt;br /&gt;gedit: A WYSIWYG text editor&lt;br /&gt;export: Make environment settings global&lt;br /&gt;ps: List running processes&lt;br /&gt;touch: Change file time stamps&lt;br /&gt;id: Show information about the current user&lt;br /&gt;sudo: Execute commands as another user&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Standard Measurement Tools&lt;/span&gt;&lt;br /&gt;•    Top Resource Consumers: top&lt;br /&gt;•    System Activity Reporter: sar&lt;br /&gt;•    Virtual Memory Statistics: vmstat&lt;br /&gt;•    I/O Statistics: iostat&lt;br /&gt;•    System Log files: /var/log/messages&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Linux Tools&lt;/span&gt;&lt;br /&gt;•    X-based tools: xosview&lt;br /&gt;•    The /proc virtual file system&lt;br /&gt;•    Free and used memory: free&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Tools for monitoring and tuning CPU include:&lt;/span&gt;&lt;br /&gt;•    top&lt;br /&gt;•    pstree and free&lt;br /&gt;•    vmstat&lt;br /&gt;•    Syntax: vmstat &lt;interval&gt; &lt;count&gt;&lt;br /&gt;•    Example : # vmstat 2 5&lt;br /&gt;•    mpstat –p All&lt;br /&gt;•    sar –u&lt;br /&gt;•    Syntax: #sar -B &lt;frequency&gt; &lt;count&gt;&lt;br /&gt;#sar -R &lt;frequency&gt; &lt;count&gt;&lt;br /&gt;•    Example : #sar -B 2 3&lt;br /&gt;#sar -R 2 3&lt;br /&gt;•    xosview&lt;br /&gt;•    xload&lt;br /&gt;•    System Monitor&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Measuring Total Memory&lt;/span&gt;&lt;br /&gt;•    top&lt;br /&gt;•    free&lt;br /&gt;•    cat /proc/meminfo&lt;br /&gt;&lt;span style=&quot;font-weight:bold;&quot;&gt;Monitoring and Tuning I/O&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;•    /proc file system&lt;br /&gt;•    sar -d&lt;br /&gt;•    I/O statistics by device [iostat –d]&lt;br /&gt;Syntax : iostat -d &lt;interval&gt; &lt;count&gt;&lt;br /&gt;Eample : #iostat -d 2 2&lt;br /&gt;•    I/O activity by partition&lt;br /&gt;iostat –d -p &lt;interval&gt; &lt;count&gt;&lt;br /&gt;•    vmstat&lt;br /&gt;•    xosview</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/3311913116334433880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/09/some-useful-linux-command-for-dba.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3311913116334433880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3311913116334433880'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/09/some-useful-linux-command-for-dba.html' title='Some useful Linux Command for DBA'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-4335805542250295619</id><published>2010-08-31T00:12:00.000-07:00</published><updated>2010-08-31T00:13:39.417-07:00</updated><title type='text'>Oracle &amp;amp; Iron Man – Great Combination</title><content type='html'>&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgKbsPbZp4mYJum5y9GGYVqsAz5VH76XiND-hnAm-2JPpgIimNzCk_xU_WinoEfXT2_IiJtfGj-2HgV1s5BzlC2OSAicWdroh3JmSeFLKWH6EigM_LaO2_ZcSLM8CHSFPt9AK-D_zFTTY/s1600/iron-man-punch-ground.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 308px; height: 400px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgKbsPbZp4mYJum5y9GGYVqsAz5VH76XiND-hnAm-2JPpgIimNzCk_xU_WinoEfXT2_IiJtfGj-2HgV1s5BzlC2OSAicWdroh3JmSeFLKWH6EigM_LaO2_ZcSLM8CHSFPt9AK-D_zFTTY/s400/iron-man-punch-ground.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5511468690725150466&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIQGczCyUHPi4w8kQlwqRRkNRQxoy1MZET15lf19JWprZ6bI4Sykq5_A7Bf3pJjk2y-rmHdo-S_5zKrGxhoL9aA27vUAjYwqPGDtVui85GWS42gaw_HDQ5guLR2hyj69fAeh_yEfYUaGU/s1600/ironman-powered-by-oracle.jpg&quot;&gt;&lt;img style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 287px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIQGczCyUHPi4w8kQlwqRRkNRQxoy1MZET15lf19JWprZ6bI4Sykq5_A7Bf3pJjk2y-rmHdo-S_5zKrGxhoL9aA27vUAjYwqPGDtVui85GWS42gaw_HDQ5guLR2hyj69fAeh_yEfYUaGU/s400/ironman-powered-by-oracle.jpg&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5511468604579761410&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;http://www.oracle.com/us/ironman2/index.html</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/4335805542250295619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/08/oracle-iron-man-great-combination.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/4335805542250295619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/4335805542250295619'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/08/oracle-iron-man-great-combination.html' title='Oracle &amp;amp; Iron Man – Great Combination'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgKbsPbZp4mYJum5y9GGYVqsAz5VH76XiND-hnAm-2JPpgIimNzCk_xU_WinoEfXT2_IiJtfGj-2HgV1s5BzlC2OSAicWdroh3JmSeFLKWH6EigM_LaO2_ZcSLM8CHSFPt9AK-D_zFTTY/s72-c/iron-man-punch-ground.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-3486935151577927873</id><published>2010-08-04T05:03:00.001-07:00</published><updated>2010-08-04T05:04:12.968-07:00</updated><title type='text'>How to use trigger to check database constant</title><content type='html'>&lt;p class=&quot;MsoNormal&quot;&gt;We can use trigger to check database constant and customize error message. For example we have two tables name &lt;b style=&quot;mso-bidi-font-weight: normal&quot;&gt;&lt;i style=&quot;mso-bidi-font-style:normal&quot;&gt;Department &lt;/i&gt;&lt;/b&gt;and &lt;b style=&quot;mso-bidi-font-weight:normal&quot;&gt;&lt;i style=&quot;mso-bidi-font-style:normal&quot;&gt;Employee&lt;/i&gt;&lt;/b&gt;. I have written two trigger on Update and Delete on Department table, which will responsible to check referential integrity constraint and customize the error message. &lt;/p&gt;  &lt;h4&gt;Creating Tables Department and Employee &lt;/h4&gt;  &lt;pre&gt;CREATE TABLE DEPARTMENT&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;(&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Department_Id&lt;span style=&quot;mso-spacerun:yes&quot;&gt;          &lt;/span&gt;Number(*,0) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Department_Name&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;Varchar2(45 Byte) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Department_Description Varchar2(500 Byte),&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Primary Key (Department_Id) &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;CREATE TABLE EMPLOYEE&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;(&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Employee_Name&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;Varchar2(45 Byte) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Employee_Ssn&lt;span style=&quot;mso-spacerun:yes&quot;&gt;         &lt;/span&gt;Varchar2(45 Byte) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Employee_Phone&lt;span style=&quot;mso-spacerun:yes&quot;&gt;       &lt;/span&gt;Varchar2(45 Byte) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Employee_Cellular&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Varchar2(45 Byte) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Employee_Description Varchar2(500 Byte),&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Department_Id&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;Number(*,0) Not Null Enable,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Primary Key (Employee_Ssn) ,&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Foreign Key (Department_Id) References Department (Department_Id) Enable&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;  &lt;h4&gt;Insert some data on Department and Employee Table&lt;/h4&gt;  &lt;pre&gt;Insert Into Department (Department_Id, Department_Name, Department_Description) &lt;/pre&gt;&lt;pre&gt;Values (&#39;1001&#39;, &#39;Tecnical&#39;, &#39;Tecnical Department&#39;);&lt;/pre&gt;&lt;pre&gt;Insert Into Department (Department_Id, Department_Name, Department_Description) &lt;/pre&gt;&lt;pre&gt;Values (&#39;1002&#39;, &#39;Merketing&#39;, &#39;Merketing Department&#39;);&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;Insert Into EMPLOYEE (Employee_Name, Employee_Ssn, Employee_Phone, Employee_Cellular, Department_Id) &lt;/pre&gt;&lt;pre&gt;Values (&#39;Tamim&#39;, &#39;100001&#39;, &#39;880175307713&#39;, &#39;880175307713&#39;, &#39;1001&#39;);&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;  &lt;h4&gt;Trigger on Delete of Department&lt;/h4&gt;  &lt;pre&gt;Create Or Replace Trigger Td_Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;After Delete on Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;FOR EACH row&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;DECLARE numrows INTEGER;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;BEGIN&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;SELECT COUNT(*) INTO numrows&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;FROM Employee&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;WHERE&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Employee.Department_ID = :old.Department_ID;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;IF (numrows&gt; 0) THEN&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;raise_application_error( -20001, &#39;Cannot DELETE Department because Employee exists.&#39; );&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;END IF;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;END;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;/&lt;/pre&gt;  &lt;h4&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Test a Delete SQL Statement on Department Table&lt;/h4&gt;  &lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Delete &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;From Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Where Department_Id = 1001 &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;/*&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;SQL Error: ORA-20001: Cannot DELETE Department because Employee exists.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;*/&lt;/pre&gt;  &lt;h4&gt;Trigger on Update of Department&lt;/h4&gt;  &lt;pre&gt;Create Or Replace Trigger Tu_Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;After Update On Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;For Each Row&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;Declare Numrows Integer;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Begin&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;IF (:old.Department_ID &lt;&gt; :new.Department_ID) THEN&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;Select Count(*) Into Numrows&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;FROM Employee&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;Where Employee.Department_Id = :Old.Department_Id;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;IF (numrows &gt; 0) THEN&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;raise_application_error( -20005, &#39;Cannot UPDATE Department because Employee exists.&#39; );&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;      &lt;/span&gt;END IF;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;    &lt;/span&gt;END IF;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;END;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;/&lt;/pre&gt;  &lt;h4&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt; &lt;/span&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Test a Update SQL Statement on Department Table&lt;/h4&gt;  &lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Update Department &lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Set Department_Id = 1003&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;Where Department_Id = 1001 &lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;/*&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color:red&quot;&gt;SQL Error: ORA-20005: Cannot UPDATE Department because Employee exists.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;mso-spacerun:yes&quot;&gt;  &lt;/span&gt;*/&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/3486935151577927873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/08/how-to-use-trigger-to-check-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3486935151577927873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3486935151577927873'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/08/how-to-use-trigger-to-check-database.html' title='How to use trigger to check database constant'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-3772097557245559027</id><published>2010-08-04T03:45:00.000-07:00</published><updated>2010-08-04T03:59:32.222-07:00</updated><title type='text'>How To Block Websites Without Using Any Software.</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; &quot;&gt;Sometimes we want to restrict access to some particular&lt;/span&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt; websitefrom our PC but we don’t know how to do it without using some software&lt;br /&gt;for it.&lt;br /&gt;&lt;br /&gt;Here I m sharing with you a method to do it without using any software......&lt;br /&gt;&lt;br /&gt;1. Run -&gt; drivers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;2. Open The file ..\drivers\etc\ hosts using note pad&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;3. Under &quot;127.0.0.1 localhost&quot; Add 127.0.0.2 &lt;span style=&quot;mso-spacerun:yes&quot;&gt; &lt;/span&gt;www.yahoo.com&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight:normal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;b style=&quot;mso-bidi-font-weight:normal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;Code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;pre&gt;&lt;span style=&quot;font-size:9.0pt&quot;&gt;127.0.0.1&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:2&quot;&gt;         &lt;/span&gt;localhost&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-size:9.0pt&quot;&gt;127.0.0.2&lt;span style=&quot;mso-spacerun:yes&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;mso-tab-count:2&quot;&gt;         &lt;/span&gt;www.yahoo.com&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-size:9.0pt&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Georgia, serif; white-space: normal; font-size: 16px; &quot;&gt;&lt;pre&gt;&lt;span style=&quot;font-size: 9pt; &quot;&gt;127.0.0.2&lt;span&gt;        &lt;/span&gt;&lt;span&gt;         &lt;/span&gt;yahoo.com&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;That site will no longer be accessible.    &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; &quot;&gt;Even if you ping &lt;a href=&quot;http://www.yahoo.com/&quot;&gt;www.yahoo.com&lt;/a&gt; from command prompt it will not response from original source.&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDJKitzsTnrHC9NaVlyaglHH4eNknfV5WJQTYjHWRIMAtWMJcCLASkcDGuOf3CHogOuMUe4Z8ukw8_UBp1w_dM8zkGp88stgdWGI6Dv5yzWSjcTdI9rDtdSA3O5Cy6qZfJ4rnyeuXH450/s400/yahoo_ping.JPG&quot; style=&quot;display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 197px;&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5501506601889960818&quot; /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 13px; &quot;&gt;N.B: Please restart your browser before you perform the test.&lt;/span&gt;&lt;/div&gt;  &lt;p class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-size:10.0pt&quot;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/3772097557245559027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/08/how-to-block-websites-without-using-any.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3772097557245559027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3772097557245559027'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/08/how-to-block-websites-without-using-any.html' title='How To Block Websites Without Using Any Software.'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDJKitzsTnrHC9NaVlyaglHH4eNknfV5WJQTYjHWRIMAtWMJcCLASkcDGuOf3CHogOuMUe4Z8ukw8_UBp1w_dM8zkGp88stgdWGI6Dv5yzWSjcTdI9rDtdSA3O5Cy6qZfJ4rnyeuXH450/s72-c/yahoo_ping.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-772478852431305724</id><published>2010-07-31T06:46:00.000-07:00</published><updated>2010-08-02T19:57:41.107-07:00</updated><title type='text'>Auto Draft</title><content type='html'></content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/772478852431305724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/07/auto-draft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/772478852431305724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/772478852431305724'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/07/auto-draft.html' title='Auto Draft'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-234395084746252130</id><published>2010-07-26T07:42:00.000-07:00</published><updated>2010-08-02T19:57:42.736-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Auditing Table Data using Trigger"/><title type='text'>Auditing Table Data using Trigger</title><content type='html'>&lt;h4&gt;Create New User in Oracle&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE User &amp;lt;UserName&amp;gt; IDENTIFIED BY &amp;lt;Passsword&amp;gt;;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Grant User necessary privileges&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;GRANT CREATE session TO &amp;lt;username&amp;gt;;&lt;br/&gt;&lt;br/&gt;GRANT CREATE TABLE TO &amp;lt;username&amp;gt;;&lt;br/&gt;&lt;br/&gt;GRANT CREATE TRIGGER TO &amp;lt;username&amp;gt;;&lt;br/&gt;&lt;br/&gt;ALTER USER &amp;lt;username&amp;gt; QUOTA UNLIMITED ON &amp;lt;TablespaceName&amp;gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a Transactional Table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE TABLE AD_DURATIONS&lt;br/&gt;  (&lt;br/&gt;      Ad_Duration_Cn    Varchar2(10 Byte)     Not Null Enable,&lt;br/&gt;      Ad_Start_Date     Date Not              Null Enable,&lt;br/&gt;      Ad_End_Date       Date Not              Null Enable,&lt;br/&gt;      Modified_By       Varchar2(10 Byte),&lt;br/&gt;      Modified_Date     Date                  Default Sysdate,&lt;br/&gt;      Constraint CJ_AD_DURATIONS_PK Primary Key (AD_DURATION_CN)&lt;br/&gt;  );&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Insert value in the AD_DURATIONS Table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Insert Into Ad_Durations (Ad_Duration_Cn, Ad_Start_Date,&lt;br/&gt;                              Ad_End_Date, Modified_By)&lt;br/&gt;Values (&#39;10001&#39;, To_Date(&#39;26-JUL-10&#39;, &#39;DD-MON-RR&#39;),&lt;br/&gt;                              To_Date(&#39;30-JUL-10&#39;, &#39;DD-MON-RR&#39;), &#39;Tamim&#39;);&lt;br/&gt;&lt;br/&gt;Insert Into Ad_Durations (Ad_Duration_Cn, Ad_Start_Date,&lt;br/&gt;                              Ad_End_Date, Modified_By)&lt;br/&gt;Values (&#39;10002&#39;, To_Date(&#39;31-JUL-10&#39;, &#39;DD-MON-RR&#39;),&lt;br/&gt;                              To_Date(&#39;05-Aug-10&#39;, &#39;DD-MON-RR&#39;), &#39;Khan&#39;);&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a Log Table for AD_DURATIONS Data&lt;/h4&gt;&lt;br/&gt;Here Modified_By, Modified_Date and Action is Audit Column.&lt;br/&gt;&lt;pre&gt;CREATE TABLE AD_DURATIONS_LOG&lt;br/&gt;  (&lt;br/&gt;      Ad_Duration_Cn    Varchar2(10 Byte),&lt;br/&gt;      Ad_Start_Date     Date,&lt;br/&gt;      Ad_End_Date       Date,&lt;br/&gt;      Modified_By       Varchar2(20 Byte),&lt;br/&gt;      Modified_Date     Timestamp (6),&lt;br/&gt;      Action            Varchar2(20 Byte)&lt;br/&gt;  );&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a Trigger on AD_DURATIONS table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Create Or Replace TRIGGER AD_DURATIONS_LOG&lt;br/&gt;AFTER DELETE OR UPDATE ON AD_DURATIONS&lt;br/&gt;FOR EACH ROW&lt;br/&gt;Begin&lt;br/&gt;  If Updating Then&lt;br/&gt;      Insert Into Ad_Durations_Log(Ad_Duration_Cn, Ad_Start_Date,&lt;br/&gt;                  Ad_End_Date, Modified_By,Modified_Date,Action)&lt;br/&gt;      Values (:Old.Ad_Duration_Cn, :Old.Ad_Start_Date,:Old.Ad_End_Date,&lt;br/&gt;                  :Old.Modified_By,:Old.Modified_Date,&#39;Update&#39;);&lt;br/&gt;  Elsif Deleting Then&lt;br/&gt;      Insert Into Ad_Durations_Log(Ad_Duration_Cn, Ad_Start_Date,&lt;br/&gt;                  Ad_End_Date, Modified_By,Modified_Date,Action)&lt;br/&gt;      Values (:Old.Ad_Duration_Cn, :Old.Ad_Start_Date, :Old.Ad_End_Date,&lt;br/&gt;                  :Old.Modified_By,:Old.Modified_Date,&#39;Delete&#39;);&lt;br/&gt;  End If;&lt;br/&gt;END;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Update on AD_DURATIONS Table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Update Ad_Durations&lt;br/&gt;Set Ad_End_Date = To_Date(&#39;31-JUL-10&#39;, &#39;DD-MON-RR&#39;)&lt;br/&gt;Where Ad_Duration_Cn = 10001;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Update from AD_DURATIONS Table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Delete From Ad_Durations&lt;br/&gt;Where Ad_Duration_Cn = 10002;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Now Selecting data from AD_DURATIONS_LOG Table.&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Select * From Ad_Durations_Log;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/234395084746252130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/07/auditing-table-data-using-trigger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/234395084746252130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/234395084746252130'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/07/auditing-table-data-using-trigger.html' title='Auditing Table Data using Trigger'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-62795384887059261</id><published>2010-07-11T09:44:00.000-07:00</published><updated>2010-08-02T19:57:42.632-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CONTROLFILE AUTO BACKUP"/><title type='text'>CONTROLFILE AUTO BACKUP</title><content type='html'>RMAN is one of the very useful utility provided by Oracle for backup and recovery Purpose. Oracle online backups were introduced with Version 6, where tablespace must be kept in backup mode in order to take online backups.&lt;br/&gt;&lt;br/&gt;RMAN has following default parameters and its default values:&lt;br/&gt;&lt;pre&gt;RMAN&amp;gt; show all;&lt;br/&gt;RMAN configuration parameters are:&lt;br/&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default&lt;br/&gt;CONFIGURE BACKUP OPTIMIZATION OFF; # default&lt;br/&gt;CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO &#39;%F&#39;; # default&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default&lt;br/&gt;CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br/&gt;CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default&lt;br/&gt;CONFIGURE MAXSETSIZE TO UNLIMITED; # default&lt;br/&gt;CONFIGURE ENCRYPTION FOR DATABASE OFF; # default&lt;br/&gt;CONFIGURE ENCRYPTION ALGORITHM &#39;AES128&#39;; # default&lt;br/&gt;CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default&lt;br/&gt;CONFIGURE SNAPSHOT CONTROLFILE NAME TO &#39;F:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\S&lt;br/&gt;NCFORCL.ORA&#39;; # default&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Or&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;RMAN&amp;gt;  SHOW CONTROLFILE AUTOBACKUP;&lt;br/&gt;&lt;br/&gt;RMAN configuration parameters are:&lt;br/&gt;CONFIGURE CONTROLFILE AUTOBACKUP &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;OFF&lt;/strong&gt;&lt;/span&gt;;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;By default CONTROLFILE AUTOBACKUP is &lt;strong&gt;OFF&lt;/strong&gt;. But it is strongly recommended enabling CONTROLFILE AUTOBACKUP &lt;strong&gt;ON&lt;/strong&gt;.&lt;br/&gt;&lt;h4&gt;Advantage:&lt;/h4&gt;&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;RMAN      can recover the database even if the current control file, recovery      catalog, and server parameter file are inaccessible.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Restore      the RMAN repository contained in the control file when the control file is      lost and you have no recovery catalog. You do not need a recovery catalog      or target database control file to restore the control file auto backup.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Control      file auto backup can keep track of add a data file, resize,      increase/decrease the size of data files or etc.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;If      CONFIGURE CONTROLFILE AUTOBACKUP is ON, then RMAN automatically backs up      the control file and the current server parameter file (if used to start      up the database) in one of two circumstances: when a successful backup      must be recorded in the RMAN repository, and when a structural change to      the database affects the contents of the control file which therefore must      be backed up&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;To perform control file auto backup on issue the following command&lt;br/&gt;&lt;pre&gt;RMAN&amp;gt; &lt;strong&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;/strong&gt;&lt;br/&gt;new RMAN configuration parameters:&lt;br/&gt;CONFIGURE CONTROLFILE AUTOBACKUP ON;&lt;br/&gt;new RMAN configuration parameters are successfully stored&lt;br/&gt;starting full resync of recovery catalog&lt;br/&gt;full resync complete&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/62795384887059261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/07/controlfile-auto-backup.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/62795384887059261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/62795384887059261'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/07/controlfile-auto-backup.html' title='CONTROLFILE AUTO BACKUP'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-28512659689077674</id><published>2010-06-28T03:51:00.000-07:00</published><updated>2010-08-02T19:57:42.620-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="db_recovery_file_dest_size"/><category scheme="http://www.blogger.com/atom/ns#" term="limit exceeded for recovery files"/><category scheme="http://www.blogger.com/atom/ns#" term="Problems And Solutions"/><title type='text'>ORA-19809: limit exceeded for recovery files</title><content type='html'>&lt;pre&gt;C:\Documents and Settings\Administrator&amp;gt;sqlplus &quot;/as sysdba&quot;&lt;br/&gt;&lt;br/&gt;SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 28 10:25:39 2010&lt;br/&gt;Copyright (c) 1982, 2005, Oracle.  All rights reserved.&lt;br/&gt;Connected to:&lt;br/&gt;Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production&lt;br/&gt;With the Partitioning, OLAP and Data Mining options&lt;br/&gt;SQL&amp;gt; select * from tab;&lt;br/&gt;select * from tab&lt;br/&gt;              *&lt;br/&gt;ERROR at line 1:&lt;br/&gt;ORA-01219: &lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;database not open&lt;/strong&gt;&lt;/span&gt;: queries allowed on fixed tables/views only&lt;br/&gt; &lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Shutdown the database first &lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; shutdown immediate;&lt;br/&gt;ORA-01109: database not open&lt;br/&gt;Database dismounted.&lt;br/&gt;ORACLE instance shut down.&lt;br/&gt;&lt;strong&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Start the database&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; startup&lt;br/&gt;ORACLE instance started.&lt;br/&gt;&lt;br/&gt;Total System Global Area  599785472 bytes&lt;br/&gt;Fixed Size                  1250356 bytes&lt;br/&gt;Variable Size             180358092 bytes&lt;br/&gt;Database Buffers          411041792 bytes&lt;br/&gt;Redo Buffers                7135232 bytes&lt;br/&gt;Database mounted.&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;ORA-16038: log 2 sequence# 135 cannot be archived&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;ORA-19809: limit exceeded for recovery files&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;ORA-00312: online log 2 thread 1:&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;&lt;strong&gt;&#39;F:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG&#39;&lt;/strong&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;&lt;strong&gt;Problem: &lt;/strong&gt;&lt;strong&gt;The value&lt;/strong&gt;&lt;em&gt; &lt;/em&gt;&lt;strong&gt;&lt;em&gt;db_recovery_file_dest_size&lt;/em&gt; is not enough for generate archive log&lt;/strong&gt;&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;          &lt;br/&gt;SQL&amp;gt; show parameter DB_RECOVERY_FILE_DEST_SIZE;&lt;br/&gt;&lt;br/&gt;NAME                                 TYPE        VALUE&lt;br/&gt;------------------------------------ ----------- -------------------&lt;br/&gt;db_recovery_file_dest_size           big integer &lt;strong&gt;2G&lt;/strong&gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;&lt;strong&gt;Solution: Increase the value of &lt;em&gt;db_recovery_file_dest_size following way.&lt;/em&gt;&lt;/strong&gt;&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt; &lt;br/&gt;SQL&amp;gt; ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 10G;&lt;br/&gt;&lt;br/&gt;System altered.&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;&lt;strong&gt;Now open the database.&lt;/strong&gt;&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; alter database open;&lt;br/&gt;&lt;br/&gt;Database altered.&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/28512659689077674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/06/ora-19809-limit-exceeded-for-recovery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/28512659689077674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/28512659689077674'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/06/ora-19809-limit-exceeded-for-recovery.html' title='ORA-19809: limit exceeded for recovery files'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-7009805000543361575</id><published>2010-06-22T02:44:00.000-07:00</published><updated>2010-08-02T20:32:52.183-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cancel-Based Recovery"/><title type='text'>Cancel-Based Recovery</title><content type='html'>A &lt;strong&gt;cancel-based recovery&lt;/strong&gt; is a type of user-managed incomplete recovery that is performed by specifying the &lt;strong&gt;UNTIL CANCEL&lt;/strong&gt; clause with the &lt;strong&gt;RECOVER&lt;/strong&gt; command (a SQL*Plus command that is used to recover a database). The UNTIL CANCEL clause specifies that the recovery process will continue until the user manually cancels the recovery process issuing the CANCEL command.&lt;br /&gt;&lt;br /&gt;In a cancel-based incomplete recovery, the recovery process proceeds by prompting the user with the suggested archived redo log files’ names. The recovery process stops when the user specifies CANCEL instead of specifying an archived redo log file’s name. If the user does not specify CANCEL, the recovery process automatically stops when all the archived redo log files have been applied to the database.&lt;br /&gt;&lt;br /&gt;A cancel-based recovery is usually performed when the requirement is to recover up to a particular archived redo log file. For example, if one of the archived redo log files required for the complete recovery is corrupt or missing, the only option is to recover up to the missing archived redo log file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table style=&quot;height:294px;&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;522&quot;&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;&lt;strong&gt;Recovery Scenario&lt;/strong&gt;&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;&lt;strong&gt;Preferred Recovery Method&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Some important table is dropped&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Time-based Recovery based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Some bad data is committed in a table&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Time-based Recovery based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Lost archive log results in failure of  complete recovery&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Cancel-based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Backup control file does not know anything about the arhivelogs&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Cancel-based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;All unarchived Redo Logs and datafiles are lost&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Cancel-based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Recovery is needed up to a specific archived log file&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Cancel-based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Recovery through Resetlogs when media failure occurs before backup completion.&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Oracle Change-based Recovery&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;A Tablespace is dropped&lt;/td&gt;&lt;td width=&quot;295&quot; valign=&quot;top&quot;&gt;Recovery with a backup control file&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;strong&gt;1. &lt;/strong&gt;Start SQL*Plus and connect to Oracle with administrator privileges. For example, enter:&lt;br /&gt;&lt;pre&gt;sqlplus &#39;/ AS SYSDBA&#39;&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;2.&lt;/strong&gt; Start a new instance and mount the database:&lt;br /&gt;&lt;pre&gt;STARTUP MOUNT&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;3.&lt;/strong&gt; Begin cancel-based recovery by issuing the following command:&lt;br /&gt;&lt;pre&gt;RECOVER DATABASE UNTIL CANCEL&lt;/pre&gt;&lt;br /&gt;&lt;em&gt;If you are using a backup control file with this incomplete recovery, then specify the USING BACKUP CONTROLFILE option in the RECOVER command.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt; &lt;/em&gt;&lt;br /&gt;&lt;pre&gt;RECOVER DATABASE UNTIL CANCEL USING BACKUP CONTROLFILE&lt;/pre&gt;&lt;br /&gt;&lt;strong&gt;4. &lt;/strong&gt;Oracle applies the necessary redo log files to reconstruct the restored datafiles. Oracle supplies the name it expects to find from LOG_ARCHIVE_DEST_1 and requests you to stop or proceed with applying the log file. Note that if the control file is a backup, then you must supply the names of the online logs if you want to apply the changes in these logs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5.&lt;/strong&gt; Continue applying redo log files until the last log has been applied to the restored datafiles, then &lt;strong&gt;cancel&lt;/strong&gt; recovery by executing the following command:&lt;br /&gt;&lt;pre&gt;CANCEL&lt;/pre&gt;&lt;br /&gt;Oracle returns a message indicating whether recovery is successful. Note that if you cancel recovery before all the datafiles have been recovered to a consistent SCN and then try to open the database, you will get an ORA-1113 error if more recovery is necessary for the file. You can query V$RECOVER_FILE to determine whether more recovery is needed, or if a backup of a datafile was not restored prior to starting incomplete recovery.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6. &lt;/strong&gt;Open the database in &lt;strong&gt;RESETLOGS&lt;/strong&gt; mode. You must always reset the online logs after incomplete recovery or recovery with a backup control file. For example, enter:&lt;br /&gt;&lt;pre&gt;ALTER DATABASE OPEN RESETLOGS;&lt;/pre&gt;&lt;br /&gt;For More Detail please visit &lt;a href=&quot;http://download.oracle.com/docs/cd/B10500_01/server.920/a96572/performingreco.htm#30935&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/7009805000543361575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/06/cancel-based-recovery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7009805000543361575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7009805000543361575'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/06/cancel-based-recovery.html' title='Cancel-Based Recovery'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-1450835471851803365</id><published>2010-06-14T06:32:00.000-07:00</published><updated>2010-08-02T19:57:42.566-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tuning Advisor"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Tuning Advisor in Oracle 10g"/><title type='text'>SQL Tuning Advisor in Oracle 10g</title><content type='html'>In Oracle 10g, the SQL tuning process has been automated by introducing a new manageability feature call &lt;strong&gt;Automatic SQL Tuning. &lt;/strong&gt;This feature is designed to work equally well for OLTP and Data Warehouse workloads. Unlike existing tools, automatic SQL Tuning id preformed in the database server by the Oracle query optimizer itself, running in special mode. When running in this mode, the Oracle query optimizer is referred to us the &lt;strong&gt;Automatic Tuning Optimizer&lt;/strong&gt;.&lt;br/&gt;&lt;h4&gt;Create a Table to Test a SQL&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Create Table TestEmp&lt;br/&gt;       As Select * from Scott.emp;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Write a SQL that you need to tune.&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO&lt;br/&gt;FROM TESTEMP&lt;br/&gt;ORDER by SAL;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Execute DBMS_STATS Package for Gather Table Satieties&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; BEGIN&lt;br/&gt;  2    DBMS_STATS.GATHER_TABLE_STATS(&lt;br/&gt;  3    ownname          =&amp;gt; &#39;TEST&#39;, &lt;br/&gt;  4    tabname          =&amp;gt; &#39;TESTEMP&#39;,&lt;br/&gt;  5    estimate_percent =&amp;gt; DBMS_STATS.AUTO_SAMPLE_SIZE,&lt;br/&gt;  6    method_opt       =&amp;gt; &#39;FOR ALL COLUMNS SIZE AUTO&#39;&lt;br/&gt;  7    );&lt;br/&gt;  8  END;&lt;br/&gt;  9  /&lt;br/&gt;PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;How to use&lt;em&gt; dbms_sqltune &lt;/em&gt;Package&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE OR REPLACE PROCEDURE P_SQL_TUNING (&lt;br/&gt;        p_sql CLOB&lt;br/&gt;  )&lt;br/&gt;AS&lt;br/&gt;  v_task VARCHAR2(30);&lt;br/&gt;BEGIN&lt;br/&gt;  /* Drop the task in case we are re-running... */&lt;br/&gt;  BEGIN&lt;br/&gt;      DBMS_SQLTUNE.DROP_TUNING_TASK(task_name =&amp;gt; &#39;sql_tuning_task&#39;);&lt;br/&gt;      EXCEPTION&lt;br/&gt;         WHEN OTHERS THEN -- ORA-13605&lt;br/&gt;            NULL;&lt;br/&gt;  END;&lt;br/&gt; &lt;br/&gt;  /* Create a SQL Tuning task for our SQL... */&lt;br/&gt;  v_task := DBMS_SQLTUNE.CREATE_TUNING_TASK(&lt;br/&gt;                   sql_text    =&amp;gt; p_sql,&lt;br/&gt;                   time_limit  =&amp;gt; 1,&lt;br/&gt;                   scope       =&amp;gt; &#39;COMPREHENSIVE&#39;,&lt;br/&gt;                   task_name   =&amp;gt; &#39;sql_tuning_task&#39;,&lt;br/&gt;                   description =&amp;gt; &#39;Demo of DBMS_SQLTUNE&#39;&lt;br/&gt;                   );          &lt;br/&gt;  /* Execute the task... */&lt;br/&gt;  DBMS_SQLTUNE.EXECUTE_TUNING_TASK(task_name =&amp;gt; &#39;sql_tuning_task&#39;);&lt;br/&gt;  &lt;br/&gt;  /* We want to run this again... */&lt;br/&gt;  ROLLBACK;&lt;br/&gt;END P_SQL_TUNING;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Execute p_Sql_Tuning Procedure&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; exec P_SQL_TUNING(&#39;SELECT emp.EMPNO, emp.ENAME, emp.JOB,&lt;br/&gt;                        emp.MGR, emp.HIREDATE, emp.SAL, emp.COMM, emp.DEPTNO&lt;br/&gt;                        FROM TESTEMP emp,TESTEMP empmgr&lt;br/&gt;                        Where emp.empno=empmgr.mgr&lt;br/&gt;                        ORDER by SAL&#39;&lt;br/&gt;                       );&lt;br/&gt; &lt;br/&gt;PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Tuning Result&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; set long 80000&lt;br/&gt;SQL&amp;gt; col recs format a90&lt;br/&gt;SQL&amp;gt; &lt;strong&gt;SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK(&#39;sql_tuning_task&#39;) AS result&lt;/strong&gt;&lt;br/&gt;&lt;strong&gt;     FROM   DUAL;&lt;/strong&gt;&lt;br/&gt; &lt;br/&gt;GENERAL INFORMATION SECTION&lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;Tuning Task Name                  : sql_tuning_task&lt;br/&gt;Tuning Task Owner                 : TEST&lt;br/&gt;Scope                             : COMPREHENSIVE&lt;br/&gt;Time Limit(seconds)               : 1&lt;br/&gt;Completion Status                 : COMPLETED&lt;br/&gt;Started at                        : 06/14/2010 12:24:18&lt;br/&gt;Completed at                      : 06/14/2010 12:24:18&lt;br/&gt;Number of Index Findings          : 1&lt;br/&gt; &lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;Schema Name: TEST&lt;br/&gt;SQL ID     : grfz43h6vdf3d&lt;br/&gt;SQL Text   : SELECT emp.EMPNO, emp.ENAME, emp.JOB, emp.MGR, emp.HIREDATE,&lt;br/&gt;             emp.SAL, emp.COMM, emp.DEPTNO FROM TESTEMP emp,TESTEMP empmgr&lt;br/&gt;             Where emp.empno=empmgr.mgr ORDER by SAL&lt;br/&gt; &lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;FINDINGS SECTION (1 finding)&lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt; &lt;br/&gt;1- Index Finding (see explain plans section below)&lt;br/&gt;--------------------------------------------------&lt;br/&gt;  The execution plan of this statement can be improved by creating one or more&lt;br/&gt;  indices.&lt;br/&gt; &lt;br/&gt;  Recommendation (estimated benefit: 100%)&lt;br/&gt;  ----------------------------------------&lt;br/&gt;  - Consider running the Access Advisor to improve the physical schema design&lt;br/&gt;    or creating the recommended index.&lt;br/&gt;    create index TEST.IDX$$_041C0001 on TEST.TESTEMP(&#39;MGR&#39;);&lt;br/&gt; &lt;br/&gt;  Rationale&lt;br/&gt;  ---------&lt;br/&gt;    Creating the recommended indices significantly improves the execution plan&lt;br/&gt;    of this statement. However, it might be preferable to run &quot;Access Advisor&quot;&lt;br/&gt;    using a representative SQL workload as opposed to a single statement. This&lt;br/&gt;    will allow to get comprehensive index recommendations which takes into&lt;br/&gt;    account index maintenance overhead and additional space consumption.&lt;br/&gt; &lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;EXPLAIN PLANS SECTION&lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt; &lt;br/&gt;1- Original&lt;br/&gt;-----------&lt;br/&gt;Plan hash value: 719480185&lt;br/&gt; &lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;| Id  | Operation           | Name    | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;|   0 | SELECT STATEMENT    |         |    13 |   533 |     8  (25)| 00:00:01 |&lt;br/&gt;|   1 |  SORT ORDER BY      |         |    13 |   533 |     8  (25)| 00:00:01 |&lt;br/&gt;|*  2 |   HASH JOIN         |         |    13 |   533 |     7  (15)| 00:00:01 |&lt;br/&gt;|*  3 |    TABLE ACCESS FULL| TESTEMP |    13 |    52 |     3   (0)| 00:00:01 |&lt;br/&gt;|   4 |    TABLE ACCESS FULL| TESTEMP |    14 |   518 |     3   (0)| 00:00:01 |&lt;br/&gt;-------------------------------------------------------------------------------&lt;br/&gt;&lt;br/&gt;Predicate Information (identified by operation id):&lt;br/&gt;---------------------------------------------------&lt;br/&gt;&lt;br/&gt;   2 - access(&quot;EMP&quot;.&quot;EMPNO&quot;=&quot;EMPMGR&quot;.&quot;MGR&quot;)&lt;br/&gt;   3 - filter(&quot;EMPMGR&quot;.&quot;MGR&quot; IS NOT NULL)&lt;br/&gt; &lt;br/&gt;2- Using New Indices&lt;br/&gt;--------------------&lt;br/&gt;Plan hash value: 2840960280&lt;br/&gt; &lt;br/&gt;--------------------------------------------------------------------------------------&lt;br/&gt;| Id  | Operation           | Name           | Rows  | Bytes | Cost (%CPU)| Time     |&lt;br/&gt;--------------------------------------------------------------------------------------&lt;br/&gt;|   0 | SELECT STATEMENT    |                |    13 |   533 |     4  (25)| 00:00:01 |&lt;br/&gt;|   1 |  SORT ORDER BY      |                |    13 |   533 |     4  (25)| 00:00:01 |&lt;br/&gt;|   2 |   NESTED LOOPS      |                |    13 |   533 |     3   (0)| 00:00:01 |&lt;br/&gt;|   3 |    TABLE ACCESS FULL| TESTEMP        |    14 |   518 |     3   (0)| 00:00:01 |&lt;br/&gt;|*  4 |    INDEX RANGE SCAN | IDX$$_041C0001 |     1 |     4 |     0   (0)| 00:00:01 |&lt;br/&gt;--------------------------------------------------------------------------------------&lt;br/&gt;&lt;br/&gt;Predicate Information (identified by operation id):&lt;br/&gt;---------------------------------------------------&lt;br/&gt;&lt;br/&gt;   4 - access(&quot;EMP&quot;.&quot;EMPNO&quot;=&quot;EMPMGR&quot;.&quot;MGR&quot;)&lt;br/&gt;       filter(&quot;EMPMGR&quot;.&quot;MGR&quot; IS NOT NULL)&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Clean up&lt;/h4&gt;&lt;br/&gt;The DBMS_SQLTUNE package provides APIs to remove the objects we created as follows.&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; exec DBMS_SQLTUNE.DROP_TUNING_TASK(&#39;sql_tuning_task&#39;);&lt;br/&gt; &lt;br/&gt;PL/SQL procedure successfully completed.&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot;color:#808080;&quot;&gt;&lt;strong&gt;Note: &lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot;color:#808080;&quot;&gt;The Following error message means user have no permission to user Advisor privilege&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot;color:#808080;&quot;&gt; ORA-13616: The current user &amp;lt;User Name&amp;gt; has not been granted the ADVISOR privilege. &lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot;color:#808080;&quot;&gt;&lt;strong&gt;Solutions:&lt;/strong&gt;&lt;/span&gt;&lt;br/&gt;&lt;pre&gt;&lt;span style=&quot;color:#808080;&quot;&gt;Grant ADVISOR to &amp;lt;User Name&amp;gt;;&lt;br/&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/1450835471851803365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/06/sql-tuning-advisor-in-oracle-10g.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1450835471851803365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1450835471851803365'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/06/sql-tuning-advisor-in-oracle-10g.html' title='SQL Tuning Advisor in Oracle 10g'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-5944340907055649990</id><published>2010-05-30T05:52:00.000-07:00</published><updated>2010-08-02T19:57:42.548-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Buffer Cash"/><category scheme="http://www.blogger.com/atom/ns#" term="Clear"/><category scheme="http://www.blogger.com/atom/ns#" term="Clear Buffer Cash and shared_pool"/><category scheme="http://www.blogger.com/atom/ns#" term="Shared Pool"/><title type='text'>How to Clear Buffer Cash and Shared Pool in Oracle 10g</title><content type='html'>&lt;strong&gt;Flush buffer cache to clear recently cached data blocks&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; alter system flush buffer_cache;&lt;br/&gt;System altered.&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Flush shared pool to clear recently created SQL parse and execution plan&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; alter system flush shared_pool;&lt;br/&gt;System altered.&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;What is the Difference between “&lt;em&gt;clear buffer&lt;/em&gt;” and “&lt;em&gt;alter system flush buffer_cache&lt;/em&gt;”&lt;/span&gt;&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Clear Buffer SQL* Plus Command which is use to clear the SQL*Plus screen and the screen buffer.&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br/&gt;CLEAR {BREAKS|BUFFER|COLUMNS|COMPUTES|SCREEN|SQL TIMING}&lt;/pre&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; clear buffer&lt;br/&gt;buffer cleared&lt;/pre&gt;&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br/&gt;SQL&amp;gt; Select empno, ename from Scott.emp Where ename=&#39;KING&#39;;&lt;br/&gt;     EMPNO ENAME&lt;br/&gt;---------- ----------&lt;br/&gt;      7839 KING&lt;br/&gt;SQL&amp;gt; list;&lt;br/&gt;  1* Select empno, ename from Scott.emp Where ename=&#39;KING&#39;&lt;br/&gt;SQL&amp;gt; clear buffer;&lt;br/&gt;buffer cleared&lt;br/&gt;SQL&amp;gt; list&lt;br/&gt;&lt;span style=&quot;color:#ff0000;&quot;&gt;SP2-0223: No lines in SQL buffer.&lt;/span&gt;&lt;/pre&gt;&lt;br/&gt;But alter system flush&lt;strong&gt; buffer_cache&lt;/strong&gt; use to clear data buffer cash in &lt;strong&gt;SGA&lt;/strong&gt;.</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/5944340907055649990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/05/how-to-clear-buffer-cash-and-shared.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/5944340907055649990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/5944340907055649990'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/05/how-to-clear-buffer-cash-and-shared.html' title='How to Clear Buffer Cash and Shared Pool in Oracle 10g'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-7212159835802066593</id><published>2010-05-22T04:20:00.000-07:00</published><updated>2010-08-02T19:57:42.535-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database Backup"/><category scheme="http://www.blogger.com/atom/ns#" term="Database Script"/><category scheme="http://www.blogger.com/atom/ns#" term="Full Database Backup Script"/><title type='text'>Full Database Backup Script</title><content type='html'>&lt;pre&gt;rem ######################################################################&lt;br/&gt;rem Filename:   FullDBBackup.sql&lt;br/&gt;rem Purpose:    Generate script to do a simple on-line database backup.&lt;br/&gt;rem Notes:      Adjust the copy_cmnd and copy_dest variables and run from&lt;br/&gt;rem             sqlplus. Uncomment last few lines to do the actual backup.&lt;br/&gt;rem ######################################################################&lt;br/&gt;set serveroutput on&lt;br/&gt;set trimspool on&lt;br/&gt;set line 500&lt;br/&gt;set head off&lt;br/&gt;set feed off&lt;br/&gt;spool backup.cmd&lt;br/&gt;declare&lt;br/&gt;  copy_cmnd constant varchar2(30) := &#39;cp&#39;;            -- Use &quot;ocopy&quot; for NT&lt;br/&gt;  copy_dest constant varchar2(30) := &#39;/u02/backup/&#39;;  -- C:\BACKUP\ for NT&lt;br/&gt;  dbname  varchar2(30);&lt;br/&gt;  logmode varchar2(30);&lt;br/&gt;begin&lt;br/&gt;  select name, log_mode&lt;br/&gt;  into   dbname, logmode&lt;br/&gt;  from   sys.v_$database;&lt;br/&gt;&lt;br/&gt;  if logmode &amp;lt;&amp;gt; &#39;ARCHIVELOG&#39; then&lt;br/&gt;    raise_application_error(-20000, &#39;ERROR: Database must be in ARCHIVELOG mode!!!&#39;);&lt;br/&gt;    return;&lt;br/&gt;  end if;&lt;br/&gt;  dbms_output.put_line(&#39;spool backup.&#39;||dbname||&#39;.&#39;|| to_char(sysdate, &#39;ddMonyy&#39;)||&#39;.log&#39;);&lt;br/&gt;  --Loop through tablespaces&lt;br/&gt;  for c1 in (select tablespace_name ts from sys.dba_tablespaces where CONTENTS &amp;lt;&amp;gt; &#39;TEMPORARY&#39;)&lt;br/&gt;  loop&lt;br/&gt;    dbms_output.put_line(&#39;alter tablespace &#39;||c1.ts||&#39; begin backup;&#39;);&lt;br/&gt;    --Loop through tablespaces&#39; data files&lt;br/&gt;    for c2 in (select file_name fil&lt;br/&gt;               from   sys.dba_data_files&lt;br/&gt;               where  tablespace_name = c1.ts)&lt;br/&gt;      loop&lt;br/&gt;        dbms_output.put_line(&#39;!&#39;||copy_cmnd||&#39; &#39;||c2.fil||&#39; &#39;||copy_dest);&lt;br/&gt;      end loop;&lt;br/&gt;      dbms_output.put_line(&#39;alter tablespace &#39;||c1.ts||&#39; end backup;&#39;);&lt;br/&gt;    end loop;&lt;br/&gt;  -- Backup controlfile and switch logfiles&lt;br/&gt;  dbms_output.put_line(&#39;alter database backup controlfile to trace;&#39;);&lt;br/&gt;  dbms_output.put_line(&#39;alter database backup controlfile to &#39;||&#39;&#39;&#39;&#39;||&lt;br/&gt;  copy_dest||&#39;control.&#39;||dbname||&#39;.&#39;||&lt;br/&gt;  to_char(sysdate,&#39;DDMonYYHH24MI&#39;)||&#39;&#39;&#39;&#39;||&#39;;&#39;);&lt;br/&gt;  dbms_output.put_line(&#39;alter system switch logfile;&#39;);&lt;br/&gt;  dbms_output.put_line(&#39;spool off&#39;);&lt;br/&gt;end;&lt;br/&gt;/&lt;br/&gt;spool off&lt;br/&gt;set head on&lt;br/&gt;set feed on&lt;br/&gt;set serveroutput off&lt;br/&gt;-- Unremark/uncomment the following line to run the backup script&lt;br/&gt;-- @backup.cmd&lt;br/&gt;-- exit&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/7212159835802066593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/05/full-database-backup-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7212159835802066593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7212159835802066593'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/05/full-database-backup-script.html' title='Full Database Backup Script'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-650431499908199927</id><published>2010-05-22T04:01:00.000-07:00</published><updated>2010-08-02T19:57:42.519-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database Script"/><category scheme="http://www.blogger.com/atom/ns#" term="Grant Permission"/><category scheme="http://www.blogger.com/atom/ns#" term="Grant Select/Execute"/><title type='text'>Grant Select/Execute on Database Objects</title><content type='html'>&lt;pre&gt;rem ##################################################################&lt;br/&gt;rem Filename:   GrantSelectOnView.sql&lt;br/&gt;rem Purpose:    Grant Select on Tables/View to the role&lt;br/&gt;rem Date:       09-May-2010&lt;br/&gt;rem Author:     Tamim Khan (Email: tamimdba@gmail.com)&lt;br/&gt;rem ##################################################################&lt;br/&gt;SELECT &#39;Grant Select on  &#39;||object_name || &#39; to &#39;||&#39;&amp;lt;Role/User Name&amp;gt;&#39; || &#39;;&#39;&lt;br/&gt;FROM ALL_OBJECTS&lt;br/&gt;Where object_type = &#39;&amp;lt;VIEW/TABLE&amp;gt;&#39;&lt;br/&gt;  and OWNER = &#39;&amp;lt;USER_NAME&amp;gt;&#39;;&lt;br/&gt;&lt;br/&gt;rem ##################################################################&lt;br/&gt;rem Filename:   GrantExecuteOnPackage.sql&lt;br/&gt;rem Purpose:    Grant Execute on Package/Function/Procedure to the Role&lt;br/&gt;rem Date:       09-May-2010&lt;br/&gt;rem Author:     Tamim Khan (Email: tamimdba@gmail.com)&lt;br/&gt;rem ##################################################################&lt;br/&gt;SELECT &#39;Grant Execute on  &#39;||object_name || &#39; to &#39;||&#39;&amp;lt;Role/User Name&amp;gt;&#39; || &#39;;&#39;&lt;br/&gt;FROM ALL_OBJECTS&lt;br/&gt;Where object_type = &#39;&amp;lt;PACKAGE/FUNCTION/PROCEDURE&amp;gt;&#39;&lt;br/&gt;  and OWNER = &#39;&amp;lt;USER_NAME&amp;gt;&#39;;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/650431499908199927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/05/grant-selectexecute-on-database-objects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/650431499908199927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/650431499908199927'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/05/grant-selectexecute-on-database-objects.html' title='Grant Select/Execute on Database Objects'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-2185920935230398030</id><published>2010-05-22T03:50:00.000-07:00</published><updated>2010-08-02T19:57:42.502-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Create Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="Create Public Synonym"/><category scheme="http://www.blogger.com/atom/ns#" term="Database Script"/><title type='text'>Create Public Synonym</title><content type='html'>&lt;div id=&quot;_mcePaste&quot;&gt;&lt;br/&gt;&lt;pre&gt;rem ##################################################################&lt;br/&gt;rem Filename:   CreatePublicSynonym.sql&lt;br/&gt;rem Purpose:    Create Public Synonym for a User Objects&lt;br/&gt;rem Date:       09-May-2010&lt;br/&gt;rem Author:     Tamim Khan (Email: tamimdba@gmail.com)&lt;br/&gt;rem ##################################################################&lt;br/&gt;&lt;br/&gt;SELECT &#39;Create or replace public synonym  &#39;||object_name || &#39; for &#39;&lt;br/&gt;                               || OWNER || &#39;.&#39; || object_name || &#39;;&#39;&lt;br/&gt;FROM ALL_OBJECTS&lt;br/&gt;Where object_type  in (&#39;VIEW&#39;,&#39;PACKAGE&#39;)&lt;br/&gt;and OWNER = &#39;&amp;lt;USER_NAME&amp;gt;&#39;;&lt;/pre&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/2185920935230398030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/05/create-public-synonym.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2185920935230398030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2185920935230398030'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/05/create-public-synonym.html' title='Create Public Synonym'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-1629538156542678697</id><published>2010-05-22T03:24:00.000-07:00</published><updated>2010-08-02T19:57:42.486-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="delete duplicate rows"/><category scheme="http://www.blogger.com/atom/ns#" term="How To"/><title type='text'>How delete duplicate rows from a Table</title><content type='html'>&lt;h3&gt;Creating Table and Insert some sample Data&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;CREATE TABLE PROC_DATA_LOG&lt;br/&gt;  (&lt;br/&gt;    CN      VARCHAR2(20 BYTE),&lt;br/&gt;    A_DATA  VARCHAR2(400 BYTE)&lt;br/&gt;  );&lt;br/&gt;Select * from PROC_DATA_LOG;&lt;br/&gt;&lt;br/&gt;CN                   A_DATA                                          &lt;br/&gt;-------------------- ------------&lt;br/&gt;1                    Test Data 1&lt;br/&gt;1                    Test Data 1&lt;br/&gt;2                    Test Data 2&lt;br/&gt;3                    Test Data 3&lt;br/&gt;3                    Test Data 3&lt;br/&gt;4                    Test Data 4&lt;br/&gt;5                    Test Data 5&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;SQL to delete the duplicate rows&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;DELETE FROM PROC_DATA_LOG  &lt;br/&gt;WHERE ROWID NOT IN (&lt;br/&gt;                    SELECT MAX (ROWID)&lt;br/&gt;                    FROM PROC_DATA_LOG&lt;br/&gt;                    GROUP BY CN&lt;br/&gt;                   );&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;All duplicate row base on CN is deleted&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Select * from PROC_DATA_LOG;&lt;br/&gt;&lt;br/&gt;CN                   A_DATA                                                   &lt;br/&gt;-------------------- ------------&lt;br/&gt;1                    Test Data 1&lt;br/&gt;2                    Test Data 2&lt;br/&gt;3                    Test Data 3&lt;br/&gt;4                    Test Data 4&lt;br/&gt;5                    Test Data 5&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Delete Duplicate Rows using Analytic functions&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;DELETE FROM PROC_DATA_LOG&lt;br/&gt;WHERE ROWID IN ( &lt;br/&gt;        SELECT ROWID&lt;br/&gt;        FROM (&lt;br/&gt;              SELECT&lt;br/&gt;              ROW_NUMBER() OVER (PARTITION BY CN ORDER BY CN) rnk&lt;br/&gt;              FROM   PROC_DATA_LOG&lt;br/&gt;             )&lt;br/&gt;        WHERE rnk&amp;gt;1&lt;br/&gt;        );&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/1629538156542678697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/05/how-delete-duplicate-rows-from-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1629538156542678697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1629538156542678697'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/05/how-delete-duplicate-rows-from-table.html' title='How delete duplicate rows from a Table'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-2846400622746308287</id><published>2010-04-10T06:01:00.000-07:00</published><updated>2010-08-02T19:57:42.457-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle10g"/><category scheme="http://www.blogger.com/atom/ns#" term="Parameterized View in Oracle"/><title type='text'>Parameterized View in Oracle</title><content type='html'>&lt;h1&gt;&lt;span style=&quot;font-weight:normal;font-size:13px;&quot;&gt;There is nothing like parameterize view in Oracle, but you can use parameterize view in oracle following way. There is two possible option, You can use the User Environment variable to manage a session variable (dbms_application_info package), another way is write a package to get and set value parameterize view in the global variable or sys_context, later on a view can use the value from, which called so called parameterized view.&lt;/span&gt;&lt;/h1&gt;&lt;br/&gt;&lt;h3&gt;Example:&lt;/h3&gt;&lt;br/&gt;&lt;h4&gt;Creating Table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE TABLE APPLICATIONS (&lt;br/&gt;    APPLICATION_CN             VARCHAR2 (10 BYTE) NOT NULL ENABLE,&lt;br/&gt;    APPLICATION_NAME           VARCHAR2 (20 BYTE) NOT NULL ENABLE,&lt;br/&gt;    APPLICATION_DESCRIPTION    VARCHAR2 (200 BYTE),&lt;br/&gt;    APPLICATION_STATUS         VARCHAR2 (5 BYTE) DEFAULT &#39;True&#39;&lt;br/&gt;  );&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Inserting Data in to the table&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;Insert into APPLICATIONS (APPLICATION_CN,APPLICATION_NAME,APPLICATION_DESCRIPTION,APPLICATION_STATUS) &lt;br/&gt;values (&#39;10001&#39;,&#39;ERP&#39;,&#39;Enterprise resource Planning &#39;,&#39;True&#39;);&lt;br/&gt;&lt;br/&gt;Insert into APPLICATIONS (APPLICATION_CN,APPLICATION_NAME,APPLICATION_DESCRIPTION,APPLICATION_STATUS) &lt;br/&gt;values (&#39;10002&#39;,&#39;Oracle ERP&#39;,&#39;Oracle Enterprise resource Planning &#39;,&#39;True&#39;);&lt;br/&gt;&lt;br/&gt;Insert into APPLICATIONS (APPLICATION_CN,APPLICATION_NAME,APPLICATION_DESCRIPTION,APPLICATION_STATUS) &lt;br/&gt;values (&#39;10003&#39;,&#39;Web Base Application&#39;,&#39;Web Base Application&#39;,&#39;True&#39;);&lt;br/&gt;&lt;br/&gt;Insert into APPLICATIONS (APPLICATION_CN,APPLICATION_NAME,APPLICATION_DESCRIPTION,APPLICATION_STATUS) &lt;br/&gt;values (&#39;10004&#39;,&#39;Desktop Application&#39;,&#39;Desktop Application&#39;,&#39;True&#39;);&lt;br/&gt;&lt;br/&gt;Commit;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a Package&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;create or replace&lt;br/&gt;PACKAGE TestParam_VW_PKG AS&lt;br/&gt; PROCEDURE P_SET_APPLICATION_CN (  &lt;br/&gt;    p_Application_CN            VARCHAR2&lt;br/&gt;  );&lt;br/&gt;&lt;br/&gt;  FUNCTION F_GET_APPLICATION_CN RETURN VARCHAR2;&lt;br/&gt;END TestParam_VW_PKG;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a Package body for Get and Set operation&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt; &lt;br/&gt;create or replace&lt;br/&gt;PACKAGE BODY TestParam_VW_PKG AS&lt;br/&gt;  g_Application_CN            VARCHAR2(10);&lt;br/&gt;  PROCEDURE P_SET_APPLICATION_CN (  &lt;br/&gt;    p_Application_CN          VARCHAR2&lt;br/&gt;  ) AS&lt;br/&gt;  BEGIN&lt;br/&gt;    g_Application_CN := p_Application_CN;&lt;br/&gt;  END;&lt;br/&gt;&lt;br/&gt;  FUNCTION F_GET_APPLICATION_CN RETURN VARCHAR2&lt;br/&gt;  IS&lt;br/&gt;  BEGIN&lt;br/&gt;    RETURN g_Application_CN;&lt;br/&gt;  END;&lt;br/&gt;END TestParam_VW_PKG;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create a View base on the Packege&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE OR REPLACE FORCE VIEW APPLICATION_VW (&quot;APPLICATION_CN&quot;, &quot;APPLICATION_NAME&quot;, &quot;APPLICATION_DESCRIPTION&quot;, &quot;APPLICATION_STATUS&quot;)&lt;br/&gt;AS&lt;br/&gt;  SELECT APPLICATION_CN,&lt;br/&gt;    APPLICATION_NAME,&lt;br/&gt;    APPLICATION_DESCRIPTION,&lt;br/&gt;    APPLICATION_STATUS&lt;br/&gt;  FROM  APPLICATIONS&lt;br/&gt;  WHERE APPLICATION_CN = TestParam_VW_PKG.F_GET_APPLICATION_CN;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;How to use the view&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; Exec TESTPARAM_VW_PKG.P_SET_APPLICATION_CN(&#39;10001&#39;);&lt;br/&gt;&lt;br/&gt;PL/SQL procedure successfully completed.&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; SELECT APPLICATION_CN, APPLICATION_NAME, APPLICATION_DESCRIPTION, APPLICATION_STATUS&lt;br/&gt;FROM APPLICATION_VW ;&lt;br/&gt;APPLICATION_CN    APPLICATION_NAME     APPLICATION_DESCRIPTION        APPLICATION_STATUS&lt;br/&gt;---------------   -------------------- -----------------------------  ------------------&lt;br/&gt;10001             ERP                  Enterprise resource Planning   True&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/2846400622746308287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/04/parameterized-view-in-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2846400622746308287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2846400622746308287'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/04/parameterized-view-in-oracle.html' title='Parameterized View in Oracle'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-4784422445921667846</id><published>2010-03-30T02:43:00.000-07:00</published><updated>2010-08-02T19:57:42.389-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Development life cycle of Database"/><title type='text'>Database system development life cycle</title><content type='html'>&lt;strong&gt;Database planning &lt;/strong&gt;is the management activities that allow the stages of the database system development lifecycle to be realized as efficiently and effectively as possible.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;System Definition &lt;/strong&gt;involves identifying the scope and boundaries of the database system, including its major user views. A user view can represent a job role or business application area.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Requirements collection and analysis &lt;/strong&gt;is the process of collecting and analyzing information about the organization that is to be supported by the database system, and using this information to identify the requirements for the new system.&lt;br/&gt;&lt;br/&gt;Requirements collection and analysis is a preliminary stage to database design. The amount of data gathered depends on the nature of the problem and the policies of the organization. Identifying the required functionality for a database system is a critical activity, as systems with inadequate or incomplete functionality will annoy the users, and may lead to rejection or underutilization of the system. However, excessive functionality can also be problematic as it can overcomplicate a system, making it difficult to implement, maintain, use, and learn.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Database design &lt;/strong&gt;is the process of creating a design that will support the organization’s mission statement and mission objectives for the required database system. This stage includes the logical and physical design of the database.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;DBMS selection &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The aim of &lt;strong&gt;DBMS selection &lt;/strong&gt;is to select a system that meets the current and future requirements of the organization, balanced against costs that include the purchase of the DBMS product and any additional software/hardware, and the costs associated with changeover and training.&lt;br/&gt;&lt;br/&gt;[caption id=&quot;attachment_636&quot; align=&quot;aligncenter&quot; width=&quot;204&quot; caption=&quot;Database Design Life Cycle&quot;]&lt;a rel=&quot;attachment wp-att-636&quot; href=&quot;http://tamimdba.wordpress.com/2010/03/30/the-database-system-development-life-cycle/database-design-life-cycle/&quot;&gt;&lt;img class=&quot;size-medium wp-image-636  &quot; title=&quot;Database Design Life Cycle&quot; src=&quot;http://tamimdba.files.wordpress.com/2010/03/database-design-life-cycle.jpg?w=204&quot; alt=&quot;Database Design Life Cycle&quot; width=&quot;204&quot; height=&quot;298&quot; /&gt;&lt;/a&gt;[/caption]&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Application design &lt;/strong&gt;involves designing the user interface and the application programs that use and process the database. This stage involves two main activities: transaction design and user interface design.&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;&lt;strong&gt;Transaction Design &lt;/strong&gt;&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;An action, or series of actions, carried out by a single user or application program that accesses or changes the content of the database.&lt;br/&gt;&lt;br/&gt;There are three main types of transactions:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;retrieval transactions&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;update transactions&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;mixed transactions&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;&lt;strong&gt; User interface      design &lt;/strong&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;In addition to designing how the required functionality is to be achieved, we have to design an appropriate user interface for the database system. This interface should present the required information in a user-friendly way.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Prototyping &lt;/strong&gt;involves building a working model of the database system, which allows the designers or users to visualize and evaluate the system.&lt;br/&gt;&lt;br/&gt;There are two prototyping strategies in common use today:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Requirements prototyping and&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Evolutionary prototyping.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;Requirements prototyping uses a prototype to determine the requirements of a proposed database system and once the requirements are complete the prototype is discarded. While evolutionary prototyping is used for the same purposes, the important difference is that the prototype is not discarded but with further development becomes the working database system.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Implementation &lt;/strong&gt;is the physical realization of the database and application designs.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Data conversion and loading &lt;/strong&gt;involves transferring any existing data into the new database and converting any existing applications to run on the new database.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Testing &lt;/strong&gt;is the process of running the database system with the intent of ﬁnding programming errors.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Operational maintenance &lt;/strong&gt;is the process of monitoring and maintaining the system following installation.&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The process of monitoring and maintaining the database system following installation.&lt;br/&gt;&lt;br/&gt;In this stage, the database system now moves into a maintenance stage, which involves the following activities:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Monitoring the performance of      the database system. If the performance falls below an acceptable level,      the database may need to be tuned or reorganized.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Maintaining and upgrading the      database system (when required). New requirements are incorporated into      the database system through the preceding stages of the lifecycle.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;For More detail please read the book &lt;a title=&quot;Building Databases &quot; href=&quot;http://www.scribd.com/doc/29142252/Database-Solutions-A-Step-by-Step-Guide-to-Building-Databases-2nd-Edition&quot; target=&quot;_blank&quot;&gt;Database Solutions A step-by-step guide to building databases&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A Tutorial on Database Design concept please click &lt;a href=&quot;http://www.databaseanswers.org/tutorial4_getting_started_with_db_design/index.htm&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/4784422445921667846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/03/database-system-development-life-cycle.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/4784422445921667846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/4784422445921667846'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/03/database-system-development-life-cycle.html' title='Database system development life cycle'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-2489565965799107652</id><published>2010-03-03T05:27:00.000-08:00</published><updated>2010-08-02T19:57:42.373-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Schema Cleanup script"/><title type='text'>How to Delete All Objects for a User in Oracle</title><content type='html'>If you don&#39;t have system level access(Sys or System), and want to clean your schema,  the following sql will produce a series of drop statments, which can  then be executed.&lt;br/&gt;&lt;pre&gt;&lt;address&gt;select &#39;drop &#39;||object_type||&#39; &#39;|| object_name||  DECODE(OBJECT_TYPE,&#39;TABLE&#39;,&#39; CASCADE CONSTRAINTS;&#39;,&#39;;&#39;)&lt;br/&gt;from user_objects&lt;/address&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;Then, I normally purge the recycle bin to really clean things up.  To be  honest, I don&#39;t see a lot of use for oracle&#39;s recycle bin, and wish i  could disable it... but anyway:&lt;br/&gt;&lt;pre&gt;&lt;br/&gt;&lt;pre&gt;&lt;address&gt;&lt;span style=&quot;text-decoration:underline;&quot;&gt;purge recyclebin;&lt;/span&gt;&lt;/address&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Following Script can run the full System&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SET feedback off&lt;br/&gt;SET verify off&lt;br/&gt;SET echo off&lt;br/&gt;PROMPT Number of objects IN the schema:&lt;br/&gt;SELECT COUNT(*) FROM user_objects;&lt;br/&gt;PROMPT Finding objects TO DROP&lt;br/&gt;&lt;br/&gt;SET termout OFF&lt;br/&gt;SET pages 80&lt;br/&gt;SET heading OFF&lt;br/&gt;SET linesize 120&lt;br/&gt;&lt;br/&gt;PURGE RECYCLEBIN;&lt;br/&gt;&lt;br/&gt;SPOOL c:\cleanup_schema.sql&lt;br/&gt;SELECT &#39;SPOOL c:\cleanup_schema.log&#39; FROM dual;&lt;br/&gt;SELECT &#39;DROP &#39;||object_type||&#39; &#39;|| object_name||  DECODE(object_type,&#39;TABLE&#39;,&#39; CASCADE CONSTRAINTS;&#39;,&#39;;&#39;) FROM user_objects ORDER BY object_id DESC;&lt;br/&gt;SELECT &#39;PURGE RECYCLEBIN;&#39; FROM dual;&lt;br/&gt;SELECT &#39;PROMPT After cleanup, number of objects remaining in schema&#39; FROM dual;&lt;br/&gt;SELECT &#39;SELECT COUNT(*) FROM user_objects;&#39; FROM dual;&lt;br/&gt;SELECT &#39;SPOOL OFF&#39; FROM dual;&lt;br/&gt;SELECT &#39;EXIT;&#39; FROM dual;&lt;br/&gt;&lt;br/&gt;SPOOL OFF&lt;br/&gt;&lt;br/&gt;SET termout ON&lt;br/&gt;PROMPT Dropping Objects now ...&lt;br/&gt;-- Execute the sql file created earlier&lt;br/&gt;--@c:\cleanup_schema.sql&lt;br/&gt;EXIT&lt;br/&gt;/&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;&lt;br/&gt;Reff:&lt;a href=&quot;http://forums.oracle.com/forums/message.jspa?messageID=1057359&quot;&gt; http://forums.oracle.com/forums/message.jspa?messageID=1057359&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/2489565965799107652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/03/how-to-delete-all-objects-for-user-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2489565965799107652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/2489565965799107652'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/03/how-to-delete-all-objects-for-user-in.html' title='How to Delete All Objects for a User in Oracle'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-3782356815932006670</id><published>2010-02-23T08:12:00.000-08:00</published><updated>2010-08-02T19:57:42.345-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SPLIT"/><category scheme="http://www.blogger.com/atom/ns#" term="SPLIT Function"/><title type='text'>Customize SPLIT Function written in Oracle (PLSQL)</title><content type='html'>&lt;h2&gt;&lt;span style=&quot;font-weight:normal;font-size:13px;&quot;&gt;A common task when selecting data from a database is to take a set of values a query returns and format it as a comma delimited list. Another task that&#39;s almost as common is the need to do the reverse take a comma delimited list of values in a single string and use it as a table of values.&lt;/span&gt;&lt;/h2&gt;&lt;br/&gt;To serve this purpose I preferred following function to Split string.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Split Function:&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;create or replace function split(&lt;br/&gt;  p_InputString   varchar2,&lt;br/&gt;  p_Position      number,&lt;br/&gt;  p_Delimiter     varchar2&lt;br/&gt;  )&lt;br/&gt;return varchar2&lt;br/&gt;is&lt;br/&gt;   v_list varchar2(32767) := p_Delimiter || p_InputString;&lt;br/&gt;   v_start_position number;&lt;br/&gt;   v_end_position number;&lt;br/&gt;begin&lt;br/&gt;   v_start_position := instr(v_list, p_Delimiter, 1, p_Position);&lt;br/&gt;   if v_start_position &amp;gt; 0 then&lt;br/&gt;      v_end_position := instr( v_list, p_Delimiter, 1, p_Position + 1);&lt;br/&gt;         if v_end_position = 0 then&lt;br/&gt;            v_end_position := length(v_list) + 1;&lt;br/&gt;         end if;&lt;br/&gt;         return(substr(v_list, v_start_position + 1, v_end_position - v_start_position - 1));&lt;br/&gt;   else&lt;br/&gt;         return NULL;&lt;br/&gt;   end if;&lt;br/&gt;end split;&lt;br/&gt;/&lt;br/&gt;Show Error&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Output 1:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;select split(&#39;Tamim Khan&#39;,1,&#39; &#39;) from dual;&lt;br/&gt;SPLIT(&#39;TAMIMKHAN&#39;,1,&#39;&#39;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br/&gt;-----------------------------------------&lt;br/&gt;Tamim&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Output 2:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;select split(&#39;Tamim Khan&#39;,2,&#39; &#39;) from dual;&lt;br/&gt;&lt;br/&gt;SPLIT(&#39;TAMIMKHAN&#39;,1,&#39;&#39;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br/&gt;------------------------------------------&lt;br/&gt;Khan&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Output 3:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;select split(&#39;Dhanmondi,Dhaka&#39;,1,&#39;,&#39;) from dual;                        &lt;br/&gt;SPLIT(&#39;TAMIMKHAN&#39;,1,&#39;&#39;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br/&gt;----------------------------------------------&lt;br/&gt;Dhanmondi&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Output 4:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;select split(&#39;Dhanmondi,Dhaka&#39;,2,&#39;,&#39;) from dual;                        &lt;br/&gt;SPLIT(&#39;TAMIMKHAN&#39;,1,&#39;&#39;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br/&gt;----------------------------------------------&lt;br/&gt;Dhaka&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/3782356815932006670/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/customize-split-function-written-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3782356815932006670'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3782356815932006670'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/customize-split-function-written-in.html' title='Customize SPLIT Function written in Oracle (PLSQL)'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-1659861174256297292</id><published>2010-02-18T02:27:00.000-08:00</published><updated>2010-08-02T19:57:42.308-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Wrapping PL/SQL"/><title type='text'>Wrapping PL/SQL</title><content type='html'>Wrapping PL/SQL source is not so different using this method than it is using the WRAP binary. It is more flexible. Oracle developers can take advantage of many PL/SQL or Java utilities that exist in $ORACLE_HOME/bin or in supplied packages.&lt;br/&gt;&lt;br/&gt;These utilities can load, encrypt, tune or debug code objects.  This chapter will focus on the utilities that perform these functions, including wrap, dbms_profiler, dbms_debug, loadjava, dropjava and loadpsp.&lt;br/&gt;&lt;br/&gt;The first of these utilities to be discussed will be the wrap utility that allows PL/SQL developers to encrypt their code.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Procedure/Function                Description &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;WRAP                                     Overloaded function that returns the wrapped PL/SQL source code when provided with the original source.&lt;br/&gt;&lt;br/&gt;CREATE_WRAPPED             Procedure that wraps the source code provided as input. It’s faster than using WRAP.&lt;br/&gt;&lt;h3&gt;Create Country Table&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;SQL Code:&lt;/strong&gt;&lt;br/&gt;CREATE TABLE COUNTRIES&lt;br/&gt;  (&lt;br/&gt;    C_NAME  VARCHAR2(15 BYTE)&lt;br/&gt;  );&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;Insert Data into Country Table&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;SQL Code:&lt;/strong&gt;&lt;br/&gt;REM INSERTING into COUNTRIES&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Poland&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Germany&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;United States&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Portugal&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Czech Republic&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;China&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Slovakia&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Slovenia&#39;);&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;The DBMS_DDL package for Dynamic Wrapping&lt;/h3&gt;&lt;br/&gt;Use the overloaded &lt;strong&gt;WRAP&lt;/strong&gt; function with &lt;strong&gt;EXECUTE IMMEDIATE&lt;/strong&gt; to create the wrapped code, as the following example illustrates:&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;SQL Code:&lt;/strong&gt;&lt;br/&gt;DECLARE&lt;br/&gt;  v_Procedure VARCHAR2(32767);&lt;br/&gt;BEGIN&lt;br/&gt;  v_Procedure :=  &#39;create or replace PROCEDURE p_CountryList &#39;&lt;br/&gt;                  || &#39;AS &#39;&lt;br/&gt;                  || &#39;cursor crCountryList is &#39;&lt;br/&gt;                  || &#39;SELECT C_NAME FROM COUNTRIES; &#39;&lt;br/&gt;                  || &#39;BEGIN &#39;&lt;br/&gt;                  || &#39; for rc_countryList in crCountryList loop &#39;&lt;br/&gt;                  || &#39;    dbms_output.put_line(rc_countryList.C_NAME);&#39;&lt;br/&gt;                  || &#39; end loop; &#39;&lt;br/&gt;                  || &#39; End;&#39;; &lt;br/&gt;  EXECUTE IMMEDIATE DBMS_DDL.WRAP(v_Procedure);&lt;br/&gt;END;&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;To see the wrapped procedure, select the text from the USER_SOURCE view.&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;&lt;strong&gt;SQL Code:&lt;/strong&gt;&lt;br/&gt;SELECT text&lt;br/&gt;FROM user_source WHERE name = &#39;P_COUNTRYLIST&#39;;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;&lt;br/&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br/&gt;TEXT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;---------------------------------------------------------------------------&lt;br/&gt;PROCEDURE p_CountryList wrapped                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  &lt;br/&gt;a000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          &lt;br/&gt;b2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;abcd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             &lt;br/&gt;7                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                &lt;br/&gt;c2 d2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            &lt;br/&gt;OBXTyU790UHZX1Pz/x6SK6zaQdowg0zwLcsVfC+EOo7QS9JbZQ2c1RiJi1GYkXCXR+Hnl92a                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         &lt;br/&gt;6yUmVMJdr3L/xdu8xYazffm813KuNLzJ0jnlJ1HKbCYmfWw51ec5hoXDZ2KBtgvDWEsq4RNq                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         &lt;br/&gt;3cHIqVKojYPLLqq6zBQLjSwb9gkM4mO6aOBaz2jrVZ+/wI9dqhpqq1XumZC83+s=&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;Execute the wrapped procedure to verify all works as expected&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;Set Serveroutput on&lt;br/&gt;execute p_CountryList;&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;This returns the following result&lt;/h3&gt;&lt;br/&gt;&lt;pre&gt;Poland&lt;br/&gt;Germany&lt;br/&gt;United States&lt;br/&gt;Portugal&lt;br/&gt;Czech Republic&lt;br/&gt;China&lt;br/&gt;Slovakia&lt;br/&gt;Slovenia&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;CREATE_WRAPPED&lt;/h3&gt;&lt;br/&gt;DBMS_DDL.CREATE_WRAPPED works in a similar way. The use of EXECUTE IMMEDIATE is not required.&lt;br/&gt;&lt;pre&gt;Use SYS.DBMS_DDL.CREATE_WRAPPED (v_procedure)&lt;br/&gt;with replace of EXECUTE IMMEDIATE DBMS_DDL.WRAP(v_Procedure)&lt;/pre&gt;&lt;br/&gt;&lt;h3&gt;PL/SQL Wrap Utility for Encryption&lt;/h3&gt;&lt;br/&gt;The wrap utility (wrap.exe) provides a way for PL/SQL developers to protect their intellectual property by making their PL/SQL code unreadable.&lt;br/&gt;&lt;br/&gt;Instead, the wrap utility takes a readable, ASCII text file as input and converts it to a file containing byte code.  The result is that the DBA, developers or anyone with database access cannot view the source code in any readable format.&lt;br/&gt;&lt;br/&gt;The command line options for wrap are:&lt;br/&gt;&lt;br/&gt;wrap iname=[file] oname=[file]&lt;br/&gt;&lt;br/&gt;· iname – The name of the unencrypted PL/SQL file to be used as input (your source file).&lt;br/&gt;&lt;br/&gt;· oname – The name of the output file.  This file will be encrypted.&lt;br/&gt;&lt;br/&gt;For more information &lt;a href=&quot;http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm&quot;&gt;http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/1659861174256297292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/wrapping-plsql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1659861174256297292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/1659861174256297292'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/wrapping-plsql.html' title='Wrapping PL/SQL'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-3121902765584274555</id><published>2010-02-17T03:03:00.000-08:00</published><updated>2010-08-02T19:57:42.293-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ref Cursor"/><title type='text'>How to use Ref Cursor example</title><content type='html'>&lt;strong&gt;How to use Ref Cursor example&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;A &lt;strong&gt;&lt;em&gt;REF CURSOR&lt;/em&gt;&lt;/strong&gt; is basically a data type.  A variable created based on such a data type is generally called a cursor variable.  A cursor variable can be associated with different queries at run-time.  The primary advantage of using cursor variables is their capability to pass result sets between sub programs (like stored procedures, functions, packages etc.).&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Declaring a SYS_REFCURSOR Cursor Variable&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;The following is the syntax for declaring a &lt;strong&gt;SYS_REFCURSOR&lt;/strong&gt; cursor variable:&lt;br/&gt;&lt;pre&gt;name SYS_REFCURSOR;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;name&lt;/strong&gt; is an identifier assigned to the cursor variable.&lt;br/&gt;&lt;br/&gt;The following is an example of a &lt;strong&gt;SYS_REFCURSOR&lt;/strong&gt; variable declaration.&lt;br/&gt;&lt;pre&gt;DECLARE&lt;br/&gt;    rc_emp SYS_REFCURSOR;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Opening a Cursor Variable&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Once a cursor variable is declared, it must be opened with an associated SELECT command. The OPEN FOR statement specifies the SELECT command to be used to create the result set.&lt;br/&gt;&lt;pre&gt;Syntax:&lt;br/&gt;OPEN name FOR query;&lt;/pre&gt;&lt;br/&gt;name is the identifier of a previously declared cursor variable.  Query is a SELECT command that determines the result set when the statement is executed. The value of the cursor variable after the OPEN FOR statement is executed identifies the result set.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;Declaring a User Defined REF CURSOR Type Variable&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You must perform two distinct declaration steps in order to use a user defined REF CURSOR variable:&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Create      a referenced cursor TYPE&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Declare      the actual cursor variable based on that TYPE&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;The syntax for creating a user defined REF CURSOR type is as follows:&lt;br/&gt;&lt;pre&gt;Syntax:&lt;br/&gt;TYPE cursor_type_name IS REF CURSOR [RETURN return_type];&lt;/pre&gt;&lt;br/&gt;The following is an example of a cursor variable declaration.&lt;br/&gt;&lt;pre&gt;DECLARE&lt;br/&gt;    TYPE emp_cur_type IS REF CURSOR RETURN emp%ROWTYPE;&lt;br/&gt;    rc_emp emp_cur_type;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Closing a Cursor Variable&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Unlike static cursors, a cursor variable does not have to be closed before it can be re-opened again. The result set from the previous open will be lost. The example is completed with the addition of the CLOSE statement.&lt;br/&gt;&lt;pre&gt;Syntax:&lt;br/&gt;CLOSE cursor_name;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;N.B:&lt;/strong&gt;&lt;br/&gt;&lt;ul&gt;&lt;br/&gt;	&lt;li&gt;Comparison      operators cannot be used to test cursor variables for equality,      inequality, null, or not null.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Null      cannot be assigned to a cursor variable.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;The      value of a cursor variable cannot be stored in a database column.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Static      cursors and cursor variables are not interchangeable. For example, a      static cursor cannot be used in an OPEN FOR statement.&lt;/li&gt;&lt;br/&gt;&lt;/ul&gt;&lt;br/&gt;&lt;strong&gt;Permitted Cursor Variable Parameter Modes&lt;/strong&gt;&lt;br/&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot;&gt;&lt;br/&gt;&lt;thead&gt;&lt;br/&gt;&lt;tr&gt;&lt;br/&gt;&lt;td&gt;Operation&lt;/td&gt;&lt;br/&gt;&lt;td&gt;IN&lt;/td&gt;&lt;br/&gt;&lt;td&gt;IN OUT&lt;/td&gt;&lt;br/&gt;&lt;td&gt;OUT&lt;/td&gt;&lt;br/&gt;&lt;/tr&gt;&lt;br/&gt;&lt;/thead&gt;&lt;br/&gt;&lt;tbody&gt;&lt;br/&gt;&lt;tr&gt;&lt;br/&gt;&lt;td&gt;OPEN&lt;/td&gt;&lt;br/&gt;&lt;td&gt;No&lt;/td&gt;&lt;br/&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;br/&gt;&lt;td&gt;No&lt;/td&gt;&lt;br/&gt;&lt;/tr&gt;&lt;br/&gt;&lt;tr&gt;&lt;br/&gt;&lt;td&gt;FETCH&lt;/td&gt;&lt;br/&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;br/&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;br/&gt;&lt;td&gt;No&lt;/td&gt;&lt;br/&gt;&lt;/tr&gt;&lt;br/&gt;&lt;tr&gt;&lt;br/&gt;&lt;td&gt;CLOSE&lt;/td&gt;&lt;br/&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;br/&gt;&lt;td&gt;Yes&lt;/td&gt;&lt;br/&gt;&lt;td&gt;No&lt;/td&gt;&lt;br/&gt;&lt;/tr&gt;&lt;br/&gt;&lt;/tbody&gt;&lt;br/&gt;&lt;/table&gt;&lt;br/&gt;&lt;strong&gt;Create Country Table&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL Code:&lt;br/&gt;CREATE TABLE COUNTRIES&lt;br/&gt;  (&lt;br/&gt;    C_NAME  VARCHAR2(15 BYTE)&lt;br/&gt;  );&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Insert Data into Country Table&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;SQL Code:&lt;br/&gt;REM INSERTING into COUNTRIES&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Poland&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Germany&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;United States&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Portugal&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Czech Republic&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;China&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Slovakia&#39;);&lt;br/&gt;Insert into COUNTRIES (C_NAME) values (&#39;Slovenia&#39;);&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Procedure using ref cursor&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;create or replace&lt;br/&gt;PROCEDURE p_Get_Country (&lt;br/&gt;    p_CountryName     IN VARCHAR2&lt;br/&gt;    )&lt;br/&gt;  AS&lt;br/&gt;  rc_Country_Search  SYS_REFCURSOR;&lt;br/&gt;  v_query            VARCHAR2(30000) := NULL;&lt;br/&gt;  rows_fetched       number;&lt;br/&gt;  TYPE t_tab IS TABLE OF COUNTRIES%ROWTYPE;&lt;br/&gt;  rec_tab t_tab;&lt;br/&gt;BEGIN&lt;br/&gt;  if (p_CountryName is not null) then&lt;br/&gt;    v_query := &#39;SELECT C_NAME FROM COUNTRIES &lt;br/&gt;                where UTL_MATCH.JARO_WINKLER_SIMILARITY&lt;br/&gt;                (C_NAME,&#39;|| &#39;&#39;&#39;&#39; || to_char(p_CountryName) || &#39;&#39;&#39;&#39;  || &#39;) &amp;gt; 60&#39;;&lt;br/&gt;  else&lt;br/&gt;    v_query := &#39;SELECT C_NAME FROM COUNTRIES&#39;;&lt;br/&gt;  end if;&lt;br/&gt;&lt;br/&gt;  OPEN  rc_Country_Search FOR v_query;&lt;br/&gt;  FETCH rc_Country_Search BULK COLLECT INTO rec_tab;&lt;br/&gt;  rows_fetched := rc_Country_Search%ROWCOUNT;&lt;br/&gt;  --Print Data to the console&lt;br/&gt;  dbms_output.put_line(&#39;--------------------------------&#39;);&lt;br/&gt;  FOR i IN 1..rows_fetched LOOP&lt;br/&gt;      dbms_output.put_line(&#39;Country Name -&amp;gt; &#39;      ||  rec_tab(i).C_NAME||CHR( 13 ) || CHR( 10 ));&lt;br/&gt;  END LOOP;&lt;br/&gt;  dbms_output.put_line(&#39;--------------------------------&#39;);&lt;br/&gt;  CLOSE rc_Country_Search;&lt;br/&gt;END p_Get_Country;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Out put 1&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;Set serveroutput on&lt;br/&gt;DECLARE&lt;br/&gt;  RC_COUNTRY_SEARCH SYS_REFCURSOR;&lt;br/&gt;BEGIN&lt;br/&gt;  P_GET_COUNTRY(&lt;br/&gt;    P_COUNTRYNAME =&amp;gt; null&lt;br/&gt;  );&lt;br/&gt;END;&lt;br/&gt;--------------------------------&lt;br/&gt;Country Name -&amp;gt; Poland&lt;br/&gt;Country Name -&amp;gt; Germany&lt;br/&gt;Country Name -&amp;gt; United States&lt;br/&gt;Country Name -&amp;gt; Portugal&lt;br/&gt;Country Name -&amp;gt; Czech Republic&lt;br/&gt;Country Name -&amp;gt; China&lt;br/&gt;Country Name -&amp;gt; Slovakia&lt;br/&gt;Country Name -&amp;gt; Slovenia&lt;br/&gt;--------------------------------&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Out put 2&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;Set serveroutput on&lt;br/&gt;DECLARE&lt;br/&gt;  RC_COUNTRY_SEARCH SYS_REFCURSOR;&lt;br/&gt;BEGIN&lt;br/&gt;  P_GET_COUNTRY(&lt;br/&gt;    P_COUNTRYNAME =&amp;gt; &#39;Slov&#39;&lt;br/&gt;  );&lt;br/&gt;END;&lt;br/&gt;--------------------------------&lt;br/&gt;Country Name -&amp;gt; Slovakia&lt;br/&gt;Country Name -&amp;gt; Slovenia&lt;br/&gt;--------------------------------&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Procedure for Ref Cursor population and return through out parameter&lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;create or replace&lt;br/&gt;PROCEDURE p_Get_Country2 (&lt;br/&gt;    p_CountryName     IN VARCHAR2,&lt;br/&gt;    rc_Country_Search  OUT SYS_REFCURSOR&lt;br/&gt;    )&lt;br/&gt;  AS&lt;br/&gt;  v_query         VARCHAR2(30000) := NULL;&lt;br/&gt;  TYPE t_tab IS TABLE OF COUNTRIES%ROWTYPE;&lt;br/&gt;  rec_tab t_tab;&lt;br/&gt;BEGIN&lt;br/&gt;  if (p_CountryName is not null) then&lt;br/&gt;    v_query := &#39;SELECT C_NAME FROM COUNTRIES&lt;br/&gt;                where UTL_MATCH.JARO_WINKLER_SIMILARITY&lt;br/&gt;                (C_NAME,&#39;|| &#39;&#39;&#39;&#39; || to_char(p_CountryName) || &#39;&#39;&#39;&#39;  || &#39;) &amp;gt; 60&#39;;&lt;br/&gt;  else&lt;br/&gt;    v_query := &#39;SELECT C_NAME FROM COUNTRIES&#39;;&lt;br/&gt;  end if;&lt;br/&gt;&lt;br/&gt;  OPEN  rc_Country_Search FOR v_query;&lt;br/&gt;&lt;br/&gt;END p_Get_Country2;&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;Populate Ref cursor variable in C#.Net Console base application using ADO.NET &lt;/strong&gt;&lt;br/&gt;&lt;pre&gt;using System;&lt;br/&gt;using System.Collections.Generic;&lt;br/&gt;using System.Text;&lt;br/&gt;using System.Data.OracleClient;&lt;br/&gt;using System.Data;&lt;br/&gt;&lt;br/&gt;namespace TEST_ODP&lt;br/&gt;{&lt;br/&gt;    class Program&lt;br/&gt;    {&lt;br/&gt;        static void Main(string[] args)&lt;br/&gt;        {&lt;br/&gt;            // create connection&lt;br/&gt;            OracleConnection conn = new OracleConnection(&quot;Data Source=orcl;User;Password=test;&quot;);&lt;br/&gt;            // create the command for the stored procedure&lt;br/&gt;            OracleCommand cmd = new OracleCommand();&lt;br/&gt;&lt;br/&gt;            Console.WriteLine(&quot;Please input your searching keyword.&quot;);&lt;br/&gt;            string str = Console.ReadLine();&lt;br/&gt;&lt;br/&gt;            cmd.Connection = conn;&lt;br/&gt;            cmd.CommandText = &quot;p_Get_Country2&quot;;&lt;br/&gt;            cmd.CommandType = CommandType.StoredProcedure;&lt;br/&gt;&lt;br/&gt;            // add the parameters for the stored procedure including the REF CURSOR&lt;br/&gt;            // to retrieve the result set&lt;br/&gt;            cmd.Parameters.Add(&quot;p_CountryName&quot;, OracleType.VarChar).Value = str.ToString();&lt;br/&gt;            cmd.Parameters.Add(&quot;rc_Country_Search&quot;, OracleType.Cursor).Direction = ParameterDirection.Output;&lt;br/&gt;&lt;br/&gt;            // open the connection and create the DataReader&lt;br/&gt;            conn.Open();&lt;br/&gt;            OracleDataReader dr = cmd.ExecuteReader();&lt;br/&gt;&lt;br/&gt;            // output the results and close the connection.&lt;br/&gt;            while (dr.Read())&lt;br/&gt;            {&lt;br/&gt;                for (int i = 0; i &amp;lt; dr.FieldCount; i++)&lt;br/&gt;                    Console.Write(dr[i].ToString() + &quot;;&quot;);&lt;br/&gt;                Console.WriteLine();&lt;br/&gt;            }&lt;br/&gt;            conn.Close();&lt;br/&gt;            Console.ReadLine();&lt;br/&gt;        }&lt;br/&gt;    }&lt;br/&gt;}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/3121902765584274555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/how-to-use-ref-cursor-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3121902765584274555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/3121902765584274555'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/how-to-use-ref-cursor-example.html' title='How to use Ref Cursor example'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-7996872584959337163</id><published>2010-02-16T02:13:00.000-08:00</published><updated>2010-08-02T19:57:42.280-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="How To"/><category scheme="http://www.blogger.com/atom/ns#" term="Uninstall Oracle"/><title type='text'>Manual Cleanup process and Uninstall Oracle for Windows system</title><content type='html'>&lt;ol&gt;&lt;br/&gt;	&lt;li&gt;Uninstall all Oracle components using the Oracle Universal Installer (OUI).&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key which contains registry entries for all Oracle products by using regedit.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Delete any references to Oracle services/components in the following registry location: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/. Looks for key entries that starts with “Ora” which are obviously related to Oracle.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Reboot the workstation.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Delete the ORACLE_BASE directory. (i.e C:\Oracle)&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Delete the C:\Program Files\Oracle directory.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Empty the temp directory.&lt;/li&gt;&lt;br/&gt;	&lt;li&gt;Empty the recycle bin.&lt;/li&gt;&lt;br/&gt;&lt;/ol&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/7996872584959337163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/manual-cleanup-process-and-uninstall.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7996872584959337163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7996872584959337163'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/manual-cleanup-process-and-uninstall.html' title='Manual Cleanup process and Uninstall Oracle for Windows system'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-7096089786079423424</id><published>2010-02-15T07:18:00.000-08:00</published><updated>2010-08-02T19:57:42.269-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DBMS_PACKEGE"/><category scheme="http://www.blogger.com/atom/ns#" term="UTL_MATCH"/><title type='text'>utl_match package for string matching</title><content type='html'>There are four functions included in the package utl_match use different methods to compare a source string and destination string, and return an assessment of what it would take to turn the source string into the destination string.&lt;br/&gt;&lt;pre&gt;Source: $ORACLE_HOME/rdbms/admin/utlmatch.sql&lt;/pre&gt;&lt;br/&gt;Oracle added the &lt;strong&gt;&lt;em&gt;UTL_MATCH &lt;/em&gt;&lt;/strong&gt;package in Version 10gRelease 2 to compare strings. The four functions included in the package use different methods to compare a source string and destination string, and return an assessment of what it would take to turn the source into the destination string. The functions are broken down into two categories. The categories are actually the algorithms employed to analyze the strings.&lt;br/&gt;&lt;h4&gt;&lt;strong&gt;Levenshtein Distance &lt;/strong&gt;&lt;/h4&gt;&lt;br/&gt;The Levenshtein Distance (LD) algorithm, commonly called the Edit Distance (ED) algorithm, is the older of the two supported methods. It measures the distance between the source and destination strings. By distance, we’re referring to the number of changes required to turn the source string into the destination string.&lt;br/&gt;&lt;h4&gt;&lt;strong&gt;Jaro-Winkler&lt;/strong&gt;&lt;/h4&gt;&lt;br/&gt;&lt;strong&gt; &lt;/strong&gt;The Jaro-Winkler algorithm is the second category of algorithms used in UTL_ MATCH. These functions take the same two arguments, but instead of simply calculating the number of steps required to change the source string to the destination string, it determines how closely the two strings agree with each other. The algorithm also tries to take into account the possibility of a data entry error when determining similarity.&lt;br/&gt;&lt;h4&gt;Procedures/Functions&lt;/h4&gt;&lt;br/&gt;&lt;strong&gt;edit_distance&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Returns the number of changes required to turn the source string into the destination string using the Levenshtein Distance algorithm.&lt;br/&gt;&lt;pre&gt;function edit_distance returns binary_integer (&lt;br/&gt; s1    in        varchar2,&lt;br/&gt; s2    in        varchar2       &lt;br/&gt;);&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;edit_distance_similarity&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Returns an integer between 0 and 100, where 0 indicates no similarity at all and 100 indicates a perfect match.&lt;br/&gt;&lt;pre&gt;function edit_distance_similarity returns binary_integer (&lt;br/&gt; s1    in        varchar2,&lt;br/&gt; s2    in        varchar2       &lt;br/&gt;);&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;jaro_winkler&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Instead of simply calculating the number of steps required to change the source string to the destination string returns similarity based on Jaro-Winkler distance algorithm, determines how closely the two strings agree with each other and tries to take into account the possibility of a data entry error.&lt;br/&gt;&lt;pre&gt;function jaro_winkler returns binary_double (&lt;br/&gt; s1    in       varchar2,&lt;br/&gt; s2    in       varchar2       &lt;br/&gt;);&lt;/pre&gt;&lt;br/&gt;&lt;strong&gt;jaro_winkler_similarity &lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Returns an integer between 0 and 100, where 0 indicates no similarity at all and 100 indicates a perfect match but tries to take into account possible data entry errors.&lt;br/&gt;&lt;pre&gt;function jaro_winkler_similarity returns binary_integer (&lt;br/&gt; s1    in                 varchar2,&lt;br/&gt; s2    in                 varchar2       &lt;br/&gt;);&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Example 1:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; SELECT UTL_MATCH.EDIT_DISTANCE(&#39;espresso&#39;, &#39;expresso&#39;)&lt;br/&gt;  2    AS DISTANCE&lt;br/&gt;  3  FROM DUAL;&lt;br/&gt;&lt;br/&gt;  DISTANCE&lt;br/&gt;----------&lt;br/&gt;         1&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; SELECT UTL_MATCH.EDIT_DISTANCE_SIMILARITY(&#39;espresso&#39;, &#39;expresso&#39;)&lt;br/&gt;  2    AS DISTANCE&lt;br/&gt;  3  FROM DUAL;&lt;br/&gt;&lt;br/&gt;  DISTANCE&lt;br/&gt;----------&lt;br/&gt;        88&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; SELECT UTL_MATCH.JARO_WINKLER(&#39;espresso&#39;, &#39;expresso&#39;)&lt;br/&gt;  2    AS DISTANCE&lt;br/&gt;  3  FROM DUAL;&lt;br/&gt;&lt;br/&gt;  DISTANCE&lt;br/&gt;----------&lt;br/&gt; 9.25E-001&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; SELECT UTL_MATCH.JARO_WINKLER_SIMILARITY (&#39;espresso&#39;, &#39;expresso&#39;)&lt;br/&gt;  2    AS DISTANCE&lt;br/&gt;  3  FROM DUAL;&lt;br/&gt;&lt;br/&gt;  DISTANCE&lt;br/&gt;----------&lt;br/&gt;        92&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Example 2:&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;CREATE TABLE TEST&lt;br/&gt;( &lt;br/&gt;        test_id        number primary key, &lt;br/&gt;        test_name      varchar2(20), &lt;br/&gt;        test_date      date&lt;br/&gt;);  &lt;br/&gt;&lt;br/&gt;INSERT INTO TEST values(1, &#39;Sony CD Player&#39;, &#39;20-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(2, &#39;Sony CD Player&#39;, &#39;24-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(3, &#39;Pioneer DVD Player&#39;, &#39;25-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(4, &#39;Sony CD Player&#39;, &#39;25-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(5, &#39;Bose Speaker&#39;, &#39;22-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(6, &#39;Tascam CD Burner&#39;, &#39;25-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(7, &#39;Nikon digital camera&#39;, &#39;22-FEB-2010&#39;);&lt;br/&gt;INSERT INTO TEST values(8, &#39;Canon digital camera&#39;, &#39;26-FEB-2010&#39;);&lt;br/&gt;&lt;br/&gt;Commit;&lt;br/&gt;&lt;br/&gt;Select TEST_ID,TEST_NAME,TEST_DATE&lt;br/&gt;FROM TEST&lt;br/&gt;WHERE  UTL_MATCH.JARO_WINKLER_SIMILARITY(test_name,&#39;dogotal&#39;) &amp;gt; 60;&lt;br/&gt;&lt;br/&gt;TEST_ID                TEST_NAME            TEST_DATE&lt;br/&gt;---------------------- -------------------- -------------------------&lt;br/&gt;7                      Nikon digital camera 22-FEB-00&lt;br/&gt;8                      Canon digital camera 26-FEB-00&lt;/pre&gt;&lt;br/&gt;&lt;pre&gt;&lt;span style=&quot;font-family:Georgia, &#39;Times New Roman&#39;, &#39;Bitstream Charter&#39;, Times, serif;font-size:small;&quot;&gt;&lt;span style=&quot;line-height:19px;white-space:normal;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/7096089786079423424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/utlmatch-package-for-string-matching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7096089786079423424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/7096089786079423424'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/utlmatch-package-for-string-matching.html' title='utl_match package for string matching'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4267846662566950522.post-8538311384216625191</id><published>2010-02-10T01:52:00.000-08:00</published><updated>2010-08-02T19:57:42.253-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Proxy User in Oracle"/><title type='text'>Proxy User in Oracle 10g</title><content type='html'>&lt;strong&gt;First we’ll create two database Schema users(&lt;/strong&gt;&lt;em&gt;&lt;strong&gt;cpdata&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;, &lt;/strong&gt;&lt;em&gt;&lt;strong&gt;mpdata&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;) and One Big Application User (&lt;/strong&gt;&lt;em&gt;&lt;strong&gt;app_user &lt;/strong&gt;&lt;strong&gt;&lt;span style=&quot;font-style:normal;&quot;&gt;called Proxy User&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;&lt;strong&gt;). The &lt;em&gt;app_user&lt;/em&gt; will be used by a web application to connect to the database. Usually the application user, in this case cpdata and mpdata, will be authenticated by the web application through app_user.&lt;/strong&gt;&lt;br/&gt;&lt;h4&gt;Create User &lt;em&gt;cpdata&lt;/em&gt; and &lt;em&gt;mpdata&lt;/em&gt; as a Sys or System user which contain schema objects.&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;create user cpdata identified by cpdata;&lt;br/&gt;grant create session, create table to cpdata;             &lt;br/&gt;alter user cpdata quota unlimited on users;              &lt;br/&gt;&lt;br/&gt;create user mpdata identified by mpdata;&lt;br/&gt;grant create session, create table to mpdata;             &lt;br/&gt;alter user mpdata quota unlimited on users;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create Table on &lt;em&gt;cpdata&lt;/em&gt; and &lt;em&gt;mpdata&lt;/em&gt; schema&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;create table cpdata.test1&lt;br/&gt;(&lt;br/&gt;        Test1  varchar2(10),&lt;br/&gt;        Test2  varchar2(10)&lt;br/&gt;);      &lt;br/&gt;&lt;br/&gt;create table mpdata.test2&lt;br/&gt;(&lt;br/&gt;        Test1  varchar2(10),&lt;br/&gt;        Test2  varchar2(10)&lt;br/&gt;);&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Create User &lt;em&gt;app_user&lt;/em&gt;, for a Proxy User.&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;create user app_user identified by app_user;&lt;br/&gt;grant create session to app_user;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Grant Proxy Authentication&lt;/h4&gt;&lt;br/&gt;&lt;p style=&quot;text-align:center;&quot;&gt;&lt;a rel=&quot;attachment wp-att-570&quot; href=&quot;http://tamimdba.wordpress.com/2010/02/10/proxy-user-in-oracle/proxyuser-2/&quot;&gt;&lt;img class=&quot;size-medium wp-image-570 aligncenter&quot; title=&quot;ProxyUser&quot; src=&quot;http://tamimdba.files.wordpress.com/2010/02/proxyuser1.jpg?w=300&quot; alt=&quot;&quot; width=&quot;300&quot; height=&quot;156&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;&lt;pre&gt;alter user cpdata grant connect through app_user;&lt;br/&gt;alter user mpdata grant connect through app_user;&lt;/pre&gt;&lt;br/&gt;&lt;h4&gt;Now Connect cpdata and mpdata user using Proxy Authentication and access there schema objects&lt;/h4&gt;&lt;br/&gt;&lt;pre&gt;SQL&amp;gt; connect app_user[&lt;strong&gt;cpdata&lt;/strong&gt;]/app_user@&amp;lt;SID&amp;gt;&lt;br/&gt;Connected.&lt;br/&gt;SQL&amp;gt; select user from dual;&lt;br/&gt;&lt;br/&gt;USER&lt;br/&gt;------------------------------&lt;br/&gt;CPDATA&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; desc test1;&lt;br/&gt;Name                                      Null?    Type&lt;br/&gt;----------------------------------------- -------- ------------------&lt;br/&gt;TEST1                                              VARCHAR2(10)&lt;br/&gt;TEST2                                              VARCHAR2(10)&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; connect app_user[&lt;strong&gt;mpdata&lt;/strong&gt;]/app_user@&amp;lt;SID&amp;gt;&lt;br/&gt;Connected.&lt;br/&gt;SQL&amp;gt; select user from dual;&lt;br/&gt;&lt;br/&gt;USER&lt;br/&gt;------------------------------&lt;br/&gt;MPDATA&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; desc test2;&lt;br/&gt;Name                                      Null?    Type&lt;br/&gt;----------------------------------------- -------- ------------------&lt;br/&gt;TEST1                                              VARCHAR2(10)&lt;br/&gt;TEST2                                              VARCHAR2(10)&lt;br/&gt;&lt;br/&gt;SQL&amp;gt; select sys_context(&#39;USERENV&#39;,&#39;PROXY_USER&#39;) from dual;&lt;br/&gt;&lt;br/&gt;SYS_CONTEXT(&#39;USERENV&#39;,&#39;PROXY_USER&#39;)&lt;br/&gt;-------------------------------------------------------------&lt;br/&gt;APP_USER&lt;/pre&gt;&lt;br/&gt;More :&lt;br/&gt;&lt;br/&gt;&lt;a href=&quot;http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/dblgcfg008.htm&quot;&gt;http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/dblgcfg008.htm&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-ds-proxy/doc/how-to-ds-proxy.html&quot;&gt;http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-ds-proxy/doc/how-to-ds-proxy.html&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href=&quot;http://www.dba-oracle.com/t_proxy_connect_authentication.htm&quot;&gt;http://www.dba-oracle.com/t_proxy_connect_authentication.htm&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://tamimdba.blogspot.com/feeds/8538311384216625191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tamimdba.blogspot.com/2010/02/proxy-user-in-oracle-10g.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/8538311384216625191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4267846662566950522/posts/default/8538311384216625191'/><link rel='alternate' type='text/html' href='http://tamimdba.blogspot.com/2010/02/proxy-user-in-oracle-10g.html' title='Proxy User in Oracle 10g'/><author><name>Tamim Khan</name><uri>http://www.blogger.com/profile/07334420727462559183</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Qd0c3VZulq2BtvlZUfuj3CCAetqbYUd6T-2uFsgFt-oWZ8eqwhLCBx5NaAUk23VJpPTUPijhEonelBP50ngQWTF_HS4VswuQhV4y8ire8-nO9cvlBX-G9CYtEQkGz9w/s220/tamim-for-dv.jpg'/></author><thr:total>0</thr:total></entry></feed>