<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Oracle Database Tips blog</title>
	
	<link>http://oracle-database-tips.com/wp</link>
	<description>News for Oracle professionals</description>
	<pubDate>Fri, 23 Oct 2009 14:19:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/OracleDatabaseTipsBlog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Oracle database hosting companies</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/tGUjVTTjpjg/oracle-database-hosting-companies</link>
		<comments>http://oracle-database-tips.com/wp/oracle-hosting/oracle-database-hosting-companies#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:20:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Hosting]]></category>

		<category><![CDATA[oracle database hosting]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=132</guid>
		<description><![CDATA[List of companies who offer Oracle database hosting]]></description>
			<content:encoded><![CDATA[<h2>Oracle Database Hosting<br />
Comparison of companies offering Oracle web hosting</h2>
<p>This &#8216;Oracle Database Hosting&#8217; article lists companies who specialize            in hosting oracle databases.<br />
You will need to perform your own due diligence research into their            services as information could have changed since this article was posted.</p>
<p><strong>Background</strong></p>
<p>There seems to be a great need for Oracle database hosting services,<br />
either for Oracle dedicated hosting or Oracle shared hosting solutions.</p>
<p>It was surprising to find only a limited number of companies offering          Oracle hosting solutions,<br />
but the hefty price tag of an Oracle database license is probably the          reason for it not being the database of choice for hosting companies.</p>
<p>Below are a list of companies,varying greatly in location, web presence,          database version offered and price tag.</p>
<p>Each link will take you to a page which lists the company&#8217;s offering          in greater detail.</p>
<p>Tip: once you have decided on a company, do a test-recovery before you          transfer all your valuable data.</p>
<p>No need to spring this on your hosting company by surprise:<br />
making your hosting company restore your data for you will force them          to test their own backup and recovery routines.</p>
<p>Nothing is ever as important in the Oracle database world as the safety          of your data in the form of backups and the ability to restore them.</p>
<p>Some of the companies listed below state that a restore is an added service          that needs to be paid for separately.</p>
<p>It will be worth the expense,<br />
whether your are a single developer with your own tablespace in a shared          database or a high-level corporation outsourcing its database storage          to an external service provider.</p>
<p><strong><br />
Oracle Hosting Companies </strong></p>
<table border="1" cellspacing="0" cellpadding="5" width="595">
<tbody>
<tr>
<td width="96"><strong>Company name</strong></td>
<td width="66"><strong>Location</strong></td>
<td width="90"><strong>Option</strong></td>
<td width="111"><strong>Price</strong></td>
<td width="66"><strong>Version</strong></td>
<td width="92"><strong>Remarks</strong></td>
</tr>
<tr>
<td><a title="opens new page" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.appshosting.com%2Foracle%2F&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.appshosting.com/oracle/" target="_blank">Appshosting</a></td>
<td>USA</td>
<td><strong>Non-RAC</strong></p>
<p><strong>Large Plan</strong><br />
1GB tblspc<br />
2GB web hosting<br />
60GB <span style="white-space: nowrap;" onclick="Intextad.keywordClicked('bandwidth')" onmouseover="Intextad.keywordMouseOver('bandwidth')" onmouseout="Intextad.keywordMouseOut('bandwidth')"><span id="i24Keyword-bandwidth" style="border-bottom: 1px dotted red; cursor: pointer; text-decoration: none;">bandwidth </span><img style="border: medium none; margin: 0pt; padding: 0pt; float: none; cursor: pointer;" src="http://www.insight24.com/view/insight24/syndications/intextad/common/mag.png" alt="" /></span></p>
<p><strong>Enterprise<br />
Plan<br />
</strong>10GB tblspc<br />
200GB web hosting<br />
320GB bandwidth</p>
<p><strong>RAC</strong></p>
<p><strong>Medium Plan<br />
</strong>2 nodes<br />
100GB SAN<br />
640GB bandwidth<br />
Metalink<br />
Webhosting</p>
<p><strong>Large Plan<br />
</strong>2 nodes<strong><br />
</strong>200 GB SAN<br />
1280GB bandwidth<br />
Metalink<br />
Webhosting</td>
<td><strong>Non-RAC</strong></p>
<p><strong>Large Plan</strong><br />
US$ 99.99<br />
/ month</p>
<p><strong>Enterp</strong><strong>rise<br />
Plan<br />
</strong>US$ 199.99<br />
/ month</p>
<p><strong>RAC</strong></p>
<p><strong>Medium Plan<br />
</strong>US$ 2299<br />
/ month</p>
<p><strong>Large Plan<br />
</strong>US$ 4499<br />
/ month</td>
<td>11g<br />
and<br />
10g</td>
<td>Included in all plans:</p>
<p>SQL/Plus access<br />
Shell access</p>
<p>They can also provide dedicated Oracle database hosting, contact                them to make up a custom package.</td>
</tr>
<tr>
<td><a title="opens new page" href="http://www.bluefur.com/inbound/go.php?aid=467" target="_blank">BlueFur</a><br />
(click on<br />
Oracle hosting<br />
link at bottom of page)</td>
<td>Canada</td>
<td>10 Users</p>
<p>150 MB tblspc</p>
<p>30 GB Monthly Transfer Limit</p>
<p>Browser-based UI</td>
<td>US$ 12.95/month</td>
<td>10g</td>
<td>Their website indicates that this option is sold out, contact them              directly to find out more.</p>
<p>If you are interested in any of their (non-sold-out) packages, we              can negotiate a 10% discount with them on your behalf.<br />
Let us know <a title="opens new page" href="http://www.oracle-database-tips.com/contact.html" target="_blank">here</a></td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.bluereef.net%2Fservers%2Foracle%2Findex.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.bluereef.net/servers/oracle/index.html" target="_blank">BlueReef</a></td>
<td>USA</td>
<td><strong>Value Plan</strong><br />
70 Mb tblspc<br />
5 users<br />
10 concurrent<br />
connections</p>
<p><strong>Pro Plan</strong><br />
200 Mb tblspc<br />
10 users<br />
40 concurrent<br />
connections</p>
<p><strong>Corporate<br />
Plan</strong><br />
500 MB tblspc<br />
unlimited users<br />
80 concurrent<br />
connections</td>
<td><strong>Value Plan</strong><br />
Setup : US$ 250<br />
Monthly: US$ 250</p>
<p><strong>Pro Plan</strong><br />
Setup : US$ 250<br />
Monthly: US$ 300</p>
<p><strong>Corporate<br />
Plan</strong><br />
Setup : US$ 250<br />
Monthly: US$ 400</td>
<td>8i</td>
<td>Recovery services are custom and incur an additional charge.<br />
Restores are charged on an hourly basis</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fcomsatshosting.net%2Findex2.php%3Flink%3Ddb_hos&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://comsatshosting.net/index2.php?link=db_hos" target="_blank">Comsatshosting</a></td>
<td>India</td>
<td><strong>Level 1</strong><br />
100 Mb tblspc<br />
1 schema</p>
<p><strong>Level 2</strong><br />
200 Mb tblspc<br />
2 schemas</p>
<p><strong>Level 3</strong><br />
500 Mb tblspc<br />
3 schemas</p>
<p><strong>Level 4</strong><br />
1024 Mb tblspc<br />
4 schemas</td>
<td><strong>Level 1</strong><br />
Rs 12,000</p>
<p><strong>Level 2</strong><br />
Rs 24,000</p>
<p><strong>Level 3</strong><br />
Rs 57,000</p>
<p><strong>Level 4</strong><br />
Rs 110,000</td>
<td>10G</td>
<td>Charges per additional Schema is Rs.2000 / year.</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.connectria.com%2Foracle.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.connectria.com/oracle.html" target="_blank">Connectria</a></td>
<td>USA</td>
<td>No details<br />
on website.</td>
<td>No details on website.</td>
<td>9i<br />
or<br />
10g<br />
or<br />
11g</td>
<td>To get quotes, contact them directly.</p>
<p>They also provide RAC hosting, details on this <a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.connectria.com%2Foracle_rac_hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.connectria.com/oracle_rac_hosting.html" target="_blank">page</a></td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.coresecure.com%2Fv5%2Foracle-hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.coresecure.com/v5/oracle-hosting.html" target="_blank">CoreSecure</a></td>
<td>USA</td>
<td>No details on website</td>
<td>No details on webiste</td>
<td>10g</td>
<td>Contact them directly for quotes.</p>
<p>They also provide dedicated hosting.</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.drushti.co.in%2Fmission-critical-hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.drushti.co.in/mission-critical-hosting.html" target="_blank">Drushti</a></td>
<td>India</td>
<td>No details on website</td>
<td>No details on webiste</td>
<td>8i<br />
onwards</td>
<td>Contact them directly for quotes</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.estation.com.au%2Fdatabase-servers&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.estation.com.au/database-servers" target="_blank">eStation</a></td>
<td>Australia</td>
<td>no details on website</td>
<td>no details on website</td>
<td>no details on website</td>
<td>They provide normal and RAC Oracle hosting.<br />
Contact them directly for more infornation.</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.firstserv.com%2FhostingServices%2FsharedHosting%2Foracle%2F&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.firstserv.com/hostingServices/sharedHosting/oracle/" target="_blank">FirstServ</a></td>
<td>UK</td>
<td><strong>ORA70</strong><br />
70MB tblspc<br />
5 users<br />
10 concurrent<br />
connections</p>
<p><strong>ORA200</strong><br />
200MB tblspc<br />
10 users<br />
20 concurrent<br />
connections</p>
<p><strong>ORA500<br />
</strong>500MB tblspc<br />
10 users<br />
40 concurrent<br />
connections</td>
<td><strong>ORA70<br />
</strong>Setup: £150<br />
Annual: £1650</p>
<p><strong>ORA200<br />
</strong>Setup: £150<br />
Annual: £2750</p>
<p><strong>ORA500</strong><br />
Setup: £150<br />
Annual: £3850</td>
<td>10g</td>
<td>Prices exclusive of VAT<br />
Minimum 12 month contract<br />
Shared Oracle database hosting is only for use in conjunction with                the shared hosting,<br />
dedicated server or colocation packages.</p>
<p>If you would like to enquire about a dedicated Oracle server, please                call their Sales Team</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.iaswww.com%2Fhosting%2Foracle_hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.iaswww.com/hosting/oracle_hosting.html" target="_blank">Internet              Advertising Solutions</a></td>
<td>USA</td>
<td><strong>Shared Hosting</strong></p>
<p><strong>Value Plan</strong><br />
150MB tblspc<br />
5 users<br />
35 concurrent<br />
connections</p>
<p><strong>Pro Plan</strong><br />
400MB tblspc<br />
10 users<br />
40 concurrent<br />
connections</p>
<p><strong>Corporate Plan</strong><br />
725MB tblspc<br />
unlimited users<br />
150 concurrent<br />
connections</p>
<p><strong>Dedicated<br />
Hosting</strong></p>
<p><strong>SE1<br />
</strong>440MGhz<br />
Netra T1<br />
512 MB RAM<br />
dual 18GB<br />
SCSI<br />
6 x 18GB external storage (Sun A1000 )<br />
2 IPS<br />
Oracle Standard Edition</p>
<p><strong>SE2<br />
</strong>dual 450MGhz<br />
E420R<br />
1024 MB RAM<br />
dual 18GB<br />
SCSI<br />
8 x 18GB external storage (Sun A1000 )<br />
2 IPS<br />
Oracle Standard Edition</p>
<p><strong>EE1<br />
</strong>440MGhz<br />
Netra T1<br />
512 MB RAM<br />
dual 18GB<br />
SCSI<br />
6 x 18GB external storage (Sun A1000 )<br />
2 IPS<br />
Oracle<strong> Enterprise</strong> Edition</p>
<p><strong>EE2<br />
</strong>dual 450MGhz<br />
E420R<br />
1024 MB RAM<br />
dual 18GB<br />
SCSI<br />
8 x 18GB external storage (Sun A1000 )<br />
2 IPS<br />
Oracle <strong>Enterprise</strong> Edition</td>
<td><strong>Shared Hosting</strong></p>
<p><strong>Value Plan</strong><br />
Setup US$ 350<br />
MonthlyUS$ 495</p>
<p><strong>Pro Plan</strong><br />
Setup US$ 350<br />
MonthlyUS$ 795</p>
<p><strong>Corporate Plan</strong><br />
Setup US$ 350<br />
Monthly<br />
US$ 1195</p>
<p><strong>Dedicated Hosting</strong></p>
<p><strong>SE1</strong><br />
Setup US$3800<br />
Monthly US$5500</p>
<p><strong>SE2</strong><br />
Setup US$7000<br />
Monthly US$8900</p>
<p><strong>EE1</strong><br />
Setup US$7000<br />
Monthly US$8900</p>
<p><strong>EE2</strong><br />
Setup US$12995<br />
Monthly US$16000</td>
<td>8i</td>
<td><strong>Dedicated Hosting</strong></p>
<p>All A1000 storage arrays come RAID 5 with hot standby drive</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.jodohost.com%2Fmanagedservers.asp&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.jodohost.com/managedservers.asp" target="_blank">JodoHost</a></td>
<td>India, servers are located in the USA</td>
<td>100MB tblspc</td>
<td>US$10/month per 100MB on top of standard hosting packages (from                US$ 79 per month)</td>
<td>10g</td>
<td>Must be a JodoHost Reseller</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.macquarietelecom.com%2Fhosting%2Foracle_hosting.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.macquarietelecom.com/hosting/oracle_hosting.htm" target="_blank">Macquarie              telecom</a></td>
<td>Australia</td>
<td>no details on website</td>
<td>no details on website</td>
<td>no details on website</td>
<td>Stringent Service Level Guarantees with cash rebates for under-performance</td>
</tr>
<tr>
<td><a title="opens new tab" href="http://www.mercurytechnology.com/" target="_blank">Mercury              Technology</a></td>
<td>USA</td>
<td>Dedicated Oracle EBusiness Suite (EBS) Hosting on Dedicated Dell              Servers; Small, Medium, Large and Custom Bundles.</td>
<td>$2,995 to $9,995/month for most small to midsize Oracle EBS Systems.              Custom pricing for larger systems.</td>
<td>11i, R12</td>
<td>SAS70, SLAs with Penalties, Failover Instances, 24&#215;7 Support, 15              Years in business.</td>
</tr>
<tr>
<td><a onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.mivitec.de&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.mivitec.de/" target="_blank">MiVitec              GmbH</a></td>
<td>Germany</td>
<td>no details on website</td>
<td>no details on website</td>
<td>9i, 10g and XE</td>
<td>Shared oracle database hosting upgradeable to cluster/grid (RAC),                they take care of security, performance optimization and can do                restores.</p>
<p>They are Oracle partners so can sell the required licenses.</p>
<p>Contact them for a customized quote.</td>
</tr>
<tr>
<td><a title="opens new window" href="http://www.modulesoft.com/services/web-hosting/oracle-10g-hosting/" target="_new">Modulesoft</a></td>
<td>India</td>
<td>50mb 1user<br />
Additional Space/50mb<br />
$15<br />
150mb 1user<br />
Additional Space/50mb<br />
$15<br />
300mb 2 users<br />
Additional Space/50mb<br />
$15<br />
1GB 3 users<br />
Additional Space/50mb<br />
$10<br />
1.5GB 3 users<br />
Additional Space/50mb<br />
$10</p>
<p>2GB 5 users<br />
Additional Space/50mb<br />
$10</p>
<p>4GB 10users<br />
Additional Space/50mb<br />
$8</td>
<td>$17/month &amp; Annually $195.$37 monthly &amp;<br />
Annually $420.</p>
<p>$50 monthly &amp;<br />
$55o Annually.</p>
<p>$125 monthly &amp;<br />
$1400 Annually.</p>
<p>$150 monthly &amp;<br />
$1600 Annually.</p>
<p>$200 monthly &amp;<br />
$2000 Annually.<br />
$250 monthly &amp;<br />
$2600 Annually.</td>
<td>all 10G XE</td>
<td>Get 100% up time SLA.24/7 customer service to assist you regarding              your query. Modulesoft is the best web hosting companies to offer              Oracle 10g Hosting at a very affordable plan significantly making              it more reachable to businesses and developers. Presently, get <a href="http://www.modulesoft.com/services/web-hosting/apex-hosting/">Apex              hosting</a></td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.redplaid.com%2Foracle_hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.redplaid.com/oracle_hosting.html" target="_blank">RedPlaid</a></td>
<td>USA</td>
<td><strong>Dedicated Hosting</strong></p>
<p><strong>Dell Poweredge 860<br />
</strong>Dual<strong> </strong>core Pentium D</p>
<p><strong>Dell Poweredge R200 </strong><br />
Dual core Pentium , Dual or Quad Core Xeon</p>
<p><strong>Dell Poweredge 1950</strong><br />
1 or 2 Dual or Quad core Xeons wth 2 disks</p>
<p><strong>Dell Poweredge 2850</strong><br />
1 or 2 Xeons wth 6 disks</p>
<p><strong>Dell PowerEdge 2950</strong><br />
1 or 2 Dual or Quad Core Xeons With 6 Disks</td>
<td><strong>Dedicated Hosting</strong></p>
<p><strong>Dell Poweredge 860<br />
</strong>US$ 189 / month</p>
<p><strong>Dell Poweredge R200 </strong><br />
US$ 199 / month</p>
<p><strong>Dell Poweredge 1950</strong><br />
US$ 269 / month</p>
<p><strong>Dell Poweredge 2850</strong><br />
US$ 318 / month</p>
<p><strong>Dell PowerEdge 2950</strong><br />
US$ 359 / month</td>
<td>9i or<br />
10i or<br />
11i</td>
<td></td>
</tr>
<tr>
<td><a id="revion" name="revion"></a><a title="opens new window" href="http://www.revion.com/" target="_blank"></p>
<p>Revion</a></td>
<td>USA</td>
<td><strong>Oracle-only<br />
</strong>100MB tblspc<br />
2 users<br />
62GB monthly transfer limit<br />
No web disk storage</p>
<p><strong>Basic Oracle<br />
</strong>50MB tblspc<br />
2 users<br />
62GB monthly transfer limit<br />
200MB web<br />
disk storage</p>
<p><strong>Oracle Gold<br />
</strong>200MB tblspc<br />
5 users<br />
62GB monthly transfer limit<br />
400MB web<br />
disk storage</p>
<p><strong>Oracle<br />
Platinum<br />
</strong>500MB tblspc<br />
10 users<br />
62GB monthly transfer limit<br />
1000MB web disk storage</p>
<p><strong><br />
Shared Oracle Database Hosting</strong></p>
<p>2GB tblspc<br />
25 users</p>
<p><strong>Dedicated Hosting</strong></p>
<p>2GB tblspc<br />
25 users<br />
Redundant managed dedicated server</td>
<td>
<p><strong><br />
</strong></p>
<p><strong>Oracle-only<br />
</strong>US$ 24.99/month<br />
no setup cost</p>
<p><strong>Basic Oracle</strong><br />
US$ 99.95/month<br />
no setup cost</p>
<p><strong>Oracle Gold<br />
</strong>US$ 149.95 /month<br />
no setup cost</p>
<p><strong>Oracle<br />
Platinum</strong><br />
US$ 249.95<br />
/ month<br />
no setup cost</p>
<p><strong> </strong></p>
<p><strong>Shared Oracle Database Hosting</strong></p>
<p>Starts at US$ 299.95 / month</p>
<p><strong>Dedicated<br />
Oracle Database </strong><strong>Hosting</strong><br />
Starts at US$399.95</td>
<td>10g</td>
<td>They can also supply RAC and Dataguard solutions as well as Oracle              packages combined with Tomcat and HTML DB (Apex)</td>
</tr>
<tr>
<td><a title="opens new window" href="http://secure-24.com/oracle-hosting.html" target="_blank">Secure-24</a></td>
<td>USA</td>
<td>no info on site</td>
<td>no info on site</td>
<td>no info</td>
<td>no info</td>
</tr>
<tr>
<td><a title="opens new page" href="http://viaverio.com/index.cfm?page_id=15" target="_blank">ViaVerio</a></td>
<td>USA and worldwide</td>
<td><strong>Value Plan</strong><br />
5 users<br />
35 concurrent<br />
connections<br />
150 MB tblspc</p>
<p><strong>Professional Plan</strong><br />
10 users<br />
75 concurrent<br />
connections<br />
400 MB tblspc</p>
<p><strong>Corporate Plan</strong><br />
unlimited users<br />
150 concurrent<br />
connections<br />
725 MB tblspc</td>
<td>
<p><strong>Value Plan</strong><br />
US$250/setup US$250/month</p>
<p><strong>Professional Plan</strong><br />
US$250/setup US$400/month</p>
<p><strong> Corporate Plan</strong><br />
US$250/setup US$600/month</td>
<td>10g</td>
<td>Recovery services are custom and incur an additional charge.</td>
</tr>
<tr>
<td><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.2020media.com%2Fdefault.htm%3Fhosting-oracle.htm%7Emain&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.2020media.com/default.htm?hosting-oracle.htm%7Emain" target="_blank">2020media</a></td>
<td>UK</td>
<td>100MB tblspc</td>
<td>£150 + Vat / month</td>
<td>9i</td>
<td>Minimum 3 month contract</p>
<p>More Oracle Database hosting options available, contact them for                a custom quote.</td>
</tr>
</tbody>
</table>
<p><a id="Update" name="Update"></a><br />
<span style="color: #ff0000;">Update</span>: here&#8217;s a link to an OTN (Oracle          Technology Network) page which lists APEX (former HtmlDB) solution providers:<br />
(You&#8217;ll need to log in with your (free) OTN account )</p>
<p><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Fproducts%2Fdatabase%2Fapplication_express%2Fhtml%2Fapex_com_hosting.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_database_hosting.html'); return false;" href="http://www.oracle.com/technology/products/database/application_express/html/apex_com_hosting.html" target="_blank">OTN          Apex Community: Hosting companies</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/tGUjVTTjpjg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-hosting/oracle-database-hosting-companies/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-hosting/oracle-database-hosting-companies</feedburner:origLink></item>
		<item>
		<title>Oracle Magazine</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/_wYilA0q_sY/oracle-magazine</link>
		<comments>http://oracle-database-tips.com/wp/oracle-magazine/oracle-magazine#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:17:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Magazine]]></category>

		<category><![CDATA[free magazine subscription]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=130</guid>
		<description><![CDATA[Oracle Magazine: free subscription]]></description>
			<content:encoded><![CDATA[<h3>Oracle Magazine Subscription</h3>
<p>The best way to keep up to date with Oracle&#8217;s world is to subscribe to Oracle        Magazine.</p>
<p>Incredibly, it is still possible to subscribe to this informative magazine          and have it delivered anywhere in the world for free.</p>
<p>Good news for us, Oracle professionals, of course, as we get a glossy          magazine related to our work and interests delivered to our doorstep for          that all-important bedtime reading.</p>
<p>You can subscribe online by clicking on the link below.</p>
<p>Remember that you must be an Oracle professional to qualify, so make sure          to select the correct, relevant job description in your application.</p>
<div>
<table style="height: 56px;" border="0" cellspacing="0" cellpadding="0" width="359">
<tbody>
<tr>
<td width="129" align="center" valign="middle"><a id="img_1" title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubomlink" target="_blank"> <img src="http://www.oracle-database-tips.com/image-files/oracle_magazine_2009.gif" border="0" alt="Oracle Magazine" width="122" height="158" align="left" /> </a></td>
<td width="230" align="center" valign="middle"><a id="txt_7" style="font-family: verdana,arial,helvetica; font-size: 10px; font-weight: bold; text-decoration: underline;" title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubomlink" target="_blank"> Oracle Magazine Online Subscription </a></td>
</tr>
</tbody>
</table>
</div>
<h3>Other Free IT Magazine Subscriptions</h3>
<p>If you find that the monthly limit of Oracle Magazine subscriptions has been reached,<br />
bookmark this page and come back at the beginning of the next month.</p>
<p>In the meantime you can subscribe for free to many other interesting magazines.</p>
<p>Some of these are limited to USA subscribers only.</p>
<ul>
<li><a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/dobbs" target="_blank">Dr Dobb&#8217;s Journal</a></li>
<li><a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/sysmannews" target="_blank">Systems Management News</a></li>
<li><a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/crm" target="_blank">CRM Magazine</a></li>
<li> <a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/bettersoft" target="_blank">Better Software Magazine</a></li>
<li> <a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/Infoweek" target="_blank">Information Week</a></li>
<li><a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/eweek" target="_blank">eWeek</a></li>
<li><a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/websitemag" target="_blank">Website magazine</a></li>
<li> <a title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubcatlink" target="_blank">Various other IT Magazines</a></li>
</ul>
<h3>Interesting Oracle Magazine Articles</h3>
<table border="0" cellspacing="2" cellpadding="5" width="577" align="left">
<tbody>
<tr>
<td width="128"><a id="img_2" title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubomlink" target="_blank"> <img src="http://www.oracle-database-tips.com/image-files/oracle_magazine_mar08.gif" border="0" alt="Oracle Magazine" width="122" height="158" align="left" /> </a></td>
<td width="449" align="left" valign="top"><strong> March/April 2008              Issue</strong><br />
This issue&#8217;s focus is on legacy systems and how Oracle helps companies preserve legacy investments while modernizing their IT infrastructure.</p>
<ul>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F08-mar%2Fo28marvel.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/08-mar/o28marvel.html" target="_blank">Support for SuperHeroes</a> : Fun article about Marvel Entertainment&#8217;s (SpiderMan, Iron Man) strategy for growth and integration using Oracle&#8217;s E-Business suite on 10G RAC databases.</li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F08-mar%2Fo28sqlperf.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/08-mar/o28sqlperf.html" target="_blank">Performing through changes</a> : Arup Nanda shows us how to use 11G&#8217;s SQL Performance Analyzer to establish what impact a tuning change could have on a set of SQL statements.</li>
</ul>
</td>
</tr>
<tr>
<td width="128"><a id="img_3" title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubomlink" target="_blank"> <img src="http://www.oracle-database-tips.com/image-files/oracle_magazine_jan08.gif" border="0" alt="Oracle Magazine" width="122" height="158" align="left" /> </a></td>
<td width="449" align="left" valign="top"><strong> Jan/Feb 2008 Issue</strong><br />
In this issue, 11G is touted as the ideal solution to host and manage the diverse types of data floating around in the Web 2.0 world.</p>
<ul>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F08-jan%2Fo18asktom.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/08-jan/o18asktom.html" target="_blank">On                  Tuning by Tracing</a> : Oracle&#8217;s own super hero Tom Kyte solves                  a tuning mystery where setting SQL_TRACE=TRUE causes an SQL query                  to perform better.</li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F08-jan%2Fo18field.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/08-jan/o18field.html" target="_blank">Succeeding with Failure</a> : Ari Kaplan makes an excellent case for Oracle Data Guard, not only as a disaster recovery solution, but also as a way to ease the backup or reporting load on your primary database.</li>
</ul>
</td>
</tr>
<tr>
<td width="128"><a id="img_4" title="opens new window" href="http://www.oracle-database-tips.com/wp/a/tradepubomlink" target="_blank"> <img src="http://www.oracle-database-tips.com/image-files/oracle_magazine_nov07.gif" border="0" alt="Oracle Magazine" width="122" height="158" align="left" /> </a></td>
<td width="449" align="left" valign="top"><strong> Nov/Dec 2007 Issue</strong><br />
Editor&#8217;s choice awards 2007: Top CIO, CTO, IT Manager, DBA, Application Implementer, Developer and Architect of the year are awarded.</p>
<ul>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F07-nov%2Fo67sql.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/07-nov/o67sql.html" target="_blank">Working with PL/SQL</a> :  			  Sue Harper showcases Oracle SQL Developer and how to edit, compile, debug and run PL/SQL stored procedures, step by step.</li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fwww.oracle.com%2Ftechnology%2Foramag%2Foracle%2F07-nov%2Fo67asktom.html&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_magazine.html'); return false;" href="http://www.oracle.com/technology/oramag/oracle/07-nov/o67asktom.html" target="_blank">More on Oracle Database 11G</a> : New PL/SQL features in 11G touched upon by Tom Kyte : PL/Scope and DBMS_SQL&#8217;s ability to accept and return Ref Cursors.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/_wYilA0q_sY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-magazine/oracle-magazine/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-magazine/oracle-magazine</feedburner:origLink></item>
		<item>
		<title>Troubleshoot Oracle database links</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/Qc3tGzKOagc/troubleshoot-oracle-database-links</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/troubleshoot-oracle-database-links#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:13:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[troubleshoot oracle database link]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=126</guid>
		<description><![CDATA[Read up here to find solutions to common db link setup mistakes and errors.

]]></description>
			<content:encoded><![CDATA[<div id="calltoaction" class="medium">Always test these &#8216;troubleshoot oracle database link errors&#8217; commands on a test server<br />
before implementing them on a production server.</div>
<p><!-- ============================================================================================================================================================ --> There are a number of errors that you can face when working with database          links in Oracle.</p>
<p>Below are a list of some of the more common ones and suggestions on how to troubleshoot oracle database link errors .</p>
<ul>
<li><a href="#TIP">Oracle10 Tip</a></li>
<li><a href="#ORA02021">ORA-02021</a></li>
<li><a href="#ORA02080">ORA-02080</a></li>
<li><a href="#ORA02085">ORA-02085</a></li>
<li><a href="#ORA12154">ORA-12154</a></li>
<li><a href="#ORA12224">ORA-12224</a></li>
<li><a href="#ORA12305">ORA-12305</a></li>
</ul>
<h3>Background</h3>
<p>What happens during database link usage ?<br />
Some information to help you troubleshoot oracle database link errors.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dual@remotedb;

D
-
X</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div >
<li> Oracle resolves the dblink name to a host name, using the value it can          find in the local server&#8217;s tnsnames.ora file.</li>
<li> It connects to this host&#8217;s listener via TCP/IP (using whichever naming          resolution is in place at OS level).</li>
<li> The remote listener for the relevant port resolves the SID or Service          Name as defined in its listener.ora and completes the connection to the          database.</li>
<p><strong>How do you find or create the correct entry in tnsnames.ora ?</strong></p>
<li> Find your server&#8217;s tnsnames.ora, it will usually be in $ORACLE_HOME/network/admin.</li>
<li> Make sure you do not have a $TNS_ADMIN environment variable set, if you          do, your tnsnames.ora will be in that directory.</li>
<li>Scan it and look for an alias which contains the hostname and database          name of the remote database you want to access.</li>
<li> Test its validity by using sql*plus on your local server and connecting          to that alias with the username and password you intend using in your          database link.</li>
<p><a id="TIP" name="TIP"></a></p>
<h3>Oracle10 Tip</h3>
<p>The first tip does not have an error associated with it, but is just          a tip:</p>
<p>If you have recently upgraded your database from Oracle9 to Oracle10          and your database links are no longer<br />
working, simply recreate them as a first step to troubleshoot oracle database          link errors .</p>
<h3><a id="ORA02021" name="ORA02021"></a>ORA-02021: DDL operations are not allowed on a remote database</h3>
<p>Self-explanatory, no need to troubleshoot oracle database link errors any further :</p>
<p>Do not try to run a DDL command through a database link.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter table dept@remotedb add column
     (manager varchar2(30));
alter table dept@remotedb add column
     (manager varchar2(30))
                 *
ERROR at line 1:
ORA-02021: DDL operations are not allowed on
a remote database</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="ORA02080" name="ORA02080"></a></p>
<h3>ORA-02080: database link is in use</h3>
<p>This can come up when you want to close a db link.</p>
<p>Solution: commit or rollback the transaction, then close the database          link.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter session close database link remotedb;
ERROR:
ORA-02080: database link is in use

SQL&gt; commit;

Commit complete.

SQL&gt; alter session close database link remotedb;

Session altered.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="ORA02085" name="ORA02085"></a></p>
<h3>ORA-02085 : database link xxx connects to yyy</h3>
<p>If your local database&#8217;s &#8216;GLOBAL_NAMES&#8217; initialization parameter is set          to true, you will receive the ORA-02085 error when USING the db link:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; connect scott/tiger
Connected

SQL&gt; create database link remotedb connect to scott
     identified by tiger using 'otherremotedb';

Database link created.

SQL&gt; select * from dual@remotedb;
select * from dual@remotedb
                   *
ERROR at line 1:
ORA-02085 : database link REMOTEDB connects to
            OTHERREMOTEDB</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
<strong>Solution:</strong><br />
On your local database, connected as sysdba,<br />
see what your parameter GLOBAL_NAMES is set to :</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; show parameter global_names

NAME             TYPE        VALUE
---------------- ----------- ----------
global_names     boolean     TRUE

SQL&gt; alter system set global_names=false
     scope=both;

System altered.

SQL&gt; connect scott/tiger

Connected.
SQL&gt; select * from dual@remotedb;

D
-
X</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> Tip : if you cannot change your local database&#8217;s GLOBAL_NAMES setting,<br />
change the name of the dblink to the global_name of the remote database.<br />
To find out what it is , log in to the remote database as sysdba:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from global_name;

GLOBAL_NAME
--------------------------------
REMOTEDB</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> Another problem to look into when you troubleshoot oracle database link errors like ORA-02085<br />
is a difference in domain          names between your local database and the remote database.<br />
This is only a problem if you do not specify the domain name in your db          link name.</p>
<p>For example, The remote database&#8217;s domain name is world.net and your          local database&#8217;s domain name is world.com</p>
<p>You create a db link as follows:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; create database link remotedb
      using 'remotedb';
Database link created.

SQL&gt; select * from dual@remotedb;
ORA-2085 "database link REMOTEDB.WORLD.COM
         connects to REMOTEDB.WORLD.NET"</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
To resolve this , drop the db link and recreate it by specifying the correct domain name:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; drop database link remotedb;
Database link dropped.

SQL&gt; create database link remotedb.world.net
     using 'remotedb';
Database link created.

SQL&gt; select * from dual@remotedb;

D
-
X</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> Alternatively you can change the global name of the remote database:</p>
<p>See what it is first:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; connect / as sysdba
Connected

SQL&gt; select * from global_name;

GLOBAL_NAME
------------
REMOTEDB

SQL&gt;alter database rename global_name
    to remotedb.world.com;
Database altered.

SQL&gt; select * from global_name;

GLOBAL_NAME
-------------------
REMOTEB.WORLD.COM</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
Now you can create the db link on the local server without specifying the domain name:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; drop database link remotedb;
Database link dropped.

SQL&gt; create database link remotedb
      using 'remotedb';
Database link created.

SQL&gt; select * from dual@remotedb;

D
-
X</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="ORA12154" name="ORA12154"></a></p>
<h3>ORA-12154 : TNS:could not resolve service name</h3>
<p>When you troubleshoot oracle database link errors like ORA-12154, you need to look into your networking configuration files.</p>
<li>Double-check the alias you are using in your database link against a          functional one from the local server&#8217;s tnsnames.ora.</li>
<li>Are you looking at the correct tnsnames.ora ?</li>
<li> If you have multiple Oracle Homes on your local server, you could be looking          at the wrong one.</li>
<li>Also check for the existence of the $TNS_ADMIN environment variable, the          correct tnsnames.ora file will be there, not where you expected it to          be.</li>
<li>The best test is to copy and paste the alias from your tnsnames.ora file,<br />
then do an sql*plus connection to it with the username and password you          are using in the db link.</li>
<li>Once that is checked, retest your database link to see if the ORA-12154 has gone away.</li>
<p><a id="ORA12224" name="ORA12224"></a></p>
<h3>ORA-12224 : TNS: no listener</h3>
<p>Make sure the remote server&#8217;s listener is running and listening on the          correct port as shown in your local server&#8217;s tnsnames.ora.<br />
Fix what is wrong and retry the db link query to see if the ORA-12224 is resolved.</p>
<p><a id="ORA12305" name="ORA12305"></a></p>
<h3>ORA-12305 : TNS:listener could not resolve SID given in connect descriptor</h3>
<p>Make sure the remote server&#8217;s listener is listening for the SID or service          name as shown in your local server&#8217;s tnsnames.ora.<br />
To check:<br />
Log onto the remote server and see what the listener is listening for          <em>: lsnrctl services</em> or <em>lsnrctl status </em></p>
<p><!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Ftroubleshoot_oracle_database_link_errors.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Ftroubleshoot_oracle_database_link_errors.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fasktom.oracle.com%2Fpls%2Fasktom%2Ff%3Fp%3D100%3A11%3A0%3A%3A%3A%3AP11_QUESTION_ID%3A456820211101&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Ftroubleshoot_oracle_database_link_errors.html'); return false;" href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:456820211101" target="_blank">AskTom: troubleshoot oracle database link errors page</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/Qc3tGzKOagc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/troubleshoot-oracle-database-links/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/troubleshoot-oracle-database-links</feedburner:origLink></item>
		<item>
		<title>Manage Oracle database links</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/gXEz7JsgqGg/manage-oracle-database-links</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/manage-oracle-database-links#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:10:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[manage oracle database links]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=124</guid>
		<description><![CDATA[How many database links are in existence on your database, how many are in use ? ]]></description>
			<content:encoded><![CDATA[<div class="large"><strong>Know your open links</strong></div>
<p><!-- ============================================================================================================================================================ -->Once you have created and made use of a database link in Oracle,<br />
you might want to keep an eye on the number of concurrent open database links<br />
in your database so you can tune the <em>open_links</em> initialization parameter.</p>
<p>Read more <a href="http://www.oracle-database-tips.com/limit_oracle_database_links.html">here</a> on limiting concurrent open links.</p>
<p>You will need to query <em>v$dblink</em> to see how many links are open in your          session:</p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select in_transaction, count(*) from v$dblink
     group by in_transaction;

IN_   COUNT(*)
--- ----------
YES          1</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Here are some interesting columns and descriptions of <em>v$dblink</em>:</p>
<pre class="large">db_link           Db link name
owner_id          Owner name
logged_on         Is the database link currently logged on?
protocol          Dblink's communications protocol
open_cursors      Are there any cursors open for the db link ?
in_transaction    Is the db link part of a transaction which
                  has not been commited or rolled back yet ?
update_sent       Was there an update on the db link ?</pre>
<div class="large"><strong>dba_db_links</strong></div>
<p>To gather information on all database links in your database, query <em>dba_db_links</em>.<br />
You will need dba privileges to see this view, the alternatives are <em>user_db_links</em> and <em>all_db_link</em>s.</p>
<p>A user who does not have dba privileges can query <em>all_db_links</em> to see<br />
which db links are available to him.</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dba_db_links;

OWNER      DB_LINK     HOST       CREATED
---------- ----------  ---------- ----------
SCOTT      REMOTEDB    remotedb   23-feb-2008 23:59:05</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Some interesting columns:</p>
<pre class="large">owner           User who owns the db link,
                will state 'PUBLIC' if it is a public database link.
db_link         Db link name.
username        The username that was specified if it was hardcoded
                during the create statement, null if not specified
                during the create statement.
host            The tnsnames alias specified during the create
                statement.
created         Date and time of link creation.</pre>
<p><!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fmanage_oracle_database_links.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fmanage_oracle_database_links.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/gXEz7JsgqGg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/manage-oracle-database-links/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/manage-oracle-database-links</feedburner:origLink></item>
		<item>
		<title>Limit Oracle database links per session</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/Pn5faDIrzSw/limit-oracle-database-links-per-session</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/limit-oracle-database-links-per-session#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:09:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[limit db links]]></category>

		<category><![CDATA[open_links]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=122</guid>
		<description><![CDATA[Limit the number of allowable db links per session for your database]]></description>
			<content:encoded><![CDATA[<div class="large"><strong> Determine the maximum allowable number of database links<br />
per session in your database</strong></div>
<p><!-- ============================================================================================================================================================ -->Each session in your database has a limited number of database links that          can be opened at the same time.</p>
<p>This number is determined by a database-wide initialization parameter:          OPEN_LINKS.</p>
<p>The default value is set to 4.</p>
<p>If it is set to 0, distributed transactions are not allowed.</p>
<p>If you are expecting your transactions to have a maximum of 3 database          links open concurrently, set this parameter to 3 or higher.</p>
<p>Do not set it too high, it is better for the application to close database          links when no longer in use than to change the parameter to a high number.</p>
<p>OPEN_LINKS cannot be modified in real-time, so you will have to change          it in the spfile or pfile and bounce the database.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter system set open_links=10 scope=both;
alter system set open_links=0 scope=both
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter
cannot be modified

SQL&gt; alter system set open_links=10 scope=spfile;

System altered.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> If you are not sure how many database links are opened up concurrently          by your session&#8217;s database application, you can query v$dblink.</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select in_transaction, count(*) from v$dblink
     group by in_transaction;

IN_   COUNT(*)
--- ----------
YES          1</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Flimit_oracle_database_links.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Flimit_oracle_database_links.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/Pn5faDIrzSw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/limit-oracle-database-links-per-session/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/limit-oracle-database-links-per-session</feedburner:origLink></item>
		<item>
		<title>Hide Oracle database link</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/_SV3EgzdI_I/hide-oracle-database-link</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/hide-oracle-database-link#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:07:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[hide oracle database link complexity]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=118</guid>
		<description><![CDATA[Want to spare yourself the db link syntax in daily use ?
Hide it with a view or a synonym. ]]></description>
			<content:encoded><![CDATA[<p><!-- ============================================================================================================================================================ --></p>
<div class="large"><strong>Use a view or synonym to hide distributed database complexity<br />
from your user</strong></div>
<p>There are 2 ways you can hide the complexity involved with Oracle database          links from your user:<br />
create a <em>synonym</em> or a <em>view</em>.</p>
<p>This will allow your user to access the data she needs without worrying<br />
about the syntax requirements of database links.</p>
<p>Your user may even be unaware of the fact that she is accessing some          data in a remote database.</p>
<p>Note:<br />
Database links are notoriously slow, not an optimal solution for          applications needing real-time response.<br />
Expect the database link to cause a delay in accessing the remote data.</p>
<p>Here is an example of creating a synonym for scott&#8217;s database link.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; create  synonym rem_emp for emp@remotedb;

Synonym created.

SQL&gt; select count(*) from rem_emp;

  COUNT(*)
----------
        14</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->The other method is to create a view on your remote database&#8217;s data.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; create view v_emp as select * from emp@remotedb;

View created.

SQL&gt; select count(*) from v_emp;

  COUNT(*)
----------
        14</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fhide_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fhide_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/_SV3EgzdI_I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/hide-oracle-database-link/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/hide-oracle-database-link</feedburner:origLink></item>
		<item>
		<title>Drop Oracle database link</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/3gggK4uffI0/drop-oracle-database-link</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/drop-oracle-database-link#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:05:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[Drop Oracle database link]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=116</guid>
		<description><![CDATA[Drop Oracle database link syntax]]></description>
			<content:encoded><![CDATA[<div class="large"><strong>How to drop a database link </strong></div>
<p>Dropping a database link from your Oracle database is as easy as doing          the following:</p>
<p><strong>drop database link remotedb;</strong><br />
or<br />
<strong>drop public database link remotedb;</strong></p>
<p>You will need no other system privilege other than the &#8216;create database          link&#8217; privilege granted directly<br />
to your username or granted via a role to drop your own database link.</p>
<p>It is not possible to drop a database link belonging to another user.</p>
<p>If you try to specify another schema&#8217;s database link by qualifying it          with a name,<br />
Oracle will just look for a private database link in your schema with          a name<br />
which includes the other schema&#8217;s name and will not find it.</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> To drop a public database link, you will need the system privilege &#8216;drop          public database link&#8217;.</p>
<p>For example:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; connect / as sysdba
Connected.

SQL&gt; drop database link scott.remotedb;
drop database link scott.remotedb
                   *
ERROR at line 1:
ORA-02024: database link not found

SQL&gt; connect scott/tiger
Connected.
SQL&gt; drop database link scott.remotedb;
drop database link scott.remotedb
                   *
ERROR at line 1:
ORA-02024: database link not found

SQL&gt; drop database link remotedb;

Database link dropped.</pre>
</div>
</div>
<p><strong> Recommended reading:</strong></p>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fdrop_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fdrop_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/3gggK4uffI0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/drop-oracle-database-link/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/drop-oracle-database-link</feedburner:origLink></item>
		<item>
		<title>Use database links</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/l23JLD3eHK0/use-database-links</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/use-database-links#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:04:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[db link usage syntax]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=113</guid>
		<description><![CDATA[Syntax to use an Oracle database link]]></description>
			<content:encoded><![CDATA[<p>Once a database link has been created<br />
you are now ready to select your data from the remote database referenced by   the db link.</p>
<p>The syntax is :</p>
<p>select &lt;column list&gt; from &lt;table&gt;@&lt;dblink name&gt;;</p>
<p>For example:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept@remotedb;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->The database link is opened during the select (or other DML transaction)        and remains open for the duration of the session.<br />
After you close a session, the links that were active in the session are        automatically closed.</p>
<h3><a id="Close" name="Close"></a>Close a db link</h3>
<p>To explicitly close the database link , use the command below:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter session close database link remotedb;

Session altered.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>Using db links in other DML statements</h3>
<p>You can use insert/update/delete statements just as easily with database          links<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept@remotedb;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL&gt; insert into dept@remotedb (deptno,dname,loc)
  2  values (50,'MARKETING','BOISE');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept@remotedb;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      BOISE

SQL&gt; update dept@remotedb set loc = 'LONDON'
     where deptno = 50;

1 row updated.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept@remotedb;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      LONDON

SQL&gt; delete from dept@remotedb
     where dname = 'MARKETING';

1 row deleted.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept@remotedb;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Note that DDL operations are not allowed through a database link:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter table dept@remotedb
     add column (manager varchar2(30));

alter table dept@remotedb add column
(manager varchar2(30))
                 *
ERROR at line 1:
ORA-02021: DDL operations are not allowed
           on a remote database</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fuse_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Online Documentation : Administrator&#8217;s Guide, Creating Database Links</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fuse_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">Oracle Online Documentation : SQL Reference, Create Datatabase Link syntax</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fasktom.oracle.com%2Fpls%2Fasktom%2Ff%3Fp%3D100%3A11%3A0%3A%3A%3A%3AP11_QUESTION_ID%3A393468893370&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fuse_oracle_database_link.html'); return false;" href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:393468893370" target="_blank">AskTom page with interesting troubleshooting tips for when you use oracle database links.</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/l23JLD3eHK0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/use-database-links/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/use-database-links</feedburner:origLink></item>
		<item>
		<title>Create Oracle database link</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/CJV_9Px3_Dg/create-oracle-database-link</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/create-oracle-database-link#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:59:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[create oracle db link]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=110</guid>
		<description><![CDATA[Syntax and explanation on creating Oracle database links.]]></description>
			<content:encoded><![CDATA[<p>Syntax :</p>
<p>CREATE {PUBLIC} DATABASE LINK<br />
{CONNECT TO<br />
IDENTIFIED BY  }<br />
USING &#8216;  &#8216;;</p>
<p>Privileges needed</p>
<p>When creating an oracle database link, you can decide to create it privately,<br />
for use only by the owner of the database link,<br />
or publicly, for use by all other database users who have the right privileges.</p>
<p>If you do not specify the word &#8216;PUBLIC&#8217; in the create statement, the database link will be created as a private one by default.<br />
Once a public database link has been created, it will be owned by a special user named &#8216;PUBLIC&#8217;.</p>
<p>The second decision is to create it with a hard-coded username and password, or without access credentials.<br />
If you create a public database link without access credentials, any user accessing it will do so with his own username and password.</p>
<p>Take care when creating a public dblink with a hardcoded username and password, it is a security risk.</p>
<p>Creation</p>
<p>Now that you are ready to create it, you must provide a database link name<br />
(this is what your db link will be called).</p>
<p>One common problem with dblinks is that Oracle will not allow you to create a db link whose name is different from the global name<br />
of the remote database if the local database&#8217;s &#8216;GLOBAL_NAMES&#8217; initialization parameter is set to &#8216;TRUE&#8217;.</p>
<p>Lastly, you must specify a valid tnsnames alias which Oracle will use to connect to the remote database.<br />
To test if your tnsnames.ora alias is valid, try to access it through sql*plus on your local server.</p>
<p>To be able to create a database link, you will need to have the system privilege<br />
&#8216;CREATE DATABASE LINK&#8217;<br />
or<br />
&#8216;CREATE PUBLIC DATABASE LINK&#8217;<br />
granted to you.</p>
<p>The remote user will need to have at least &#8216;CREATE SESSION&#8217; privileges.</p>
<p>Examples:<br />
Let&#8217;s create a private database link using a hard-coded username and password.</p>
<p>SQL&gt;Create database link remotedb connect to scott identified by tiger using &#8216;remotedb.world.com&#8217;;<br />
Database link created.</p>
<p>The same db link without a username/password:</p>
<p>SQL&gt;create database link remotedb using &#8216;remotedb.world.com&#8217;;<br />
Database link created.</p>
<p>Here&#8217;s an example to create a public database link with a username and password:</p>
<p>SQL&gt; create public database link remotedb connect to scott identified by tiger using &#8216;remotedb.world.com&#8217;;<br />
Database link created.</p>
<p>Here&#8217;s a public database link without a username and password.</p>
<p>SQL&gt;create public database link remotedb using &#8216;remotedb.world.com&#8217;;<br />
Database link created.</p>
<p>Recommended reading:</p>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fds_admin.htm%23i1007820&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fcreate_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/ds_admin.htm#i1007820" target="_blank">Oracle Administrator&#8217;s Guide: Create oracle database link</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_5005.htm%23SQLRF01205&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fcreate_oracle_database_link.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5005.htm#SQLRF01205" target="_blank">SQL Reference: Oracle create database link syntax</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/CJV_9Px3_Dg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/create-oracle-database-link/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/create-oracle-database-link</feedburner:origLink></item>
		<item>
		<title>Oracle Database Links Background</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/zmxYbMJ_KeU/oracle-database-links-background</link>
		<comments>http://oracle-database-tips.com/wp/dblinks/oracle-database-links-background#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:55:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[DB Links]]></category>

		<category><![CDATA[oracle database link]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=107</guid>
		<description><![CDATA[Oracle Database Links Background information]]></description>
			<content:encoded><![CDATA[<p><ins style="border: medium none; margin: 0pt; padding: 0pt; display: inline-table; height: 250px; position: relative; visibility: visible; width: 250px;"><ins style="border: medium none; margin: 0pt; padding: 0pt; display: block; height: 250px; position: relative; visibility: visible; width: 250px;"></ins></ins> <script type="text/javascript"><!--
&lt;! 
google_ad_client = "pub-7851621922754096";
/* 250x250left */
google_ad_slot = "5892931358";
google_ad_width = 250;
google_ad_height = 250;
// &gt;
// --></script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><script type="text/javascript"><!--
google_protectAndRun("ads_core.google_render_ad", google_handleError, google_render_ad);
// --></script><ins style="border: medium none; margin: 0pt; padding: 0pt; display: inline-table; height: 250px; position: relative; visibility: visible; width: 250px;"><ins style="border: medium none; margin: 0pt; padding: 0pt; display: block; height: 250px; position: relative; visibility: visible; width: 250px;"></ins></ins> <!-- ============================================================================================================================================================ --> A Database Link allows you to access data in a remote database as if it          is a local table&#8217;s data.</p>
<p>The connection can be made to a database hosted on the same machine or          remotely on another server.</p>
<p>When you query data on a different database, you are essentially using          a distributed query.<br />
It is also possible to execute distributed transactions through database          links like insert, update and delete.</p>
<p>The authentication used in a database link is either the link&#8217;s owner          or a hard-coded username and password, depending on the way the link was          created.</p>
<p>A database link in oracle can be either private (for use only by the link&#8217;s          owner) or public (accessible to any user with the correct privileges).</p>
<p>Connectivity is established via Sql*Net, using an alias defined in the          local database server&#8217;s tnsnames.ora</p>
<p>Have a look at the tutorials on this site  to find out more about oracle database          links :</p>
<p><a href="http://oracle-database-tips.com/wp/category/dblinks">Dblinks category</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/zmxYbMJ_KeU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/dblinks/oracle-database-links-background/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/dblinks/oracle-database-links-background</feedburner:origLink></item>
		<item>
		<title>Standby database commands.</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/ftFq76F_VXU/standby-database-commands</link>
		<comments>http://oracle-database-tips.com/wp/standby/standby-database-commands#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:53:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Standby DBs]]></category>

		<category><![CDATA[oracle standby databas commands]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=105</guid>
		<description><![CDATA[oracle standby databases: quick command reference]]></description>
			<content:encoded><![CDATA[<p>This section, <strong>standby db tutorials</strong> aims to give you          real-life examples and practical advice on<br />
setting up and maintaining Oracle&#8217;s standby database technology, now called          Oracle Data Guard.</p>
<p>Standby databases are no longer very complex to set up.<br />
By using Data Guard Broker, all the hard work is done for you in the background,<br />
and all you have to do is click a few buttons.</p>
<p>If you would rather get your hands dirty, this is the place         for you.</p>
<p>The tutorials below will take you through all the steps needed to set          up and maintain an Oracle standby database.</p>
<p>The examples are all related to a physical standby database, not a logical          one.</p>
<p>Standby databases are really Oracle&#8217;s gift to the DBA community.</p>
<p>Gone are the days where hardware failure meant days of restoring backup          files from tapes,<br />
which were probably far away in an offsite vault,<br />
while hoping that the tapes were not corrupt and that no bug had crept          into your backup routine.</p>
<p>With a standby database in place, you can be up and running in no time,<br />
minimizing the impact on your users and their businesses.</p>
<h2>Quick reference to monitor, start and stop a physical standby database</h2>
<p>Starting a physical standby database:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>startup nomount;<br />
alter database mount standby database;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Starting the managed recovery:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>alter database recover managed standby database            disconnect from session;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Stop the managed recovery:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>alter database recover managed standby database            cancel;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Shutdown the physical standby database:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>shutdown immediate;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Monitor primary&#8217;s archive destination status:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>select destination, status, archived_thread#,            archived_seq# from v$archive_dest_status<br />
where status &lt;&gt; &#8216;deferred&#8217;  and status &lt;&gt; &#8216;inactive&#8217;;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Check if archived logs are synching OK, compare both results:</p>
<ul>
<li>on primary db</li>
</ul>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>select max(sequence#) from v$log_history;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<ul>
<li>on standby db:</li>
</ul>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>select max(sequence#) from v$archived_log;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Check Dataguard processes status:</p>
<ul>
<li> on standby db:</li>
</ul>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>select process, status, thread#, sequence#, block#,            blocks from v$managed_standby;</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<p><!-- ****************************************************************************************   --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14239%2Ftoc.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fstandby_db_tutorials.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/toc.htm" target="_blank">Oracle online documentation: Data Guard Concepts and Administration</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14239%2Fmanage_ps.htm%23i1006374&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_standby_commands.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/manage_ps.htm#i1006374" target="_blank">Oracle   online documentation:Data Guard Concepts and Administration , Managing a Physical Standby database.</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/ftFq76F_VXU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/standby/standby-database-commands/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/standby/standby-database-commands</feedburner:origLink></item>
		<item>
		<title>Kill oracle processes using grep only</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/Gt5y4c5PgOs/kill-oracle-processes-using-grep-only</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes-using-grep-only#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:48:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[kill oracle process using grep]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=102</guid>
		<description><![CDATA[Use grep to kill a range of similar oracle processes]]></description>
			<content:encoded><![CDATA[<p>If you have ever sighed at needing to kill a number of Oracle processes related to one aspect of Oracle<br />
(listener,instance, agent, oms) then you will enjoy using this little script as much as I do now that I&#8217;ve found it.<br />
Be very careful with it, if you get the &#8216;requirement&#8217; wrong, you could end up killing the wrong processes.</p>
<p>For example, if you want to kill all processes associated with one particular SID, but have multiple SIDs running on your server,<br />
don&#8217;t grep for &#8216;oracle&#8217; as the list that is returned is for ALL oracle processes on the server.</p>
<p>In this example, I need to kill all processed associated with the Oracle management agent (emagent) on a server.</p>
<p>I do not need to worry about being careful as I only have one agent home on the server and can not accidentally kill irrelevant ones.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<pre class="medium">$ps -ef | grep emagent

oracle     395 14244  0 15:10 pts/1    00:00:00
 grep emagent
oracle    3905     1  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/perl/bin/perl
/home/oracle/product/agent10g/bin/emwd.pl
agent /home/oracle/product/agent10g/sysman/log/emagent.nohup
oracle    3922  3905  0 13:45 pts/1    00:00:08
/home/oracle/product/agent10g/bin/emagent
oracle    3928  3922  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    3929  3928  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    3930  3928  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    3931  3928  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    3932  3928  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4019  3928  0 13:45 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4233  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4235  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4236  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4237  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4238  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4239  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4240  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle    4241  3928  0 13:46 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent
oracle   14736  3928  0 14:41 pts/1    00:00:00
/home/oracle/product/agent10g/bin/emagent

$ps -ef | grep emagent| awk '{print $2}' | xargs kill -9
$
$ps -ef | grep emagent
oracle   27931 14244  0 15:26 pts/1    00:00:00 grep emagent</pre>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/Gt5y4c5PgOs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes-using-grep-only/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes-using-grep-only</feedburner:origLink></item>
		<item>
		<title>Open Cursors</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/Pae4sP32deo/open-cursors</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/open-cursors#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:45:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[open cursor]]></category>

		<category><![CDATA[ora-01000]]></category>

		<category><![CDATA[oracle cursors]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=99</guid>
		<description><![CDATA[Open Cursors
What they are, How to manage them,
Resolving ORA-01000]]></description>
			<content:encoded><![CDATA[<p>A <strong>cursor</strong> is a name used to access a specific private SQL area.</p>
<p>Oracle creates implicit cursors for all SQL DML (data manipluation language)          statements, even for select statements returning one row.</p>
<p>If your query returns more than one row, you can explicitly declare a          cursor in PL/SQL to process the rows one by one.</p>
<p>Here is a simple example of using a cursor in a &#8216;cursor for loop&#8217; (which          automatically opens, fetches from and closes the cursor for you) :</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; set serveroutput on size 100000;</p>
<p>SQL&gt; begin<br />
2 for c1 in (select empno from emp) loop<br />
3 dbms_output.put_line(c1.empno);<br />
4 end loop;<br />
5 end;<br />
6 /</p>
<p>7369<br />
7499<br />
7521<br />
7566<br />
7654<br />
7698<br />
7782<br />
7788<br />
7839<br />
7844<br />
7876<br />
7900<br />
7902<br />
7934</p>
<p>PL/SQL procedure successfully completed.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Your client application may hit the following error :</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>ORA-01000: maximum open cursors exceeded</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<p>This means that your application&#8217;s session has hit the database-wide          limit of the maximum number of open cursors which one session is allowed          to have.</p>
<p>The database parameter which governs this limit is :<em> open_cursors</em></p>
<p>You can change this parameter in real-time, but you should ask yourself          the question if the value is really too low, perhaps the application code         should be rewritten, to either do better housekeeping (close cursors when          they are done), or rewrite the code so that many DML statements can be          recoded to be used in one cursor.</p>
<p>Never set this to an excessive value, you want to keep open cursors in          check.<br />
Rather let a new, untuned application hit this error so that the code         can be tuned.</p>
<p>Setting this value higher does not cause performance overhead on the          database.</p>
<p>If you do decide to change the value , this is how to do it :<br />
(the default value of 50 is usually too small, so you will probably change it sooner          or later).</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>alter system set open_cursors=300 scope=both;</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>How to find out which cursors are open for a session ?</h3>
<p>Get the session&#8217;s sid from v$session, then get the sql_text from v$open_cursor :</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; select sid, serial#, username from v$session where username =          &#8216;SYS&#8217;;</p>
<p>SID SERIAL# USERNAME<br />
&#8212; &#8212;&#8212;  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
94    3569     SYS</p>
<p>SQL&gt; select sql_text from v$open_cursor where sid = 94;</p>
<p>SQL_TEXT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.fla<br />
select sql_text from v$open_cursor where sid = 94</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <!-- **********************************************************************************************************************************************   --></p>
<h3>Recommended reading for more information on oracle cursors :</h3>
<p><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fappdev.102%2Fb14251%2Fadfns_sqlproc.htm%23i1024748&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fopen_cursors.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_sqlproc.htm#i1024748" target="_blank">Oracle          online documentation: Oracle® Database Application Developer&#8217;s Guide - Fundamentals</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/Pae4sP32deo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/open-cursors/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/open-cursors</feedburner:origLink></item>
		<item>
		<title>Match OS process to Oracle session</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/PwCzk1ocoZM/match-os-process-to-oracle-session</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/match-os-process-to-oracle-session#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:43:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[oracle os session id]]></category>

		<category><![CDATA[paddr]]></category>

		<category><![CDATA[spid]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=97</guid>
		<description><![CDATA[Identify the oracle session whose shadow process is using excessive resources, with these 'Match os process to oracle session' instructions]]></description>
			<content:encoded><![CDATA[<p>Your server is under pressure and you have decided to kill the oracle session which is causing excessive<br />
CPU or memory consumption, here&#8217;s how you can find the oracle session associated with a unix process:</p>
<p>Use top on the unix command line to see which process is the main culprit:<br />
(use shift+M to sort the list in order of highest memory consumption)</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>$top<br />
top - 15:35:38 up 81 days, 47 min,  2 users,  load average: 0.03, 0.04, 0.06<br />
Tasks: 148 total,   2 running, 146 sleeping,   0 stopped,   0 zombie<br />
Cpu(s):  1.5% us,  0.0% sy,  0.0% ni, 98.5% id,  0.0% wa,  0.0% hi,  0.0% si<br />
Mem:    993492k total,   979396k used,    14096k free,     8568k buffers<br />
Swap:  1998840k total,   392928k used,  1605912k free,   791300k cached</p>
<p>PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND<br />
<strong>4132</strong> oracle    15   0  754m 149m 143m S  0.0 15.4   0:03.92 oracle<br />
9581  oracle 15 0 754m 137m 132m S 0.0 14.2 0:01.70 oracle<br />
5230  oracle 15 0 755m 132m 130m S 0.0 13.7 0:16.90 oracle<br />
6404  oracle 16 0 754m 116m 111m S 0.0 12.0 0:02.75 oracle<br />
5224  oracle 16 0 766m   99m   98m S 0.0 10.2            0:08.76 oracle<br />
5234  oracle 16 0 754m   89m   87m S 0.0 9.2              0:06.84 oracle</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Make sure the top process is a client connection shadow process:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>$ps -ef | grep 4132</p>
<p>oracle    4132     1  0 08:52 ?        00:00:03 oracletestdb (LOCAL=NO)<br />
oracle   23557 23472  0 15:35 pts/1    00:00:00 grep 4132</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
Inside the database, find out who this is :<br />
(formatted result)<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt;</p>
<p>select<br />
p.username,<br />
s.sid,<br />
s.serial#,<br />
p.spid,<br />
s.osuser,<br />
s.status,<br />
p.program,<br />
p.terminal,<br />
to_char(s.logon_time,&#8217;dd-mon-yyyy hh24:mi:ss&#8217;) &#8220;Logon              Time&#8221;,<br />
s.module<br />
from<br />
v$process p,<br />
v$session s<br />
where<br />
p.addr = s.paddr<br />
and p.spid = &#8216;4132&#8242;;</p>
<p>USERNAME  SID   SERIAL# SPID    OSUSER STATUS<br />
&#8212;&#8212;&#8212;&#8212;   &#8212;-     &#8212;&#8212;-                 &#8212;&#8211;     &#8212;&#8212;     &#8212;&#8212;-<br />
devuser      393    1178                    4132     LarryE   ACTIVE</p>
<p>PROGRAM                            TERMINAL                 Logon Time                             MODULE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;  &#8212;&#8212;&#8212;&#8212;-                  &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-  &#8212;&#8212;&#8212;&#8212;&#8212;<br />
oracletestdb@test.world.com  UNKNOWN  16-feb-2008 13:18:20              TOAD 9.0.1.8</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> Kill the user:          <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>SQL&gt; alter system kill session &#8216;393,1178&#8242;;</p>
<p>System altered.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> The user will receive this message either immediately or at the next attempted          SQL statement:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>ORA-00028: your session has been killed</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <!-- ****************************************************************************************   --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14231%2Fmanproc.htm%23i1006851&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fmatch_os_process_to_oracle_session.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/manproc.htm#i1006851" target="_blank"> Oracle® Database Administrator&#8217;s Guide : Terminating sessions</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14237%2Fdynviews_2022.htm%23i1411655&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fmatch_os_process_to_oracle_session.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2022.htm#i1411655" target="_blank"> Oracle Database Reference: v$process</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14237%2Fdynviews_2088.htm%23i1414383&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fmatch_os_process_to_oracle_session.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2088.htm#i1414383" target="_blank"> Oracle® Database  Reference: v$session</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/PwCzk1ocoZM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/match-os-process-to-oracle-session/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/match-os-process-to-oracle-session</feedburner:origLink></item>
		<item>
		<title>Raise alert.log error</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/6-HBHMfIHGI/raise-alertlog-error</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/raise-alertlog-error#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:41:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[dbms_system.ksdwrt]]></category>

		<category><![CDATA[raise alert.log error]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=95</guid>
		<description><![CDATA[Use this unsupported but useful package to log your user error code in the database's alert.log]]></description>
			<content:encoded><![CDATA[<p>Came across this very handy utility recently.</p>
<p>Warning, it is unsupported by Oracle, so don&#8217;t base your mission-critical          alerts on this method.</p>
<p>Let&#8217;s say you are creating a stored proc as user scott, and instead of          writing your<br />
trapped error message to a table, an error file or sending an email, you          would like it to be reflected<br />
in the database&#8217;s alert.log.</p>
<p>The steps below show you how.</p>
<p>If not documented, this is guaranteed to make you unpopular with DBAs who manage your database in your absence&#8230;<br />
First, grant execution privileges to scott:</p>
<p>as sys:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; grant execute on sys.dbms_system to scott;</p>
<p>Grant succeeded.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
Now run and test a procedure which will write to the alert.log</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>declare<br />
Mess varchar2(200);<br />
begin<br />
Mess := &#8216;ORA-USER_ERROR&#8217;||&#8217;, scott.test_proc, &#8216;||&#8217;, &#8216;||substr(SQLERRM,1,100);<br />
sys.dbms_system.ksdwrt(2,Mess);<br />
commit;<br />
end;</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
This is how it reflects in the alert.log (ORA-0000 because there is no          error.)</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>Thu Jan 24 14:57:15 2008<br />
ORA-USER_ERROR, scott.test_proc, ORA-0000: normal, successful completion</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Lastly : implement it in your procedure&#8217;s exception handler section:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div>
<p>&#8230;<br />
exception<br />
when others then<br />
Mess := &#8216;ORA-USER_ERROR&#8217;||&#8217;, scott.test_proc, &#8216;||&#8217;, &#8216;||substr(SQLERRM,1,100);<br />
sys.dbms_system.ksdwrt(2,Mess);<br />
commit;<br />
&#8230;.</p></div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/6-HBHMfIHGI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/raise-alertlog-error/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/raise-alertlog-error</feedburner:origLink></item>
		<item>
		<title>Compile another’s Oracle schema</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/_Hd1b7CzxsQ/compile-anothers-oracle-schema</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/compile-anothers-oracle-schema#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:39:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[compile oracle schema]]></category>

		<category><![CDATA[dbms_utility]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=93</guid>
		<description><![CDATA[
How to compile another Oracle user schema.]]></description>
			<content:encoded><![CDATA[<p>There will be times when you want to compile a schema which does not belong          to you,<br />
or for which you do not have the password.</p>
<p>The solution is to use the dbms_utility package as a DBA user.</p>
<p>Example, if you want to recompile all procedures,functions, packages          and triggers belonging to scott<br />
here is how to do it:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; exec dbms_utility.compile_schema(schema=&gt;&#8217;SCOTT&#8217;);<br />
PL/SQL procedure successfully completed.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->If you only want to recompile all invalid options, execute it like this          :  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; exec dbms_utility.compile_schema(schema=&gt;&#8217;SCOTT&#8217;,compile_all=&gt;false);<br />
PL/SQL procedure successfully completed.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->If you want to use each object&#8217;s session settings instead of the calling          user&#8217;s settings:  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; exec dbms_utility.compile_schema(schema=&gt;&#8217;SCOTT&#8217;,compile_all=&gt;false,          reuse_settings=&gt;true);<br />
PL/SQL procedure successfully completed.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->To see if any errors were generated<br />
(you must run this command immediately after executing dbms_utility) :  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; show errors<br />
No errors.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Another way to see if the compilations were successful :  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>SQL&gt; select object_name, object_type from dba_objects where owner = &#8216;SCOTT&#8217;          and status = &#8216;INVALID&#8217;;<br />
no rows selected</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <!-- ****************************************************************************************   --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fappdev.102%2Fb14258%2Fd_util.htm%23CHDGHICD&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fcompile_oracle_schema.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_util.htm#CHDGHICD" target="_blank">Oracle Database PL/SQL Packages and Types Reference, DBMS_UTILITY</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/_Hd1b7CzxsQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/compile-anothers-oracle-schema/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/compile-anothers-oracle-schema</feedburner:origLink></item>
		<item>
		<title>NFS Mount article</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/cEQl9LfOBbE/nfs-mount-article</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/nfs-mount-article#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:37:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[nfs mount instructions]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=91</guid>
		<description><![CDATA[NFS Mount a linux server's filesystem to another server]]></description>
			<content:encoded><![CDATA[<p><strong>NFS Mount</strong> is incredibly useful in a corporate unix environment.</p>
<p>You can use it to share disk space amongst servers, so that each server          &#8217;sees&#8217; the shared filesystem as if it is local.</p>
<p>If your network is fast enough, you can backup your oracle database to a shared filesystem, or just keep<br />
any required software on the shared filesystem so that you do not need to install the software<br />
numerous times on different servers.</p>
<p>In this example, we are sharing a filesystem called orabackup on server share01.world.com, and then<br />
we will mount that on a database server called prod01.world.com.</p>
<h3>Steps to take on share01:</h3>
<p>Log in as root.</p>
<p>Add prod01&#8217;s IP to /etc/exports<br />
If there is more than one entry, make sure there is a space between IP          addresses.  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@share01 ~]# cat /etc/exports</p>
<p>/orabackup -maproot=root 141.146.8.66</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Send a hangup to the mountd process to force it to reread the /etc/exports          file.  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@share01 ~]#kill -s HUP `cat /var/run/mountd.pid`</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>Steps to take on prod01:</h3>
<p>Log in as root.</p>
<p>Create /orabackup  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@prod01 ~]# mkdir /orabackup</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Edit /etc/fstab, add line to the bottom:  <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@prod01 ~]#cat /etc/fstab share01.world.com:/orabackup /orabackup nfs rsize=1024,wsize=1024</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Mount the filesystem :   <!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@prod01 ~]#mount share01.world.com:/orabackup</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<p>Once that is completed, you will be able to access it like a local filesystem.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<p>[root@prod01 ~]#df -h</p>
<p>Filesystem                  Size          Used Avail Use% Mounted on<br />
/dev/hda9                  7.6G          6.5G 750M 90% /<br />
/dev/hda1                  99M          8.7M 86M 10%  /boot<br />
none                        237M          0 237M 0%        /dev/shm<br />
/dev/hda7                  12G          5.6G 5.7G 50%   /home<br />
/dev/hda6                   20G          17G 1.7G 91%   /u01<br />
/dev/hda3                   25G          20G 4.3G 82%    /u02<br />
/dev/hda5                   20G          8.5G 11G 46%    /u03<br />
/dev/hda2                   25G          20G 3.5G 86%    /u04<br />
share01.world.com:/orabackup 66G 29G 34G 46% /orabackup</p></div>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/cEQl9LfOBbE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/nfs-mount-article/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/nfs-mount-article</feedburner:origLink></item>
		<item>
		<title>Sqlplus Bindvariables</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/uVoA18ZyaF0/sqlplus-bindvariables</link>
		<comments>http://oracle-database-tips.com/wp/sqlplus/sqlplus-bindvariables#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:25:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL*PLUS]]></category>

		<category><![CDATA[bindvariables syntax]]></category>

		<category><![CDATA[sqlplus bindvariables]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=88</guid>
		<description><![CDATA[sqlplus bindvariables example]]></description>
			<content:encoded><![CDATA[<p>Below is an example script (check_stby.sql)  which I&#8217;ve used to compare the most<br />
recently applied archive log file  at a standby database to the most recently archived log<br />
at the primary database.<br />
(I know, DataGuard can do this for me with much less effort..)</p>
<p>I am using sql*plus bind variables because I needed to connect  to 2 different databases<br />
and compare their results.<br />
The standby database is in mounted mode, so this precludes the idea of trying to get this information<br />
across a database link.</p>
<p>The sql script is then called by a shell script. (check_stby.sh) which gets called by<br />
a host-user-defined-metric in Enterprise Manager&#8217;s Grid Control system.</p>
<p>If the returned value exceeds the metric&#8217;s threshold, an alert is triggered and I receive an<br />
email warning me to check the status of the standby database.</p>
<h3>check_stby.sql</h3>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">set echo off
set feedback off
set termout off
VARIABLE prim_seq NUMBER
variable stby_seq number
variable diff number

connect sys/xxxx@primarydb.world.com as sysdba
begin
select max(sequence#)into :prim_seq from v$archived_log;
end;
/

connect sys/xxxx@standbydb.world.com as sysdba
begin
select max(sequence#) into :stby_seq from v$log_history;
end;
/

begin
:diff := :prim_seq - :stby_seq   ;
end;
/
exit :diff;</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3>check_stby.sh</h3>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">#!/bin/ksh

export ORACLE_HOME=/home/oracle/product/10.2.0

$ORACLE_HOME/bin/sqlplus -s /nolog @check_stby.sql

echo "em_result="$?"\n"</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14357%2Fch5.htm%23sthref1114&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fsqlplus_bindvariables.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch5.htm#sthref1114" target="_blank">Oracle Online Documentation : SQL*Plus® User&#8217;s Guide and Reference, Using Bind Variables</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/uVoA18ZyaF0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sqlplus/sqlplus-bindvariables/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sqlplus/sqlplus-bindvariables</feedburner:origLink></item>
		<item>
		<title>Demodrop.sql</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/0BRUdtrz_5c/demodropsql</link>
		<comments>http://oracle-database-tips.com/wp/sqlplus/demodropsql#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:22:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL*PLUS]]></category>

		<category><![CDATA[demodrop.sql]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=85</guid>
		<description><![CDATA[demodrop.sql syntax]]></description>
			<content:encoded><![CDATA[<p>If you can&#8217;t find the sql script to drop the demo tables in your $ORACLE_HOME/sqlplus/demo folder<br />
(or %ORACLE_HOME%\sqlplus\demo on windows)<br />
you can cut it from this page and paste it in a text editor of your choice.</p>
<p>Save it to a file on your server or PC and run it to complete dropping the Oracle demo tables.</p>
<h3>Demo_drop.sql</h3>
<p>====== start of section to cut ======</p>
<pre>--
-- Copyright (c) Oracle Corporation 1988, 2000.  All Rights Reserved.
--
--
-- DESCRIPTION
--   This script drops the SQL*Plus demonstration tables created by
--   demobld.sql.  It should be STARTed by each owner of the tables.
--
-- USAGE
--   From within SQL*Plus, enter:
--       START demodrop.sql

SET TERMOUT ON
PROMPT Dropping demonstration tables.  Please wait.
SET TERMOUT OFF

DROP TABLE EMP;
DROP TABLE DEPT;
DROP TABLE BONUS;
DROP TABLE SALGRADE;
DROP TABLE DUMMY;

SET TERMOUT ON
PROMPT Demonstration table drop is complete.

EXIT</pre>
<p>====== end of section to cut ======</p>
<h3>Drop scott user</h3>
<p>If you want to drop the scott user, do the following (login as DBA ):<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>SQL&gt; drop user scott cascade;</p>
<p>User dropped.</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="content">
<li>The cascade word drops all objects owned by scott.</li>
<li>Make sure scott is no longer connected.</li>
<li>Only do this if you are sure you will no longer need the user or his objects.</li>
<li>Always take an export before dropping users.</li>
<p><!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14357%2Ftoc.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fdemodrop.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm" target="_blank">Oracle online documentation: SQL*Plus® User&#8217;s Guide and Reference</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/0BRUdtrz_5c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sqlplus/demodropsql/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sqlplus/demodropsql</feedburner:origLink></item>
		<item>
		<title>Demobld.sql</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/mTMg6IbJMyk/demobldsql</link>
		<comments>http://oracle-database-tips.com/wp/sqlplus/demobldsql#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:21:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL*PLUS]]></category>

		<category><![CDATA[demobld]]></category>

		<category><![CDATA[demobld.sql]]></category>

		<category><![CDATA[oracle demo build]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=83</guid>
		<description><![CDATA[demobld.sql syntax]]></description>
			<content:encoded><![CDATA[<p>If you can&#8217;t find the demobld.sql in your $ORACLE_HOME/sqlplus/demo folder<br />
(or %ORACLE_HOME%\sqlplus\demo on windows)<br />
you can cut it from this page and paste it in a text editor of your choice.</p>
<p>Save it to a file on your server or PC and follow the instructions in the<br />
<a title="opens new window" href="http://oracle-database-tips.com/wp/sqlplus/sqlplus-demo-table-setup" target="_blank">oracle sqlplus demo table article</a><br />
to complete building the Oracle demo tables.</p>
<h3>Demobld.sql</h3>
<p>====== start of section to cut ======</p>
<pre>--
-- Copyright (c) Oracle Corporation 1988, 2000.  All Rights Reserved.
--
-- NAME
--   demobld.sql
--
-- DESCRIPTION
--   This script creates the SQL*Plus demonstration tables in the
--   current schema.  It should be STARTed by each user wishing to
--   access the tables.  To remove the tables use the demodrop.sql
--   script.
--
--  USAGE
--    From within SQL*Plus, enter:
--        START demobld.sql

SET TERMOUT ON
PROMPT Building demonstration tables.  Please wait.
SET TERMOUT OFF

DROP TABLE EMP;
DROP TABLE DEPT;
DROP TABLE BONUS;
DROP TABLE SALGRADE;
DROP TABLE DUMMY;

CREATE TABLE EMP
       (EMPNO NUMBER(4) NOT NULL,
        ENAME VARCHAR2(10),
        JOB VARCHAR2(9),
        MGR NUMBER(4),
        HIREDATE DATE,
        SAL NUMBER(7, 2),
        COMM NUMBER(7, 2),
        DEPTNO NUMBER(2));

INSERT INTO EMP VALUES
        (7369, 'SMITH',  'CLERK',     7902,
        TO_DATE('17-DEC-1980', 'DD-MON-YYYY'),  800, NULL, 20);
INSERT INTO EMP VALUES
        (7499, 'ALLEN',  'SALESMAN',  7698,
        TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600,  300, 30);
INSERT INTO EMP VALUES
        (7521, 'WARD',   'SALESMAN',  7698,
        TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250,  500, 30);
INSERT INTO EMP VALUES
        (7566, 'JONES',  'MANAGER',   7839,
        TO_DATE('2-APR-1981', 'DD-MON-YYYY'),  2975, NULL, 20);
INSERT INTO EMP VALUES
        (7654, 'MARTIN', 'SALESMAN',  7698,
        TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
INSERT INTO EMP VALUES
        (7698, 'BLAKE',  'MANAGER',   7839,
        TO_DATE('1-MAY-1981', 'DD-MON-YYYY'),  2850, NULL, 30);
INSERT INTO EMP VALUES
        (7782, 'CLARK',  'MANAGER',   7839,
        TO_DATE('9-JUN-1981', 'DD-MON-YYYY'),  2450, NULL, 10);
INSERT INTO EMP VALUES
        (7788, 'SCOTT',  'ANALYST',   7566,
        TO_DATE('09-DEC-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
        (7839, 'KING',   'PRESIDENT', NULL,
        TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
INSERT INTO EMP VALUES
        (7844, 'TURNER', 'SALESMAN',  7698,
        TO_DATE('8-SEP-1981', 'DD-MON-YYYY'),  1500,    0, 30);
INSERT INTO EMP VALUES
        (7876, 'ADAMS',  'CLERK',     7788,
        TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
INSERT INTO EMP VALUES
        (7900, 'JAMES',  'CLERK',     7698,
        TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),   950, NULL, 30);
INSERT INTO EMP VALUES
        (7902, 'FORD',   'ANALYST',   7566,
        TO_DATE('3-DEC-1981', 'DD-MON-YYYY'),  3000, NULL, 20);
INSERT INTO EMP VALUES
        (7934, 'MILLER', 'CLERK',     7782,
        TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);

CREATE TABLE DEPT
       (DEPTNO NUMBER(2),
        DNAME VARCHAR2(14),
        LOC VARCHAR2(13) );

INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');
INSERT INTO DEPT VALUES (20, 'RESEARCH',   'DALLAS');
INSERT INTO DEPT VALUES (30, 'SALES',      'CHICAGO');
INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');

CREATE TABLE BONUS
        (ENAME VARCHAR2(10),
         JOB   VARCHAR2(9),
         SAL   NUMBER,
         COMM  NUMBER);

CREATE TABLE SALGRADE
        (GRADE NUMBER,
         LOSAL NUMBER,
         HISAL NUMBER);

INSERT INTO SALGRADE VALUES (1,  700, 1200);
INSERT INTO SALGRADE VALUES (2, 1201, 1400);
INSERT INTO SALGRADE VALUES (3, 1401, 2000);
INSERT INTO SALGRADE VALUES (4, 2001, 3000);
INSERT INTO SALGRADE VALUES (5, 3001, 9999);

CREATE TABLE DUMMY
        (DUMMY NUMBER);

INSERT INTO DUMMY VALUES (0);

COMMIT;

SET TERMOUT ON
PROMPT Demonstration table build is complete.

EXIT</pre>
<p>====== end of section to cut ======<br />
<!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14357%2Ftoc.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fdemobld.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm" target="_blank">Oracle online documentation: SQL*Plus® User&#8217;s Guide and Reference</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/mTMg6IbJMyk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sqlplus/demobldsql/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sqlplus/demobldsql</feedburner:origLink></item>
		<item>
		<title>Sqlplus demo table setup</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/oGidjYT23j8/sqlplus-demo-table-setup</link>
		<comments>http://oracle-database-tips.com/wp/sqlplus/sqlplus-demo-table-setup#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:18:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL*PLUS]]></category>

		<category><![CDATA[oracle demo setup]]></category>

		<category><![CDATA[sqlplus demo setup]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=81</guid>
		<description><![CDATA[Sqlplus demo table setup]]></description>
			<content:encoded><![CDATA[<p>Create scott and run the oracle sqlplus demo table creation script<br />
by following the instructions below.</p>
<p>Scott is the standard example schema used to run queries and scripts to show how Oracle works.</p>
<h3>Scott schema creation.</h3>
<p>Create the <strong>scott</strong> user on your database if it does not already exist.</p>
<p>Connect to the database as a dba user, like sys or system.</p>
<div id="textbox">
<div>SQL&gt; create user scott identified by tiger<br />
default tablespace users temporary tablespace temp profile default;</p>
<p>User created.</p>
<p>SQL&gt; grant connect, resource to scott;</p>
<p>Grant succeeded.</p>
<p>SQL&gt; alter user scott account unlock;</p>
<p>User altered.</p></div>
</div>
<h3>Demobuild execution.</h3>
<p>The script to create the tables (<a href="http://oracle-database-tips.com/wp/sqlplus/demobldsql">demobld.sql</a>) is located in<br />
%oracle_home%\sqlplus\demo\demobld.sql<br />
or<br />
$ORACLE_HOME/sqlplus/demo/demobld.sql,<br />
for either windows or unix.</p>
<p>Depending on which version of Oracle you use, it will create the following tables:</p>
<ul>
<li>EMP</li>
<li>DEPT</li>
<li>BONUS</li>
<li>SALGRADE</li>
<li>DUMMY</li>
</ul>
<p>How to run it:</p>
<div id="textbox">
<div>SQL&gt; connect scott/tiger<br />
Connected.</p>
<p>SQl&gt; @?/sqlplus/demo/demobld.sql<br />
Building demonstration tables.  Please wait.<br />
Demonstration table build is complete.</p></div>
</div>
<p>To drop the demo tables, run the <a href="http://oracle-database-tips.com/wp/sqlplus/demodropsql">demodrop.sql</a> script in the same directory.</p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/oGidjYT23j8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sqlplus/sqlplus-demo-table-setup/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sqlplus/sqlplus-demo-table-setup</feedburner:origLink></item>
		<item>
		<title>Foreign key constraints and other type of constraints in an Oracle database</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/TJCU5VkDUAo/foreign-key-constraints-and-other-type-of-constraints-in-an-oracle-database</link>
		<comments>http://oracle-database-tips.com/wp/sql/foreign-key-constraints-and-other-type-of-constraints-in-an-oracle-database#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:16:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[oracle constraint]]></category>

		<category><![CDATA[oracle forein key constraint]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=79</guid>
		<description><![CDATA[A foreign key is one of the different types of Oracle constraints.]]></description>
			<content:encoded><![CDATA[<p>A foreign key is one of the different types of Oracle constraints.<br />
The purpose of a constraint is literally to constrain or restrict the quality of          data which you are allowed to insert into a table.</p>
<p>There are 5 kinds of constraints :</p>
<ul class="medium">
<li><a href="#CK">Check</a></li>
<li><a href=#NK">Not-Null</a></li>
<li><a href="#UK">Unique</a></li>
<li><a href="#PK">Primary Key</a></li>
<li><a href="l#FK">Foreign Key</a></li>
</ul>
<h3><a id="CK" name="CK"></a><br />
Check Constraints</h3>
<p>A check constraint allows you to define a function which determines whether          the data is allowable or not.</p>
<p>Example: Let&#8217;s add a check constraint to employees.surname  (table Employees, column Surname)<br />
which will only allow characters to be entered in upper case:</p>
<div id="textbox">
<div>SQL&gt; alter table employees add constraint ch_employees check (surname = upper(surname));</div>
</div>
<p>If you try to add a surname in lower case , you will receive the following        error:</p>
<div id="textbox">
<div>SQL&amp;gtinsert into employees (surname) values (&#8217;jones&#8217;)</p>
<p>ORA-02290: check constraint (CH_EMPLOYEES) violated</p></div>
</div>
<p>Now let&#8217;s add it the proper way:</p>
<div id="textbox">
<div>SQL&gt; insert into employees (surname) values (&#8217;JONES&#8217;);</p>
<p>1 row created.</p></div>
</div>
<h3><a id="NK" name="NK"></a><br />
Not-Null Constraints</h3>
<p>This simple constraint determines whether your column is allowed to contain    null data.<br />
By default, a column can contain null data, unless you add a not-null constraint.</p>
<p>Example :  Let&#8217;s add a not-null constraint to Employees.Surname</p>
<div id="textbox">
<div>SQL&gt;alter table employees modify (surname not null);</div>
</div>
<p>Now try to insert a null value.</p>
<div id="textbox">
<div>SQL&gt; insert into employees (surname) values (null);</p>
<p>ORA-01400: cannot insert NULL into (&#8221;EMPLOYEES&#8221;.&#8221;SURNAME&#8221;)</p></div>
</div>
<h3><a id="UK" name="UK"></a><br />
Unique Constraints</h3>
<p>These constraints enforce uniqueness in your column&#8217;s data : it will stop duplicated    data from being inserted.</p>
<p>Example:</p>
<div id="textbox">
<div>SQL&gt; alter table employees add constraint u_employees unique enable validate;</div>
</div>
<p>We know there is already an entry named &#8216;JONES&#8217; in the table, so let&#8217;s see    what happens when we try to insert it again:</p>
<div id="textbox">
<div>SQL&gt; insert into employees (surname) values (&#8217;JONES&#8217;);</p>
<p>ORA-00001: unique constraint (U_EMPLOYEES) violated</p></div>
</div>
<h3><a id="PK" name="PK"></a><br />
Primary Key Constraints</h3>
<p>A primary key constraint is a combination of a unique <em>and</em> a not-null constraint.<br />
It allows you to use a column in your table to uniquely identify each row by your predetermined key.<br />
Creating a primary key automatically creates a unique index of the same name on the table.<br />
This is how Oracle enforces the uniqueness.</p>
<p>Example: Before we can create a primary key, let&#8217;s drop the previous not-null and unique key constraints.</p>
<div id="textbox">
<div>SQL&gt; alter table employees modify(surname  null);</p>
<p>SQL&gt; alter table employees  drop constraint u_employees;</p>
<p>SQL&gt; alter table employees add constraint pk_employee primary key (surname);</p></div>
</div>
<p>Either inserting a pre-existing surname or attempting to insert a null value into the surname column<br />
will now result in an error.</p>
<div id="textbox">
<div>SQL&gt; insert into employees (surname) values (&#8217;JONES&#8217;);</p>
<p>ORA-00001: unique constraint (PK_EMPLOYEES) violated</p>
<p>SQL&gt; insert into employees (surname) values (null);</p>
<p>ORA-01400: cannot insert NULL into (&#8221;EMPLOYEES&#8221;.&#8221;SURNAME&#8221;)</p></div>
</div>
<h3><a id="FK" name="FK"></a><br />
Foreign Key Constraints</h3>
<p>Another name for these is relational integrity constraints.<br />
They enforce logical relationships between parent and child tables.</p>
<p>Let&#8217;s use a geographical example.</p>
<p>We have a parent table called Countries and a child table called Cities.<br />
A row in the Cities table must be able to find its parent Country in the Countries table<br />
before you are allowed to  insert the City.</p>
<p>Parent table <em>Countries</em> :</p>
<table border="1" cellspacing="0" cellpadding="0" width="203">
<tbody>
<tr>
<td width="64">CountryID</td>
<td width="133">CountryName</td>
</tr>
<tr>
<td>1</td>
<td>UK</td>
</tr>
<tr>
<td>2</td>
<td>USA</td>
</tr>
<tr>
<td>3</td>
<td>INDIA</td>
</tr>
</tbody>
</table>
<p>Child table <em>Cities</em>:</p>
<table border="1" cellspacing="0" cellpadding="0" width="294">
<tbody>
<tr>
<td width="80">CityID</td>
<td width="108">CityName</td>
<td width="98">CountryID</td>
</tr>
<tr>
<td>M00001</td>
<td>MADRAS</td>
<td>3</td>
</tr>
<tr>
<td>F00001</td>
<td>FARMINGTON</td>
<td>2</td>
</tr>
<tr>
<td>B00001</td>
<td>BOISE</td>
<td>2</td>
</tr>
<tr>
<td>L00001</td>
<td>LONDON</td>
<td>1</td>
</tr>
<tr>
<td>B00002</td>
<td>BANGALORE</td>
<td>3</td>
</tr>
</tbody>
</table>
<p>To implement this is slightly more complicated than the other constraints:<br />
First you create the primary key on the parent table:</p>
<div id="textbox">
<div>SQL&gt; alter table countries add constraint pk_countries  primary key (countryid);</div>
</div>
<p>Now we create the foreign key constraint on the child table which references the primary key on the parent table:</p>
<div id="textbox">
<div>SQL&gt; alter table cities add constraint fk_cities foreign key (countryid) references countries (countryid);</div>
</div>
<p>Time to test:  let&#8217;s try to add a row in Cities with a non-existent Countryid.</p>
<div id="textbox">
<div>SQL&gt; insert into cities (cityid, cityname, countryid) values (&#8217;M00002&#8242;,&#8217;MELBOURNE&#8217;,5);</p>
<p>ORA-02291: integrity constraint (FK_CITIES) violated - parent key not found</p></div>
</div>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14220%2Fintro.htm%23sthref227&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fforeign_key.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/intro.htm#sthref227" target="_blank">Oracle online documentation: Database Concepts</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/TJCU5VkDUAo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/foreign-key-constraints-and-other-type-of-constraints-in-an-oracle-database/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/foreign-key-constraints-and-other-type-of-constraints-in-an-oracle-database</feedburner:origLink></item>
		<item>
		<title>Oracle Functions</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/qGm8jJC8pTc/oracle-functions</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-functions#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:13:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[function syntax]]></category>

		<category><![CDATA[oracle functions]]></category>

		<category><![CDATA[sql functions]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=77</guid>
		<description><![CDATA[Oracle Functions explained]]></description>
			<content:encoded><![CDATA[<p>Oracle functions are very handy utilities to help you massage a result set to conform to your requirements, 		whether you are selecting, inserting, deleting or updating.</p>
<p>Below is a list of some commonly used sql functions, with an example of        each:</p>
<ul class="medium">
<li><a href="#01">add_months</a></li>
<li><a href="#02">avg</a></li>
<li><a href="#03">ceil</a></li>
<li><a href="#04">chr</a></li>
<li><a href="#05">concat</a></li>
<li><a href="#06">count </a></li>
<li><a href="#07">decode</a></li>
<li><a href="#08">dump</a></li>
<li><a href="#10">floor</a></li>
<li><a href="#11">greatest</a></li>
<li><a href="#12">initcap</a></li>
<li><a href="#13">instr</a></li>
<li><a href="#15">last_day</a></li>
<li><a href="#16">least</a></li>
<li><a href="#17">length</a></li>
<li><a href="#18">lower</a></li>
<li><a href="#19">lpad</a></li>
<li><a href="#20">ltrim</a></li>
<li><a href="#21">max</a></li>
<li><a href="#22">min</a></li>
<li><a href="#22a">mod</a></li>
<li><a href="#23">months_between</a></li>
<li><a href="#24">next_day</a></li>
<li><a href="#25">nullif</a></li>
<li><a href="#26">nvl</a></li>
<li><a href="#27">nvl2</a></li>
<li><a href="#29">replace</a></li>
<li><a href="#30">round </a></li>
<li><a href="#31">rpad</a></li>
<li><a href="#32">rtrim</a></li>
<li><a href="#33">sqrt</a></li>
<li><a href="#34">substr</a></li>
<li><a href="#35">sum</a></li>
<li><a href="#35a">sysdate</a></li>
<li><a href="#36">to_char </a></li>
<li><a href="#37">to_date</a></li>
<li><a href="#38">to_number</a></li>
<li><a href="#39">translate</a></li>
<li><a href="#40">trim</a></li>
<li><a href="#41">trunc </a></li>
<li><a href="#42">upper</a></li>
</ul>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="01" name="01"></a><br />
add_months</h3>
<p>Returns the supplied date with the requested number of months added to it.<br />
If the supplied date has a day value which is larger than the maximum number of days<br />
in the resulting month, the result is the last day of that month.</p>
<div id="textbox">
<div>SQL&gt; select sysdate from dual;</p>
<p>SYSDATE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
25-dec-2007 23:41:50</p>
<p>SQL&gt; select add_months(sysdate,1) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
25-jan-2008 23:41:52</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="02" name="02"></a><br />
avg</h3>
<p>Returns the average of a series of numbers.</p>
<div id="textbox">
<div>SQL&gt; select salary from employees;</p>
<p>SALARY<br />
&#8212;&#8212;&#8212;-<br />
20000<br />
30000<br />
30000<br />
10000</p>
<p>SQL&gt; select avg(salary) &#8220;result&#8221;  from employees;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
22500</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="03" name="03"></a><br />
ceil</h3>
<p>Returns the smallest integer larger than the supplied argument.<br />
Opposite of sql function: <a href="#10">floor</a>.</p>
<div id="textbox">
<div>SQL&gt; select 99.5, ceil(99.5) &#8220;result&#8221; from dual;</p>
<p>99.5     result<br />
&#8212;- &#8212;&#8212;&#8212;-<br />
99.5        100</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="04" name="04"></a><br />
chr</h3>
<p>Returns the character equivalent of the supplied integer.</p>
<div id="textbox">
<div>SQL&gt; select chr(79)||chr(82)||chr(65)||chr(67)||chr(76)||chr(69) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
ORACLE</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="05" name="05"></a><br />
concat</h3>
<p>Returns the first argument concatenated with the second argument.<br />
The result&#8217;s dataype will depend on the datatype of the arguments.<br />
I prefer to use the two pipe symbols (||) to concatenate.</p>
<div id="textbox">
<div>SQL&gt; select concat(&#8217;data&#8217;,'base&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
database</p>
<p>SQL&gt; select &#8216;data&#8217;||&#8217;base&#8217; &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
database</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="06" name="06"></a><br />
count</h3>
<p>Returns the number of rows as requested by the query, either all rows or only distinct values.<br />
By specifying *, it will return all rows including duplicates and nulls.<br />
If no rows match your query, count will return 0. (never null)</p>
<div id="textbox">
<div>SQL&gt; select count(*) &#8220;result&#8221; from emp;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
14</p>
<p>SQL&gt; select job &#8220;result&#8221; from emp;</p>
<p>result<br />
&#8212;&#8212;&#8212;<br />
CLERK<br />
SALESMAN<br />
SALESMAN<br />
MANAGER<br />
SALESMAN<br />
MANAGER<br />
MANAGER<br />
ANALYST<br />
PRESIDENT<br />
SALESMAN<br />
CLERK<br />
CLERK<br />
ANALYST<br />
CLERK</p>
<p>14 rows selected.</p>
<p>SQL&gt; select count(distinct job) &#8220;result&#8221; from emp ;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
5</p>
<p>SQL&gt; select count(*) &#8220;result&#8221; from emp where job = &#8216;VP&#8217;;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
0</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="07" name="07"></a><br />
decode</h3>
<p>The oracle decode function takes up to 255 argument sets and returns the relevant result depending on the value found.<br />
This is similar to the &#8216;case&#8217; statement in other languages.<br />
The last argument is what will be returned if no match is found in the decode statement.</p>
<div id="textbox">
<div>SQL&gt; select deptno &#8220;dn&#8221; , decode(deptno,10,&#8217;ten&#8217;,20,&#8217;twenty&#8217;,30,&#8217;thirty&#8217;,'other&#8217;) &#8220;result&#8221; from dept;</p>
<p>dn result<br />
&#8211; &#8212;&#8212;<br />
10    ten<br />
20    twenty<br />
30    thirty<br />
40    other</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="08" name="08"></a><br />
dump</h3>
<p>Returns a  string  representing the argument&#8217;s datatype code, byte length and internal representation.<br />
Very handy command if you are hunting for unexpected or hidden characters in your data.</p>
<div id="textbox">
<div>SQL&gt; select dump(&#8217;cat&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Typ=96 Len=3: 99,97,116</p>
<p>SQL&gt; select dump(&#8217;cat &#8216;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Typ=96 Len=4: 99,97,116,32</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="10" name="10"></a><br />
floor</h3>
<p>Returns an integer equal to or 1 less than the argument.<br />
Opposite of oracle function : <a href="#03">ceil</a>.</p>
<div id="textbox">
<div>SQL&gt; select 99.5, floor(99.5) &#8220;result&#8221; from dual;</p>
<p>99.5     result<br />
&#8212;- &#8212;&#8212;&#8212;-<br />
99.5         99</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="11" name="11"></a><br />
greatest</h3>
<p>Returns greatest ranking argument out of a list of arguments.<br />
The ranking is determined by the value of the numerical codes of the whole character string.<br />
Opposite of oracle function : <a href="#16">least</a>.</p>
<div id="textbox">
<div>SQL&gt; select greatest(&#8217;oracle&#8217;,'oracle10G&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;<br />
oracle10G</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="12" name="12"></a><br />
initcap</h3>
<p>Returns the string with each word&#8217;s first letter capitalized.<br />
Similar to oracle functions : <a href="#18">lower</a> and <a href="#42">upper</a></p>
<div id="textbox">
<div>SQL&gt; select initcap(&#8217;oracle database tips&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Oracle Database Tips</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="13" name="13"></a><br />
instr</h3>
<p>Returns the first position of a string inside another string.<br />
The 1st argument is the string to be searched.<br />
The 2nd argument specifies the character or string to search for.<br />
The 3rd argument allows you to specify from which character position to start searching.<br />
The 4th argument allows you to specify which occurence of the search string to return.</p>
<div id="textbox">
<div>SQL&gt; select instr(&#8217;package&#8217;,'a&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
2</p>
<p>SQL&gt; select instr(&#8217;package&#8217;,'a&#8217;,3,1) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
5</p>
<p>SQL&gt; select instr(&#8217;package&#8217;,'a&#8217;,1,2) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-</p>
<p>5</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="15" name="15"></a><br />
last_day</h3>
<p>Returns the last day&#8217;s date of the supplied date&#8217;s month.</p>
<div id="textbox">
<div>SQL&gt; select sysdate, last_day(sysdate) &#8220;result &#8221; from            dual;</p>
<p>SYSDATE                      result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;          &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
27-dec-2007 15:49:27   31-dec-2007 15:49:27</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="16" name="16"></a><br />
least</h3>
<p>Returns the least or smallest ranking argument out of a list of arguments.<br />
The ranking is determined by the value of the numerical codes of the whole character string.<br />
Opposite of oracle function : <a href="#11">greatest</a></p>
<div id="textbox">
<div>SQL&gt; select least(&#8217;oracle&#8217;,'oracle10G&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
oracle</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="17" name="17"></a><br />
length</h3>
<p>Returns the length (as an integer) of the supplied argument.</p>
<div id="textbox">
<div>SQL&gt; select length(&#8217;oracle database&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
15</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="18" name="18"></a><br />
lower</h3>
<p>Returns the argument in lower case.<br />
Similar to oracle functions : <a href="#42">upper</a> and <a href="#12">initcap</a></p>
<div id="textbox">
<div>SQL&gt; select lower(&#8217;ORACLE&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
oracle</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="19" name="19"></a><br />
lpad</h3>
<p>Returns the first argument, left-padded by the third argument, so that the complete string is as long as specified by the second argument.<br />
If you do not supply the third argument, blank spaces are used for padding.<br />
Similar to oracle function : <a href="#31">rpad</a></p>
<div id="textbox">
<div>SQL&gt; select lpad(&#8217;oracle&#8217;,10,&#8217;*') &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
****oracle</p>
<p>SQL&gt; select lpad(&#8217;oracle&#8217;,10) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
oracle</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="20" name="20"></a><br />
ltrim</h3>
<p>Removes the second argument from the first argument.<br />
If you do not supply the second argument, it will remove blank spaces.<br />
Similar to oracle function: <a href="#32">rtrim</a></p>
<div id="textbox">
<div>SQL&gt; select ltrim(&#8217;oracle database&#8217;,'orac&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
le database</p>
<p>SQL&gt; select ltrim(&#8217;    oracle&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
oracle</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="21" name="21"></a><br />
max</h3>
<p>Returns the largest of a series of numbers.<br />
Similar to oracle function :  <a href="#22">min</a></p>
<div id="textbox">
<div>SQL&gt; select grade from salgrade;</p>
<p>GRADE<br />
&#8212;&#8212;&#8212;-<br />
1<br />
2<br />
3<br />
4<br />
5</p>
<p>SQL&gt; select max(grade) &#8220;result&#8221; from salgrade;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
5</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="22" name="22"></a><br />
min</h3>
<p>Returns the smallest in a series of numbers.<br />
Similar to oracle function : <a href="#21">max</a></p>
<div id="textbox">
<div>SQL&gt; select grade from salgrade;</p>
<p>GRADE<br />
&#8212;&#8212;&#8212;-<br />
1<br />
2<br />
3<br />
4<br />
5</p>
<p>SQL&gt; select min(grade) &#8220;result&#8221; from salgrade;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
1</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="22a" name="22a"></a><br />
mod</h3>
<p>Returns the remainder of the first argument divided by the second argument.<br />
The result is <a href="#10">floor</a>-ed.</p>
<div id="textbox">
<div>SQL&gt; select mod(222,23) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
15</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="23" name="23"></a><br />
months_between</h3>
<p>This date-oriented oracle function returns the number of months between two dates as a fraction.</p>
<div id="textbox">
<div>SQL&gt; select months_between(sysdate+320 ,sysdate) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
10.483871</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="24" name="24"></a><br />
next_day</h3>
<p>Returns date of the day of the week (supplied as the second argument) after the date of the first argument.<br />
The second argument is specified as the name of a weekday.</p>
<div id="textbox">
<div>SQL&gt; select next_day(&#8217;01-JAN-2008&#8242;,&#8217;SUNDAY&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
06-jan-2008 00:00:00</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="25" name="25"></a><br />
nullif</h3>
<p>Returns null if the first and second argument are equal, if they are unequal, it will return the first argument.</p>
<div id="textbox">
<div>SQL&gt; select nullif(1,1) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-</p>
<p>SQL&gt; select nullif(1,2) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
1</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="26" name="26"></a><br />
nvl</h3>
<p>Returns the second argument if the first argument is null.<br />
Otherwise, the first argument is returned.<br />
Similar to oracle function : <a href="#27">nvl2</a></p>
<div id="textbox">
<div>SQL&gt; select nvl(null,&#8217;no value&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
no value</p>
<p>SQL&gt; select nvl(&#8217;some value&#8217;,'no value&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
some value</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="27" name="27"></a><br />
nvl2</h3>
<p>This function is an extension to nvl by allowing you to specify a value to return if the argument to be checked is null.<br />
So, nvl2 will return the third argument if the first argument is null and will return the second argument if the first argument is not null.<br />
Similar to oracle function : <a href="#26">nvl</a></p>
<div id="textbox">
<div>SQL&gt; select nvl2(null,&#8217;has value&#8217;,'no value&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
no value</p>
<p>SQL&gt; select nvl2(&#8217;some value&#8217;,'has value&#8217;,'no value&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;<br />
has value</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="29" name="29"></a><br />
replace</h3>
<p>Returns the first argument with every occurence of the second argument replaced with the third argument.<br />
If the third argument is left out, the second argument is removed from the first argument.<br />
If the second argument is null, then the first argument is returned unmodified.</p>
<div id="textbox">
<div>SQL&gt; select replace(&#8217;down in the creek&#8217;,'down in&#8217;,'up&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;<br />
up the creek</p>
<p>SQL&gt; select replace(&#8217;down in the creek&#8217;,'down in&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
the creek</p>
<p>SQL&gt; select replace(&#8217;down in the creek&#8217;,null,&#8217;up&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
down in the creek</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="30" name="30"></a><br />
round (number)</h3>
<p>Returns the first argument rounded to the number of places after the decimal point as specified by the second argument.<br />
If the second argument is not specified, then the first argument is rounded to 0 places after the decimal point.<br />
If the result is n.5, round will round up to the next integer, if the result is -n.5, it will round down to the next integer.</p>
<div id="textbox">
<div>SQL&gt; select round(8.345,2) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
8.35</p>
<p>SQL&gt; select round(8.345) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
8</p>
<p>SQL&gt; select round(8.5) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
9</p>
<p>SQL&gt; select round(-8.5) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
-9</p></div>
</div>
<h3>
round (date)</h3>
<p>This will always return a date.<br />
The format of the second argument determines the timeperiod it will round to, like YEAR, MONTH, DAY, HH and MI.<br />
If you do not specify a second argument, the format defaults to day.</p>
<div id="textbox">
<div>SQL&gt; select sysdate &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
04-jan-2008 15:34:19</p>
<p>SQL&gt; select round(sysdate) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
05-jan-2008 00:00:00</p>
<p>SQL&gt; select round(sysdate,&#8217;YYYY&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
01-jan-2008 00:00:00</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="31" name="31"></a><br />
rpad</h3>
<p>Returns the first argument, right-padded by the third argument, so that the complete string is as long as specified by the second argument.<br />
If you do not supply the third argument, blank spaces are used for padding.<br />
Similar to oracle function : <a href="#19">lpad</a></p>
<div id="textbox">
<div>SQL&gt; select rpad(&#8217;star status &#8216;,15,&#8217;*') &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;<br />
star status ***</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="32" name="32"></a><br />
rtrim</h3>
<p>Removes the second argument from the first argument.<br />
If you do not supply the second argument, it will remove blank spaces.<br />
Similar to oracle function : <a href="#20">ltrim</a></p>
<div id="textbox">
<div>SQL&gt; select rtrim(&#8217;oracle***&#8217;,'*&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;<br />
oracle</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="33" name="33"></a><br />
sqrt</h3>
<p>Returns the square root of the argument.</p>
<div id="textbox">
<div>SQL&gt; select sqrt(16) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
4</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="34" name="34"></a><br />
substr</h3>
<p>This very useful sql function returns the part of the first argument, determined by what you specify as the second and third arguments.<br />
The second argument tells Oracle from which character position to start counting.<br />
It can contain a positive or negative value.<br />
The third argument determines the number of characters to select.<br />
If you do not supply this argument, all characters until the end are selected.</p>
<p>Read up more about this very useful oracle function :<br />
<a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Ffunctions162.htm%23i87066&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_functions.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions162.htm#i87066" target="_blank">Oracle          online documentation : SQL Reference, substr</a></p>
<div id="textbox">
<div>SQL&gt; select substr(&#8217;oracle functions&#8217;,8,8) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;-<br />
function</p>
<p>SQL&gt; select substr(&#8217;oracle functions&#8217;,8) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
functions</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="35" name="35"></a><br />
sum</h3>
<p>Returns the sum of a range of numbers.</p>
<div id="textbox">
<div>SQL&gt; select sal from emp;</p>
<p>SAL<br />
&#8212;&#8212;&#8212;-<br />
800<br />
1600<br />
1250<br />
2975<br />
1250<br />
2850<br />
2450<br />
3000<br />
5000<br />
1500<br />
1100<br />
950<br />
3000<br />
1300</p>
<p>14 rows selected.</p>
<p>SQL&gt; select sum(sal) &#8220;result&#8221; from emp;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
29025</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="35a" name="35a"></a><br />
sysdate</h3>
<p>Returns the current date and time of the local database server&#8217;s operating system.<br />
You will see the date format as it is specified by the NLS_DATE_FORMAT<br />
database initialization parameter.<br />
You can set NLS_DATE_FORMAT for your session to overwrite the database&#8217;s default value.<br />
Alternatively, you can convert sysdate to a character datatype using the <a href="#36">to_char</a> function.</p>
<div id="textbox">
<div>SQL&gt; select sysdate &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
05-jan-2008 16:57:11</p>
<p>SQL&gt; alter session set nls_date_format=&#8217;dd/mm/yyyy hh24-mi&#8217;;</p>
<p>Session altered.</p>
<p>SQL&gt; select sysdate &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
05/01/2008 16-58</p>
<p>SQL&gt; select to_char(sysdate,&#8217;dd/mon/yyyy hh24:mi:ss&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
05/jan/2008 16:58:36</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="36" name="36"></a><br />
to_char</h3>
<p>Converts the argument to a character datatype, using the format specified by the second argument.<br />
You can convert number, date and CLOB datatypes.</p>
<p>Read up more about format models here:<br />
<a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fsql_elements004.htm%23i34510&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_functions.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34510" target="_blank">Oracle          online documentation : SQL Reference, format models</a></p>
<div id="textbox">
<div>SQL&gt; select to_char(sal,&#8217;L99G999D99MI&#8217;) &#8220;result&#8221; from emp;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
$800.00<br />
$1,600.00<br />
$1,250.00<br />
$2,975.00<br />
$1,250.00<br />
$2,850.00<br />
$2,450.00<br />
$3,000.00<br />
$5,000.00<br />
$1,500.00<br />
$1,100.00<br />
$950.00<br />
$3,000.00<br />
$1,300.00</p>
<p>SQL&gt; select to_char(sysdate,&#8217;DD-MON-YYYY hh24:mi:ss&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
05-JAN-2008 16:42:27</p>
<p>select to_char(clob_column) &#8220;result&#8221; from large_table where itemno = 469;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed<br />
diam nonumy eirmod tempor invidunt ut labore et dolore magna<br />
aliquyam erat, sed diam voluptua. At vero eos et accusam et<br />
justo duo dolores et ea rebum. Stet clita kasd gubergren, no<br />
sea takimata sanctus est Lorem ipsum dolor sit amet.</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="37" name="37"></a><br />
to_date</h3>
<p>Converts a character string to a date datatype.<br />
If the character string is already in the default format, you do not need to specify a format as the second argument.<br />
The default format is specified by initialization parameter NLS_TERRITORY or can be set by NLS_DATE_FORMAT.</p>
<p>Read up more about format models here:<br />
<a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fsql_elements004.htm%23i34510&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_functions.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34510" target="_blank">Oracle          online documentation : SQL Reference, oracle function format models</a></p>
<div id="textbox">
<div>SQL&gt; select * from nls_session_parameters where parameter = &#8216;NLS_DATE_FORMAT&#8217;;</p>
<p>PARAMETER                VALUE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
NLS_DATE_FORMAT     dd-mon-yyyy</p>
<p>SQL&gt; select to_date(&#8217;01-jan-2008&#8242;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
01-jan-2008</p>
<p>SQL&gt; select to_date(&#8217;01/01/2008&#8242;) &#8220;result&#8221; from dual;<br />
select to_date(&#8217;01/01/2008&#8242;) &#8220;result&#8221; from dual<br />
*<br />
ERROR at line 1:<br />
ORA-01843: not a valid month</p>
<p>SQL&gt; select to_date(&#8217;01/01/2008&#8242;,&#8217;DD/MM/YYYY&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
01-jan-2008</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="38" name="38"></a><br />
to_number</h3>
<p>Converts a character datatype to a number datatype<br />
The second argument supplies the format needed to do the conversion.</p>
<p>Read up more about format models here:<br />
<a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fsql_elements004.htm%23i34510&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_functions.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements004.htm#i34510" target="_blank">Oracle          online documentation : SQL Reference, format models</a></p>
<div id="textbox">
<div>SQL&gt; select to_number(&#8217;$800.00&#8242;,&#8217;L9G999D99&#8242;) &#8220;result&#8221;  from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
800</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="39" name="39"></a><br />
translate</h3>
<p>Returns a string which replaces all occurences of the characters in the second argument<br />
with the characters of the third argument.<br />
If the second argument contains more characters than the third argument,<br />
the extra characters are removed from the result.</p>
<div id="textbox">
<div>SQL&gt; select translate(&#8217;November&#8217;,'Nov&#8217;,'Dec&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
December</p>
<p>SQL&gt; select translate(&#8217;September&#8217;,'Sept&#8217;,'Dec&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8211;<br />
December</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="40" name="40"></a><br />
trim</h3>
<p>Returns the third argument with the leading, ending or both sides of the argument&#8217;s characters trimmed.<br />
The first argument specifies which side to trim from.<br />
Values can be &#8216;LEADING&#8217;,'TRAILING&#8217; or &#8216;BOTH&#8217;.<br />
If null, both sides are trimmed.<br />
The second argument specifies which character to trim. If null, blanks are assumed.<br />
The third argument takes the form : FROM &lt; source &gt; which can be a column name.</p>
<div id="textbox">
<div>SQL&gt; select ename from emp where ename = &#8216;FORD&#8217;;</p>
<p>ENAME<br />
&#8212;&#8212;&#8212;-<br />
FORD</p>
<p>SQL&gt; select trim(leading &#8216;F&#8217; from ename) &#8220;result&#8221; from emp where ename = &#8216;FORD&#8217;;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
ORD</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="41" name="41"></a><br />
trunc(number)</h3>
<p>Returns the first argument truncated to the number of decimal places determined by the second argument.<br />
If the second argument is not specified, Oracle assumes 0.</p>
<div id="textbox">
<div>SQL&gt; select trunc(18.456,2) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
18.45</p>
<p>SQL&gt; select trunc(18.456) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;-<br />
18</p></div>
</div>
<h3><a id="41" name="41"></a><br />
trunc(date)</h3>
<p>Returns the date truncated to the day specified by the second argument&#8217;s format.<br />
The format of the second argument determines the timeperiod it will truncate to, like YEAR, MONTH, DAY, HH and MI.<br />
If you do not specify a second argument, the format defaults to DAY.</p>
<div id="textbox">
<div>SQL&gt; select sysdate &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
05-jan-2008</p>
<p>SQL&gt; select trunc(sysdate,&#8217;YEAR&#8217;) &#8220;result&#8221; from dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8211;<br />
01-jan-2008</p></div>
</div>
<div><a href="#" target="_top">top of page</a></div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<h3><a id="42" name="42"></a><br />
upper</h3>
<p>Returns the argument with all characters in upper case.<br />
Similar to oracle functions : <a href="#18">lower</a> and <a href="#12">initcap</a></p>
<div id="textbox">
<div>SQL&gt; select upper(&#8217;oracle functions&#8217;) &#8220;result&#8221; from            dual;</p>
<p>result<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
ORACLE FUNCTIONS</p></div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<p><!--  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  --></p>
<h3>Recommended reading for more information on oracle functions :</h3>
<p><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Ffunctions.htm%23i1482196&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_functions.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions.htm#i1482196" target="_blank">Oracle          online documentation: SQL Reference</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/qGm8jJC8pTc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-functions/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-functions</feedburner:origLink></item>
		<item>
		<title>Oracle Subquery</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/OkFCX6Y9m0g/oracle-subquery</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-subquery#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:07:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[oracle subquery]]></category>

		<category><![CDATA[subquery syntax]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=74</guid>
		<description><![CDATA[Oracle Subquery syntax and examples]]></description>
			<content:encoded><![CDATA[<p><strong>Contents</strong></p>
<ul>
<li><a href="#0">Definition</a></li>
<li><a href="#1">Simple subquery</a></li>
<li><a href="#correlated">Correlated subquery</a></li>
<li><a href="#update">Update with correlated subquery</a></li>
<li><a href="#delete">Delete with correlated subquery</a></li>
</ul>
<p><a id="0" name="0"></a><br />
<strong>Definition</strong></p>
<p>A subquery is basically a select clause which is used instead of another statement.</p>
<p>For example : Have a look at the following 2 tables : DEPT and EMP</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL&gt; select empno,ename,job,sal,deptno from emp;

     EMPNO ENAME      JOB              SAL     DEPTNO
---------- ---------- --------- ---------- ----------
      7369 SMITH      CLERK            800         20
      7499 ALLEN      SALESMAN        1600         30
      7521 WARD       SALESMAN        1250         30
      7566 JONES      MANAGER         2975         20
      7654 MARTIN     SALESMAN        1250         30
      7698 BLAKE      MANAGER         2850         30
      7782 CLARK      MANAGER         2450         10
      7788 SCOTT      ANALYST         3000         20
      7839 KING       PRESIDENT       5000         10
      7844 TURNER     SALESMAN        1500         30
      7876 ADAMS      CLERK           1100         20
      7900 JAMES      CLERK            950         30
      7902 FORD       ANALYST         3000         20
      7934 MILLER     CLERK           1300         10

14 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><a id="1" name="1"></a><br />
<strong>Simple Oracle subquery</strong></p>
<p>A simple subquery is evaluated once for each table.</p>
<p>You would like to select all employees whose department is located in Chicago.</p>
<p>A join would be a better solution for this select,<br />
but for the purposes of illustration we will use a subquery.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">
SQL&gt; select empno,ename,job,sal,deptno from emp where
     deptno in (select deptno from dept
	 where loc = 'CHICAGO');

     EMPNO ENAME      JOB              SAL     DEPTNO
---------- ---------- --------- ---------- ----------
      7900 JAMES      CLERK            950         30
      7844 TURNER     SALESMAN        1500         30
      7698 BLAKE      MANAGER         2850         30
      7654 MARTIN     SALESMAN        1250         30
      7521 WARD       SALESMAN        1250         30
      7499 ALLEN      SALESMAN        1600         30

6 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
You can use a subquery in the place of a table name in the &#8216;from&#8217; clause.</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; Select ename, deptno from
     (select ename, deptno from emp
	 where job = 'CLERK' )
     where
     deptno &gt; 20;

ENAME          DEPTNO
---------- ----------
JAMES              30</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
You can even replace a column name with a subquery:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select ename,
            (select max(sal) from emp) "maxsal" ,
            sal,
            ((select max(sal) from emp ) - sal )
			"difference"  from emp;

ENAME          maxsal        SAL difference
---------- ---------- ---------- ----------
SMITH            5000        800       4200
ALLEN            5000       1600       3400
WARD             5000       1250       3750
JONES            5000       2975       2025
MARTIN           5000       1250       3750
BLAKE            5000       2850       2150
CLARK            5000       2450       2550
SCOTT            5000       3000       2000
KING             5000       5000          0
TURNER           5000       1500       3500
ADAMS            5000       1100       3900
JAMES            5000        950       4050
FORD             5000       3000       2000
MILLER           5000       1300       3700

14 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
<a id="correlated" name="correlated"></a><br />
<strong>Correlated Oracle subquery</strong></p>
<p>A correlated Oracle subquery is evaluated once FOR EACH ROW as opposed to a normal subquery which is evaluated only once for each table.</p>
<p>You can reference the outer query inside the correlated subquery using an alias which makes it so handy to use.</p>
<p>Let&#8217;s select all employees whose salary is less than the average of all the employees&#8217; salaries in the same department.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select ename ,sal ,deptno from emp a where
     a.sal &lt; (select avg(sal) from emp b
	           where a.deptno = b.deptno)
     order by deptno;

ENAME             SAL     DEPTNO
---------- ---------- ----------
CLARK            2450         10
MILLER           1300         10
SMITH             800         20
ADAMS            1100         20
WARD             1250         30
MARTIN           1250         30
TURNER           1500         30
JAMES             950         30

8 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
<a id="update" name="update"></a><br />
<strong>Using a correlated subquery in an update</strong></p>
<p>Let&#8217;s give these people (whose salary is less than their department&#8217;s average)  a raise.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">
SQL&gt; select ename, sal, deptno  from emp
     order by deptno, ename;

ENAME             SAL     DEPTNO
---------- ---------- ----------
CLARK            2450         10
KING             5000         10
MILLER           1300         10
ADAMS            1100         20
FORD             3000         20
JONES            2975         20
SCOTT            3000         20
SMITH             800         20
ALLEN            1600         30
BLAKE            2850         30
JAMES             950         30
MARTIN           1250         30
TURNER           1500         30
WARD             1250         30

14 rows selected.

SQL&gt;  UPDATE emp a
      set sal = (select avg(sal)
                from emp b
	        where
	        a.deptno = b.deptno)
      where sal &lt;
	   (select avg(sal) from emp c
	   where a.deptno = c.deptno);

8 rows updated.

SQL&gt; select ename, sal, deptno  from emp
     order by deptno, ename;

ENAME             SAL     DEPTNO
---------- ---------- ----------
CLARK         2916.67         10
KING             5000         10
MILLER        2916.67         10
ADAMS            2175         20
FORD             3000         20
JONES            2975         20
SCOTT            3000         20
SMITH            2175         20
ALLEN            1600         30
BLAKE            2850         30
JAMES         1566.67         30
MARTIN        1566.67         30
TURNER        1566.67         30
WARD          1566.67         30

14 rows selected.

SQL&gt; commit;

Commit complete.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><a id="delete" name="delete"></a><br />
<strong>Using a correlated subquery in a delete</strong></p>
<p>Let&#8217;s delete the highest earning employees in each department.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">
SQL&gt;  delete from emp a where
      a.sal = (select max(sal) from emp b
	  where a.deptno = b.deptno);

4 rows deleted.

SQL&gt; select ename, sal, deptno  from emp
     order by deptno, ename;

ENAME             SAL     DEPTNO
---------- ---------- ----------
CLARK         2916.67         10
MILLER        2916.67         10
ADAMS            2175         20
JONES            2975         20
SMITH            2175         20
ALLEN            1600         30
JAMES         1566.67         30
MARTIN        1566.67         30
TURNER        1566.67         30
WARD          1566.67         30

10 rows selected.

SQL&gt; commit;

Commit complete.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
Lastly: do not forget to commit to make your changes permanent when using the oracle subquery statement.<br />
<!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fappdev.102%2Fb14261%2Fsqloperations.htm%23i3317&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_subquery.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i3317" target="_blank">Oracle Online Documentation: SQL Reference, Using Subqueries</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/OkFCX6Y9m0g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-subquery/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-subquery</feedburner:origLink></item>
		<item>
		<title>Oracle Delete syntax</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/tqdMFEyjzNg/oracle-delete-syntax</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:03:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[delete syntax]]></category>

		<category><![CDATA[oracle delete]]></category>

		<category><![CDATA[sql delete]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=72</guid>
		<description><![CDATA[The Oracle Delete statement allows you to remove rows from a table.]]></description>
			<content:encoded><![CDATA[<p>Always test these &#8216;oracle delete&#8217; commands on a test server<br />
before implementing them on a production server.</p>
<p>The Oracle Delete statement allows you to remove rows from a table.</p>
<p>The syntax is : delete from<br />
(where );</p>
<p>If you specify the delete statement without the where clause, you will delete all rows from a table.</p>
<p>Specifying the where clause will restrict the deletion to the rows which match the restriction clause.</p>
<p>Here is the sample table:</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
70 CALLCENTRE<br />
80 SUPPORT        NONE<br />
90                BOISE<br />
91 SHIPPING       DETROIT<br />
92 FINANCE        DETROIT</p>
<p>11 rows selected.</p>
<p>Let&#8217;s delete all rows that are located in Detroit.</p>
<p>SQL&gt; delete from dept where loc = &#8216;DETROIT&#8217;;</p>
<p>2 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
70 CALLCENTRE<br />
80 SUPPORT        NONE<br />
90                BOISE</p>
<p>9 rows selected.</p>
<p>Now let&#8217;s select all rows that have a null value in either the dname column or the deptno column.</p>
<p>SQL&gt; delete from dept where dname is null or loc is null;</p>
<p>2 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
10 ACCOUNTING     NEW YORK<br />
20 RESEARCH       DALLAS<br />
30 SALES          CHICAGO<br />
40 OPERATIONS     BOSTON<br />
50 MARKETING      MELBOURNE<br />
60 IT             HARTORD<br />
80 SUPPORT        NONE</p>
<p>7 rows selected.</p>
<p>Now let&#8217;s delete all the remaining rows from this table:</p>
<p>SQL&gt; delete from dept;</p>
<p>7 rows deleted.</p>
<p>SQL&gt; select * from dept order by deptno;</p>
<p>no rows selected</p>
<p>Lastly: do not forget to commit to make your changes permanent after you use the Delete statement.</p>
<p>Recommended reading:</p>
<p><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_8005.htm%23i2117787&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_delete.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8005.htm#i2117787" target="_blank">Oracle Online Documentation: SQL Reference, Delete statement</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/tqdMFEyjzNg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-delete-syntax</feedburner:origLink></item>
		<item>
		<title>Oracle Update syntax</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/G_tYgOPkpuU/oracle-update-syntax</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-update-syntax#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:02:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[oracle update]]></category>

		<category><![CDATA[sql update]]></category>

		<category><![CDATA[update syntax]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=70</guid>
		<description><![CDATA[Look at these examples of the Oracle SQL Update statement]]></description>
			<content:encoded><![CDATA[<p>The Oracle update statement allows you to change the data inside a table.</p>
<p>Syntax</p>
<p>update<br />
<table_name> set <column list> = <value list> where <restriction clause>;</p>
<p>If you do not specify a where clause, all rows in the table will be updated.</p>
<p>Permissions<br />
You must have update privileges to update another schema&#8217;s table.</p>
<p>If you want to update through a view, the view&#8217;s owner needs to have<br />
update permissions on the base table and you need update privileges on the view.</p>
<p>The &#8216;update any table&#8217; privilege sidesteps the 2 requirements above by combining them in one privilege.</p>
<p>Examples</p>
<p>Let&#8217;s use table SCOTT.DEPT as our example table.</p>
<p>DEPTNO 	DNAME 	LOC<br />
10 	ACCOUNTING 	NEW YORK<br />
20 	RESEARCH 	DALLAS<br />
30 	SALES 	CHICAGO<br />
40 	OPERATIONS 	BOSTON</p>
<p>DEPT contains 3 columns (deptno, dname and loc) and 4 rows.</p>
<p>SQL> select * from dept;</p>
<p>    DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
        10 ACCOUNTING     NEW YORK<br />
        20 RESEARCH       DALLAS<br />
        30 SALES          CHICAGO<br />
        40 OPERATIONS     BOSTON</p>
<p>I want to update the location for department &#8216;SALES&#8217; to &#8216;LONDON&#8217;.</p>
<p>SQL> update dept set loc = &#8216;LONDON&#8217;<br />
     where dname = &#8216;SALES&#8217;;</p>
<p>1 row updated.</p>
<p>SQL> commit;</p>
<p>Commit complete.</p>
<p>SQL> select * from dept;</p>
<p>    DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
        10 ACCOUNTING     NEW YORK<br />
        20 RESEARCH       DALLAS<br />
        30 SALES          LONDON<br />
        40 OPERATIONS     BOSTON</p>
<p>Let&#8217;s update 2 columns at the same time:</p>
<p>SQL> update dept set loc = &#8216;MIAMI&#8217;, deptno = 50<br />
     where dname = &#8216;SALES&#8217;;</p>
<p>1 row updated.</p>
<p>SQL> select * from dept;</p>
<p>    DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
        10 ACCOUNTING     NEW YORK<br />
        20 RESEARCH       DALLAS<br />
        50 SALES          MIAMI<br />
        40 OPERATIONS     BOSTON</p>
<p>SQL> commit;</p>
<p>Commit complete.</p>
<p>Let&#8217;s use a function to change the value of the location column:</p>
<p>SQL> update dept set loc = lower(loc) ;</p>
<p>4 rows updated.</p>
<p>SQL> commit;</p>
<p>Commit complete.</p>
<p>SQL> select * from dept;</p>
<p>    DEPTNO DNAME          LOC<br />
&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;-<br />
        10 ACCOUNTING     new york<br />
        20 RESEARCH       dallas<br />
        50 SALES          miami<br />
        40 OPERATIONS     boston</p>
<p>Lastly: do not forget to commit to make your changes permanent.</p>
<p>Recommended reading:</p>
<p># Oracle Online Documentation: SQL Reference, Update statement</p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/G_tYgOPkpuU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-update-syntax/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-update-syntax</feedburner:origLink></item>
		<item>
		<title>Oracle Insert</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/j153VvUFWzU/oracle-insert</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-insert#comments</comments>
		<pubDate>Fri, 23 Oct 2009 11:00:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[insert syntax]]></category>

		<category><![CDATA[oracle insert]]></category>

		<category><![CDATA[sql insert]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=68</guid>
		<description><![CDATA[The Oracle Insert statement allows you to add data to a table using the following syntax:]]></description>
			<content:encoded><![CDATA[<p><strong>Examples and explanation</strong></p>
<p>The Oracle Insert statement allows you to add data to a table.</p>
<p>Contents :</p>
<ul>
<li> <a href="#nocolumn"> Inserting without specifying column names</a></li>
<li><a href="#column"> Inserting by specifying column names</a></li>
<li> <a href="#default"> Insert a column&#8217;s default value</a></li>
<li> <a href="#null"> Inserting a null value</a></li>
<li> <a href="#subquery"> Inserting multiple rows by means of a subquery</a></li>
</ul>
<p>The syntax is : insert into &lt;table_name&gt; ( &lt;column list&gt;)          values (&lt;values list&gt;);</p>
<p>You do not have to specify the column names if your value list is in          the same order as the columns of the table, but it is best to always specify          the column names.</p>
<p><strong>Sample table for use in the Oracle Insert syntax tutorial:</strong><br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><a id="nocolumn" name="nocolumn"></a><strong>No column list</strong></p>
<p>When you do not specify the column list, you can use the <em>values</em> clause immediately after<br />
the <em>table</em> clause, but Oracle will expect the values to match the column datatypes,<br />
so you must make sure that the values are in the same order as the table&#8217;s columns.</p>
<p>To see what the order of a table&#8217;s columns is,<br />
use the &#8216;DESCRIBE&#8217; statement or its abbreviation &#8216;desc&#8217; :<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; describe dept
 Name                   Null?    Type
 ---------------------- -------- ---------------

 DEPTNO                          NUMBER(2)
 DNAME                           VARCHAR2(14)
 LOC                             VARCHAR2(13)</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; insert into dept values
     (50,'MARKETING','MELBOURNE');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><a id="column" name="column"></a><strong>Using a column list </strong><br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; insert into dept (deptno,dname,loc)
     values (60,'IT','HARTFORD');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE
        60 IT             HARTFORD

6 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Using a column list allows you to insert values for selected columns only:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; insert into dept (deptno,dname)
     values (70,'CALLCENTER');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE
        60 IT             HARTORD
        70 CALLCENTER

7 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="default" name="default"></a><strong>Default values</strong><br />
You can choose to insert a column&#8217;s default value like this:<br />
Let&#8217;s first change the DEPT table to have a default value of &#8216;NONE&#8217; for          the location column:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; alter table dept modify (loc default 'NONE');

Table altered.

SQL&gt; insert into dept (deptno,dname,loc)
     values (80,'SUPPORT',DEFAULT);

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE
        60 IT             HARTORD
        70 CALLCENTER
        80 SUPPORT        NONE

8 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="null" name="null"></a><strong>Inserting a null value</strong></p>
<p>Use the &#8216;null&#8217; identifier to insert a null value instead of a real value.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; insert into dept (deptno,dname,loc)
     values (90,NULL,'BOISE');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE
        60 IT             HARTORD
        70 CALLCENTER
        80 SUPPORT        NONE
        90                BOISE

9 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <a id="subquery" name="subquery"></a><strong>Inserting multiple rows by means of a subquery</strong></p>
<p>Instead of adding one row at a time, here is an example of inserting          a number of rows by using a subquery:</p>
<p>We have another table called DEPT_MERGE with the same table structure          as DEPT and with rows which need to be added to DEPT.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept_merge order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        91 SHIPPING       DETROIT
        92 FINANCE        DETROIT

SQL&gt; insert into dept
  2  (select * from dept_merge);

2 rows created.

SQL&gt; commit;

Commit complete.

SQL&gt; select * from dept order by deptno;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 MARKETING      MELBOURNE
        60 IT             HARTORD
        70 CALLCENTER
        80 SUPPORT        NONE
        90                BOISE
        91 SHIPPING       DETROIT
        92 FINANCE        DETROIT

11 rows selected.</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
Lastly: do not forget to commit to make your changes permanent after you use the Oracle Insert statement.</p>
<p><!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_9014.htm%23i2163698&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_insert.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#i2163698" target="_blank">Oracle Online Documentation: SQL Reference, Insert statement</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/j153VvUFWzU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-insert/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-insert</feedburner:origLink></item>
		<item>
		<title>Oracle SQL Select</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/0AJHDr4UGTs/oracle-sql-select</link>
		<comments>http://oracle-database-tips.com/wp/sql/oracle-sql-select#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:55:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[oracle select]]></category>

		<category><![CDATA[select syntax]]></category>

		<category><![CDATA[sql select]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=64</guid>
		<description><![CDATA[This tutorial will show you how to use the correct syntax to query data in the Oracle database.]]></description>
			<content:encoded><![CDATA[<h1></h1>
<h3>How to query the Oracle database</h3>
<p>Always test these &#8217;select&#8217; commands on a test server<br />
before implementing them on a production server.</p>
<p>This tutorial will show you how to use the correct syntax to query data          in the Oracle database.</p>
<p>When you query an object, you could be querying a table, a synonym or          a view,<br />
but this will make no difference to the syntax you need to use or to the          result you will obtain.</p>
<p>A table consists of a number of columns and rows and your query          will be built so that you decide which rows and which columns to return.</p>
<p>The simplified syntax for the queries we&#8217;ll be using in this          tutorial is as follows:</p>
<p>select &lt;column list&gt; from &lt;table&gt; where &lt;row criteria&gt;          ;</p>
<p>For example: (log in as scott/tiger)</p>
<p>Table DEPT looks like this :</p>
<table border="1" cellspacing="0" cellpadding="0" width="400">
<tbody>
<tr>
<td width="73"><strong>DEPTNO </strong></td>
<td width="62"><strong>DNAME </strong></td>
<td width="57"><strong>LOC</strong></td>
</tr>
<tr>
<td>10</td>
<td>ACCOUNTING</td>
<td>NEW YORK</td>
</tr>
<tr>
<td>20</td>
<td>RESEARCH</td>
<td>DALLAS</td>
</tr>
<tr>
<td>30</td>
<td>SALES</td>
<td>CHICAGO</td>
</tr>
<tr>
<td>40</td>
<td>OPERATIONS</td>
<td>BOSTON</td>
</tr>
</tbody>
</table>
<p>There are 3 columns : DEPTNO, DNAME and LOC<br />
There are 4 rows.</p>
<p><strong>Column criteria</strong></p>
<p>Let&#8217;s query all columns and all rows:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select deptno, dname, loc from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> Time saving tip: use * instead of the whole column list if you plan to          return each column<br />
in the table:</p>
<p>Let&#8217;s only query the Location column in the table.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select loc from dept;

LOC
-------------
NEW YORK
DALLAS
CHICAGO
BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->Now let&#8217;s query both the DNAME and LOC columns from this table:<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select dname, loc from dept;

DNAME          LOC
-------------- -------------
ACCOUNTING     NEW YORK
RESEARCH       DALLAS
SALES          CHICAGO
OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <strong>Row criteria</strong></p>
<p>To specify only a subset of rows to be returned,<br />
you will use the WHERE clause.</p>
<p>Let&#8217;s query only the rows in the dept table belonging to the SALES department.<br />
We will query all columns.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept where dname = 'SALES';

    DEPTNO DNAME          LOC
---------- -------------- -------------
        30 SALES          CHICAGO</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->We could also decide to make the DEPTNO the criteria to deliver the same        result.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept where deptno = 30;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        30 SALES          CHICAGO</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   -->What if we want to query all rows related to departments that have department        numbers larger than 20 ?<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept where deptno &gt; 20;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> What if you want to make your <em>where</em> clause more complex ?</p>
<p>Let&#8217;s look for any rows that have &#8216;SALES&#8217; as a department name but also          any rows that have &#8216;BOSTON&#8217; as the location.</p>
<p>This means that<br />
any row contains the value &#8216;SALES&#8217; in the DNAME column,<br />
as well as<br />
any row containing the value &#8216;BOSTON&#8217; in the LOC column<br />
will be included in the result set.</p>
<p>You can do so by adding another section to the <em>where</em> clause and          using the &#8216;OR&#8217; term to glue them together.<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept
     where dname = 'SALES' or loc = 'BOSTON';

    DEPTNO DNAME          LOC
---------- -------------- -------------
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --><br />
If you want your result set to return only rows<br />
where the location is &#8216;BOSTON&#8217;<br />
and<br />
the department name is &#8216;SALES&#8217;,<br />
you will see 0 rows returned because no row has both those values for the        relevant columns :<br />
<!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; select * from dept
     where dname = 'SALES' and loc = 'BOSTON';

no rows</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <strong>Note on datatypes<br />
</strong> Your <em>where</em> clause will have to be aware of which type          of data you are using as query criteria.<br />
In other words, you must be sure to use the correct datatype in your <em>where</em> clause.</p>
<p>For example, DNAME is a varchar column, so you must put single quotes          around your query criteria.<br />
(Only number datatypes do not need single quotes)</p>
<p>If you try to specify SALES in your <em>where</em> clause like this          :</p>
<p><em>where dname = SALES;</em></p>
<p>you will receive an error:</p>
<p><em> ORA-00904: &#8220;SALES&#8221;: invalid identifier</em></p>
<p>because you are expected to supply single quotes around a varchar datatype          like this:</p>
<p><em> where dname = &#8216;SALES&#8217;;</em></p>
<p><strong>How do you know the datatype of a column in a table ?</strong></p>
<p>Use DESCRIBE to see which columns are in a table and what their datatypes          are:</p>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --></p>
<div id="textbox">
<div>
<pre class="large">SQL&gt; desc dept;
 Name                Null?    Type
 ------------------- -------- -----------------

 DEPTNO                       NUMBER(2)
 DNAME                        VARCHAR2(14)
 LOC                          VARCHAR2(13)</pre>
</div>
</div>
<p><!-- ccccccccccccccccccccccccccccccccccccccccccccccccc   --> <strong>Varchar tip </strong><br />
Oracle is case sensitive to data inside the tables,<br />
unlike column and table names which are usually upper case unless you          explicitly create them otherwise.</p>
<p>So, there is a difference between &#8216;SALES&#8217;, &#8217;sales&#8217; and even &#8216;Sales&#8217;.</p>
<p>If you are unsure of the case that is used in your data, you can force          the result to upper (or lower)<br />
case by calling the <em>upper</em> or <em>lower </em><a title="opens new window" href="http://www.oracle-database-tips.com/oracle_functions.html" target="_blank">function</a> to convert the column data, like this:</p>
<p>&#8230; where lower(dname) = &#8217;sales&#8217;;.</p>
<p><!-- ============================================================================================================================================================ --></p>
<h3>Recommended reading:</h3>
<p>Spend some time reading Oracle&#8217;s documentation to get comfortable with Oracle&#8217;s        syntax.</p>
<p>It will be worth the effort.</p>
<div id="content">
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fstatements_10002.htm%23i2065646&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fselect.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2065646" target="_blank">Oracle          Online Documentation: SQL Reference</a></li>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Fqueries.htm%23i2068094&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Fselect.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries.htm#i2068094" target="_blank">Oracle Online Documentation : SQL Reference, SQL Queries and Subqueries</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/0AJHDr4UGTs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/oracle-sql-select/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/oracle-sql-select</feedburner:origLink></item>
		<item>
		<title>SQL Background</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/ptFzPd4MdBs/sql-background</link>
		<comments>http://oracle-database-tips.com/wp/sql/sql-background#comments</comments>
		<pubDate>Fri, 23 Oct 2009 10:53:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<category><![CDATA[oracle database]]></category>

		<category><![CDATA[sql background]]></category>

		<category><![CDATA[sql info]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=62</guid>
		<description><![CDATA[SQL is short for Structured Query Language.

It is the language you will use to access any data structure or its data in the Oracle database.
]]></description>
			<content:encoded><![CDATA[<p><strong>SQL </strong>is short for <strong>S</strong>tructured<strong> Q</strong>uery <strong>L</strong>anguage.</p>
<p>It is the language you will use to access any data structure or its data in the Oracle database.</p>
<p>You will use this to issue commands to send instructions to the database.</p>
<p>It is a standard across all compliant databases.</p>
<p>SQL commands work on sets of data and allow you to :</p>
<ul>
<li>Query the data (select)</li>
<li>Change the data (insert, update, delete)</li>
<li>Work with data structures (create or replace, alter, drop)</li>
<li>Determine access rules to data and structures (grant)</li>
<li>Lock rows or tables to enforce consistency. (lock)</li>
</ul>
<h3>Tables and indexes</h3>
<p>A<strong> table </strong> is a structure which contains horizontal rows and vertical columns.</p>
<p>The intersection of a row and a column is a cell.</p>
<p>When we search for data in a table, we use the SQL &#8217;select&#8217; statement          to extract the data in the table cells by specifying which &#8216;intersection&#8217;          of column  and row we want to extract results for. (More details later..)</p>
<table border="1" cellspacing="0" cellpadding="0" width="405">
<tbody>
<tr>
<td width="81"></td>
<td width="161">Column A</td>
<td width="155">Column B</td>
</tr>
<tr>
<td>Row 1</td>
<td>Cell: column A, row 1</td>
<td>Cell: column B, row 1</td>
</tr>
<tr>
<td>Row 2</td>
<td>Cell: column A, row 2</td>
<td>Cell: column B, row 2</td>
</tr>
</tbody>
</table>
<p>Here&#8217;s a real-world example of a table:</p>
<p>Table: Employees, contains 3 columns : EmployeeID, Surname and Firstname          and 4 rows of data.<br />
Each table has a hidden column called rowid which uniquely identifies          each row in the table.</p>
<table border="1" cellspacing="0" cellpadding="0" width="524">
<tbody>
<tr>
<td width="224">Rowid</td>
<td width="113"><strong>EmployeeID</strong></td>
<td width="61"><strong>Surname</strong></td>
<td width="116"><strong>Firstname</strong></td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAA</td>
<td>J001</td>
<td>Jones</td>
<td>Abe</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAB</td>
<td>S001</td>
<td>Smith</td>
<td>Brian</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAB</td>
<td>B001</td>
<td>Beckett</td>
<td>Chris</td>
</tr>
<tr>
<td>AAAUM2AAMAACepMAAD</td>
<td>B002</td>
<td>Brown</td>
<td>David</td>
</tr>
</tbody>
</table>
<p><strong>Index:</strong> a technique implemented by the database engine          to conduct data access as fast as possible.</p>
<p>An index on the &#8216;Surname&#8217; column of the Employees table would create          another &#8216;table&#8217; (but now called an index) containing only the sorted Surname data and the rowid of that row.</p>
<p>When you query data in the Surname column of the Employees table,<br />
the database engine&#8217;s optimizer determines whether or not to use the index,<br />
based on the expected number of rows it has to return.<br />
If it detects and uses the relevant index, it does a search on the index rather than the table.</p>
<p>Once if finds the correct row, it uses the stored rowid to access the          Employees table directly (no searching) to retrieve the whole row.</p>
<p>Once an index is created, you do not need to maintain it, nor do you need to use its name to access<br />
the data in the table. The Oracle engine does that for you in the background.</p>
<h3>Normalization:</h3>
<p>A methodology to design a database system in such a way so that there is no or limited data duplication.<br />
No table should contain data already stored in another table unless it is a link to a row<br />
in the other table (foreign key relationships).<br />
There are many other rules and degrees of normalization , if you would<br />
like to read more about it , see the link below in &#8216;Additional resources&#8217;.</p>
<h3>Recommended reading:</h3>
<p>For more info on relational database theory, here&#8217;s an excellent well-priced resource:</p>
<div id="content">
<li><a title="opens new window" href="http://www.oracle-database-tips.com/alflink" target="_blank">Database Normalization ebook by Alf Pedersen</a></li>
<p>If you have time to scan through Oracle&#8217;s manual about SQL, follow the link to the online documentation :</p>
<li><a title="opens new window" onclick="window.open('http://www.oracle-database-tips.com/cgi-bin/counter.pl?url=http%3A%2F%2Fdownload.oracle.com%2Fdocs%2Fcd%2FB19306_01%2Fserver.102%2Fb14200%2Ftoc.htm&amp;referrer=http%3A%2F%2Fwww.oracle-database-tips.com%2Foracle_sql_background.html'); return false;" href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/toc.htm" target="_blank">Oracle SQL Background reference (Oracle online documentation)</a></li>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/ptFzPd4MdBs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/sql/sql-background/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/sql/sql-background</feedburner:origLink></item>
		<item>
		<title>Solaris: How to Find Large Files and Directories</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/C65mLc50yOU/solaris-how-to-find-large-files-and-directories</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/solaris-how-to-find-large-files-and-directories#comments</comments>
		<pubDate>Sun, 13 Sep 2009 08:51:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[du]]></category>

		<category><![CDATA[find large file]]></category>

		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=57</guid>
		<description><![CDATA[Finding Large Directories and files on SunOs
]]></description>
			<content:encoded><![CDATA[<h5>Finding Large Directories</h5>
<p>To find large directories, use the <strong>du</strong> command and sort the output.</p>
<p>For example, to output the 10 largest directories in <strong>/var</strong>, sorted in ascending size order, use the following command:</p>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
<pre class="code-java">du -ko /<span class="code-keyword">var</span>|sort -n | tail -10</pre>
</div>
</div>
<p>To avoid crossing file system boundaries, that is, to see the directory usage in <strong>/</strong> but not in the other mounted files systems (<strong>/var</strong>, <strong>/opt</strong>, and so on), add the <strong>d</strong> option to the <strong>du</strong> command:</p>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
<pre class="code-java">du -kod /<span class="code-keyword">var</span>|sort -n | tail -10</pre>
</div>
</div>
<h5><a name="FindingLargeFilesandDirectoriesintheSolarisOS-FindingLargeFiles"></a>Finding Large Files</h5>
<p>To find large files, use the <strong>find</strong> command and sort the output.</p>
<p>Example 1: To find all plain files (not block, character, symbolic links, and so on) in a file system larger than 200,000 512-byte blocks (approximately 100 Mbytes) and sort on field 7 (file size) while numerically ignoring leading blanks, do this:</p>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
<pre class="code-java">find / -size +200000 -type f -ls | sort -k 7,7 -n

Sourced from: http://wikis.sun.com/display/BigAdmin/Finding+Large+Files+and+Directories+in+the+Solaris+OS</pre>
</div>
</div>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/C65mLc50yOU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/solaris-how-to-find-large-files-and-directories/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/solaris-how-to-find-large-files-and-directories</feedburner:origLink></item>
		<item>
		<title>Get rid of large listener.log file while the listener is still running.</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/3Ux31wuHq2Q/get-rid-of-large-listenerlog-file-while-the-listener-is-still-running</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/get-rid-of-large-listenerlog-file-while-the-listener-is-still-running#comments</comments>
		<pubDate>Sun, 13 Sep 2009 08:10:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[listener]]></category>

		<category><![CDATA[listener.log]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=54</guid>
		<description><![CDATA[Your listener.log file can get quite large if you do not make it part of your housekeeping scripts, and renaming it while the listener is running is not a good idea.

Here is the method to follow to clean it up while your listener is still running.]]></description>
			<content:encoded><![CDATA[<p>Your listener.log file can get quite large if you do not make it part of your housekeeping scripts, and renaming it while the listener is running is not a good idea.</p>
<p>Here is the method to follow to clean it up while your listener is still running.</p>
<p>Log into your listener from the command prompt (make sure your Oracle environment is set to that of where the listener is started from, the commands below assume there is only one (default)  listener running ) :</p>
<p>$<span style="color: #ff9900;">lsnrctl </span></p>
<p>..</p>
<p>LSNRCTL&gt; <span style="color: #ff9900;"> set log_status off</span><br />
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))<br />
LISTENER parameter &#8220;log_status&#8221; set to OFF<br />
The command completed successfully</p>
<p><span style="color: #3366ff;">(Now go delete/rename $ORACLE_HOME/network/log/listener.log to something else in another OS session )</span><br />
LSNRCTL&gt; <span style="color: #ff9900;">set log_status on</span><br />
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))<br />
LISTENER parameter &#8220;log_status&#8221; set to ON<br />
The command completed successfully<br />
LSNRCTL&gt; <span style="color: #ff9900;">quit</span></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/3Ux31wuHq2Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/get-rid-of-large-listenerlog-file-while-the-listener-is-still-running/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/get-rid-of-large-listenerlog-file-while-the-listener-is-still-running</feedburner:origLink></item>
		<item>
		<title>Quick SQL to determine your Database size. (excluding tempfiles)</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/SYk9XfCwECI/quick-sql-to-determine-your-database-size-excluding-tempfiles</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/quick-sql-to-determine-your-database-size-excluding-tempfiles#comments</comments>
		<pubDate>Tue, 30 Jun 2009 12:30:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[determine oracle db size]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=51</guid>
		<description><![CDATA[quick sql to determine your database size exluding tempfiles.]]></description>
			<content:encoded><![CDATA[<p>SQL&gt; select DF.TOTAL/1048576 &#8220;DataFile Size Mb&#8221;,<br />
2  LOG.TOTAL/1048576 &#8220;Redo Log Size Mb&#8221;,<br />
3  CONTROL.TOTAL/1048576 &#8220;Control File Size Mb&#8221;,<br />
4  (DF.TOTAL + LOG.TOTAL + CONTROL.TOTAL)/1048576 &#8220;Total Size Mb&#8221; from dual,<br />
5  (select sum(a.bytes) TOTAL from dba_data_files a) DF,<br />
6  (select sum(b.bytes) TOTAL from v$log b) LOG,<br />
7  (select sum((cffsz+1)*cfbsz) TOTAL from x$kcccf c) CONTROL;</p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/SYk9XfCwECI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/quick-sql-to-determine-your-database-size-excluding-tempfiles/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/quick-sql-to-determine-your-database-size-excluding-tempfiles</feedburner:origLink></item>
		<item>
		<title>Kill Oracle processes</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/K1dhJxyUrpk/kill-oracle-processes</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes#comments</comments>
		<pubDate>Thu, 15 Jan 2009 13:14:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[kill oracle process]]></category>

		<category><![CDATA[oracle process]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=28</guid>
		<description><![CDATA[Kill a bunch of related orphan Oracle processes with one command.
Permalink        &#8212; click for full blog post
Related Blogs

Related Blogs on kill oracle process


Related Blogs on oracle process

]]></description>
			<content:encoded><![CDATA[<p>Kill a bunch of related orphan Oracle processes with one command.</p>
<p><a href="http://www.oracle-database-tips.com/kill_oracle_process.html">Permalink        &#8212; click for full blog post</a><br />
<h4>Related Blogs</h4>
<ul class="pc_pingback">
<li class="hdl" style="list-style: none">Related Blogs on <b>kill oracle process</b></li>
</ul>
<ul class="pc_pingback">
<li class="hdl" style="list-style: none">Related Blogs on <b>oracle process</b></li>
</ul>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/K1dhJxyUrpk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/kill-oracle-processes</feedburner:origLink></item>
		<item>
		<title>Free technology webcasts</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/j_bwKi23Nyo/free-technology-webcasts</link>
		<comments>http://oracle-database-tips.com/wp/technology-webcasts/free-technology-webcasts#comments</comments>
		<pubDate>Thu, 15 Jan 2009 13:13:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Technology Webcasts]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=25</guid>
		<description><![CDATA[We&#8217;ve partnered with Insight24 to bring you great free technology-focused webcasts and videos.
Permalink        &#8212; click for full blog post
Related Blogs

Related Blogs on technology webcasts

]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve partnered with Insight24 to bring you great free technology-focused webcasts and videos.</p>
<p><a href="http://www.oracle-database-tips.com/free_technology_webcasts.html">Permalink        &#8212; click for full blog post</a><br />
<h4>Related Blogs</h4>
<ul class="pc_pingback">
<li class="hdl" style="list-style: none">Related Blogs on <b>technology webcasts</b></li>
</ul>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/j_bwKi23Nyo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/technology-webcasts/free-technology-webcasts/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/technology-webcasts/free-technology-webcasts</feedburner:origLink></item>
		<item>
		<title>VNC Tutorial</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/c1my_vYX-ks/vnc-tutorial</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/vnc-tutorial#comments</comments>
		<pubDate>Thu, 15 Jan 2009 12:11:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[vnc tutorial]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=23</guid>
		<description><![CDATA[Quick tutorial to download, install and use Free VNC for Linux.
This will give you &#8216;remote desktop&#8217;-type functionality on UNix.
Permalink        &#8212; click for full blog post
]]></description>
			<content:encoded><![CDATA[<p>Quick tutorial to download, install and use Free VNC for Linux.<br />
This will give you &#8216;remote desktop&#8217;-type functionality on UNix.</p>
<p><a href="http://www.oracle-database-tips.com/vnc_tutorial.html">Permalink        &#8212; click for full blog post</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/c1my_vYX-ks" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/vnc-tutorial/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/vnc-tutorial</feedburner:origLink></item>
		<item>
		<title>Linux du command : options used to summarize directory space usage.</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/cyg_Dc5uaXg/linux-du-command-options-used-to-summarize-directory-space-usage</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/linux-du-command-options-used-to-summarize-directory-space-usage#comments</comments>
		<pubDate>Thu, 15 Jan 2009 12:10:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[linux du]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=21</guid>
		<description><![CDATA[Quick page to remind myself what options to use with the linux du command to summarize the list of directories,
not all the files.
Permalink &#8212; click for full blog post
]]></description>
			<content:encoded><![CDATA[<p>Quick page to remind myself what options to use with the linux du command to summarize the list of directories,<br />
not all the files.</p>
<p><a href="http://www.oracle-database-tips.com/linux_du.html">Permalink &#8212; click for full blog post</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/cyg_Dc5uaXg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/linux-du-command-options-used-to-summarize-directory-space-usage/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/linux-du-command-options-used-to-summarize-directory-space-usage</feedburner:origLink></item>
		<item>
		<title>VSFTPD</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/BOQBMtrSPfU/vsftpd</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/vsftpd#comments</comments>
		<pubDate>Thu, 15 Jan 2009 12:09:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[vsftp]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=17</guid>
		<description><![CDATA[Installing and running vsftpd on your CentOS 4.5 server
Permalink &#8212; click for full blog post
]]></description>
			<content:encoded><![CDATA[<p>Installing and running vsftpd on your CentOS 4.5 server</p>
<p><a href="http://www.oracle-database-tips.com/vsftpd.html">Permalink &#8212; click for full blog post</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/BOQBMtrSPfU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/vsftpd/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/vsftpd</feedburner:origLink></item>
		<item>
		<title>AWR reports</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/F6ffO4UVRI4/awr-reports</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/awr-reports#comments</comments>
		<pubDate>Thu, 15 Jan 2009 12:07:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[awr report]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=13</guid>
		<description><![CDATA[Use these steps to publish oracle awr reports regularly and mail them to yourself
Permalink &#8212; click for full blog post
]]></description>
			<content:encoded><![CDATA[<p>Use these steps to publish oracle awr reports regularly and mail them to yourself</p>
<p><a href="http://www.oracle-database-tips.com/awr.html">Permalink &#8212; click for full blog post</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/F6ffO4UVRI4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/awr-reports/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/awr-reports</feedburner:origLink></item>
		<item>
		<title>Oracle FTP Script</title>
		<link>http://feedproxy.google.com/~r/OracleDatabaseTipsBlog/~3/imZmG04Qu4g/oracle-ftp-script</link>
		<comments>http://oracle-database-tips.com/wp/oracle-scripts/oracle-ftp-script#comments</comments>
		<pubDate>Thu, 15 Jan 2009 10:51:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Scripts]]></category>

		<category><![CDATA[ftp script]]></category>

		<category><![CDATA[oracle ftp]]></category>

		<guid isPermaLink="false">http://oracle-database-tips.com/wp/?p=10</guid>
		<description><![CDATA[Automate the transfer of files across servers with this oracle ftp script.
Permalink &#8212; click for full blog post
]]></description>
			<content:encoded><![CDATA[<p>Automate the transfer of files across servers with this oracle ftp script.</p>
<p><a href="http://www.oracle-database-tips.com/oracle_ftp_script.html">Permalink &#8212; click for full blog post</a></p>
<img src="http://feeds.feedburner.com/~r/OracleDatabaseTipsBlog/~4/imZmG04Qu4g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://oracle-database-tips.com/wp/oracle-scripts/oracle-ftp-script/feed</wfw:commentRss>
		<feedburner:origLink>http://oracle-database-tips.com/wp/oracle-scripts/oracle-ftp-script</feedburner:origLink></item>
	</channel>
</rss>
