<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;C0cDQnY4fCp7ImA9WhRUE0w.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426</id><updated>2012-01-23T10:31:13.834+01:00</updated><category term="Off Topic" /><category term="Oracle Tuning" /><category term="Performance" /><category term="Certification" /><category term="Oracle Network" /><category term="Hints" /><category term="Oracle Other" /><category term="ORA Errors" /><category term="Troubleshooting" /><category term="PL/SQL" /><category term="Recovery" /><category term="Internals" /><category term="Workarounds" /><category term="Oracle Security" /><category term="RMAN" /><category term="Tracing" /><category term="DBMS Packgs" /><category term="Unix/Linux" /><category term="ORA Bugs" /><category term="Best Practice" /><category term="Privileges" /><category term="Book Reviews" /><category term="Backup" /><category term="Scripts" /><category term="SqlPlus" /><category term="Storage" /><category term="Miscellaneous" /><category term="Upgrade/Patch" /><category term="Export/Import" /><title>Marko Sutic's Oracle Blog</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://msutic.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>76</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/MarkoSuticsOracleBlog" /><feedburner:info uri="markosuticsoracleblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>MarkoSuticsOracleBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DUIAQX4zfSp7ImA9WhRVEk0.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-2767683774686051416</id><published>2012-01-10T15:48:00.004+01:00</published><updated>2012-01-10T15:59:00.085+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-10T15:59:00.085+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Troubleshooting" /><title>Troubleshooting memory usage</title><content type="html">Last few days we had significant load problems with one of our database servers. Server was choking under minor database load which caused applications to be non-responsive.&lt;br /&gt;
&lt;br /&gt;
This is 8-core 32-bit OEL5 (2.6.18-92.el5PAE) server with 4GB RAM running two Oracle 10g (10.2.0.4) SE databases. SGA's of those databases where 1,2 GB and 700MB with pga_aggregate_target 64M and 128M.&lt;br /&gt;
&lt;br /&gt;
As databases were small (under 50G) and not very active I didn't expected any performance problems.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
Using vmstat, mpstat, top and sar tools I've noticed that we were having slight issues with swapping, despite that there was enough physical memory.&lt;br /&gt;
&lt;br /&gt;
So I've started troubleshooting...&lt;br /&gt;
&lt;br /&gt;
First I've found that one of top running processes was "&lt;b&gt;kswapd0&lt;/b&gt;" process. &lt;br /&gt;
This is Kernel Swap Deamon responsible for scanning memory to locate free pages, and scheduling dirty pages to be written to disk. It is OK to occasionally notice kswapd running, but it shouldn't continuously appear in top processes. In some situations you can resolve kswapd issues using huge pages but this wasn't the case here.&lt;br /&gt;
&lt;br /&gt;
I've decided to check several OS parameters related to swapping to find possible cause of our issues.&lt;br /&gt;
&lt;br /&gt;
Parameters below were specified in "/etc/sysctl.conf":&lt;br /&gt;
...&lt;br /&gt;
vm.overcommit_memory=1&lt;br /&gt;
vm.swappiness=0&lt;br /&gt;
vm.min_free_kbytes=262144&lt;br /&gt;
vm.page-cluster=5&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
Considering that I didn't installed this server, this parameters were little odd to me. All of them were custom parameters not required from install guide.&lt;br /&gt;
&lt;br /&gt;
The swappiness variable bothered me the most. It tells Linux kernel how fast it can move inactive pages to swap area. Default value is 60, but in this case value was changed to 0 which tells the Linux kernel to avoid swapping as much as possible.&lt;br /&gt;
&lt;br /&gt;
As this was production server which was still choking we had to react quickly without prior testing. I haven't seen the purpose of vm custom parameters on this server so I've decided to comment them and apply only default parameters required from install guide. It's easy to add custom parameters later if there is a need.&lt;br /&gt;
&lt;br /&gt;
After I applied parameters running "sysctl -p" load average suddenly started to fall. Several minutes later it fell from 13 to 1. From vmstat I've noticed significant drop in swapping and kswapd0 wasn't in top processes anymore.  &lt;br /&gt;
&lt;br /&gt;
With altering swappiness to 60 (default) I've told kernel to find inactive pages more aggressively and swap them out to disk.&lt;br /&gt;
Probably that helped OS to use memory more effectively.&lt;br /&gt;
&lt;br /&gt;
I will closely monitor performance of this server in next few days but so far it is working very good.&lt;br /&gt;
&lt;br /&gt;
Considerations for future:&lt;br /&gt;
- enable Huge Pages&lt;br /&gt;
- migrate os/db to 64bit&lt;br /&gt;
&lt;br /&gt;
When I'm installing database servers I tend to use parameters specified in install guide or Oracle support site. Eventually I will add some custom parameters but only if I have proper reason for that. Even then it is wise to test changes before applying them in production.&lt;br /&gt;
&lt;br /&gt;
So my conclusion for this case would be - do not add custom parameters without proper reason.&lt;br /&gt;
Google - "Compulsive Tuning Disorder" :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-2767683774686051416?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cRGvgMA6V8wN1CNEN7FLXqhRDus/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cRGvgMA6V8wN1CNEN7FLXqhRDus/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cRGvgMA6V8wN1CNEN7FLXqhRDus/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cRGvgMA6V8wN1CNEN7FLXqhRDus/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/J5txpmn3BuU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/2767683774686051416/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=2767683774686051416&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2767683774686051416?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2767683774686051416?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/J5txpmn3BuU/troubleshooting-memory-usage.html" title="Troubleshooting memory usage" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2012/01/troubleshooting-memory-usage.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4ER3g4eyp7ImA9WhdXF0Q.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7334353695419806580</id><published>2011-08-31T13:36:00.002+02:00</published><updated>2011-08-31T13:41:46.633+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-31T13:41:46.633+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ORA Bugs" /><category scheme="http://www.blogger.com/atom/ns#" term="Export/Import" /><title>IMPDP creates indexes with parallel degree 1 during import</title><content type="html">Last few days I’ve been playing with export and import of 750 GB database. During this whole trial and error process I’ve learned several things that were unfamiliar to me. In this blog post I want to share some of the stuff that I learnt.&lt;br /&gt;
&lt;br /&gt;
I have Oracle 10.2.0.4 database on Solaris 64bit which I want to migrate to Oracle 11.1.0.7 on Linux 64bit. It is 750GB large database with mostly partitioned tables (compressed partitions).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let's get to the subject of the post.&lt;br /&gt;
&lt;br /&gt;
I won't talk much about export operation - just to mention that it is important to specify this bolded line in parameter file:&lt;br /&gt;
&lt;b&gt;dumpfile=exportdb_%U.dmp&lt;/b&gt;&lt;br /&gt;
filesize=30G&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
This means that multiple 30GB sized dump files will be generated during export. It is important to specify %U expression or to manually define multiple dump files if you want to get the most from parallel processing during export and import.&lt;br /&gt;
&lt;br /&gt;
In my case - after performing full export of the database I've created 20 dump files which is about 600GB of export data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now comes the tricky part - importing database to the new environment.&lt;br /&gt;
&lt;br /&gt;
Data import was very fast as it finished in below 2,5 hours. During import server was fully utilized using all available resources in parallel processing. When &lt;b&gt;index creation&lt;/b&gt; started utilization of the server dropped to about 10%.&lt;br /&gt;
&lt;br /&gt;
Only one worker performed the entire work, while others were waiting - even with parallel option specified.&lt;br /&gt;
&lt;br /&gt;
Then I found that this was the result of the very nasty bug:&lt;br /&gt;
&lt;b&gt;“Bug 8604502 - IMPDP creates indexes with parallel degree 1 during import”&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This issue is fixed in:&lt;br /&gt;
&lt;blockquote&gt;12.1 (Future Release)&lt;br /&gt;
11.2.0.2 (Server Patch Set)&lt;br /&gt;
11.2.0.1 Bundle Patch 7 for Exadata Database&lt;br /&gt;
11.1.0.7 Patch 24 on Windows Platforms&lt;/blockquote&gt;&lt;br /&gt;
Great, I don’t have fix for this bug. &lt;br /&gt;
With only one worker creating indexes this import could last for days.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For a quick solution I’ve decided to perform import in two steps. Firstly I will import everything but indexes and in next step I will import just indexes.&lt;br /&gt;
&lt;br /&gt;
Data import again lasted below 2,5 hours and it finished without any problems fully utilizing the server.&lt;br /&gt;
&lt;br /&gt;
For index creation I’ve generated CREATE INDEX script using SQLFILE option in IMPDP. &lt;br /&gt;
&lt;br /&gt;
*parameter file*&lt;br /&gt;
&lt;i&gt;userid=xxx/yyy&lt;br /&gt;
&lt;b&gt;sqlfile=createidx.sql&lt;/b&gt;&lt;br /&gt;
dumpfile=exportdb_%U.dmp&lt;br /&gt;
&lt;b&gt;include=INDEX&lt;/b&gt;&lt;br /&gt;
directory=export_dir&lt;br /&gt;
schemas=(...)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
As SQLFILE generates CREATE INDEX scripts with &lt;b&gt;parallel degree set to 1&lt;/b&gt; I’ve decided to manually edit script and replace parallel 1 to parallel 16.&lt;br /&gt;
&lt;br /&gt;
Besides &lt;b&gt;parallel 16&lt;/b&gt; option, I’ve specified &lt;b&gt;NOLOGGING&lt;/b&gt; option to restrict generation of large redo log. As I expected creation of large indexes I’ve allocated large enough temporary tablespace and specified higher pga_aggregate_target parameter.&lt;br /&gt;
&lt;br /&gt;
Then executed script from sqlplus and monitored server utilization and waits.&lt;br /&gt;
&lt;br /&gt;
Script finished in about 3 hours which was nice improvement.&lt;br /&gt;
Server was fully utilized - mostly using 16 processes for index creation.&lt;br /&gt;
&lt;br /&gt;
Main waits were:&lt;br /&gt;
- WAITING direct path read&lt;br /&gt;
- WAITING direct path read temp&lt;br /&gt;
- WAITING direct path write temp&lt;br /&gt;
&lt;br /&gt;
This waits were expected as temporary space was extensively used.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Later I’ve found nice article from great Oracle expert Randolf Geist - &lt;a href="http://oracle-randolf.blogspot.com/2011/02/concurrent-index-creation.html"&gt;Concurrent Index Creation&lt;/a&gt;. As a solution for the same problem he wrote tool for concurrent index creation. &lt;br /&gt;
I plan to test this approach in my environment.&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7334353695419806580?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Zt40LDI9b3ole8HA2ZQxJ6I_bwI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zt40LDI9b3ole8HA2ZQxJ6I_bwI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Zt40LDI9b3ole8HA2ZQxJ6I_bwI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zt40LDI9b3ole8HA2ZQxJ6I_bwI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/50Z8A3k-Zbw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7334353695419806580/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7334353695419806580&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7334353695419806580?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7334353695419806580?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/50Z8A3k-Zbw/impdp-creates-indexes-with-parallel.html" title="IMPDP creates indexes with parallel degree 1 during import" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/08/impdp-creates-indexes-with-parallel.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYAQHo7cCp7ImA9WhdTEEk.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7655331937791162302</id><published>2011-07-07T13:54:00.004+02:00</published><updated>2011-07-07T14:02:21.408+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-07T14:02:21.408+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Upgrade/Patch" /><category scheme="http://www.blogger.com/atom/ns#" term="Troubleshooting" /><title>Wrong results with 'hash group by' aggregation on 10.2.0.2</title><content type="html">If you are running 10.2.0.2 in your production environment check document [ID 4604970.8] on Oracle support site.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This week colleague noticed that query, he wanted to use for some reports, returns different results than he expected. He made some additional checks using Microsof Excel and confirmed that something is wrong. He was getting incorrect results.&lt;br /&gt;
&lt;br /&gt;
My first suspicion was that probably something is wrong with query or maybe logical corruption happened.&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
Example of the queries (I’ve changed names of the table/columns):&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;-- partitioned_table (date range partitioned table)

create table temp_tab_2011
as
select col, date_to,  sum (col1) col1, 
       sum (col2) f_col1, sum (col3) col3, 
    sum (col4) col4, 
    sum (col5) col5, count(*) cnt
from partitioned_table t
where t.date_to &gt;= to_date ('01.02.2011 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
    and t.date_to &lt; to_date ('01.07.2011 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
group by col, date_to
/

create table temp_tab_2010_2011
as
select col, date_to, sum (col1) col1, 
       sum (f_col1) f_col1, sum (col3) col3, 
    sum (col4) col4, 
    sum (col5) col5, count(*) cnt
from partitioned_table t
where t.date_to &gt;= to_date ('01.02.2010 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
    and t.date_to &lt; to_date ('01.07.2011 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
group by col, date_to
/

-- COMPARASION QUERY
select j.col, j.col1, j.col2, j.col3, j.cnt, d.col, d.col1, d.col2, d.col3, d.cnt, j.col1 - d.col1
from
temp_tab_2011 j, temp_tab_2010_2011 d
where 1=1
and j.col = d.col
and j.date_to = d.date_to
and j.date_to = to_date ('01.06.2011 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
and d.date_to = to_date ('01.06.2011 00:00:00', 'dd.mm.yyyy HH24:MI:SS')
and (j.col1 - d.col1) &lt;&gt; 0
/
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
We expected &lt;b&gt;0 rows returned&lt;/b&gt; for comparison query but we received some rows - which was serious issue.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I’ve restored that database on another machine. Checked files for logical corruption, rebuilded indexes into another tablespace, rebuilded table into another tablespace and re-created temporary tablespace - but still we were receiving wrong results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Luckily for us I’ve noticed this blog post during my searches for answer on Google:&lt;br /&gt;
&lt;a href="http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/"&gt;http://www.oracloid.com/2006/05/hash-group-by-can-give-wrong-result-in-oracle-102/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Queries were using this plan:&lt;br /&gt;
(click "view source" to get better output)&lt;br /&gt;
&lt;pre class="brush: sql"&gt;----------------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                            | Name                          | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     | Pstart| Pstop |
----------------------------------------------------------------------------------------------------------------------------------------------
|   0 | CREATE TABLE STATEMENT               |                               |       |       |       | 43069 (100)|          |       |       |
|   1 |  LOAD AS SELECT                      |                               |       |       |       |            |          |       |       |
|   2 |   PARTITION RANGE ITERATOR           |                               |   631K|    50M|       | 39729   (1)| 00:13:08 |    57 |    74 |
|   3 |    HASH GROUP BY                     |                               |   631K|    50M|   219M| 39729   (1)| 00:13:08 |       |       |
|   4 |     TABLE ACCESS BY LOCAL INDEX ROWID| PARTITIONED_TABLE             |  1557K|   124M|       | 20999   (1)| 00:06:56 |    57 |    74 |
|*  5 |      INDEX RANGE SCAN                | IX_DATE                       |  1557K|       |       |  3874   (1)| 00:01:17 |    57 |    74 |
----------------------------------------------------------------------------------------------------------------------------------------------
&lt;/pre&gt;&lt;br /&gt;
In our version 10.2.0.2 wrong results are possible from the result of a non-distinct aggregation with a group by &lt;b&gt;when HASH GROUB BY is used&lt;/b&gt;. We were hitting that bug. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In session level we changed undocumented parameter &lt;b&gt;"_gby_hash_aggregation_enabled"&lt;/b&gt; to &lt;b&gt;FALSE&lt;/b&gt; and executed queries again. Result was as expected - 0 rows returned.&lt;br /&gt;
&lt;br /&gt;
It is noted in Metalink note that this issue is fixed in 10.2.0.3 version so I’ve upgraded test instance to 10.2.0.4 version and that solved problems with incorrect results.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is nasty Oracle bug and if you are running 10.2.0.1 or 10.2.0.2 check your results :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7655331937791162302?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H0PJfAmBVOEnvJACUcB9KQodJ0I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H0PJfAmBVOEnvJACUcB9KQodJ0I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/H0PJfAmBVOEnvJACUcB9KQodJ0I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H0PJfAmBVOEnvJACUcB9KQodJ0I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/klXGzDC8jKw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7655331937791162302/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7655331937791162302&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7655331937791162302?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7655331937791162302?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/klXGzDC8jKw/wrong-results-with-hash-group-by.html" title="Wrong results with 'hash group by' aggregation on 10.2.0.2" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/07/wrong-results-with-hash-group-by.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUECR3c6cSp7ImA9WhZUFkk.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7688322271263589627</id><published>2011-06-09T16:10:00.005+02:00</published><updated>2011-06-09T21:27:46.919+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-09T21:27:46.919+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>Recover lost datafile without valid backup</title><content type="html">I’ve decided to perform this test case and publish blog post after reading this topic on OTN forums - &lt;a href="http://bit.ly/mLwaA9"&gt;http://bit.ly/mLwaA9&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
How to recover lost datafile when you don’t have valid backup of your database. Your database is running in &lt;b&gt;archivelog mode&lt;/b&gt; and you have all necessary archive logs.&lt;br /&gt;
&lt;br /&gt;
In situation when you don’t have valid backup and your datatabase is running in &lt;b&gt;noarchivelog mode&lt;/b&gt; - your datafile is &lt;b&gt;lost forever&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
So take regular backups of your database and enable archivelog mode ;-)&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
Environment for this test:&lt;br /&gt;
OS: OEL 5&lt;br /&gt;
DB: Oracle EE 10.2.0.4&lt;br /&gt;
&lt;br /&gt;
To check am I running my database in archivelog mode.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     70
Next log sequence to archive   72
Current log sequence           72
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I will create new tablespace for my test and name it - TS_TEST.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create tablespace ts_test datafile '/u01/oradata/orcl/ts_test01.dbf' size 256M;

Tablespace created.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now to create table in TS_TEST tablespace. I will fill this table with 1000000 rows using Tom Kyte's script.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create table bigtab tablespace ts_test
  2  as
  3  select rownum id, a.*
  from all_objects a
 where 1=0;  4    5
 
 
 
SQL&gt; select tablespace_name, segment_name from 
2         dba_segments where segment_name = 'BIGTAB';

TABLESPACE_NAME                SEGMENT_NAME
--------------- ---------------------------------------
TS_TEST                        BIGTAB
 
--
-- I'VE EXCLUDED SCRIPT LINES CAUSE
-- IT'S NOT IMPORTANT FOR THIS TEST CASE
--
SQL&gt; select count(*) from bigtab;

  COUNT(*)
----------
   1000000
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I can see in alert log that there were 5 log switches during insert.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;Starting control autobackup
Control autobackup written to DISK device
        handle '/u01/app/oracle/flash_recovery_area/ORCL/autobackup/2011_06_09/o1_mf_s_753372242_6z1folfy_.bkp'
Completed: create tablespace ts_test datafile '/u01/oradata/orcl/ts_test01.dbf' size 256M
Thu Jun  9 14:07:42 2011
Thread 1 advanced to log sequence 73 (LGWR switch)
  Current log# 1 seq# 73 mem# 0: /u01/oradata/orcl/redo01.log
Thu Jun  9 14:07:45 2011
Thread 1 advanced to log sequence 74 (LGWR switch)
  Current log# 2 seq# 74 mem# 0: /u01/oradata/orcl/redo02.log
Thu Jun  9 14:10:55 2011
Thread 1 cannot allocate new log, sequence 75
Checkpoint not complete
  Current log# 2 seq# 74 mem# 0: /u01/oradata/orcl/redo02.log
Thu Jun  9 14:10:56 2011
Thread 1 advanced to log sequence 75 (LGWR switch)
  Current log# 3 seq# 75 mem# 0: /u01/oradata/orcl/redo03.log
Thu Jun  9 14:10:58 2011
Thread 1 advanced to log sequence 76 (LGWR switch)
  Current log# 1 seq# 76 mem# 0: /u01/oradata/orcl/redo01.log
Thread 1 cannot allocate new log, sequence 77
Checkpoint not complete
  Current log# 1 seq# 76 mem# 0: /u01/oradata/orcl/redo01.log
Thu Jun  9 14:11:00 2011
Thread 1 advanced to log sequence 77 (LGWR switch)
  Current log# 2 seq# 77 mem# 0: /u01/oradata/orcl/redo02.log
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To simulate disaster I will delete “ts_test01.dbf” datafile using OS command and flush buffer cache several times.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; !rm /u01/oradata/orcl/ts_test01.dbf

SQL&gt; alter system flush buffer_cache;

System altered.

SQL&gt; /

System altered.

SQL&gt; /

System altered.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now my query throws an error because datafile 8 is missing.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select count(*) from bigtab;
select count(*) from bigtab
*
ERROR at line 1:
ORA-01116: error in opening database file 8
ORA-01110: data file 8: '/u01/oradata/orcl/ts_test01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
How to recover this datafile when you don’t have valid backup to restore it?&lt;br /&gt;
&lt;br /&gt;
Trick is to create new datafile based on the file “ts_test01.dbf” using command:&lt;br /&gt;
ALTER DATABASE CREATE DATAFILE 'xxxx.dbf' AS 'xxxx.dbf' and fill it with data from archive logs.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database create datafile '/u01/oradata/orcl/ts_test01.dbf' as '/u01/oradata/orcl/ts_test01.dbf';
alter database create datafile '/u01/oradata/orcl/ts_test01.dbf' as '/u01/oradata/orcl/ts_test01.dbf'
*
ERROR at line 1:
ORA-01182: cannot create database file 8 - file is in use or recovery
ORA-01110: data file 8: '/u01/oradata/orcl/ts_test01.dbf'
&lt;/pre&gt;&lt;br /&gt;
To avoid error - before creating new datafile, you must take the existing datafile (or the tablespace) offline.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database datafile 8 offline drop;

Database altered.


SQL&gt; alter database create datafile '/u01/oradata/orcl/ts_test01.dbf' as '/u01/oradata/orcl/ts_test01.dbf';

Database altered.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now I have new empty datafile which I will fill with records applying archive logs over it during recovery.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; recover datafile 8;
ORA-00279: change 92069000 generated at 06/09/2011 14:03:59 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_72_%u_.arc
ORA-00280: change 92069000 for thread 1 is in sequence #72


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

ORA-00279: change 92069587 generated at 06/09/2011 14:07:42 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_73_%u_.arc
ORA-00280: change 92069587 for thread 1 is in sequence #73
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_72_6z1fw
gvn_.arc' no longer needed for this recovery


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

ORA-00279: change 92069713 generated at 06/09/2011 14:07:45 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_74_%u_.arc
ORA-00280: change 92069713 for thread 1 is in sequence #74
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_73_6z1fw
kyj_.arc' no longer needed for this recovery


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

ORA-00279: change 92070100 generated at 06/09/2011 14:10:56 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_75_%u_.arc
ORA-00280: change 92070100 for thread 1 is in sequence #75
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_74_6z1g2
jh1_.arc' no longer needed for this recovery


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

ORA-00279: change 92071034 generated at 06/09/2011 14:10:58 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_76_%u_.arc
ORA-00280: change 92071034 for thread 1 is in sequence #76
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_75_6z1g2
lbg_.arc' no longer needed for this recovery


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

ORA-00279: change 92071751 generated at 06/09/2011 14:11:00 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_77_%u_.arc
ORA-00280: change 92071751 for thread 1 is in sequence #77
ORA-00278: log file
'/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_06_09/o1_mf_1_76_6z1g2
nmz_.arc' no longer needed for this recovery


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

Log applied.
Media recovery complete.
&lt;/pre&gt;&lt;br /&gt;
Recovery is successfully completed and now to alter datafile 8 to be online again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database datafile 8 online;

Database altered.


-- CHECK
SQL&gt; select count(*) from bigtab;

  COUNT(*)
----------
   1000000


-- CLEANUP

SQL&gt; drop tablespace ts_test including contents and datafiles;

Tablespace dropped.
&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7688322271263589627?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rNWRFuZdhdr69OYYLM3yJsr3xh0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNWRFuZdhdr69OYYLM3yJsr3xh0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rNWRFuZdhdr69OYYLM3yJsr3xh0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNWRFuZdhdr69OYYLM3yJsr3xh0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/JB_YOsWwNLY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7688322271263589627/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7688322271263589627&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7688322271263589627?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7688322271263589627?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/JB_YOsWwNLY/recover-lost-datafile-without-valid.html" title="Recover lost datafile without valid backup" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/06/recover-lost-datafile-without-valid.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cDRHg5fip7ImA9WhZUFU8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-6987388882259395380</id><published>2011-06-08T11:24:00.000+02:00</published><updated>2011-06-08T11:24:35.626+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-08T11:24:35.626+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Network" /><category scheme="http://www.blogger.com/atom/ns#" term="Troubleshooting" /><title>Oracle Listener crashes with core dump in Linux 64bit</title><content type="html">We had serious problems with Oracle TNS Listener last few days. Problems were happening on very critical system - most active OLTP database.&lt;br /&gt;
&lt;br /&gt;
Every few hours/minutes, in irregular intervals, TNS listener suddenly crashes which forces our Red Hat Cluster Manager to restart instance and even switch database to another node. Business systems that have relied on this database were experiencing great difficulties.&lt;br /&gt;
&lt;br /&gt;
It is worth to mention that everything worked without any problems for about 2 years without any intervention on OS or database configuration.&lt;br /&gt;
&lt;br /&gt;
Environment:&lt;br /&gt;
OS: Red Hat Enterprise Linux ES release 4 (64bit)&lt;br /&gt;
DB: Oracle EE 10.2.0.4.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
From Listener log:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;…
…
…
07-LIP-2011 11:19:21 * (CONNECT_DATA=(SERVICE_NAME=odb )(CID=(PROGRAM=httpd)(HOST=rad2)(USER=apache))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.3.13.49)(PORT=58405)) * establish * odb * 12518
TNS-12518: TNS:listener could not hand off client connection
TNS-12547: TNS:lost contact
 TNS-12560: TNS:protocol adapter error
  TNS-00517: Lost contact
    Linux Error: 32: Broken pipe
07-LIP-2011 11:19:21 * service_update * odb * 0
07-LIP-2011 11:19:21 * service_update * odb * 0
07-LIP-2011 11:19:21 * (CONNECT_DATA=(SERVICE_NAME=otp)(CID=(PROGRAM=httpd)(HOST=rad2)(USER=apache))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.3.13.49)(PORT=58402)) * establish * odb * 0

TNSLSNR for Linux: Version 10.2.0.4.0 - Production on 07-LIP-2011 11:21:23

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

System parameter file is /u01/app/oracle/product/10.2/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2/db_1/network/log/listener_odb.log
Trace information written to /u01/app/oracle/product/10.2/db_1/network/trace/listener_odb.trc
Trace level is currently 0

Started with pid=9607
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.2.10.40)(PORT=1521)))
Listener completed notification to CRS on start
…
…
...
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="brush: sql"&gt;….
….
….
07-LIP-2011 11:10:16 * (CONNECT_DATA=(SERVICE_NAME=UDB)(CID=(PROGRAM=)(HOST=POP1)(USER=root))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.3.12.71)(PORT=44557)) * establish * UDB * 12518
TNS-12518: TNS:listener could not hand off client connection
TNS-12571: TNS:packet writer failure
 TNS-12560: TNS:protocol adapter error
  TNS-00530: Protocol adapter error
    Linux Error: 104: Connection reset by peer

TNSLSNR for Linux: Version 10.2.0.4.0 - Production on 07-LIP-2011 11:11:01

Copyright (c) 1991, 2007, Oracle.  All rights reserved.

System parameter file is /u01/app/oracle/product/10.2/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2/db_1/network/log/listener_udb.log
Trace information written to /u01/app/oracle/product/10.2/db_1/network/trace/listener_udb.trc
Trace level is currently 0

Started with pid=21862
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.2.10.39)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Listener completed notification to CRS on start

TIMESTAMP * CONNECT DATA [* PROTOCOL INFO] * EVENT [* SID] * RETURN CODE
WARNING: Subscription for node down event still pending
…
…
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
From /var/log/messages:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;tnslsnr[31928]: segfault at 0000000000000018 rip 0000003d34268593 rsp 0000007fbfff9ba0 error 4
tnslsnr[21862]: segfault at 0000000000000018 rip 0000003c00367f2d rsp 0000007fbfff9220 error 4
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
My first destinations to search for answers were Oracle support site, OTN forums and Oracle related technical blogs.&lt;br /&gt;
&lt;br /&gt;
I’ve found interesting note on Oracle support site: [ID 549932.1]&lt;br /&gt;
Symptoms mentioned there:&lt;br /&gt;
- There may be heavy load on the CPU shooting up to 100%.&lt;br /&gt;
- The number of sessions in the database is well below the upper or maximum limit defined in the parameter  file.&lt;br /&gt;
- The listener crashes suddenly during  this heavy CPU load generating the core.&lt;br /&gt;
- (Optional) Listener.Ora has SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF.&lt;br /&gt;
&lt;br /&gt;
Cause:&lt;br /&gt;
Extensive paging/swapping activity is a clear indication that the system is running out of the physical memory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So I’ve decided to run vmstat for hour or two to check for swapping activity.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$vmstat 5
&lt;/pre&gt;&lt;br /&gt;
Columns si and so were 0 all the time so I thought that our problems weren’t associated with paging/swapping activity. We continued to search problems in other areas.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To cut a long story short - after few days searching for answers we found nothing so I’ve decided to apply patch for unpublished &lt;b&gt;Bug 6139856&lt;/b&gt; despite the fact that I haven't found problem with swapping.&lt;br /&gt;
&lt;br /&gt;
Before applying patch I like to take backup of Oracle Home so I’ve decided to make compressed copy of that directory. Soon after compression began CPU load significantly raised and vmstat started to display swapping activity.&lt;br /&gt;
&lt;br /&gt;
It was pretty clear now that paging/swapping activity is probably the cause of our problems so I applied the patch 6139856.&lt;br /&gt;
That fixed our problems and system was stable again :-)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Conclusion&lt;br /&gt;
Due to some recent network/firewall problems CPU load on our OLTP database server occasionally raises, causes extensive swapping which crashes TNS listener.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-6987388882259395380?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LE2lk5M0GAYSkbeg_pzIQaB7Wcw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LE2lk5M0GAYSkbeg_pzIQaB7Wcw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LE2lk5M0GAYSkbeg_pzIQaB7Wcw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LE2lk5M0GAYSkbeg_pzIQaB7Wcw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/uRxIvJ5UoU0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/6987388882259395380/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=6987388882259395380&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/6987388882259395380?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/6987388882259395380?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/uRxIvJ5UoU0/oracle-listener-crashes-with-core-dump.html" title="Oracle Listener crashes with core dump in Linux 64bit" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/06/oracle-listener-crashes-with-core-dump.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAERXg9eip7ImA9WhZVGEk.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-3992881705850401800</id><published>2011-05-31T14:07:00.001+02:00</published><updated>2011-05-31T14:08:24.662+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-31T14:08:24.662+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Unix/Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Troubleshooting" /><title>Datapump fails with ORA-27086 on NFS</title><content type="html">I've received following error while trying to perform full database export using datapump to NFS:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;Export: Release 10.2.0.4.0 - Production on Tuesday, 31 May, 2011 11:27:50

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Release 10.2.0.4.0 - Production
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-31641: unable to create dump file "/backup-nfs/testdb/export/exportfull.dmp"
ORA-27086: unable to lock file - already in use
Linux Error: 37: No locks available
Additional information: 10
&lt;/pre&gt;&lt;br /&gt;
In this case problem was lying in NFS locking deamons - on most Unix-like systems also known as rpc.lockd and the rpc.statd.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
&lt;br /&gt;
Checking if 'nfslock' service is running:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;# service nfslock status
rpc.statd is stopped
&lt;/pre&gt;&lt;br /&gt;
Start 'nfslock' service:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;# /etc/init.d/nfslock start
Starting NFS statd:                                        [  OK  ]
&lt;/pre&gt;&lt;br /&gt;
Status:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;# service nfslock status
rpc.statd (pid  4943) is running...
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Starting 'nfslock' service resolved my problem with performing export to NFS.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-3992881705850401800?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JtEwz12UKRfukaZHRag0uY_zsME/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JtEwz12UKRfukaZHRag0uY_zsME/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JtEwz12UKRfukaZHRag0uY_zsME/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JtEwz12UKRfukaZHRag0uY_zsME/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/bQ643GV7T8w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/3992881705850401800/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=3992881705850401800&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/3992881705850401800?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/3992881705850401800?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/bQ643GV7T8w/datapump-fails-with-ora-27086-on-nfs.html" title="Datapump fails with ORA-27086 on NFS" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/05/datapump-fails-with-ora-27086-on-nfs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0MFQ3c8eSp7ImA9WhZTGE4.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-2374752760785141848</id><published>2011-03-22T20:58:00.002+01:00</published><updated>2011-03-22T23:03:32.971+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-22T23:03:32.971+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Miscellaneous" /><title>Replacing old database servers (project check list)</title><content type="html">We are currently in process of replacing our old database servers with new ones. During the evaluation process we’re checking various technical solutions to find the best option in terms of price/performance.&lt;br /&gt;
&lt;br /&gt;
For me, real life experience is the most important when we are talking about database server performance so I’ve posted question on &lt;a href="http://www.freelists.org/post/oracle-l/Replacement-for-aged-SunFire-v490-servers"&gt;Oracle-L&lt;/a&gt; lists to get some answers about noted servers and performance.&lt;br /&gt;
&lt;br /&gt;
DBA’s from &lt;a href="http://www.freelists.org/archive/oracle-l"&gt;Oracle-L&lt;/a&gt; lists helped me a lot. Thanks guys!&lt;br /&gt;
&lt;br /&gt;
As replay to my question &lt;a href="http://itdavid.blogspot.com/2011/03/what-to-look-out-for-when-changing-old.html"&gt;David Robillard&lt;/a&gt; posted answer that is worth publishing on this blog. It is nicely summarized project check list that can be used as a template when evaluating various technical solutions in or outside world of Oracle.&lt;br /&gt;
&lt;br /&gt;
We will surely use this check list in our projects :-)  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
What to look for when buying (database) servers.&lt;br /&gt;
&lt;blockquote&gt;Hello Marko,&lt;br /&gt;
&lt;br /&gt;
&gt; we're considering to replace our SunFire v490 servers with newer generation &lt;br /&gt;
&gt; of Oracle SUN or IBM servers.&lt;br /&gt;
&gt;&lt;br /&gt;
&gt; Our current configuration is:&lt;br /&gt;
&gt; 2x SunFire v490 , 4GB RAM , 2 (1x dual-port HBA) x 2Gb FC&lt;br /&gt;
&gt; 2x SunFire v490 , 8GB RAM , 2 (1x dual-port HBA) x 2Gb FC&lt;br /&gt;
&gt;&lt;br /&gt;
&gt; Do you have any experience with Oracle M-Series SPARC servers or x86 Sun &lt;br /&gt;
&gt; servers running as database servers?&lt;br /&gt;
&lt;br /&gt;
Yes indeed :)&lt;br /&gt;
&lt;br /&gt;
&gt; We were checking Intel 7500 X4470 and Sparc VII+ M4000 servers as replacement &lt;br /&gt;
&gt; for our SunFire v490's.&lt;br /&gt;
&lt;br /&gt;
Both CPU architectures can run your type of workload, that's for sure.&lt;br /&gt;
What you need to look out for is (but not limited to)&lt;br /&gt;
&lt;br /&gt;
a) Budget.&lt;br /&gt;
b) Server's RAS &amp; Virtualization features.&lt;br /&gt;
c) Server's technical specs.&lt;br /&gt;
d) Employee technical knowledge in hardware and software.&lt;br /&gt;
e) Data center system's homogenization.&lt;br /&gt;
&lt;br /&gt;
So if we go into more detail for each bullet point, we have...&lt;br /&gt;
&lt;br /&gt;
-- a) Budget.&lt;br /&gt;
&lt;br /&gt;
This is a very important starting point in which you need to check: 1.&lt;br /&gt;
Oracle software licenses, 2. Oracle hardware cost of purchase, 3.&lt;br /&gt;
Oracle software and hardware maintenance costs and 4. electrical and&lt;br /&gt;
HVAC costs.&lt;br /&gt;
&lt;br /&gt;
1. Oracle software licenses.&lt;br /&gt;
&lt;br /&gt;
Make sure to check with your Oracle database friendly salesman. I&lt;br /&gt;
don't know if this is still the case, but the Oracle license cost for&lt;br /&gt;
an x86 CPU was not the same as for the SPARC achitecture. Count the&lt;br /&gt;
number of cores and run the numbers with your Oracle software&lt;br /&gt;
representative. Unless things have changed since the aquisition of Sun&lt;br /&gt;
by Oracle, you might be in for a little surprise.&lt;br /&gt;
&lt;br /&gt;
2. Oracle hardware cost of purchase.&lt;br /&gt;
&lt;br /&gt;
The X4470 and M4000 machines are probably not the same price up front.&lt;br /&gt;
And you might not be able to get the same discount on both&lt;br /&gt;
architectures. Make sure to talk with your IHV or Oracle hardware&lt;br /&gt;
technical representative to see what configuration of each system is&lt;br /&gt;
adequate for your workload and then get a price for both system types.&lt;br /&gt;
There could be a big difference.&lt;br /&gt;
&lt;br /&gt;
3. Oracle software and hardware maintenance costs.&lt;br /&gt;
&lt;br /&gt;
Depending on the type of hardware, your Oracle software licenses might&lt;br /&gt;
be different. So is the maintenance contract on the hardware itself.&lt;br /&gt;
Make sure to check those two over a period of 3 to 5 years and compare&lt;br /&gt;
the TCO at the end of the system's life cycle. Again, that can be&lt;br /&gt;
quite significant. Considering your pay around 20 % annually of the&lt;br /&gt;
total cost of purchase on the Oracle software licenses, if they're&lt;br /&gt;
more expensive up front, they're going to be a lot more expensive&lt;br /&gt;
after 5 years. I'm not sure about the 20 %, so check this number with&lt;br /&gt;
your Oracle sales rep.&lt;br /&gt;
&lt;br /&gt;
4. electrical and HVAC costs.&lt;br /&gt;
&lt;br /&gt;
Check the electrical specs for both systems. Keep in mind that you&lt;br /&gt;
need to feed these machines power to make the run and more power to&lt;br /&gt;
cool them. Since they probably won't have the same requirements, make&lt;br /&gt;
sure to check this with your data center specialist to see how much&lt;br /&gt;
money it will cost to run those systems? Again, run those numbers up&lt;br /&gt;
to 3 or 5 years and compare them.&lt;br /&gt;
&lt;br /&gt;
-- b) Server's RAS and Virtualization features.&lt;br /&gt;
&lt;br /&gt;
The M-series is packed with RAS features. Especially if you run&lt;br /&gt;
Solaris on them. Compare those features with what the X-series&lt;br /&gt;
platform offers you. The M-series also has built in hardware&lt;br /&gt;
virtualization with logical domains and such. In an Oracle database&lt;br /&gt;
scenario, are those important? For example, you could decide to assign&lt;br /&gt;
a single CPU/memory board for OLTP and perform a dynamic domain change&lt;br /&gt;
to add the other CPU/memory board for backup or batch jobs. Will you&lt;br /&gt;
be using RAC? Don't forget to ask your Oracle software and hardware&lt;br /&gt;
reps to know if you can run RAC in logical domains and/or Solaris&lt;br /&gt;
containers?&lt;br /&gt;
&lt;br /&gt;
Make a side-by-side comparision and see what is an added-value to your&lt;br /&gt;
organisation and what is simly a nice to have. See if the price&lt;br /&gt;
difference is worth the features?&lt;br /&gt;
&lt;br /&gt;
-- c) Server's technical specs.&lt;br /&gt;
&lt;br /&gt;
The M4000 machine can use up to 256 GB while the X4470 is limited to&lt;br /&gt;
64 GB. Is that interesting to you? Of course most of us would you&lt;br /&gt;
benifit from a very big SGA, but does it makes sense to pay for the&lt;br /&gt;
M4000 and 256 GB if your workload is happy with a 10 GB SGA that fits&lt;br /&gt;
into both hardware platforms?&lt;br /&gt;
&lt;br /&gt;
The Intel 7500 CPU is most probably faster then the SPARC64 VII+ for&lt;br /&gt;
single threaded applications. But the SPARC architecture is probably&lt;br /&gt;
better wth multi-threaded applications. Check your SQL code and see if&lt;br /&gt;
you would benefit from one or the other. Ask your Oracle hardware rep&lt;br /&gt;
for Oracle benchmarks on both architectures and try to compare apples&lt;br /&gt;
to apples.&lt;br /&gt;
&lt;br /&gt;
The X4470 is a 3 U machine while the M4000 requires double that. Do&lt;br /&gt;
you have enough space in your data center racks to have the new&lt;br /&gt;
machines online while the old ones are still there? You will need it&lt;br /&gt;
in order to have a smooth transition of your old production machines&lt;br /&gt;
to the new ones.&lt;br /&gt;
&lt;br /&gt;
-- d) Employee technical knowledge in hardware and software.&lt;br /&gt;
&lt;br /&gt;
Your team of sysadmins and DBAs have obviously been working with&lt;br /&gt;
Solaris + SPARC for a few years now. Are they familiar with Linux +&lt;br /&gt;
x86? Or Solaris + x86? They are not the same. Even Solaris SPARC vs&lt;br /&gt;
Solaris x86 is not the same. If you have all your operating practices&lt;br /&gt;
documented on Solaris + SPARC, are you ready to update all those to&lt;br /&gt;
another OS? Will you need to send sysadmins to Oracle university to&lt;br /&gt;
learn about Solaris x86, the new M4000 or the X4470? Don't forget to&lt;br /&gt;
factor these into the overall price of the solution too. You talked&lt;br /&gt;
about IBM machines. Will they be running AIX or Linux? Consider that&lt;br /&gt;
the IBM POWER systems running AIX are *very* different then the Oracle&lt;br /&gt;
SPARC systems running Solaris. Both are very good products, but be&lt;br /&gt;
ready for a big learning curve if you switch from one to another.&lt;br /&gt;
&lt;br /&gt;
IMHO you should stick to what you know and comfortable with. In this&lt;br /&gt;
case this is Solaris SPARC. But the price might be prohibitive. If you&lt;br /&gt;
need to switch to Solaris x86, consider training your staff to Linux&lt;br /&gt;
maybe?&lt;br /&gt;
&lt;br /&gt;
-- e) Data center system's homogenization.&lt;br /&gt;
&lt;br /&gt;
What do you have in your data center? Only Sun Oracle hardware or a&lt;br /&gt;
mix of many vendors? It's a lot easier to handle a single vendor then&lt;br /&gt;
three to four different ones. Plus the spare parts are easier to stock&lt;br /&gt;
and share between the machines of an identical vendor. You also have&lt;br /&gt;
an easier time to manage the service contracts from one or two vendors&lt;br /&gt;
then three of four. If your team is trained on Sun and Oracle&lt;br /&gt;
procedures and hardware, be wary of moving to IBM. It's a lot&lt;br /&gt;
different and the learning curve is steep. Keep in mind that it's also&lt;br /&gt;
more expensive and more difficult to keep and find trained sysadmins&lt;br /&gt;
on different OSes and platforms. Think of what your job offer would&lt;br /&gt;
look like if you need to hire another sysadmin. The more product you&lt;br /&gt;
have, the more difficult it will be to find qualified sysadmins. Not&lt;br /&gt;
to mention that they might ask for a higher salary :)&lt;br /&gt;
&lt;br /&gt;
&gt; Do you think that Intel 7500 X4470 is strong enough to handle workload of two &lt;br /&gt;
&gt; SunFire v490 servers?&lt;br /&gt;
&gt; Same question related to Sparc VII+ M4000 server - can this server handle &lt;br /&gt;
&gt; workload of two SunFire v490's?&lt;br /&gt;
&lt;br /&gt;
Again, ask your Oracle rep these questions. I'm pretty sure the answer&lt;br /&gt;
is yes, both machines can support your workload. But at what speed?&lt;br /&gt;
And at what cost?&lt;br /&gt;
&lt;br /&gt;
Finally, make sure you have fun! That's a very nice project you have there :o)&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
David&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-2374752760785141848?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gZGY8IPBzHICZirIwj6dWbK41Ms/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gZGY8IPBzHICZirIwj6dWbK41Ms/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gZGY8IPBzHICZirIwj6dWbK41Ms/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gZGY8IPBzHICZirIwj6dWbK41Ms/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/VKC6CEFpNLg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/2374752760785141848/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=2374752760785141848&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2374752760785141848?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2374752760785141848?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/VKC6CEFpNLg/replacing-old-database-servers-project.html" title="Replacing old database servers (project check list)" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/03/replacing-old-database-servers-project.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAFR3c7fSp7ImA9Wx9aFEQ.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-609445877796723319</id><published>2011-02-22T15:35:00.003+01:00</published><updated>2011-03-07T12:35:16.905+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-07T12:35:16.905+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Tuning" /><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Network" /><title>"SQL*Net message to/from dblink" - How to improve query performance over dblink?</title><content type="html">Colleague reported to me that execution of his query is taking too long. After quick look it was obvious that this was ideal tunning candidate.&lt;br /&gt;
I will note my tuning process in this blog post.&lt;br /&gt;
&lt;br /&gt;
Table and column names are changed.&lt;br /&gt;
&lt;br /&gt;
DB: Oracle 10.2.0.2.0&lt;br /&gt;
OS: Solaris 9 64-bit&lt;br /&gt;
&lt;br /&gt;
Query:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SELECT
       ROUND (
          SUM (poz_traj) / 60,2)
          mins,
       SUM (amount) iznos,
       COUNT (*) pozivi
  FROM 
       (SELECT co.con_nr
          FROM usr.ugov@remote_db co,
               usr.ugov_item@remote_db ci,
               usr.np_zah@remote_db np
         WHERE     1 = 1
               AND co.ugov_id = ci.ugov_id
               AND ci.ugov_item_id = np.ugov_item_id
               AND NP.kol_id IN
                      (355375, 360996, 424469, 466193, 466194, 480438, 492748)
               AND np.u_po IS NOT NULL
               AND status_cd = 'PRI'
               AND co.status &amp;lt&amp;gt 'CC') c,
             table1 x
 WHERE 1 = 1 
       AND x.sub_cd = c.con_nr
       AND record_date &amp;gt=
              TO_DATE ('24.01.2011 08:40:01', 'dd.mm.yyyy hh24:mi:ss')
       AND record_date &amp;lt
              TO_DATE ('24.01.2011 18:00:01', 'dd.mm.yyyy hh24:mi:ss')
       AND orgn = 0                                     
       AND item_cd = 1                      
       AND corr_status &amp;gt -1
       AND parameter_sg = 'glas';
&lt;/pre&gt;&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
&lt;br /&gt;
This query is using database link to access tables on remote database - "REMOTE_DB". &lt;br /&gt;
&lt;br /&gt;
Explain plan showed:&lt;br /&gt;
&lt;br /&gt;
NOTE! &lt;br /&gt;
Click "view source" to get explain plan better formatted.     &lt;br /&gt;
&lt;pre class="brush: sql"&gt;----------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                              | Name          | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop | Inst   |IN-OUT|
----------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                       |               |       |       |   105 (100)|          |       |       |        |      |
|   1 |  SORT AGGREGATE                        |               |     1 |   275 |            |          |       |       |        |      |
|   2 |   NESTED LOOPS                         |               |     1 |   275 |   105   (0)| 00:00:03 |       |       |        |      |
|   3 |    NESTED LOOPS                        |               |    32 |  3264 |   103   (0)| 00:00:03 |       |       |        |      |
|   4 |     NESTED LOOPS                       |               |    16 |  1216 |    55   (0)| 00:00:02 |       |       |        |      |
|   5 |      PARTITION RANGE SINGLE            |               |    16 |   704 |    23   (0)| 00:00:01 |    37 |    37 |        |      |
|*  6 |       TABLE ACCESS BY LOCAL INDEX ROWID| TABLE1        |    16 |   704 |    23   (0)| 00:00:01 |    37 |    37 |        |      |
|*  7 |        INDEX RANGE SCAN                | IX_TABLE1_RD  |    21 |       |     3   (0)| 00:00:01 |    37 |    37 |        |      |
|   8 |      REMOTE                            | UGOV          |     1 |    32 |     2   (0)| 00:00:01 |       |       | REMO_~ | R-&amp;gtS |
|   9 |     REMOTE                             | UGOV_ITEM     |     2 |    52 |     3   (0)| 00:00:01 |       |       | REMO_~ | R-&amp;gtS |
|  10 |    REMOTE                              | NP_ZAH        |     1 |   173 |     1   (0)| 00:00:01 |       |       | REMO_~ | R-&amp;gtS |
----------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   6 - filter(("item_cd"=1 AND "parameter_sg"='glas' AND "orgn"=0 AND "corr_status"&amp;gt(-1)))
   7 - access("RECORD_DATE"&amp;gt=TO_DATE('2011-01-24 08:40:01', 'yyyy-mm-dd hh24:mi:ss') AND "RECORD_DATE"&amp;ltTO_DATE('2011-01-24
              18:00:01', 'yyyy-mm-dd hh24:mi:ss'))
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
To help myself a little I’ve checked how many rows there are in tables queried in inline view.&lt;br /&gt;
&lt;br /&gt;
ugov - 777802 rows&lt;br /&gt;
ugov_item - 1581553 rows&lt;br /&gt;
np_zah - 155802 rows&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt;  SELECT co.con_nr
  2            FROM usr.ugov@remote_db co,
  3                 usr.ugov_item@remote_db ci,
  4                 usr.np_zah@remote_db np
  5           WHERE     1 = 1
  6                 AND co.ugov_id = ci.ugov_id
  7                 AND ci.ugov_item_id = np.ugov_item_id
  8                 AND NP.kol_id IN
  9                        (355375, 360996, 424469, 466193, 466194, 480438, 492748)
 10                 AND np.u_po IS NOT NULL
 11                 AND status_cd = 'PRI'
 12                 AND co.status &amp;lt&amp;gt 'CC';

4599 rows selected.

Elapsed: 00:00:23.60
&lt;/pre&gt;&lt;br /&gt;
Execution of inline view was satisfying with 4599 rows received.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this initial checks it was obvious where problem lies. Oracle probably transfers whole tables over network from remote database and then resolves the query.&lt;br /&gt;
&lt;br /&gt;
To confirm my thoughts I’ve decided to trace execution of the current query and check wait events.&lt;br /&gt;
&lt;br /&gt;
Results were:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; SELECT
  2         ROUND (
  3            SUM (poz_traj) / 60,
  4            2)
  5            mins,
  6         SUM (amount) iznos,
  7         COUNT (*) pozivi
  8    FROM
  9         (SELECT co.con_nr
 10            FROM usr.ugov@remote_db co,
 11                 usr.ugov_item@remote_db ci,
 12                 usr.np_zah@remote_db np
 13           WHERE     1 = 1
 14                 AND co.ugov_id = ci.ugov_id
 15                 AND ci.ugov_item_id = np.ugov_item_id
 16                 AND NP.kol_id IN
 17                        (355375, 360996, 424469, 466193, 466194, 480438, 492748)
 18                 AND np.u_po IS NOT NULL
 19                 AND status_cd = 'PRI'
 20                 AND co.status &amp;lt&amp;gt 'CC') c,
 21               table1 x
 22   WHERE 1 = 1
 23         AND x.sub_cd = c.con_nr
 24         AND record_date &amp;gt=
 25                TO_DATE ('24.01.2011 08:40:01', 'dd.mm.yyyy hh24:mi:ss')
 26         AND record_date &amp;lt
 27                TO_DATE ('24.01.2011 18:00:01', 'dd.mm.yyyy hh24:mi:ss')
 28         AND orgn = 0
 29         AND item_cd = 1
 30         AND corr_status &amp;gt -1
 31         AND parameter_sg = 'glas';

1 row selected.

Elapsed: 01:22:23.17
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class="brush: sql"&gt;Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to dblink                 3055416        0.00          1.55
  SQL*Net message from dblink               3055416        2.73       3835.51
  db file sequential read                     34051        0.51        226.57
  SQL*Net message from client                     2      323.35        323.35
  SQL*Net message to client                       1        0.00          0.00
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Time of query execution was &lt;b&gt;1:22:23&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Top wait events were "&lt;b&gt;SQL*Net message to dblink&lt;/b&gt;" and "&lt;b&gt;SQL*Net message from dblink&lt;/b&gt;".&lt;br /&gt;
&lt;br /&gt;
I’ve had network bottleneck because query produced lot of traffic between databases.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To resolve this problem I have to minimize data transfer from remote database. &lt;br /&gt;
Inline view should be executed on remote database to cut down number of rows that are transferred over dblink.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So I’ve created view on remote database and checked execution again.&lt;br /&gt;
&lt;br /&gt;
REMOTE DATABASE&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;create view temp_view_test as
  SELECT co.con_nr
          FROM usr.ugov co,
               usr.ugov_item ci,
               usr.np_zah np
         WHERE     1 = 1
               AND co.ugov_id = ci.ugov_id
               AND ci.ugov_item_id = np.ugov_item_id
               AND NP.kol_id IN
                      (355375, 360996, 424469, 466193, 466194, 480438, 492748)
               AND np.u_po IS NOT NULL
               AND status_cd = 'PRI'
               AND co.status &amp;lt&amp;gt 'CC';
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
What will happen now:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL &amp;gt SELECT
  2         ROUND (
  3            SUM (poz_traj) / 60,
  4            2)
  5            mins,
  6         SUM (amount) iznos,
  7         COUNT (*) pozivi
  8    FROM
  9         usr.temp_view_test@remote_db c,
 10               table1 x
 11   WHERE 1 = 1
 12         AND x.sub_cd = c.con_nr
 13         AND record_date &amp;gt=
 14                TO_DATE ('25.01.2011 08:40:01', 'dd.mm.yyyy hh24:mi:ss')
 15         AND record_date &amp;lt
 16                TO_DATE ('25.01.2011 18:00:01', 'dd.mm.yyyy hh24:mi:ss')
 17         AND orgn = 0
 18         AND item_cd = 1
 19         AND corr_status &amp;gt -1
 20         AND parameter_sg = 'glas';

1 row selected.

Elapsed: 00:02:55.53

----------------------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                            | Name            | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop | Inst   |IN-OUT|
----------------------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                     |                 |       |       |   625 (100)|          |       |       |        |      |
|   1 |  SORT AGGREGATE                      |                 |     1 |    56 |            |          |       |       |        |      |
|*  2 |   HASH JOIN                          |                 |     8 |   448 |   625   (1)| 00:00:13 |       |       |        |      |
|   3 |    PARTITION RANGE SINGLE            |                 |    16 |   704 |    23   (0)| 00:00:01 |    37 |    37 |        |      |
|*  4 |     TABLE ACCESS BY LOCAL INDEX ROWID| TABLE1          |    16 |   704 |    23   (0)| 00:00:01 |    37 |    37 |        |      |
|*  5 |      INDEX RANGE SCAN                | IX_TABLE1_RD    |    21 |       |     3   (0)| 00:00:01 |    37 |    37 |        |      |
|   6 |    REMOTE                            | TEMP_VIEW_TEST  | 51418 |   602K|   601   (1)| 00:00:12 |       |       | REMO_~ | R-&amp;gtS |
----------------------------------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("X"."sub_cd"="C"."con_nr")
   4 - filter(("item_cd"=1 AND "parameter_sg"='glas' AND "orgn"=0 AND "corr_status"&amp;gt(-1)))
   5 - access("RECORD_DATE"&amp;gt=TO_DATE('2011-01-24 08:40:01', 'yyyy-mm-dd hh24:mi:ss') AND "RECORD_DATE"&amp;ltTO_DATE('2011-01-24
              18:00:01', 'yyyy-mm-dd hh24:mi:ss'))
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This was significant performance improvement. From &lt;b&gt;1 hour 22 mins&lt;/b&gt; to &lt;b&gt;2 mins 55 secs&lt;/b&gt; !&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  db file sequential read                     27932        0.27         41.32
  SQL*Net message to dblink                       2        0.00          0.00
  SQL*Net message from dblink                     2       42.79         44.46
  SQL*Net more data from dblink                  36        3.24         65.83
  SQL*Net message from client                     2        0.01          0.01
  SQL*Net message to client      
&lt;/pre&gt;&lt;br /&gt;
Top wait events weren't related to network bottlenecks. &lt;br /&gt;
&lt;br /&gt;
So the trick was to create view on remote database which reduced number of rows transferred over network.&lt;br /&gt;
&lt;br /&gt;
Colleague was happy with new execution time :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-609445877796723319?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9JcT6Q6_zo0T3HvN1xlWQVPuKPU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9JcT6Q6_zo0T3HvN1xlWQVPuKPU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9JcT6Q6_zo0T3HvN1xlWQVPuKPU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9JcT6Q6_zo0T3HvN1xlWQVPuKPU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/bmoddA-5TTc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/609445877796723319/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=609445877796723319&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/609445877796723319?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/609445877796723319?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/bmoddA-5TTc/sqlnet-message-tofrom-dblink-how-to.html" title="&quot;SQL*Net message to/from dblink&quot; - How to improve query performance over dblink?" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2011/02/sqlnet-message-tofrom-dblink-how-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8CRXc_eSp7ImA9Wx9QEE8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-2674563045716703516</id><published>2010-11-19T16:57:00.002+01:00</published><updated>2010-12-22T14:34:24.941+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-22T14:34:24.941+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Security" /><category scheme="http://www.blogger.com/atom/ns#" term="Privileges" /><title>Invalid objects after Revoking Execute On DBMS_JOB, DBMS_LOB, UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_FILE from PUBLIC</title><content type="html">You can use Oracle Grid Control for checking policy violations, to keep compliance with company security or configuration standards. Grid Control comes with pre-installed set of policies and recommendations of best practices for databases.&lt;br /&gt;
&lt;br /&gt;
With having that in mind I checked Critical Policy Violations for my database and noticed this critical violations:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;...
Execute Privileges on DBMS_JOB to PUBLIC 
Restricted Privilege to Execute UTL_TCP
Restricted Privilege to Execute UTL_HTTP 
Restricted Privilege to Execute UTL_SMTP 
Execute Privileges on DBMS_LOB to PUBLIC 
Execute Privileges on UTL_FILE To PUBLIC
...
&lt;/pre&gt;&lt;br /&gt;
It is recommended to remove excessive privileges from some users to prevent possible attacks for happening in the first place. So based on recommendations from Grid Control I’ve decided to revoke noted privileges from PUBLIC and check what will happen after.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
As SYS user I executed:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;REVOKE EXECUTE ON utl_tcp FROM public;
REVOKE EXECUTE ON utl_smtp FROM public;
REVOKE EXECUTE ON utl_http FROM public;
REVOKE EXECUTE ON utl_file FROM public;
REVOKE EXECUTE ON dbms_job FROM public;
REVOKE EXECUTE ON dbms_lob FROM public;
&lt;/pre&gt;&lt;br /&gt;
Immediately after revoking those grants I checked database status noticed &lt;b&gt;invalid objects&lt;/b&gt; in sys schema, mdsys, ordsys, wmsys, etc.&lt;br /&gt;
&lt;br /&gt;
My next move was rollback:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;GRANT EXECUTE ON dbms_job TO public;
GRANT EXECUTE ON utl_file TO public;
GRANT EXECUTE ON utl_tcp TO public;
GRANT EXECUTE ON utl_http TO public;
GRANT EXECUTE ON utl_smtp TO public;
GRANT EXECUTE ON dbms_lob TO public;

-- Compile
SQL&gt; shutdown immediate;
SQL&gt; startup restrict;
SQL&gt; @$ORACLE_HOME/rdbms/admin/@utlrp.sql
SQL&gt; shutdown immediate;
SQL&gt; startup;
&lt;/pre&gt;&lt;br /&gt;
After granting privileges back and recompiling invalid objects everything was valid again. &lt;br /&gt;
This test was very educational for me.&lt;br /&gt;
&lt;br /&gt;
My next step was searching for Metalink notes that explain this situation and I’ve found very useful notes -  [ID 247093.1] [ID 1165830.1] [ID 797706.1]&lt;br /&gt;
&lt;br /&gt;
Important lesson learned in this experiment was - do not blindly follow EM/GC policy recommendations without consulting Oracle support or (at least) skimming through Metalink notes.&lt;br /&gt;
&lt;br /&gt;
From Metalink note:&lt;br /&gt;
&lt;i&gt;“Oracle highly recommends keeping DBMS_SQL, DBMS_JOB, DBMS_LOB granted to PUBLIC just to keep user’s database running. Otherwise lots of things break including some of the utilities like Import/Export, Datapump expdp/impdp, SQL*Loader, etc.”&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PUBLIC is pseudo user/schema used by database for its internal functionality. Privileges are granted to PUBLIC with CATALOG and CATPROC components for 10g database instance.&lt;br /&gt;
&lt;br /&gt;
If you still want to revoke privileges from PUBLIC make sure that you re-grant privileges to user that require them and recompile possible invalidated objects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-2674563045716703516?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/yoZ4FzHk_kKm0lxDg9xeBaljK1I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yoZ4FzHk_kKm0lxDg9xeBaljK1I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/yoZ4FzHk_kKm0lxDg9xeBaljK1I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/yoZ4FzHk_kKm0lxDg9xeBaljK1I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/b5ur7EpLlso" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/2674563045716703516/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=2674563045716703516&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2674563045716703516?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2674563045716703516?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/b5ur7EpLlso/invalid-objects-after-revoking-execute.html" title="Invalid objects after Revoking Execute On DBMS_JOB, DBMS_LOB, UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_FILE from PUBLIC" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/11/invalid-objects-after-revoking-execute.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcFSXo_fCp7ImA9Wx9TEEU.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-4525946516852473521</id><published>2010-11-18T12:56:00.002+01:00</published><updated>2010-11-18T13:06:58.444+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-18T13:06:58.444+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RMAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>RMAN restore fails with RMAN-06023 but there are backups available</title><content type="html">I must admit - today I learned new thing about RMAN restore and this is good enough reason for a blog post.&lt;br /&gt;
&lt;br /&gt;
Part of my daily tasks is to perform RMAN backup and recovery scenarios in my test environment (as I said beore), to be familiar with every possible situation that can happen.&lt;br /&gt;
&lt;br /&gt;
So today, very simple task of restoring database to another machine took me over 2 hours...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Demo case:&lt;br /&gt;
Environment : Oracle 10.2.0.4 on Linux 64bit&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
I have backup files of the database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ ls -l /oracle/backup/*
ARCH_OTP_20101117_0tlt6lum_s8221_p1
controlf_OTP_0ult6mop_8222_20101117
FULL_OTP_0rlt6ip4
spfile_OTP_0vlt6mos_8223_20101117
&lt;/pre&gt;&lt;br /&gt;
Restore controlfile from backup and mount database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Nov 18 08:32:09 2010
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database (not started)

RMAN&gt; startup nomount;
Oracle instance started
Total System Global Area     838860800 bytes
Fixed Size                     2087672 bytes
Variable Size                750781704 bytes
Database Buffers              67108864 bytes
Redo Buffers                  18882560 bytes

RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; restore controlfile from '/oracle/backup/controlf_OTP_0ult6mop_8222_20101117';
5&gt; }

Starting restore at 18.11.2010 08:40:51

channel c1: restoring control file
channel c1: restore complete, elapsed time: 00:00:01
output filename=/oracle/product/10.2.0/db_1/dbs/control01.ctl
output filename=/oracle/product/10.2.0/db_1/dbs/control02.ctl
Finished restore at 18.11.2010 08:40:52
released channel: c1

RMAN&gt; alter database mount;
database mounted
&lt;/pre&gt;&lt;br /&gt;
I will delete all EXPIRED backups from RMAN repository:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; crosscheck backup;
RMAN&gt; delete noprompt expired backup;

RMAN&gt; crosscheck archivelog all;
RMAN&gt; delete noprompt expired archivelog all;
&lt;/pre&gt;&lt;br /&gt;
For this case it is very important to mention that I’ve had enabled controlfile autobackup (CONFIGURE CONTROLFILE AUTOBACKUP ON) in older incarnations. With this parameter enabled RMAN automatically takes backup of controlfile and server parameter file whenever the database structure metadata in the control file changes or whenever a backup or copy operation is performed using RMAN.&lt;br /&gt;
&lt;br /&gt;
List backup command shows that there are two old autobackup files in flash recovery area.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; list backup;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8199    Full    7.89M      DISK        00:00:00     16.06.2010 14:50:28
        BP Key: 8199   Status: AVAILABLE  Compressed: NO  Tag: TAG20100616T145028
        Piece Name: /oracle/oradata/archive/flash_recovery_area/OTP/autobackup/2010_06_16/o1_mf_s_721839028_61kl4o2y_.bkp
  Control File Included: Ckp SCN: 43471045788   Ckp time: 16.06.2010 14:50:28
  SPFILE Included: Modification time: 16.06.2010 13:15:03

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8200    Full    7.89M      DISK        00:00:00     16.06.2010 14:49:49
        BP Key: 8200   Status: AVAILABLE  Compressed: NO  Tag: TAG20100616T144949
        Piece Name: /oracle/oradata/archive/flash_recovery_area/OTP/autobackup/2010_06_16/o1_mf_s_721838989_61kl3hhq_.bkp
  Control File Included: Ckp SCN: 43471045571   Ckp time: 16.06.2010 14:49:49
  SPFILE Included: Modification time: 16.06.2010 13:15:03
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
To continue with my restore process I will catalog my backup files noted before.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; catalog start with '/oracle/backup/';

searching for all files that match the pattern /oracle/backup/

List of Files Unknown to the Database
=====================================
File Name: /oracle/backup/FULL_OTP_0rlt6ip4
File Name: /oracle/backup/ARCH_OTP_20101117_0tlt6lum_s8221_p1
File Name: /oracle/backup/controlf_OTP_0ult6mop_8222_20101117

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /oracle/backup/FULL_OTP_0rlt6ip4
File Name: /oracle/backup/ARCH_OTP_20101117_0tlt6lum_s8221_p1
File Name: /oracle/backup/controlf_OTP_0ult6mop_8222_20101117
&lt;/pre&gt;&lt;br /&gt;
Check backup of database.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; list backup of database;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8196    Incr 0  11.18G     DISK        00:53:38     17.11.2010 01:53:58
        BP Key: 8201   Status: AVAILABLE  Compressed: YES  Tag: WEEKLY_FULL
        Piece Name: /oracle/backup/FULL_OTP_0rlt6ip4
  List of Datafiles in backup set 8196
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/system/otp/system01.dbf
  2    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/data02/otp/users02.dbf
  3    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/system/otp/sysaux01.dbf
  4    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/data02/otp/users01.dbf
  5    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/index/otp/tools01.dbf
  6    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/data02/otp/users03.dbf
  7    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/system/otp/undotbs01.dbf
  8    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/system/otp/cluser_tbs01.dbf
&lt;/pre&gt;&lt;br /&gt;
Restore database files from backup to another location.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; SET NEWNAME FOR DATAFILE 1 TO '/oracle/u02/oradata/system/otp/system01.dbf';
5&gt; SET NEWNAME FOR DATAFILE 2 TO '/oracle/u02/oradata/data02/otp/users02.dbf';
6&gt; SET NEWNAME FOR DATAFILE 3 TO '/oracle/u02/oradata/system/otp/sysaux01.dbf';
7&gt; SET NEWNAME FOR DATAFILE 4 TO '/oracle/u02/oradata/data02/otp/users01.dbf';
8&gt; SET NEWNAME FOR DATAFILE 5 TO '/oracle/u02/oradata/index/otp/tools01.dbf';
9&gt; SET NEWNAME FOR DATAFILE 6 TO '/oracle/u02/oradata/data02/otp/users03.dbf';
10&gt; SET NEWNAME FOR DATAFILE 7 TO '/oracle/u02/oradata/system/otp/undotbs01.dbf';
11&gt; SET NEWNAME FOR DATAFILE 8 TO '/oracle/u02/oradata/system/otp/cluser_tbs01.dbf';
12&gt;
13&gt; RESTORE DATABASE;
14&gt; SWITCH DATAFILE ALL;
15&gt; RECOVER DATABASE;
16&gt; }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=321 devtype=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 18.11.2010 08:46:21

released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 11/18/2010 08:46:22
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore
&lt;/pre&gt;&lt;br /&gt;
Hm...&lt;br /&gt;
For me this was unexpected error because I had database backup available.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; list backup of datafile 4;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8196    Incr 0  11.18G     DISK        00:53:38     17.11.2010 01:53:58
        BP Key: 8201   Status: AVAILABLE  Compressed: YES  Tag: WEEKLY_FULL
        Piece Name: /oracle/backup/FULL_OTP_0rlt6ip4
  List of Datafiles in backup set 8196
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  4    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/data02/otp/users01.dbf

RMAN&gt; list backup of datafile 3;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
8196    Incr 0  11.18G     DISK        00:53:38     17.11.2010 01:53:58
        BP Key: 8201   Status: AVAILABLE  Compressed: YES  Tag: WEEKLY_FULL
        Piece Name: /oracle/backup/FULL_OTP_0rlt6ip4
  List of Datafiles in backup set 8196
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  3    0  Incr 48852276752 17.11.2010 01:00:20 /u02/oradata/system/otp/sysaux01.dbf

…
…
…
&lt;/pre&gt;&lt;br /&gt;
After two hours of searching for answers and performing more tests I ran to the Metalink document 965122.1.&lt;br /&gt;
&lt;br /&gt;
The problem were those autobackups in FRA that I showed before. That files belonged to different incarnation than the available backups current incarnation.&lt;br /&gt;
&lt;br /&gt;
[From Metalink document]&lt;br /&gt;
If we start a RESTORE database with a BACKUP controlfile and Flash Recovery Area is defined, RMAN execute and &lt;b&gt;implicit crosscheck and catalog of all the objects in the Flash Recovery Area&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
RMAN will catalog any objects in the Flash Recovery Area that will not be registered in the controlfile and if any of this files belongs to an incarnation different from CURRENT incarnation in the controlfile then &lt;b&gt;changes controlfile CURRENT incarnation to the one found in the file that is being cataloged.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;This prevents database from restoring backups that belong to old CURRENT incarnation&lt;/b&gt;.  &lt;br /&gt;
RMAN considers backup availble for being restored if the backup incarnation and CURRENT incarnation in controlfile are the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So I’ve decided to temporary disable FRA during recovery process commending &lt;b&gt;db_recovery_file_dest&lt;/b&gt; and &lt;b&gt;db_recovery_file_dest_size&lt;/b&gt; parameters in parameter file.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; shutdown abort;

Oracle instance shut down

$ vi $ORACLE_HOME/dbs/initotp.ora
...
#*.db_recovery_file_dest='/oracle/oradata/archive/flash_recovery_area'
#*.db_recovery_file_dest_size=2147483648
…
...

$ sqlplus "/as sysdba"

SQL&gt; startup nomount pfile='$ORACLE_HOME/dbs/initotp.ora';
ORACLE instance started.

Total System Global Area  838860800 bytes
Fixed Size                  2087672 bytes
Variable Size             750781704 bytes
Database Buffers           67108864 bytes
Redo Buffers               18882560 bytes
&lt;/pre&gt;&lt;br /&gt;
Restore and recover database.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; restore controlfile from '/oracle/backup/controlf_OTP_0ult6mop_8222_20101117';
5&gt; }
…
…
…
RMAN&gt; alter database mount;
database mounted

RMAN&gt; catalog start with '/oracle/backup';
…
…

RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; SET NEWNAME FOR DATAFILE 1 TO '/oracle/u02/oradata/system/otp/system01.dbf';
5&gt; SET NEWNAME FOR DATAFILE 2 TO '/oracle/u02/oradata/data02/otp/users02.dbf';
6&gt; SET NEWNAME FOR DATAFILE 3 TO '/oracle/u02/oradata/system/otp/sysaux01.dbf';
7&gt; SET NEWNAME FOR DATAFILE 4 TO '/oracle/u02/oradata/data02/otp/users01.dbf';
8&gt; SET NEWNAME FOR DATAFILE 5 TO '/oracle/u02/oradata/index/otp/tools01.dbf';
9&gt; SET NEWNAME FOR DATAFILE 6 TO '/oracle/u02/oradata/data02/otp/users03.dbf';
10&gt; SET NEWNAME FOR DATAFILE 7 TO '/oracle/u02/oradata/system/otp/undotbs01.dbf';
11&gt; SET NEWNAME FOR DATAFILE 8 TO '/oracle/u02/oradata/system/otp/cluser_tbs01.dbf';
12&gt;
13&gt; RESTORE DATABASE;
14&gt; SWITCH DATAFILE ALL;
15&gt; RECOVER DATABASE;
16&gt; }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=321 devtype=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 18.11.2010 09:01:48

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/u02/oradata/system/otp/system01.dbf
restoring datafile 00002 to /oracle/u02/oradata/data02/otp/users02.dbf
restoring datafile 00003 to /oracle/u02/oradata/system/otp/sysaux01.dbf
restoring datafile 00004 to /oracle/u02/oradata/data02/otp/users01.dbf
restoring datafile 00005 to /oracle/u02/oradata/index/otp/tools01.dbf
restoring datafile 00006 to /oracle/u02/oradata/data02/otp/users03.dbf
restoring datafile 00007 to /oracle/u02/oradata/system/otp/undotbs01.dbf
restoring datafile 00008 to /oracle/u02/oradata/system/otp/cluser_tbs01.dbf
channel c1: reading from backup piece /var/umoracle/otp/fullbkp_dir/FULL_OTP_0rlt6ip4
channel c1: restored backup piece 1
failover to piece handle=/mnt/l01dbdev-s01storage1/oracle/backup/FULL_OTP_0rlt6ip4 tag=WEEKLY_FULL
channel c1: restore complete, elapsed time: 01:28:51
Finished restore at 18.11.2010 10:30:40

datafile 1 switched to datafile copy
input datafile copy recid=9 stamp=735388241 filename=/oracle/u02/oradata/system/otp/system01.dbf
datafile 2 switched to datafile copy
input datafile copy recid=10 stamp=735388241 filename=/oracle/u02/oradata/data02/otp/users02.dbf
datafile 3 switched to datafile copy
input datafile copy recid=11 stamp=735388241 filename=/oracle/u02/oradata/system/otp/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=12 stamp=735388241 filename=/oracle/u02/oradata/data02/otp/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=13 stamp=735388241 filename=/oracle/u02/oradata/index/otp/tools01.dbf
datafile 6 switched to datafile copy
input datafile copy recid=14 stamp=735388242 filename=/oracle/u02/oradata/data02/otp/users03.dbf
datafile 7 switched to datafile copy
input datafile copy recid=15 stamp=735388242 filename=/oracle/u02/oradata/system/otp/undotbs01.dbf
datafile 8 switched to datafile copy
input datafile copy recid=16 stamp=735388242 filename=/oracle/u02/oradata/system/otp/cluser_tbs01.dbf

Starting recover at 18.11.2010 10:30:43

starting media recovery

channel c1: starting archive log restore to default destination
channel c1: restoring archive log
archive log thread=1 sequence=33610
channel c1: reading from backup piece /var/otp/fullbkp_dir/ARCH_OTP_20101117_0tlt6lum_s8221_p1
channel c1: restored backup piece 1
failover to piece handle=/oracle/backup/ARCH_OTP_20101117_0tlt6lum_s8221_p1 tag=ARCHIVELOGS
channel c1: restore complete, elapsed time: 00:11:44
archive log filename=/oracle/oradata/archive/arch_1_33610_586538926.arc thread=1 sequence=33610
unable to find archive log
archive log thread=1 sequence=33611
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/18/2010 10:50:16
RMAN-06054: media recovery requesting unknown log: thread 1 seq 33611 lowscn 48852472202
RMAN&gt; exit


$ sqlplus "/as sysdba"

SQL&gt; recover database using backup controlfile until cancel;
ORA-00279: change 48852472202 generated at 11/17/2010 01:54:16 needed for
thread 1
ORA-00289: suggestion :
/oracle/oradata/archive/arch_1_33611_586538926.arc
ORA-00280: change 48852472202 for thread 1 is in sequence #33611

Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.

SQL&gt; alter database open resetlogs;
Database altered.
&lt;/pre&gt;&lt;br /&gt;
I'm glad that this problem occurred now in test environment because those two hours spent on searching for answers could be critical in recovery of a production database.&lt;br /&gt;
&lt;br /&gt;
You never know :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
REFERENCES&lt;br /&gt;
Metalink -  [ID 965122.1]&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-4525946516852473521?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hgo8l56EDAHC7TpQFsc84R1pkKM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hgo8l56EDAHC7TpQFsc84R1pkKM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hgo8l56EDAHC7TpQFsc84R1pkKM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hgo8l56EDAHC7TpQFsc84R1pkKM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/ptyFN_31L-8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/4525946516852473521/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=4525946516852473521&amp;isPopup=true" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4525946516852473521?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4525946516852473521?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/ptyFN_31L-8/rman-restore-fails-with-rman-06023-but.html" title="RMAN restore fails with RMAN-06023 but there are backups available" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/11/rman-restore-fails-with-rman-06023-but.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUFSXc-fCp7ImA9Wx5bGU0.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7535427003238504526</id><published>2010-11-04T21:21:00.002+01:00</published><updated>2010-11-04T21:23:38.954+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-04T21:23:38.954+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RMAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><category scheme="http://www.blogger.com/atom/ns#" term="Backup" /><title>Recover From Incrementally Updated Backup (test case)</title><content type="html">In this test I will play with incrementally updated backup. Using this feature we can recover datafile image copies applying incremental backups to them. &lt;br /&gt;
&lt;br /&gt;
NOTE!&lt;br /&gt;
You should use 'flash recovery area' as primary location for your backups whenever you can. To complicate this test case a little I won’t use 'flash recovery area' for my backups.&lt;br /&gt;
&lt;br /&gt;
Oracle 10.2.0.4.0&lt;br /&gt;
Linux OEL5&lt;br /&gt;
&lt;br /&gt;
For taking backup I will use this RMAN script:&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;pre class="brush: sql"&gt;connect target /
run
{
sql 'alter system checkpoint';
allocate channel c1 device type disk format '/home/ora10g/backup/%U.dbf';
backup as compressed backupset
check logical incremental level 1
for recover of copy with tag DAILY_FULL database
filesperset 1;

recover copy of database with tag DAILY_FULL;
release channel c1;

allocate channel c1 device type disk;
backup (archivelog all format '/home/ora10g/backup/ARCH_%d_%T_%u_s%s_p%p' delete input TAG "archivelogs");
backup current controlfile format '/home/ora10g/backup/controlf_%d_%u_%s_%T';
release channel c1;
}
&lt;/pre&gt;(I've borrowed first part of the script from great DBA &lt;a href="http://husnusensoy.wordpress.com/"&gt;Husnu Sensoy&lt;/a&gt; - Thanks!)&lt;br /&gt;
&lt;br /&gt;
After first execution of this script RMAN will create initial image copy of the database, backup archived redo logs and current controlfile to directory ‘/home/ora10g/backup’.&lt;br /&gt;
&lt;br /&gt;
Now I will create small table just for later checks and run script above again.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ sqlplus admin

SQL&gt; create table test123 as select * from dba_objects;
Table created.

SQL&gt; alter system switch logfile;
System altered.
&lt;/pre&gt;&lt;br /&gt;
Next time RMAN will find image copies of data files and make just incremental backups. Additional step we will be updating image copies of datafiles applying the incremental backups to them.&lt;br /&gt;
&lt;br /&gt;
RMAN script in usual circumstances works perfectly but this time &lt;b&gt;I will interfere&lt;/b&gt; and kill RMAN process during recovery using &lt;b&gt;‘kill -9 [rman pid]’&lt;/b&gt; command to simulate &lt;b&gt;disaster&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
To simulate disk crash I will drop original database using &lt;b&gt;rm&lt;/b&gt; command.&lt;br /&gt;
&lt;br /&gt;
So to summarize:&lt;br /&gt;
- I’ve lost my original database due to the 'disk crash'&lt;br /&gt;
- I have: &lt;br /&gt;
Image copies of datafiles partially recovered&lt;br /&gt;
Backups of archived redo logs  &lt;br /&gt;
Multiplexed redo logs&lt;br /&gt;
Backup of controlfile&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Can I fully recover my original database using this files? I can try... :)&lt;br /&gt;
&lt;br /&gt;
I have already created empty directories where I will put database files, controlfiles, etc. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Restore controlfile and mount database:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; restore controlfile from '/home/ora10g/backup/controlf_RASAPP_khls5prr_3729_20101104';
5&gt; }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=157 devtype=DISK

Starting restore at 04-NOV-10

channel c1: restoring control file
channel c1: restore complete, elapsed time: 00:00:02
output filename=/u01/oradata/rasapp/control01.ctl
output filename=/u01/oradata/rasapp/control02.ctl
output filename=/u02/oradata/rasapp/control03.ctl
Finished restore at 04-NOV-10
released channel: c1

RMAN&gt; alter database mount;

database mounted
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Catalog backup pieces from backup directory ‘/home/ora10g/backup’:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; catalog start with '/home/ora10g/backup';
...
...

-- Check copy of database:

RMAN&gt; list copy of database;
...
...
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now I will try to switch database to the latest image copy.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; switch database to copy;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 11/04/2010 15:30:15
RMAN-06571: datafile 9 does not have recoverable copy
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As I’ve killed RMAN process during recovery operation my image copy of database is not valid.&lt;br /&gt;
&lt;br /&gt;
How to overcome this error...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will run ‘RECOVER COPY OF DATABASE WITH TAG ‘DAILY_FULL’’ to apply incremental backups to datafile copies with the same tag.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; recover copy of database with tag 'DAILY_FULL';

Starting recover at 04-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
no copy of datafile 9 found to recover
no copy of datafile 12 found to recover
no copy of datafile 13 found to recover
no copy of datafile 17 found to recover
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00018 name=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-UNDOTBS2_FNO-18_k4ls5pee.dbf
channel ORA_DISK_1: reading from backup piece /home/ora10g/backup/krls5qrn_1_1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/ora10g/backup/krls5qrn_1_1.dbf tag=TAG20101104T145544
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00008 name=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SAP_MERGE_FNO-8_k3ls5p99.dbf
channel ORA_DISK_1: reading from backup piece /home/ora10g/backup/kqls5qrm_1_1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/ora10g/backup/kqls5qrm_1_1.dbf tag=TAG20101104T145544
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy fno=00006 name=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-BILL_DATA_FNO-6_k8ls5pnh.dbf
channel ORA_DISK_1: reading from backup piece /home/ora10g/backup/kvls5qrs_1_1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/ora10g/backup/kvls5qrs_1_1.dbf tag=TAG20101104T145544
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
...
...
Finished recover at 04-NOV-10&lt;/pre&gt;&lt;br /&gt;
Notice this part of the log:&lt;br /&gt;
no copy of datafile 9 found to recover&lt;br /&gt;
no copy of datafile 12 found to recover&lt;br /&gt;
no copy of datafile 13 found to recover&lt;br /&gt;
no copy of datafile 17 found to recover&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;From alertlog:
...
Thu Nov  4 15:26:51 2010
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf
Thu Nov  4 15:27:06 2010
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
datafilecopy header validation failure for file /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf
...
...
&lt;/pre&gt;&lt;br /&gt;
&lt;blockquote&gt;ORA-19563:&lt;br /&gt;
%s header validation failed for file string&lt;br /&gt;
&lt;br /&gt;
Cause:  When opening the file to be placed in a copy or backup set, to be inspected, or used as the target for an incremental restore, its header was not recognized as a valid file header for a file of the indicated type (data file, archived log, or control file) belonging to the current database.&lt;br /&gt;
&lt;br /&gt;
Action:  Ensure that the correct files are being specified for the copy or backup operation.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
When I run ‘switch database to copy’ command it fails again with same error as before:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; switch database to copy;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of switch to copy command at 11/04/2010 18:29:03
RMAN-06571: datafile 9 does not have recoverable copy&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
To overcome this error I will &lt;b&gt;uncatalog noted datafiles&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; change copy of datafile 9 uncatalog;

using target database control file instead of recovery catalog
uncataloged datafile copy
datafile copy filename=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf recid=95 stamp=734192788
Uncataloged 1 objects


RMAN&gt; change copy of datafile 12 uncatalog;

uncataloged datafile copy
datafile copy filename=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf recid=93 stamp=734192037
Uncataloged 1 objects


RMAN&gt; change copy of datafile 13 uncatalog;

uncataloged datafile copy
datafile copy filename=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf recid=92 stamp=734191568
Uncataloged 1 objects


RMAN&gt; change copy of datafile 17 uncatalog;

uncataloged datafile copy
datafile copy filename=/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf recid=94 stamp=734192505
Uncataloged 1 objects
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Catalog&lt;/b&gt; them again:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; catalog start with '/home/ora10g/backup';

searching for all files that match the pattern /home/ora10g/backup

List of Files Unknown to the Database
=====================================
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
File Name: /home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Let’s try switch database to copy:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; switch database to copy;

datafile 1 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SYSTEM_FNO-1_k6ls5plb.dbf"
datafile 2 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SAPBI_DATA_FNO-2_k7ls5pmo.dbf"
datafile 3 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SYSAUX_FNO-3_k5ls5piv.dbf"
datafile 4 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-APP_DATA_FNO-4_k2ls5p4o.dbf"
datafile 5 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-USERS_FNO-5_kbls5ppj.dbf"
datafile 6 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-BILL_DATA_FNO-6_k8ls5pnh.dbf"
datafile 7 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-OT_DATA_FNO-7_kcls5pq2.dbf"
datafile 8 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SAP_MERGE_FNO-8_k3ls5p99.dbf"
datafile 9 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf"
datafile 10 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PHONEBOOK_FNO-10_kals5pp4.dbf"
datafile 11 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-IVR_DATA_FNO-11_kdls5pqh.dbf"
datafile 12 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf"
datafile 13 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf"
datafile 14 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SIPDIR_DATA_FNO-14_k9ls5pob.dbf"
datafile 16 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-INV_RN_INTERFACE_FNO-16_kels5pr0.dbf"
datafile 17 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf"
datafile 18 switched to datafile copy "/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-UNDOTBS2_FNO-18_k4ls5pee.dbf"
&lt;/pre&gt;&lt;br /&gt;
It worked...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Recover database now:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; recover database;

Starting recover at 04-NOV-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=10
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=11
channel ORA_DISK_1: reading from backup piece /home/ora10g/backup/ARCH_RASAPP_20101104_kjls5q8e_s3731_p1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/ora10g/backup/ARCH_RASAPP_20101104_kjls5q8e_s3731_p1 tag=ARCHIVELOGS
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/u01/oradata/rasapp/archlogs/1_10_734173548.dbf thread=1 sequence=10
archive log filename=/u01/oradata/rasapp/archlogs/1_11_734173548.dbf thread=1 sequence=11
unable to find archive log
archive log thread=1 sequence=12
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/04/2010 18:31:26
RMAN-06054: media recovery requesting unknown log: thread 1 seq 12 lowscn 48367782959
&lt;/pre&gt;&lt;br /&gt;
I’m missing some redo entries - this is because I forgot to copy multiplexed redo log files to the correct location.&lt;br /&gt;
&lt;br /&gt;
Copy multiplexed redo logs to specified locations:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/oradata/rasapp/redo01a.rdo
/u02/oradata/rasapp/redo01b.rdo
/u01/oradata/rasapp/redo02a.rdo
/u02/oradata/rasapp/redo02b.rdo
/u01/oradata/rasapp/redo03a.rdo
/u02/oradata/rasapp/redo03b.rdo

6 rows selected.


$ cp redo01b.rdo /u02/oradata/rasapp/
...
...&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Everything should be OK now during recovery:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Thu Nov 4 18:50:25 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: RASAPP (DBID=1650089695, not open)

RMAN&gt; recover database;

Starting recover at 04-NOV-10
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK

starting media recovery

archive log thread 1 sequence 12 is already on disk as file /u01/oradata/rasapp/redo03b.rdo
archive log filename=/u02/oradata/rasapp/redo03b.rdo thread=1 sequence=12
media recovery complete, elapsed time: 00:00:06
Finished recover at 04-NOV-10

RMAN&gt; alter database open resetlogs;

database opened
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Let’s check data:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; col file_name for a100
SQL&gt; set lines 200
SQL&gt; set pages 999
SQL&gt; select file_name from dba_data_files;

FILE_NAME
----------------------------------------------------------------------------------------------------
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SYSTEM_FNO-1_k6ls5plb.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SAPBI_DATA_FNO-2_k7ls5pmo.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SYSAUX_FNO-3_k5ls5piv.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-OT_DATA_FNO-7_kcls5pq2.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-APP_DATA_FNO-4_k2ls5p4o.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-USERS_FNO-5_kbls5ppj.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-BILL_DATA_FNO-6_k8ls5pnh.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SAP_MERGE_FNO-8_k3ls5p99.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-LNP_FNO-9_k1ls5orq.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PHONEBOOK_FNO-10_kals5pp4.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-IVR_DATA_FNO-11_kdls5pqh.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-PSUB_DATA_FNO-12_jvls5nuo.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-DSLAM_STATS_FNO-13_juls5nco.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-SIPDIR_DATA_FNO-14_k9ls5pob.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-INV_RN_INTERFACE_FNO-16_kels5pr0.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-TS_DATA_FNO-17_k0ls5od9.dbf
/home/ora10g/backup/data_D-RASAPP_I-1650089695_TS-UNDOTBS2_FNO-18_k4ls5pee.dbf

17 rows selected.

SQL&gt; select count(*) from dba_objects where status&lt;&gt;'VALID';

  COUNT(*)
----------
         0

SQL&gt; select count(*) from admin.test123;

  COUNT(*)
----------
     50118
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
In your own test environment, you can try out many different recovery scenarios without doing any harm. Performing test cases is very important for DBA’s because you must be well prepared when production database encounters disaster ;)&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7535427003238504526?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/qbTTkZztEtQh2EF_VI_jHX4lr6w/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qbTTkZztEtQh2EF_VI_jHX4lr6w/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/qbTTkZztEtQh2EF_VI_jHX4lr6w/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/qbTTkZztEtQh2EF_VI_jHX4lr6w/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/jLv8Xp3A3IQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7535427003238504526/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7535427003238504526&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7535427003238504526?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7535427003238504526?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/jLv8Xp3A3IQ/recover-from-incrementally-updated.html" title="Recover From Incrementally Updated Backup (test case)" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/11/recover-from-incrementally-updated.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcAQ3Y4cSp7ImA9Wx5UFEQ.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-8224224958674896251</id><published>2010-10-19T15:14:00.000+02:00</published><updated>2010-10-19T15:14:02.839+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-19T15:14:02.839+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Certification" /><title>Finally, I’m Oracle 10g Certified Professional now</title><content type="html">I’ve been studying last couple of months for the exam “1Z0-043 Oracle Database 10g: Administration II” and today I finally passed that exam. So I’m officially &lt;b&gt;OCP 10g&lt;/b&gt; now :)&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
As I was mostly learning in my spare time whole that process lasted longer then I’ve expected. Material was familiar to me before I began studying for the exam but still I’ve become more proficient with resource management, using scheduler, handling block corruption, securing listener, etc.&lt;br /&gt;
&lt;br /&gt;
For learning material I used Official Oracle Documentation, several different books, blog articles and OTN forum posts. But the most important was testing environment where I installed 10g database and played with it.&lt;br /&gt;
&lt;br /&gt;
I don’t know what will be my next certification but I’m sure that I will find something interesting eventually :)&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-8224224958674896251?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3rgWwsk3WRApKs7BNpwY2MxGi2E/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3rgWwsk3WRApKs7BNpwY2MxGi2E/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3rgWwsk3WRApKs7BNpwY2MxGi2E/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3rgWwsk3WRApKs7BNpwY2MxGi2E/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/T7j_ln9ZvuA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/8224224958674896251/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=8224224958674896251&amp;isPopup=true" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8224224958674896251?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8224224958674896251?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/T7j_ln9ZvuA/finally-im-oracle-10g-certified.html" title="Finally, I’m Oracle 10g Certified Professional now" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/10/finally-im-oracle-10g-certified.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkEDSXk7cSp7ImA9Wx5RF08.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-4728530247071300030</id><published>2010-08-24T11:21:00.004+02:00</published><updated>2010-08-25T09:17:58.709+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-25T09:17:58.709+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>Using Flashback Database to perform PITR</title><content type="html">Flashback database is great alternative for incomplete recovery because it is much less time consuming in some cases. You can find in documentation nice explanations how flashback database works so I won’t concentrate much on theory.&lt;br /&gt;
&lt;br /&gt;
In this blog post I will perform simple demo case of point in time recovery using flashback database feature.&lt;br /&gt;
&lt;br /&gt;
Database must be in ARCHIVELOG mode and FLASHBACK should be enabled.&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Prod
PL/SQL Release 10.1.0.4.0 - Production
CORE    10.1.0.4.0      Production
TNS for Linux: Version 10.1.0.4.0 - Production
NLSRTL Version 10.1.0.4.0 - Production





SQL&gt; select log_mode,flashback_on from v$database;

LOG_MODE     FLASHBACK_ON
------------ ------------------
ARCHIVELOG   YES
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
For testing purposes I will use SCOTT schema where I will create three tables in different time periods with my “sensitive data”.&lt;br /&gt;
&lt;br /&gt;
Created first table at 21:35.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; conn scott/tiger
Connected.

SQL&gt; select to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'DD
--------
23.08.2010 21:35:19

SQL&gt; create table t1 (a number);

Table created.

SQL&gt; insert into t1 values (1);

1 row created.

SQL&gt; commit;

Commit complete.
&lt;/pre&gt;&lt;br /&gt;
Second table at 21:45.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'DD
--------
23.08.2010 21:45:05

SQL&gt; create table t2 (b number);

Table created.

SQL&gt; insert into t2 values (2);

1 row created.

SQL&gt; commit;

Commit complete.
&lt;/pre&gt;&lt;br /&gt;
Third table at 22:05.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select to_char(sysdate,'dd.mm.yyyy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'DD
--------
23.08.2010 22:05:48

SQL&gt; create table t3 (c number);

Table created.

SQL&gt; insert into t3 values (3);

1 row created.

SQL&gt; commit;

Commit complete.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Lets assume that SCOTT is important production schema and DBA drops that schema by mistake. It is very important to recover lost schema as quickly as possible. DBA isn’t sure about correct time when he/she dropped schema.&lt;br /&gt;
&lt;br /&gt;
Drop SCOTT schema:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 23 22:13:13 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL&gt; drop user scott cascade;

User dropped.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
RMAN uses flashback logs to undo changes to point before target time and then applies redo logs that are needed to make database consistent.&lt;br /&gt;
&lt;br /&gt;
I will shutdown database and start in mount mode. As you can see I will use “shutdown abort” opinion - simply to minimize downtime.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown abort;
ORACLE instance shut down.


SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size                  1219064 bytes
Variable Size              83887624 bytes
Database Buffers          209715200 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL&gt;
&lt;/pre&gt;&lt;br /&gt;
Flashback database to 21:40 because DBA said that he/she dropped schema somewhere around that time.&lt;br /&gt;
Before opening database with resetlogs opinion I want to check for my sensitive data. So I will temporary open flashbacked database in read only mode and do some checks.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; flashback database to timestamp
 2  to_timestamp('23.08.2010 21:40:00','dd.mm.yyyy hh24:mi:ss');

Flashback complete.


SQL&gt; alter database open read only;

Database altered.
&lt;/pre&gt;&lt;br /&gt;
My SCOTT schema is here but some data is missing.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from scott.t1;

        A
----------
        1

SQL&gt; select * from scott.t2;
select * from scott.t2
                   *
ERROR at line 1:
ORA-00942: table or view does not exist


SQL&gt; select * from scott.t3;
select * from scott.t3
                   *
ERROR at line 1:
ORA-00942: table or view does not exist
&lt;/pre&gt;&lt;br /&gt;
I will recover database to 21:50 and do some checks in read only mode:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown abort;
ORACLE instance shut down.
SQL&gt;
SQL&gt;
SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size                  1219064 bytes
Variable Size              83887624 bytes
Database Buffers          209715200 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL&gt;


SQL&gt; recover database until time '2010-08-23:21:50:00';

ORA-00279: change 609683 generated at 08/23/2010 21:40:13 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_
recovery_area/ORA10G/archivelog/2010_08_23/o1_mf_1_10_%u_.
arc
ORA-00280: change 609683 for thread 1 is in sequence #10


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}

Log applied.
Media recovery complete.
&lt;/pre&gt;&lt;br /&gt;
This is better situation but still some data is missing.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database open read only;

Database altered.

SQL&gt; select * from scott.t1;

        A
----------
        1

SQL&gt; select * from scott.t2;

        B
----------
        2

SQL&gt; select * from scott.t3;
select * from scott.t3
                   *
ERROR at line 1:
ORA-00942: table or view does not exist
&lt;/pre&gt;&lt;br /&gt;
This time I will recover to 22:07.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown abort;
ORACLE instance shut down.

SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size                  1219064 bytes
Variable Size              83887624 bytes
Database Buffers          209715200 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL&gt;
SQL&gt;
SQL&gt; recover database until time '2010-08-23:22:07:00';
Media recovery complete.
&lt;/pre&gt;&lt;br /&gt;
Now everything is here.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database open read only;

Database altered.

SQL&gt; select * from scott.t1;

        A
----------
        1

SQL&gt; select * from scott.t2;

        B
----------
        2

SQL&gt; select * from scott.t3;

        C
----------
        3
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As I recovered all my sensitive data it is safe to open database with RESETLOGS opinion.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown abort;
ORACLE instance shut down.

SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area  608174080 bytes
Fixed Size                  1268896 bytes
Variable Size             209716064 bytes
Database Buffers          390070272 bytes
Redo Buffers                7118848 bytes
Database mounted.

SQL&gt; alter database open resetlogs;
Database altered.
&lt;/pre&gt;&lt;br /&gt;
Point in time recovery with flashback database lasted only several minutes with minimal loss of data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
REFERENCE&lt;br /&gt;
http://www.comp.dit.ie/btierney/oracle11gdoc/backup.111/b28273/rcmsynta023.htm&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-4728530247071300030?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1WGhpo_xdhFORjHwhmr8pJ6XBak/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1WGhpo_xdhFORjHwhmr8pJ6XBak/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1WGhpo_xdhFORjHwhmr8pJ6XBak/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1WGhpo_xdhFORjHwhmr8pJ6XBak/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/dCA8rE_i7_I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/4728530247071300030/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=4728530247071300030&amp;isPopup=true" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4728530247071300030?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4728530247071300030?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/dCA8rE_i7_I/using-flashback-database-to-perform.html" title="Using Flashback Database to perform PITR" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/08/using-flashback-database-to-perform.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ENQHw5fyp7ImA9Wx5RFE8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-4936461460140091448</id><published>2010-08-22T00:25:00.001+02:00</published><updated>2010-08-22T00:28:11.227+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-08-22T00:28:11.227+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>Recovering From A Lost Controlfile</title><content type="html">I decided to play a little with control file recovery. It is always wise to have controlfiles multiplexed on separate disks but for testing purposes my controlfiles will be placed in the same directory.&lt;br /&gt;
&lt;br /&gt;
What will happen when I delete one of my three controlfiles?&lt;br /&gt;
&lt;br /&gt;
From documentation:&lt;br /&gt;
&lt;blockquote&gt;Damage to any control file, whether it is multiplexed or not, halts database operation when the database attempts to read or write to the damaged control file (which happens frequently, for example at every checkpoint and log switch).&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Little demonstration...&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
Environment:&lt;br /&gt;
Linux 32 bit&lt;br /&gt;
Oracle 10gR2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Delete one controlfile:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ora10g/control01.ctl
/u01/app/oracle/oradata/ora10g/control02.ctl
/u01/app/oracle/oradata/ora10g/control03.ctl


SQL&gt; !rm /u01/app/oracle/oradata/ora10g/control03.ctl
&lt;/pre&gt;&lt;br /&gt;
First I will try shutdown immediate:&lt;br /&gt;
(Operation failed but database is still up and active.)&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora10g/control03.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3

-- from alert.log:

Sat Aug 21 23:52:00 2010
Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_16200.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora10g/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sat Aug 21 23:52:00 2010
Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_16200.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora10g/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
Sat Aug 21 23:52:01 2010
Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_16200.trc:
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ora10g/control01.ctl'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
What will happen if I copy good controlfile to location of missing one and then try to alter tablespace.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; !cp /u01/app/oracle/oradata/ora10g/control01.ctl -
&gt; /u01/app/oracle/oradata/ora10g/control03.ctl

SQL&gt; alter system checkpoint;

System altered.



SQL&gt; alter tablespace users read only;
alter tablespace users read only
     *
ERROR at line 1:
ORA-03113: end-of-file on communication channel



-- from alert.log:
Sat Aug 21 18:54:29 2010
********************* ATTENTION: ********************
The controlfile header block returned by the OS
has a sequence number that is too old.
The controlfile might be corrupted.
PLEASE DO NOT ATTEMPT TO START UP THE INSTANCE
without following the steps below.
RE-STARTING THE INSTANCE CAN CAUSE SERIOUS DAMAGE
TO THE DATABASE, if the controlfile is truly corrupted.
In order to re-start the instance safely,
please do the following:
(1) Save all copies of the controlfile for later
    analysis and contact your OS vendor and Oracle support.
(2) Mount the instance and issue:
    ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
(3) Unmount the instance.
(4) Use the script in the trace file to
    RE-CREATE THE CONTROLFILE and open the database.
*****************************************************
Instance terminated by DBW0, pid = 7444
&lt;/pre&gt;Instance was immediately terminated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What if I execute startup now:&lt;br /&gt;
(Operation failed with error below.)&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; startup
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size                  1219064 bytes
Variable Size              71304712 bytes
Database Buffers          222298112 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-01110: data file 4: '/u01/app/oracle/oradata/ora10g/users01.dbf'
ORA-00372: file 4 cannot be modified at this time
ORA-01110: data file 4: '/u01/app/oracle/oradata/ora10g/users01.dbf'
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So what is the proper way to handle this controlfile recovery.&lt;br /&gt;
&lt;br /&gt;
Delete one controlfile to simulate disk or controller failure.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ora10g/control01.ctl
/u01/app/oracle/oradata/ora10g/control02.ctl
/u01/app/oracle/oradata/ora10g/control03.ctl

SQL&gt;

SQL&gt; !rm /u01/app/oracle/oradata/ora10g/control03.ctl
&lt;/pre&gt;&lt;br /&gt;
Shutdown &lt;b&gt;abort&lt;/b&gt; database and copy good copy of controlfile to the location of the lost one. You can also modify parameter file (CONTROL_FILES parameter) if you have to change location of lost controlfile.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown abort;
ORACLE instance shut down.

SQL&gt; !cp /u01/app/oracle/oradata/ora10g/control01.ctl -
&gt; /u01/app/oracle/oradata/ora10g/control03.ctl

SQL&gt; startup
ORACLE instance started.

Total System Global Area  297795584 bytes
Fixed Size                  1219064 bytes
Variable Size              71304712 bytes
Database Buffers          222298112 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.

SQL&gt;
&lt;/pre&gt;&lt;br /&gt;
Database is up and fully functional.&lt;br /&gt;
&lt;br /&gt;
REFERENCE&lt;br /&gt;
http://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/intro008.htm#sthref96&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-4936461460140091448?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ywCK2T4l-k5tDF56ZpztgMYfxcY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ywCK2T4l-k5tDF56ZpztgMYfxcY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ywCK2T4l-k5tDF56ZpztgMYfxcY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ywCK2T4l-k5tDF56ZpztgMYfxcY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/gg9jsDtWli8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/4936461460140091448/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=4936461460140091448&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4936461460140091448?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/4936461460140091448?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/gg9jsDtWli8/recovering-from-lost-controlfile.html" title="Recovering From A Lost Controlfile" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/08/recovering-from-lost-controlfile.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkEARHs8fSp7ImA9WxFaF00.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-912850520568704649</id><published>2010-07-21T11:27:00.002+02:00</published><updated>2010-07-21T11:30:45.575+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-21T11:30:45.575+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Tuning" /><category scheme="http://www.blogger.com/atom/ns#" term="Storage" /><title>Automatic Workload Repository (AWR) space usage</title><content type="html">AWR is very powerful diagnostic tool which is used for problem detection and tuning. By default, snapshots of database performance statistics and metrics are taken every hour, retained for 7 days and stored in SYSAUX tablespace.&lt;br /&gt;
&lt;br /&gt;
If possible, I prefer to change default settings to increase retention period and reduce snapshot interval. Before changing default values it is important to think about space consumption by the Automatic Workload Repository.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nice tool for estimating amount of space required for the SYSAUX tablespace is - &lt;b&gt;utlsyxsz.sql&lt;/b&gt; stored in “$ORACLE_HOME/rdbms/admin” directory.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
In this example I will estimate size of AWR data with 15 min intervals and 60 days of retention.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;This script estimates the space required for the SYSAUX tablespace.&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
&lt;br /&gt;
Specify the Report File Name&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
The default report file name is utlsyxsz.txt.  To use this name,&lt;br /&gt;
press &lt;return&gt; to continue, otherwise enter an alternative.&lt;br /&gt;
&lt;br /&gt;
Enter value for report_name: /tmp/estimate_awr.out&lt;br /&gt;
&lt;br /&gt;
Using the report name /tmp/estimate_awr.out&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
SYSAUX Size Estimation Report&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
&lt;br /&gt;
Estimated at&lt;br /&gt;
10:03:56 on Srp 21, 2010 ( Srijeda ) in Timezone +02:00&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DB_NAME     HOST_PLATFORM                             INST STARTUP_TIME      PAR&lt;br /&gt;
----------- ---------------------------------------- ----- ----------------- ---&lt;br /&gt;
* TESTDB    l01test1 - Linux IA (32-bit)                1 22:08:09 (10/13)  NO&lt;br /&gt;
&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
Current SYSAUX usage&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
| Total SYSAUX size:                         653.9 MB&lt;br /&gt;
|&lt;br /&gt;
| Total size of SM/AWR                       334.8 MB (  51.2% of SYSAUX )&lt;br /&gt;
| Total size of SM/OPTSTAT                   104.2 MB (  15.9% of SYSAUX )&lt;br /&gt;
| Total size of EM                            48.8 MB (   7.5% of SYSAUX )&lt;br /&gt;
| Total size of XDB                           48.2 MB (   7.4% of SYSAUX )&lt;br /&gt;
| Total size of SM/ADVISOR                    45.2 MB (   6.9% of SYSAUX )&lt;br /&gt;
| Total size of SDO                           33.1 MB (   5.1% of SYSAUX )&lt;br /&gt;
| Total size of WM                             7.1 MB (   1.1% of SYSAUX )&lt;br /&gt;
| Total size of LOGMNR                         5.9 MB (   0.9% of SYSAUX )&lt;br /&gt;
| Total size of SM/OTHER                       4.9 MB (   0.8% of SYSAUX )&lt;br /&gt;
| Total size of TEXT                           4.6 MB (   0.7% of SYSAUX )&lt;br /&gt;
| Total size of EXPRESSION_FILTER              3.6 MB (   0.6% of SYSAUX )&lt;br /&gt;
| Total size of EM_MONITORING_USER             1.6 MB (   0.2% of SYSAUX )&lt;br /&gt;
| Total size of LOGSTDBY                       0.9 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of XSOQHIST                       0.8 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of AO                             0.8 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of JOB_SCHEDULER                  0.8 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of ORDIM                          0.5 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of STREAMS                        0.5 MB (   0.1% of SYSAUX )&lt;br /&gt;
| Total size of TSM                            0.3 MB (   0.0% of SYSAUX )&lt;br /&gt;
| Total size of ODM                            0.3 MB (   0.0% of SYSAUX )&lt;br /&gt;
| Total size of Others                         7.2 MB (   1.1% of SYSAUX )&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
AWR Space Estimation&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
&lt;br /&gt;
| To estimate the size of the Automatic Workload Repository (AWR)&lt;br /&gt;
| in SYSAUX, we need the following values:&lt;br /&gt;
|&lt;br /&gt;
|     - Interval Setting (minutes)&lt;br /&gt;
|     - Retention Setting (days)&lt;br /&gt;
|     - Number of Instances&lt;br /&gt;
|     - Average Number of Active Sessions&lt;br /&gt;
|     - Number of Datafiles&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Interval Setting',&lt;br /&gt;
|   Press [return] to use the current value:     60.0 minutes&lt;br /&gt;
|   otherwise enter an alternative&lt;br /&gt;
|&lt;br /&gt;
Enter value for interval: 15&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Interval Setting': 15&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Retention Setting',&lt;br /&gt;
|   Press [return] to use the current value:     30.0 days&lt;br /&gt;
|   otherwise enter an alternative&lt;br /&gt;
|&lt;br /&gt;
Enter value for retention: 60&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Retention Setting': 60&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Number of Instances',&lt;br /&gt;
|   Press [return] to use the current value:   1.00&lt;br /&gt;
|   otherwise enter an alternative&lt;br /&gt;
|&lt;br /&gt;
Enter value for num_instances: 1&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Number of Instances': 1&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Average Number of Active Sessions',&lt;br /&gt;
|   Press [return] to use the current value:   0.43&lt;br /&gt;
|   otherwise enter an alternative&lt;br /&gt;
|&lt;br /&gt;
Enter value for active_sessions:&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Average Number of Active Sessions': .43&lt;br /&gt;
&lt;br /&gt;
| ***************************************************&lt;br /&gt;
| Estimated size of AWR:                   2,816.7 MB&lt;br /&gt;
|&lt;br /&gt;
|   The AWR estimate was computed using&lt;br /&gt;
|   the following values:&lt;br /&gt;
|&lt;br /&gt;
|            Interval -        15 minutes&lt;br /&gt;
|           Retention -     60.00 days&lt;br /&gt;
|       Num Instances -         1&lt;br /&gt;
|     Active Sessions -      0.43&lt;br /&gt;
|           Datafiles -        17&lt;br /&gt;
| ***************************************************&lt;br /&gt;
&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
Optimizer Stat History Space Estimation&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
&lt;br /&gt;
| To estimate the size of the Optimizer Statistics History&lt;br /&gt;
| we need the following values:&lt;br /&gt;
|&lt;br /&gt;
|     - Number of Tables in the Database&lt;br /&gt;
|     - Number of Partitions in the Database&lt;br /&gt;
|     - Statistics Retention Period (days)&lt;br /&gt;
|     - DML Activity in the Database (level)&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Number of Tables',&lt;br /&gt;
|   Press [return] to use the current value:    463.0&lt;br /&gt;
|   otherwise enter an alternative [a positive integer]&lt;br /&gt;
|&lt;br /&gt;
Enter value for number_of_tables:&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Number of Tables': 463&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Number of Partitions',&lt;br /&gt;
|   Press [return] to use the current value:   0.00&lt;br /&gt;
|   otherwise enter an alternative [a positive integer]&lt;br /&gt;
|&lt;br /&gt;
Enter value for number_of_partitions:&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Number of Partitions': 0&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'Statistics Retention',&lt;br /&gt;
|   Press [return] to use the current value:     31.0 days&lt;br /&gt;
|   otherwise enter an alternative [a positive integer]&lt;br /&gt;
|&lt;br /&gt;
Enter value for stats_retention:&lt;br /&gt;
&lt;br /&gt;
**   Value for 'Statistics Retention': 31&lt;br /&gt;
&lt;br /&gt;
|&lt;br /&gt;
| For 'DML Activity',&lt;br /&gt;
|   Press [return] to use the current value:        2 [medium]&lt;br /&gt;
|   otherwise enter an alternative [1=low, 2=medium, 3=high]&lt;br /&gt;
|&lt;br /&gt;
Enter value for dml_activity:&lt;br /&gt;
&lt;br /&gt;
**   Value for 'DML Activity': 2&lt;br /&gt;
&lt;br /&gt;
| ***************************************************&lt;br /&gt;
| Estimated size of Stats history             33.4 MB&lt;br /&gt;
|&lt;br /&gt;
|   The space for Optimizer Statistics history was&lt;br /&gt;
|   estimated using the following values:&lt;br /&gt;
|&lt;br /&gt;
|                         Tables -     463&lt;br /&gt;
|                        Indexes -     496&lt;br /&gt;
|                        Columns -   5,734&lt;br /&gt;
|                     Partitions -       0&lt;br /&gt;
|          Indexes on Partitions -       0&lt;br /&gt;
|          Columns in Partitions -       0&lt;br /&gt;
|        Stats Retention in Days -      31&lt;br /&gt;
|          Level of DML Activity -  Medium&lt;br /&gt;
| ***************************************************&lt;br /&gt;
&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
Estimated SYSAUX usage&lt;br /&gt;
~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
| Estimated size of AWR:                   2,816.7 MB&lt;br /&gt;
|&lt;br /&gt;
|   The AWR estimate was computed using&lt;br /&gt;
|   the following values:&lt;br /&gt;
|&lt;br /&gt;
|            Interval -        15 minutes&lt;br /&gt;
|           Retention -     60.00 days&lt;br /&gt;
|       Num Instances -         1&lt;br /&gt;
|     Active Sessions -      0.43&lt;br /&gt;
|           Datafiles -        17&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
| Estimated size of Stats history             33.4 MB&lt;br /&gt;
|&lt;br /&gt;
|   The space for Optimizer Statistics history was&lt;br /&gt;
|   estimated using the following values:&lt;br /&gt;
|&lt;br /&gt;
|                         Tables -     463&lt;br /&gt;
|                        Indexes -     496&lt;br /&gt;
|                        Columns -   5,734&lt;br /&gt;
|                     Partitions -       0&lt;br /&gt;
|          Indexes on Partitions -       0&lt;br /&gt;
|          Columns in Partitions -       0&lt;br /&gt;
|        Stats Retention in Days -      31&lt;br /&gt;
|          Level of DML Activity -  Medium&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
|   For all the other components, the estimate&lt;br /&gt;
|   is equal to the current space usage of&lt;br /&gt;
|   the component.&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| ***************************************************&lt;br /&gt;
| Summary of SYSAUX Space Estimation&lt;br /&gt;
| ***************************************************&lt;br /&gt;
&lt;br /&gt;
| Est size of EM                              48.8 MB&lt;br /&gt;
| Est size of XDB                             48.2 MB&lt;br /&gt;
| Est size of SM/ADVISOR                      45.2 MB&lt;br /&gt;
| Est size of SDO                             33.1 MB&lt;br /&gt;
| Est size of WM                               7.1 MB&lt;br /&gt;
| Est size of LOGMNR                           5.9 MB&lt;br /&gt;
| Est size of SM/OTHER                         4.9 MB&lt;br /&gt;
| Est size of TEXT                             4.6 MB&lt;br /&gt;
| Est size of EXPRESSION_FILTER                3.6 MB&lt;br /&gt;
| Est size of EM_MONITORING_USER               1.6 MB&lt;br /&gt;
| Est size of LOGSTDBY                         0.9 MB&lt;br /&gt;
| Est size of XSOQHIST                         0.8 MB&lt;br /&gt;
| Est size of AO                               0.8 MB&lt;br /&gt;
| Est size of JOB_SCHEDULER                    0.8 MB&lt;br /&gt;
| Est size of ORDIM                            0.5 MB&lt;br /&gt;
| Est size of STREAMS                          0.5 MB&lt;br /&gt;
| Est size of TSM                              0.3 MB&lt;br /&gt;
| Est size of ODM                              0.3 MB&lt;br /&gt;
| Est size of Others                           7.2 MB&lt;br /&gt;
&lt;br /&gt;
| Est size of SM/AWR                       2,816.7 MB&lt;br /&gt;
| Est size of SM/OPTSTAT                      33.4 MB&lt;br /&gt;
|&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
| Total Estimated SYSAUX size:             3,065.0 MB&lt;br /&gt;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;br /&gt;
| ***************************************************&lt;br /&gt;
&lt;br /&gt;
End of Report&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
Another nice script to mention - &lt;b&gt;awrinfo.sql&lt;/b&gt; stored in “$ORACLE_HOME/rdmbs/admin” directory. This script displays general AWR information such as current space usage, data distribution, etc. I like to check space usage with awrinfo.sql script when SYSAUX starts to increase rapidly.&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-912850520568704649?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PbOEAQ2d1beGknGjIYD-8sXaLEM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PbOEAQ2d1beGknGjIYD-8sXaLEM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PbOEAQ2d1beGknGjIYD-8sXaLEM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PbOEAQ2d1beGknGjIYD-8sXaLEM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/8aRm7udEqFM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/912850520568704649/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=912850520568704649&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/912850520568704649?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/912850520568704649?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/8aRm7udEqFM/automatic-workload-repository-awr-space.html" title="Automatic Workload Repository (AWR) space usage" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/07/automatic-workload-repository-awr-space.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcAQXw5eyp7ImA9WxFaFk8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-974508487517123079</id><published>2010-07-20T13:38:00.002+02:00</published><updated>2010-07-20T13:40:40.223+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-20T13:40:40.223+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Storage" /><title>DBA_TS_QUOTAS (ORA-00959,ORA-01536)</title><content type="html">How much space user can consume in particular tablespace is showed in DBA_TS_QUOTAS dictionary view. Quota can be assigned to any user on any tablespace. More about quotas can be found in Oracle documentation... &lt;br /&gt;
&lt;br /&gt;
I will concentrate on small demo case in this blog post.&lt;br /&gt;
&lt;br /&gt;
Oracle 10.2.0.4&lt;br /&gt;
Linux x86&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
Create tablespace TEST_TBS and TESTUSR.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create tablespace test_tbs;
Tablespace created.

SQL&gt; create user testusr identified by test;
User created.

SQL&gt; grant create session to testusr;
Grant succeeded.

SQL&gt; grant create table to testusr;
Grant succeeded.
&lt;/pre&gt;&lt;br /&gt;
By default, user has no quota on any tablespace.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;-- system user
SQL&gt; set lines 200
SQL&gt; col tablespace_name for a30
SQL&gt; col username for a20
SQL&gt; col dropped for a15
SQL&gt;
SQL&gt; select * from dba_ts_quotas
 2  where username='TESTUSR';

no rows selected

-- testusr user
SQL&gt; connect testusr/test
Connected.

SQL&gt; create table testtab(a number) tablespace test_tbs;
create table testtab(a number) tablespace test_tbs
*
ERROR at line 1:
ORA-01950: no privileges on tablespace 'TEST_TBS'
&lt;/pre&gt;&lt;br /&gt;
Now I will grant RESOURCE role to TESTUSR and check DBA_TS_QUTAS view.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; grant resource to testusr;
Grant succeeded.

SQL&gt; select * from dba_ts_quotas
 2  where username='TESTUSR';

no rows selected
&lt;/pre&gt;&lt;br /&gt;
Still no quota entries for TESTUSR (in dba_ts_quotas), but user is able to create table in TEST_TBS tablespace.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create table testtab1(a number) tablespace test_tbs;

Table created.
&lt;/pre&gt;&lt;br /&gt;
When I granted RESOURCE role to TESTUSR, “UNLIMITED TABLESPACE” privilege was granted automatically.&lt;br /&gt;
More about “UNLIMITED TABLESPACE” privilege:&lt;br /&gt;
&lt;a href="http://msutic.blogspot.com/2008/07/oracle-roles-unlimited-tablespace.html"&gt;http://msutic.blogspot.com/2008/07/oracle-roles-unlimited-tablespace.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When I revoke RESOURCE role, “CREATE TABLE” statement fails.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; revoke resource from testusr;
Revoke succeeded.

SQL&gt; create table testtab2(a number) tablespace test_tbs;
create table testtab2(a number) tablespace test_tbs
*
ERROR at line 1:
ORA-01536: space quota exceeded for tablespace 'TEST_TBS'
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Add some quota for user.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter user testusr quota 50M on test_tbs;
User altered.

SQL&gt; select tablespace_name,username,max_bytes,dropped
  2  from dba_ts_quotas
  3  where username='TESTUSR';

TABLESPACE_NAME                USERNAME              MAX_BYTES DROPPED
------------------------------ -------------------- ---------- ---------------
TEST_TBS                       TESTUSR                52428800 NO


SQL&gt; create table testtab2(a number) tablespace test_tbs;
Table created.
&lt;/pre&gt;&lt;br /&gt;
Now I managed to create table in TEST_TBS tablespace.&lt;br /&gt;
&lt;br /&gt;
I will drop TEST_TBS tablespace and check DBA_TS_QUOTAS.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; drop tablespace test_tbs including contents and datafiles;

Tablespace dropped.

SQL&gt; select tablespace_name,username,max_bytes,dropped
  2  from dba_ts_quotas
  3  where username='TESTUSR';

TABLESPACE_NAME                USERNAME              MAX_BYTES DROPPED
------------------------------ -------------------- ---------- ---------------
TEST_TBS                       TESTUSR                52428800 YES



SQL&gt; alter user testusr quota 0 on test_tbs;
alter user testusr quota 0 on test_tbs
*
ERROR at line 1:
ORA-00959: tablespace 'TEST_TBS' does not exist
&lt;/pre&gt;&lt;br /&gt;
User quota entry is still there with &lt;b&gt;DROPPED = YES&lt;/b&gt; (tablespace has been dropped). Quota cannot be removed from DBA_TS_QUOTES if tablespace does not exist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will create new tablespace with the same name as dropped one - “TEST_TBS”.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;-- execute as SYSTEM
SQL&gt; create tablespace test_tbs;
Tablespace created.

SQL&gt; select tablespace_name,username,max_bytes,dropped
  2  from dba_ts_quotas
  3  where username='TESTUSR';

TABLESPACE_NAME                USERNAME              MAX_BYTES DROPPED
------------------------------ -------------------- ---------- ---------------
TEST_TBS                       TESTUSR                52428800 NO


-- execute as TESTUSR
SQL&gt; create table testtab3(a number) tablespace test_tbs;
Table created.
&lt;/pre&gt;&lt;br /&gt;
Now column &lt;b&gt;DROPPED = NO&lt;/b&gt; for TESTUSR and TESTUSR is able to create table in new tablespace. To prevent this you should remove quota entries before you drop tablespace.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Remove user quota entry.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter user testusr quota 0 on test_tbs;

User altered.

SQL&gt; select * from dba_ts_quotas
 2  where username='TESTUSR';

no rows selected
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Cleanup!&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; drop tablespace test_tbs including contents and datafiles;

Tablespace dropped.

SQL&gt; drop user testusr cascade;

User dropped.
&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-974508487517123079?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9AryNGAfpQpde476fSvtvyHBTlo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9AryNGAfpQpde476fSvtvyHBTlo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9AryNGAfpQpde476fSvtvyHBTlo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9AryNGAfpQpde476fSvtvyHBTlo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/Ik0irpiH2WY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/974508487517123079/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=974508487517123079&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/974508487517123079?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/974508487517123079?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/Ik0irpiH2WY/dbatsquotas-ora-00959ora-01536.html" title="DBA_TS_QUOTAS (ORA-00959,ORA-01536)" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/07/dbatsquotas-ora-00959ora-01536.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ABRHg5fCp7ImA9WxFaGE8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-8891107385288751703</id><published>2010-07-14T14:05:00.001+02:00</published><updated>2010-07-22T22:15:55.624+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-22T22:15:55.624+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Miscellaneous" /><title>Convert "10.2.0.4 SE+CPU" to "10.2.0.4 EE+CPU"</title><content type="html">In this test case I will convert "Oracle 10.2.0.4 &lt;b&gt;SE&lt;/b&gt; + CPU" to "Oracle 10.2.0.4 &lt;b&gt;EE&lt;/b&gt; + CPU".&lt;br /&gt;
&lt;br /&gt;
I’ve installed "Oracle 10.2.0.4 SE+CPU" on my test machine and created database for test purpose. Database resides on Linux 32bit operating system.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
My steps:&lt;br /&gt;
&lt;br /&gt;
1. Install Oracle 10.2.0.1 EE software to different location.&lt;br /&gt;
During software installation I will keep my database running and won’t touch 10.2.0.4 SE installation.&lt;br /&gt;
&lt;br /&gt;
2. Upgrade 10.2.0.1 EE software to 10.2.0.4 version and apply CPU.&lt;br /&gt;
&lt;br /&gt;
3. Shutdown database and listener + take cold backup.&lt;br /&gt;
&lt;br /&gt;
4. Copy parameter file (init.ora/spfile.ora) from SE/dbs to EE/dbs.&lt;br /&gt;
&lt;br /&gt;
5. Copy tnsnames.ora, listener.ora and sqlnet.ora from SE/network/admin to EE/network/admin.&lt;br /&gt;
&lt;br /&gt;
6. Change ORACLE_HOME environment variable to point database to new EE home.&lt;br /&gt;
&lt;br /&gt;
7. If necessary change /etc/oratab entries to point new EE home.&lt;br /&gt;
&lt;br /&gt;
8. Startup database and listener.&lt;br /&gt;
&lt;br /&gt;
9. Run the catalog.sql and catproc.sql scripts.&lt;br /&gt;
&lt;br /&gt;
10. Run utlrp.sql to recompile invalid objects.&lt;br /&gt;
&lt;br /&gt;
11. Later you can remove SE installation using OUI (if everything went OK).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Small checks:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

5 rows selected.

SQL&gt; select count(*) from dba_objects where status&lt;&gt;'VALID';

 COUNT(*)
----------
        0

1 row selected.


Check Alert.log -&gt; OK.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Maybe some steps are unnecessary or incorrect so if you have any suggestion or correction please leave it in a comment and I will add correction.&lt;br /&gt;
&lt;br /&gt;
Thanks!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-8891107385288751703?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HVnYWl3NolWPsm_0oyDOpwQB9jY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HVnYWl3NolWPsm_0oyDOpwQB9jY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HVnYWl3NolWPsm_0oyDOpwQB9jY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HVnYWl3NolWPsm_0oyDOpwQB9jY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/Nd_YPb5qq7M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/8891107385288751703/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=8891107385288751703&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8891107385288751703?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8891107385288751703?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/Nd_YPb5qq7M/convert-10204-secpu-to-10204-eecpu.html" title="Convert &quot;10.2.0.4 SE+CPU&quot; to &quot;10.2.0.4 EE+CPU&quot;" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/07/convert-10204-secpu-to-10204-eecpu.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4NQXoycSp7ImA9WxFbF0k.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7920544826140091899</id><published>2010-07-10T08:38:00.001+02:00</published><updated>2010-07-10T08:39:50.499+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-10T08:39:50.499+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Certification" /><title>My first Oracle Course</title><content type="html">After waiting for couple of months finally enough students signed up for the “Oracle Database 11g: Administration Workshop II Release 2” and we could start with the course.&lt;br /&gt;
&lt;br /&gt;
Given that most of the topics  were already familiar to me I didn’t expect to learn much. So I must confess that I was a bit sceptical about the course.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
But the course exceeded all my expectations...&lt;br /&gt;
&lt;br /&gt;
The biggest benefit of taking this in-class course was the opportunity to talk with our lecturer and classmates about various stuff in person. Most of my questions were out of the scope of the slides but we discussed about them anyway. Our lecturer was very accessible and clear in his explanations.&lt;br /&gt;
&lt;br /&gt;
My classmates were great, lecturer was great and I’ve learned much so I think this is very well spent money :)&lt;br /&gt;
&lt;br /&gt;
If you are considering about taking Oracle course I would recommend to choose &lt;b&gt;in-class&lt;/b&gt; instead of online especially if the price is the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to catch up with blogs, forums, mails...&lt;br /&gt;
&lt;br /&gt;
Regards ;)&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7920544826140091899?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0xPT7jrqJmIh4dGsbcRBM4HpBFQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0xPT7jrqJmIh4dGsbcRBM4HpBFQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0xPT7jrqJmIh4dGsbcRBM4HpBFQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0xPT7jrqJmIh4dGsbcRBM4HpBFQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/4zz9vyrhZNU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7920544826140091899/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7920544826140091899&amp;isPopup=true" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7920544826140091899?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7920544826140091899?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/4zz9vyrhZNU/my-first-oracle-course.html" title="My first Oracle Course" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/07/my-first-oracle-course.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUGSH4ycCp7ImA9WxFXE04.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-5249607261775526756</id><published>2010-05-19T14:38:00.003+02:00</published><updated>2010-05-20T08:50:29.098+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-20T08:50:29.098+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Miscellaneous" /><title>Table missing in DBA_TABLES dictionary view</title><content type="html">Today I learned something new about &lt;b&gt;DBA_TABLES&lt;/b&gt; and &lt;b&gt;DBA_ALL_TABLES&lt;/b&gt; dictionary views.&lt;br /&gt;
&lt;br /&gt;
During some PL/SQL programming I noticed that several tables exist in DBA_SEGMENTS and DBA_OBJECTS views but not in DBA_TABLES.&lt;br /&gt;
&lt;br /&gt;
That confused me a little but I found answer quickly after posting question on OTN forums. User named "admin" helped me with that.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;select * from v$version;
 
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
PL/SQL Release 9.2.0.6.0 - Production
CORE 9.2.0.6.0 Production
TNS for Solaris: Version 9.2.0.6.0 - Production
NLSRTL Version 9.2.0.6.0 - Production
 
5 rows selected.
 
 
select * from dba_segments where segment_name = 'TMP_WEB_DATA';
 
OWNER : TST
SEGMENT_NAME : TMP_WEB_DATA
PARTITION_NAME :
SEGMENT_TYPE : TABLE
TABLESPACE_NAME : TST_DATA
HEADER_FILE : 3
HEADER_BLOCK : 514179
BYTES : 65536
BLOCKS : 8
EXTENTS : 1
INITIAL_EXTENT : 65536
NEXT_EXTENT :
MIN_EXTENTS : 1
MAX_EXTENTS : 2147483645
PCT_INCREASE :
FREELISTS :
FREELIST_GROUPS :
RELATIVE_FNO : 3
BUFFER_POOL : DEFAULT
-----------------


select * from dba_objects where object_name = 'TMP_WEB_DATA';
 
OWNER : TST
OBJECT_NAME : TMP_WEB_DATA
SUBOBJECT_NAME :
OBJECT_ID : 42663
DATA_OBJECT_ID : 42663
OBJECT_TYPE : TABLE
CREATED : 23.05.2007 17:05:20
LAST_DDL_TIME : 19.12.2008 14:05:20
TIMESTAMP : 2007-05-23:17:05:20
STATUS : VALID
TEMPORARY : N
GENERATED : N
SECONDARY : N
-----------------
 

select * from dba_tables where table_name = 'TMP_WEB_DATA';
 
no rows selected
-----------------


select count(*) from TST.TMP_WEB_DATA;
 
COUNT(*)
----------
1&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
The answer lies in dictionary view &lt;b&gt;DBA_ALL_TABLES&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;select * from dba_all_tables where table_name = 'TMP_WEB_DATA';

OWNER                         : TST
TABLE_NAME                    : TMP_WEB_DATA
TABLESPACE_NAME               : TST_DATA
CLUSTER_NAME                  :
IOT_NAME                      :
PCT_FREE                      : 10
PCT_USED                      :
INI_TRANS                     : 1
MAX_TRANS                     : 255
INITIAL_EXTENT                : 65536
NEXT_EXTENT                   :
MIN_EXTENTS                   : 1
MAX_EXTENTS                   : 2147483645
PCT_INCREASE                  :
FREELISTS                     :
FREELIST_GROUPS               :
LOGGING                       : YES
BACKED_UP                     : N
NUM_ROWS                      :
BLOCKS                        :
EMPTY_BLOCKS                  :
AVG_SPACE                     :
CHAIN_CNT                     :
AVG_ROW_LEN                   :
AVG_SPACE_FREELIST_BLOCKS     :
NUM_FREELIST_BLOCKS           :
DEGREE                        :          1
INSTANCES                     :          1
CACHE                         :     N
TABLE_LOCK                    : ENABLED
SAMPLE_SIZE                   :
LAST_ANALYZED                 :
PARTITIONED                   : NO
IOT_TYPE                      :
OBJECT_ID_TYPE                : SYSTEM GENERATED
TABLE_TYPE_OWNER              : TST
TABLE_TYPE                    : PARTNER_WEB_DATA
TEMPORARY                     : N
SECONDARY                     : N
NESTED                        : NO
BUFFER_POOL                   : DEFAULT
ROW_MOVEMENT                  : DISABLED
GLOBAL_STATS                  : NO
USER_STATS                    : NO
DURATION                      :
SKIP_CORRUPT                  : DISABLED
MONITORING                    : NO
CLUSTER_OWNER                 :
DEPENDENCIES                  : DISABLED
COMPRESSION                   : DISABLED
-----------------
&lt;/pre&gt;&lt;br /&gt;
When I peeked in documentation for explanation:&lt;br /&gt;
&lt;br /&gt;
- DBA_TABLES describes all relational tables in the database. Its columns are the same as those in ALL_TABLES. To gather statistics for this view, use the ANALYZE SQL statement.&lt;br /&gt;
&lt;br /&gt;
- DBA_ALL_TABLES describes &lt;b&gt;all object tables&lt;/b&gt; and relational tables in the database. Its columns are the same as those in ALL_ALL_TABLES.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DDL of TMP_WEB_DATA:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;CREATE TABLE "TST"."TMP_WEB_DATA" OF "TST"."PARTNER_WEB_DATA"
OIDINDEX ( PCTFREE 10 INITRANS 2 MAXTRANS 255
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_DATA" )
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "TST_DATA" ;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So TMP_WEB_DATA is object table and this is the reason why it was missing from DBA_TABLES view.&lt;br /&gt;
&lt;br /&gt;
It's nice to know that :)&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-5249607261775526756?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RE7dWoOTeQxPs5SlzhfvGSoxAoc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RE7dWoOTeQxPs5SlzhfvGSoxAoc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RE7dWoOTeQxPs5SlzhfvGSoxAoc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RE7dWoOTeQxPs5SlzhfvGSoxAoc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/2os7ro0f_rs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/5249607261775526756/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=5249607261775526756&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/5249607261775526756?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/5249607261775526756?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/2os7ro0f_rs/table-missing-in-dbatables-dictionary.html" title="Table missing in DBA_TABLES dictionary view" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/05/table-missing-in-dbatables-dictionary.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcHQn8-fyp7ImA9WxFQFUU.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-1066021081014946854</id><published>2010-05-11T15:03:00.001+02:00</published><updated>2010-05-11T15:03:53.157+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-11T15:03:53.157+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>Missing or extra files in ControlFile</title><content type="html">At the end of &lt;a href="http://msutic.blogspot.com/2010/01/partial-restore-of-database.html"&gt;partial restore of database&lt;/a&gt; I've noticed entries MISSING00008, MISSING00009, etc. Oracle created those entries because some datafiles were found in data dictionary but not in new controlfile. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I didn't know that Oracle will add "MISSINGnnnn" entry for read only and offline files also.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Small demo case...&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create read only tablespace with one table:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create tablespace DEMO_RO datafile '/oracle/oradata/test10/demo_ro.dbf' size 50M;

Tablespace created.

SQL&gt; create table test_ro (id number, name varchar2(20)) tablespace DEMO_RO;

Table created.

SQL&gt; insert into test_ro values (1,'Cartman');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; alter tablespace DEMO_RO read only;

Tablespace altered.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Create tablespace with one table and alter this tablespace with "offline normal" opinion:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; create tablespace DEMO_OFF datafile '/oracle/oradata/test10/demo_off.dbf' size 50M;

Tablespace created.

SQL&gt; create table test_off (id number, name varchar2(20)) tablespace DEMO_OFF;

Table created.

SQL&gt; insert into test_off values (5,'Kenny');

1 row created.

SQL&gt; commit;

Commit complete.

SQL&gt; alter tablespace DEMO_OFF offline normal;

Tablespace altered.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Backup controlfile to trace and shutdown database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database backup controlfile to  trace as  '/tmp/ctlfile.sql';

Database altered.

SQL&gt; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Check controlfile script:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TEST10" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/oradata/test10/redo01.log'  SIZE 50M,
  GROUP 2 '/oracle/oradata/test10/redo02.log'  SIZE 50M,
  GROUP 3 '/oracle/oradata/test10/redo03.log'  SIZE 50M
DATAFILE
  '/oracle/oradata/test10/system01.dbf',
  '/oracle/oradata/test10/undotbs01.dbf',
  '/oracle/oradata/test10/sysaux01.dbf',
  '/oracle/oradata/test10/users01.dbf'
CHARACTER SET UTF8
;
&lt;/pre&gt;&lt;br /&gt;
It is interesting to notice that newly created database files '/oracle/oradata/test10/demo_ro.dbf' and '/oracle/oradata/test10/demo_off.dbf' are missing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will delete existing controlfiles to force myself to create new ones.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ rm control01.ctl control02.ctl control03.ctl
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create new controlfile based on script above and open database with resetlogs opinion:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ sqlplus "/as sysdba"

SQL&gt; @/tmp/ctlfile.sql
ORACLE instance started.

Total System Global Area  608174080 bytes
Fixed Size                  1268896 bytes
Variable Size             163578720 bytes
Database Buffers          436207616 bytes
Redo Buffers                7118848 bytes

Control file created.


SQL&gt; alter database open resetlogs;

Database altered.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Excerpt from alert.log:&lt;br /&gt;
&lt;blockquote&gt;Dictionary check beginning&lt;br /&gt;
Tablespace 'TEMP' #3 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'DEMO_RO' #6 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'DEMO_OFF' #7 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
File #5 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00005' in the controlfile.&lt;br /&gt;
File #6 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00006' in the controlfile.&lt;br /&gt;
Dictionary check complete&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;br /&gt;
During dictionary checking Oracle found that some files exist in data dictionary but not in controlfile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To query database files:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; col tablespace_name for a30
SQL&gt; col file_name for a50
SQL&gt; set lines 200
SQL&gt; select tablespace_name, file_name from dba_data_files;

TABLESPACE_NAME                FILE_NAME
------------------------------ --------------------------------------------------
USERS                          /oracle/oradata/test10/users01.dbf
SYSAUX                         /oracle/oradata/test10/sysaux01.dbf
UNDOTBS1                       /oracle/oradata/test10/undotbs01.dbf
SYSTEM                         /oracle/oradata/test10/system01.dbf
DEMO_RO                        /oracle/product/10.2.0/dbs/MISSING00005
DEMO_OFF                       /oracle/product/10.2.0/dbs/MISSING00006

6 rows selected.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I will try to get data from test tables:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from test_ro;
select * from test_ro
              *
ERROR at line 1:
ORA-00376: file 5 cannot be read at this time
ORA-01111: name for data file 5 is unknown - rename to correct file
ORA-01110: data file 5: '/oracle/product/10.2.0/dbs/MISSING00005'


SQL&gt; select * from test_off;
select * from test_off
              *
ERROR at line 1:
ORA-00376: file 6 cannot be read at this time
ORA-01111: name for data file 6 is unknown - rename to correct file
ORA-01110: data file 6: '/oracle/product/10.2.0/dbs/MISSING00006'
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
As expected - that operation failed. According to ORA-01111 error I have to rename datafile name to correct file and make it accessible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Renaming:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database rename file 'MISSING00006'
  to '/oracle/oradata/test10/demo_off.dbf';
 
Database altered.


SQL&gt; alter database rename file 'MISSING00005'
  to '/oracle/oradata/test10/demo_ro.dbf';
 
 
SQL&gt; alter tablespace demo_ro online;

Tablespace altered.

SQL&gt; alter tablespace demo_off online;

Tablespace altered.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now to get data from test tables:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select * from test_ro;

        ID NAME
---------- --------------------
         1 Cartman

SQL&gt; select * from test_off;

        ID NAME
---------- --------------------
         5 Kenny
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
I can make datafile accessible by renaming MISSINGnnnn entry only if datafile was offline normal or read only.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
REFERENCES:&lt;br /&gt;
&lt;a href="http://download.oracle.com/docs/cd/B10501_01/server.920/a96521/control.htm"&gt;Managing Control Files&lt;/a&gt;&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-1066021081014946854?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/J1HKoY5XKX3vQw5nJl53bpTmWf8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/J1HKoY5XKX3vQw5nJl53bpTmWf8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/J1HKoY5XKX3vQw5nJl53bpTmWf8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/J1HKoY5XKX3vQw5nJl53bpTmWf8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/xI_zXc9wIwo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/1066021081014946854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=1066021081014946854&amp;isPopup=true" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1066021081014946854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1066021081014946854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/xI_zXc9wIwo/missing-or-extra-files-in-controlfiles.html" title="Missing or extra files in ControlFile" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/05/missing-or-extra-files-in-controlfiles.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIGR3c5cCp7ImA9WxFSEEs.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-8493873530572277660</id><published>2010-02-18T14:34:00.003+01:00</published><updated>2010-04-12T11:28:46.928+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-12T11:28:46.928+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Certification" /><title>My first Oracle certificate</title><content type="html">I've passed the exam "1Z0-007 Introduction to Oracle9i SQL®" few hours ago with excellent score. About three months ago I've passed "1Z0-042 Oracle Database 10g: Administration I" also with excellent score. And this was enough for Oracle Database 10g Administrator Certified Associate "OCA" certificate.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;It was great for me that I could take exams without attending a training course because training is quite expensive.&lt;br /&gt;
&lt;br /&gt;
My next goal is to attend "Oracle Database 10g: Administration Workshop II Release 2" training course and taking "1Z0-043 Oracle Database 10g: Administration II" exam which will lead me to Oracle Database 10g Oracle Certified Professional "OCP" certificate.&lt;br /&gt;
&lt;br /&gt;
While I was preparing for this exams I've noticed several areas of weakness which I could improve. Now after preparation period I can say that I'm slightly better DBA.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Uff... my RSS reader is full with so many great blog posts...&lt;br /&gt;
&lt;br /&gt;
It's time to read some new interesting stuff from Oracle professionals :)&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-8493873530572277660?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-vV3SSVfEk7SOcHb809ma61YOao/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-vV3SSVfEk7SOcHb809ma61YOao/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/-vV3SSVfEk7SOcHb809ma61YOao/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-vV3SSVfEk7SOcHb809ma61YOao/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/dZhSiXA0KmI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/8493873530572277660/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=8493873530572277660&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8493873530572277660?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/8493873530572277660?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/dZhSiXA0KmI/my-first-oracle-certificate.html" title="My first Oracle certificate" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/02/my-first-oracle-certificate.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04NRX09cSp7ImA9WxBWFk8.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-1749357552412863912</id><published>2010-02-08T12:38:00.010+01:00</published><updated>2010-02-08T12:53:14.369+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-08T12:53:14.369+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Best Practice" /><title>Quick query to check for the existence of a row in a table</title><content type="html">I've seen several times that when developer needs to check for the existence of a row in a table he &lt;b&gt;counts how many times row occurs in a table&lt;/b&gt;. &lt;br /&gt;
&lt;br /&gt;
Something like:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;declare
l_cnt number;
begin
    select count(*) into l_cnt
    from test_table
    where row = something;
if l_cnt&gt;0 then
    exists, do something
else
    not exists, do something
end if;
end;
/&lt;/pre&gt;&lt;br /&gt;
This query is correct, but it is not very fast when test_table is big table with many rows. &lt;br /&gt;
&lt;br /&gt;
Much better approach is to stop query &lt;b&gt;when it hits first row&lt;/b&gt;. Counting how many times row occurs in a table is &lt;b&gt;unnecessary&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;br /&gt;
Checking row existence is sometimes used as a part of triggers or procedures that execute very often. In that cases using quicker query check can be great opinion to improve performance.&lt;br /&gt;
&lt;br /&gt;
There are many ways to rewrite your query to speed up things a little and I will show you just few of them. This is probably familiar to most developers and DBA's but I'll will add solutions to the post anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OS: OEL5&lt;br /&gt;
DB: Oracle 10.2.0.4&lt;br /&gt;
&lt;br /&gt;
Create simple table without indexes and populate that table with 2000000 rows.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;drop table testtab;

create table testtab (id     number,
                             code number,
                             text  varchar2(50),
                             tdate date);

Table created.


insert /*+ append */ into testtab
select rownum, mod(rownum,1000), rpad('x',50,'x'), sysdate+rownum
from all_objects o1,
     all_objects o2
where
   rownum &lt;= 2000000
/

2000000 rows created.

SQL&gt; commit;

Commit complete.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
In test cases I will search for an existence of row with code 999.&lt;br /&gt;
&lt;br /&gt;
First solution:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set timing on
SQL&gt; alter system flush buffer_cache;

System altered.

declare
l_cnt number;
begin
    select count(*) into l_cnt
    from testtab
    where code=999;
if l_cnt&gt;0 then
    dbms_output.put_line('Exists!');
else
    dbms_output.put_line('NOT Exists!');
end if;
end;
/

Exists!

PL/SQL procedure successfully completed.

Elapsed: 00:00:04.32
&lt;/pre&gt;&lt;br /&gt;
In this case I spent &lt;b&gt;more then 4 secs&lt;/b&gt; to check existence of specified row.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Second solution:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set timing on
SQL&gt; alter system flush buffer_cache;

System altered.

declare
l_cnt number;
begin
    select count(*) into l_cnt
    from dual
    where exists (select code
          from testtab
          where code=999);
if l_cnt&gt;0 then
    dbms_output.put_line('Exists!');
else
    dbms_output.put_line('NOT Exists!');
end if;
end;
/

Exists!

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.07&lt;/pre&gt;&lt;br /&gt;
You can notice significant improvement in this case.&lt;br /&gt;
Checking existence lasted only &lt;b&gt;00.07&lt;/b&gt; secs.&lt;br /&gt;
This is my preferred way to check existence - query stops after hitting first row.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Third solution:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set timing on
SQL&gt; alter system flush buffer_cache;

System altered.

declare
l_cnt number;
begin
    select count(*) into l_cnt
    from testtab
    where code = 999
    and rownum = 1;
if l_cnt&gt;0 then
    dbms_output.put_line('Exists!');
else
    dbms_output.put_line('NOT Exists!');
end if;
end;
/

Exists!

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.06&lt;/pre&gt;&lt;br /&gt;
This is another option using &lt;b&gt;rownum=1&lt;/b&gt; inside query. Result is displayed after finding first matching row.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fourth solution:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set timing on
SQL&gt; alter system flush buffer_cache;

System altered.

begin
for x in (select count(*) cnt
          from dual
          where exists (select NULL from testtab
                where code=999))
loop
    if (x.cnt = 1)
    then
     dbms_output.put_line('Exists!');
    else
     dbms_output.put_line('NOT Exists!');
    end if;
end loop;
end;
/

Exists!

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.07
&lt;/pre&gt;&lt;br /&gt;
I found this solution on AskTom site.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fifth solution:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set timing on
SQL&gt; alter system flush buffer_cache;

System altered.

begin
for x in (select /*+ first_rows(1) */ count(*) cnt
          from testtab
          where code=999
      and rownum &lt; 2)
loop
    if (x.cnt = 1)
    then
     dbms_output.put_line('Exists!');
    else
     dbms_output.put_line('NOT Exists!');
    end if;
end loop;
end;
/

Exists!

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.06&lt;/pre&gt;
Another solution from AskTom site. This time without querying dual table.
&lt;br /&gt;
&lt;br /&gt;
Drop test table:
&lt;pre class="brush: sql"&gt;drop table testtab;

Table dropped.&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
You can find many other solutions for checking row existence using Google.
&lt;br /&gt;
&lt;br /&gt;
REFERENCES:&lt;br /&gt;
&lt;a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3069487275935"&gt;http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3069487275935&lt;/a&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-1749357552412863912?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uqV7An7aDZGxAEVCZ5kxSBWoG1o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uqV7An7aDZGxAEVCZ5kxSBWoG1o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/uqV7An7aDZGxAEVCZ5kxSBWoG1o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uqV7An7aDZGxAEVCZ5kxSBWoG1o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/s1W7iEVRFaE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/1749357552412863912/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=1749357552412863912&amp;isPopup=true" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1749357552412863912?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1749357552412863912?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/s1W7iEVRFaE/quick-query-to-check-for-existence-of.html" title="Quick query to check for the existence of a row in a table" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>7</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/02/quick-query-to-check-for-existence-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8DR3YyeSp7ImA9WxBXEUs.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-2525265783861461068</id><published>2010-01-19T10:16:00.021+01:00</published><updated>2010-01-22T13:37:56.891+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-22T13:37:56.891+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Workarounds" /><title>ORA-14074 when adding partition at the beginning of a table</title><content type="html">One of maintenance tasks for DBA's in our company is archiving old data. To ease maintenance for us we've created few big interval-date range partitioned tables to be able perform partition based operations on that tables.&lt;br /&gt;
&lt;br /&gt;
We archive old partitions using exchange partition + transportable tablespace feature.&lt;br /&gt;
&lt;br /&gt;
This time I won't concentrate on archiving partitions but adding old partitions back to table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So how to add "old" partition at the beginning or in the middle of a table?&lt;br /&gt;
&lt;br /&gt;
My first try was using 'alter table add partition' command but then I received error:&lt;br /&gt;
&lt;b&gt;ORA-14074: partition bound must collate higher than that of the last partition&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;br /&gt;
Small demo case with workaround...&lt;br /&gt;
&lt;br /&gt;
First to create partitioned table with global and local indexes:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;create table testtab (id number,
                      code number,
                      datum date)
partition by range (datum) (
    partition part_2009_10 values less than (to_date('01.11.2009','dd.mm.yyyy')),
    partition part_2009_11 values less than (to_date('01.12.2009','dd.mm.yyyy')),
    partition part_2009_12 values less than (to_date('01.01.2010','dd.mm.yyyy')),
    partition part_2010_01 values less than (to_date('01.02.2010','dd.mm.yyyy'))
    );

 
-- global index    
create unique index id_idx on testtab(id);


-- local indexes
create index code_idx on testtab(code)
local ( partition part_2009_10,
        partition part_2009_11,
        partition part_2009_12,
        partition part_2010_01);
        
        
-- create primary key
alter table testtab add constraint pk_id
    primary key (id) using index;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Populate table:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;insert into testtab
select level,abs(dbms_random.random), trunc(sysdate)-level
from dual
connect by level&lt;101;

commit;
&lt;/pre&gt;

Small check:
&lt;pre class="brush: sql"&gt;SQL&gt; begin
  2  dbms_stats.gather_table_stats(ownname=&gt;user,tabname=&gt;'TESTTAB');
  3  end;
  4  /

PL/SQL procedure successfully completed.

select partition_name,high_value,num_rows as "NR", blocks
from user_tab_partitions
where table_name='TESTTAB';

PARTITION_NAME  HIGH_VALUE                                                  NR    BLOCKS
--------------- ---------------------------------------------------------- ----- -------
PART_2009_11    TO_DATE(' 2009-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')     30       5
PART_2009_12    TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')     31       5
PART_2010_01    TO_DATE(' 2010-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')     17       5
PART_2009_10    TO_DATE(' 2009-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')     22       5

4 rows selected.
&lt;/pre&gt;
Now to "archive old partition":
&lt;pre class="brush: sql"&gt;-- create new table based on testtab for "archive" data
create table tab_2009_10
as select * from testtab where 1=2;

alter table tab_2009_10 modify (id not null);

create index code_2009_10_idx on tab_2009_10(code);


-- exchange "old" partition
alter table testtab exchange partition part_2009_10
with table tab_2009_10 including indexes update global indexes;


-- drop "old" partition prom partitioned table
alter table testtab drop partition part_2009_10 update global indexes;


-- select
col partition_name for a15
col high_value for a90

select partition_name,high_value
from user_tab_partitions
where table_name='TESTTAB'
order by 1;

PARTITION_NAME  HIGH_VALUE
--------------- -------------------------------------------------------------
PART_2009_11    TO_DATE(' 2009-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
PART_2009_12    TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
PART_2010_01    TO_DATE(' 2010-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')

3 rows selected.



-- select "archived" data from newly created table
select min(datum),max(datum),count(*)
from tab_2009_10;

MIN(DATUM)          MAX(DATUM)            COUNT(*)
------------------- ------------------- ----------
10.10.2009 00:00:00 31.10.2009 00:00:00         22

1 row selected.
&lt;/pre&gt;
It is now safe to export tab_2009_10 table and archive it somewhere else.

But what if I need this archived data to be a part of partitioned table again...


First I will try to add partition using "add partition" command:
&lt;pre class="brush: sql"&gt;-- add partition test
SQL&gt; alter table testtab add partition part_2009_10
  2      values less than (to_date('01.11.2009','dd.mm.yyyy'));
alter table testtab add partition part_2009_10
                                  *
ERROR at line 1:
ORA-14074: partition bound must collate higher than that of the last partition&lt;/pre&gt;
So little workaround is needed...


We could use &lt;b&gt;"split partition"&lt;/b&gt; command to add partition at the beginning of the table:
&lt;pre class="brush: sql"&gt;alter table testtab split partition part_2009_11
at (to_date('01.11.2009','dd.mm.yyyy'))
into (partition part_2009_10,partition part_2009_11);&lt;/pre&gt;
Little check:
&lt;pre class="brush: sql"&gt;col partition_name for a15
col high_value for a90

select partition_name,high_value
from user_tab_partitions
where table_name='TESTTAB'
order by 1;

PARTITION_NAME  HIGH_VALUE
--------------- --------------------------------------------------------------
PART_2009_10    TO_DATE(' 2009-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
PART_2009_11    TO_DATE(' 2009-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
PART_2009_12    TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
PART_2010_01    TO_DATE(' 2010-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS')
&lt;/pre&gt;
So PART_2009_10 is again part of partitioned table.


Now it is possible to insert archived rows in partitioned table using "insert ... select" command:
&lt;pre class="brush: sql"&gt;insert into testtab
    select * from tab_2009_10;&lt;/pre&gt;
This is little inconvenient solution when we have to insert many rows, so there is another solution using exchange partition:
&lt;pre class="brush: sql"&gt;alter table testtab exchange partition part_2009_10
  2  with table tab_2009_10 including indexes update global indexes;
alter table testtab exchange partition part_2009_10
*
ERROR at line 1:
ORA-14130: UNIQUE constraints mismatch in ALTER TABLE EXCHANGE PARTITION
&lt;/pre&gt;
To avoid this error I've disabled and re-enabled constraint of partitioned table.

NOTE!
I don't know if this is appropriate solution so I would be tankful if someone could suggest me better solution.

&lt;pre class="brush: sql"&gt;SQL&gt; alter table testtab disable novalidate constraint PK_ID;

Table altered.

-- because of disable novalidate pk_id lost not null constraint
SQL&gt; alter table tab_2009_10 modify (id null);

Table altered.

SQL&gt; alter table testtab exchange partition part_2009_10
  2  with table tab_2009_10 including indexes update global indexes;

Table altered.

SQL&gt; alter table testtab enable validate constraint PK_ID;

Table altered.&lt;/pre&gt;
For final check I will query "old" data in partitioned table:
&lt;pre class="brush: sql"&gt;SQL&gt; select min(datum),max(datum),count(*)
  2   from testtab partition (part_2009_10);

MIN(DATUM)          MAX(DATUM)            COUNT(*)
------------------- ------------------- ----------
10.10.2009 00:00:00 31.10.2009 00:00:00         22

1 row selected.&lt;/pre&gt;

References:
Metalink [ID 727306.1]
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-2525265783861461068?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QguKjQt18m5xbyKegXZESebE6zU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QguKjQt18m5xbyKegXZESebE6zU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QguKjQt18m5xbyKegXZESebE6zU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QguKjQt18m5xbyKegXZESebE6zU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/RVWq9ylhLvg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/2525265783861461068/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=2525265783861461068&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2525265783861461068?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/2525265783861461068?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/RVWq9ylhLvg/ora-14074-when-adding-partition-at.html" title="ORA-14074 when adding partition at the beginning of a table" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/01/ora-14074-when-adding-partition-at.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUCQH47fCp7ImA9WxBQFEs.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-7271915131623139356</id><published>2010-01-12T12:51:00.024+01:00</published><updated>2010-01-14T10:11:01.004+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-14T10:11:01.004+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RMAN" /><category scheme="http://www.blogger.com/atom/ns#" term="Recovery" /><title>Partial restore of a database</title><content type="html">Before database migration to new version it is always wise to test how will applications work on this new version.&lt;br /&gt;
&lt;br /&gt;
But what if you have in production very big database and your test storage is limited - then &lt;b&gt;partial restore&lt;/b&gt; comes as handy solution.&lt;br /&gt;
&lt;br /&gt;
In most cases you will probably have few big interval-date range partitioned tables in production database. To fit in limited storage you can expel some tables or partitions. Using partial restored database you can still successfully test functionality of application.&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
After partial restore is finished it is probably important to recreate few tables or to fix some other errors - but this depends from application to application.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this demo case I will concentrate only on partial restore.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt; &lt;br /&gt;
&lt;br /&gt;
OS: Red Hat Enterprise Linux Server release 5.4 (Tikanga) 32bit&lt;br /&gt;
DB: Oracle 10.2.0.4&lt;br /&gt;
&lt;br /&gt;
First to list tablespaces of my database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set lines 200
SQL&gt; set pages 999
SQL&gt; col tablespace_name for a30
SQL&gt; col file_name for a55
SQL&gt; select tablespace_name, file_name from dba_data_files;

TABLESPACE_NAME                FILE_NAME
------------------------------ -------------------------------------------------------
SYSTEM                         /oratest/oradata/datafiles/system01.dbf
UNDOTBS1                       /oratest/oradata/datafiles/undotbs101.dbf
SYSAUX                         /oratest/oradata/datafiles/sysaux01.dbf
APP_DATA                       /oratest/oradata/datafiles/app_data01.dbf
USERS                          /oratest/oradata/datafiles/users01.dbf
BILL_DATA                      /oratest/oradata/datafiles/bill_data01.dbf
OT_DATA_01                     /oratest/oradata/datafiles/ot_data_01.dbf
OT_DATA_02                     /oratest/oradata/datafiles/ot_data_02.dbf
OT_DATA_03                     /oratest/oradata/datafiles/ot_data_03.dbf
OT_DATA_04                     /oratest/oradata/datafiles/ot_data_04.dbf
OT_DATA_05                     /oratest/oradata/datafiles/ot_data_05.dbf
OT_DATA_06                     /oratest/oradata/datafiles/ot_data_06.dbf
OT_DATA_07                     /oratest/oradata/datafiles/ot_data_07.dbf
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Before anything I will backup this database using script below:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 type disk;
4&gt; backup as compressed backupset incremental level 0 database format '/home/oratest/rmanbkp/FULL_%d_%u_%s_%T';
5&gt; BACKUP CURRENT CONTROLFILE FORMAT '/home/oratest/rmanbkp/controlf_%d_%u_%s_%T';
6&gt; BACKUP SPFILE FORMAT '/home/oratest/rmanbkp/spfile_%d_%u_%s_%T';
7&gt; release channel c1;
8&gt; }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Now to create control file script:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database backup controlfile to trace as '/home/oratest/ctlfile_scr.sql';

Database altered.
&lt;/pre&gt;&lt;br /&gt;
What tablespaces are mandatory for partial restore:&lt;br /&gt;
- SYSTEM tablespace&lt;br /&gt;
- SYSAUX tablespace (if my database is 10g or higher)&lt;br /&gt;
- Other tablespaces that hold dictionary information&lt;br /&gt;
select distinct tablespace_name from dba_segments where owner in ('SYS', 'SYSTEM');&lt;br /&gt;
- Tablespace with rollback segments&lt;br /&gt;
&lt;br /&gt;
Optional:&lt;br /&gt;
- All tablespaces with user data that I want to use for restore&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this case i will use this tablespaces for partial restore:&lt;br /&gt;
&lt;blockquote&gt;SYSTEM                         /oratest/oradata/datafiles/system01.dbf&lt;br /&gt;
SYSAUX                         /oratest/oradata/datafiles/sysaux01.dbf&lt;br /&gt;
UNDOTBS1                       /oratest/oradata/datafiles/undotbs101.dbf&lt;br /&gt;
APP_DATA                       /oratest/oradata/datafiles/app_data01.dbf&lt;br /&gt;
USERS                          /oratest/oradata/datafiles/users01.dbf&lt;br /&gt;
BILL_DATA                      /oratest/oradata/datafiles/bill_data01.dbf&lt;br /&gt;
OT_DATA_01                     /oratest/oradata/datafiles/ot_data_01.dbf&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
I've expelled OT_DATA "old" parts...&lt;br /&gt;
&lt;br /&gt;
Edit control file script including only tablespaces that I want to restore:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/oratest/oradata/TESTDB/redo/redo01a.rdo',
    '/oratest/oradata/TESTDB/redo/redo01b.rdo'
  ) SIZE 100M,
  GROUP 2 (
    '/oratest/oradata/TESTDB/redo/redo02a.rdo',
    '/oratest/oradata/TESTDB/redo/redo02b.rdo'
  ) SIZE 100M,
  GROUP 3 (
    '/oratest/oradata/TESTDB/redo/redo03a.rdo',
    '/oratest/oradata/TESTDB/redo/redo03b.rdo'
  ) SIZE 100M
-- STANDBY LOGFILE

DATAFILE
  '/oratest/oradata/datafiles/system01.dbf',
  '/oratest/oradata/datafiles/undotbs101.dbf',
  '/oratest/oradata/datafiles/sysaux01.dbf',
  '/oratest/oradata/datafiles/app_data01.dbf',
  '/oratest/oradata/datafiles/users01.dbf',
  '/oratest/oradata/datafiles/bill_data01.dbf',
  '/oratest/oradata/datafiles/ot_data_01.dbf'
CHARACTER SET AL32UTF8
;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is time to test this partial restore.&lt;br /&gt;
&lt;br /&gt;
First to restore control file and mount database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; startup nomount;

RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 device type disk;
4&gt; restore controlfile from '/home/oratest/rmanbkp/controlf_TESTDB_i5l38viu_1605_20100112';
5&gt; release channel c1;
6&gt; }

RMAN&gt; alter database mount;
database mounted
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
To check File# of datafiles that I want to restore:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; SET PAGES 200
SQL&gt; COLUMN NAME FORMAT a60
SQL&gt; SELECT FILE#, NAME FROM V$DATAFILE;

     FILE# NAME
---------- ------------------------------------------------------------
         1 /oratest/oradata/datafiles/system01.dbf
         2 /oratest/oradata/datafiles/undotbs101.dbf
         3 /oratest/oradata/datafiles/sysaux01.dbf
         4 /oratest/oradata/datafiles/app_data01.dbf
         5 /oratest/oradata/datafiles/users01.dbf
         6 /oratest/oradata/datafiles/bill_data01.dbf
         7 /oratest/oradata/datafiles/ot_data_01.dbf
         8 /oratest/oradata/datafiles/ot_data_02.dbf
         9 /oratest/oradata/datafiles/ot_data_03.dbf
        10 /oratest/oradata/datafiles/ot_data_04.dbf
        11 /oratest/oradata/datafiles/ot_data_05.dbf
        12 /oratest/oradata/datafiles/ot_data_06.dbf
        13 /oratest/oradata/datafiles/ot_data_07.dbf
&lt;/pre&gt;&lt;br /&gt;
Restore specified datafiles:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; restore datafile 1;
4&gt; restore datafile 2;
5&gt; restore datafile 3;
6&gt; restore datafile 4;
7&gt; restore datafile 5;
8&gt; restore datafile 6;
9&gt; restore datafile 7;
10&gt; }
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Create new control file using script above and mount database:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;$ sqlplus "/as sysdba"

SQL&gt; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL&gt; @/home/oratest/ctlfile_scr.sql
ORACLE instance started.

Total System Global Area 1342177280 bytes
Fixed Size                  1267380 bytes
Variable Size            1191184716 bytes
Database Buffers          134217728 bytes
Redo Buffers               15507456 bytes

Control file created.
&lt;/pre&gt;&lt;br /&gt;
I will cancel media recovery in this test case:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; recover database until cancel using backup controlfile;
ORA-00279: change 36022694011 generated at 01/12/2010 09:48:08 needed for
thread 1
ORA-00289: suggestion : /oratest/oradata/archlogs/1_18_706354584.dbf
ORA-00280: change 36022694011 for thread 1 is in sequence #18


Specify log: {&lt;ret&gt;=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
&lt;/pre&gt;&lt;br /&gt;
Open database using resetlogs command:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; alter database open resetlogs;

Database altered.
&lt;/pre&gt;&lt;br /&gt;
Create temporary tablespace:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; ALTER TABLESPACE TMP ADD TEMPFILE '/oratest/oradata/datafiles/tmp01.dbf'
  2  SIZE 50M REUSE AUTOEXTEND ON NEXT 25M  MAXSIZE 2048M;


Tablespace altered.
&lt;/pre&gt;&lt;br /&gt;
Excerpt from alert log:&lt;br /&gt;
&lt;blockquote&gt;...&lt;br /&gt;
Dictionary check beginning&lt;br /&gt;
Tablespace 'TMP' #7 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_02' #9 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_03' #10 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_04' #11 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_05' #12 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_06' #13 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
Tablespace 'OT_DATA_07' #14 found in data dictionary,&lt;br /&gt;
but not in the controlfile. Adding to controlfile.&lt;br /&gt;
File #8 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00008' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
File #9 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00009' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
File #10 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00010' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
File #11 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00011' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
File #12 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00012' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
File #13 found in data dictionary but not in controlfile.&lt;br /&gt;
Creating OFFLINE file 'MISSING00013' in the controlfile.&lt;br /&gt;
This file can no longer be recovered so it must be dropped.&lt;br /&gt;
Dictionary check complete&lt;br /&gt;
...&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
Tablespace check:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; set lines 200
SQL&gt; set pages 999
SQL&gt; col tablespace_name for a30
SQL&gt; col file_name for a55
SQL&gt; select tablespace_name, file_name from dba_data_files
  2  union all
  3  select tablespace_name, file_name from dba_temp_files;

TABLESPACE_NAME                FILE_NAME
------------------------------ -------------------------------------------------------
BILL_DATA                      /oratest/oradata/datafiles/bill_data01.dbf
USERS                          /oratest/oradata/datafiles/users01.dbf
APP_DATA                       /oratest/oradata/datafiles/app_data01.dbf
SYSAUX                         /oratest/oradata/datafiles/sysaux01.dbf
UNDOTBS1                       /oratest/oradata/datafiles/undotbs101.dbf
SYSTEM                         /oratest/oradata/datafiles/system01.dbf
OT_DATA_01                     /oratest/oradata/datafiles/ot_data_01.dbf
OT_DATA_02                     /oratest/product/10.2.0/dbs/MISSING00008
OT_DATA_03                     /oratest/product/10.2.0/dbs/MISSING00009
OT_DATA_04                     /oratest/product/10.2.0/dbs/MISSING00010
OT_DATA_05                     /oratest/product/10.2.0/dbs/MISSING00011
OT_DATA_06                     /oratest/product/10.2.0/dbs/MISSING00012
OT_DATA_07                     /oratest/product/10.2.0/dbs/MISSING00013
TMP                            /oratest/oradata/datafiles/tmp01.dbf

14 rows selected.
&lt;/pre&gt;&lt;br /&gt;
Drop tablespaces with missing datafiles:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL&gt; startup mount;
ORACLE instance started.

Total System Global Area 1342177280 bytes
Fixed Size                  1267380 bytes
Variable Size            1191184716 bytes
Database Buffers          134217728 bytes
Redo Buffers               15507456 bytes
Database mounted.
SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00008' offline drop;

Database altered.

SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00009' offline drop;

Database altered.

SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00010' offline drop;

Database altered.

SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00011' offline drop;

Database altered.

SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00012' offline drop;

Database altered.

SQL&gt; alter database datafile '/oratest/product/10.2.0/dbs/MISSING00013' offline drop;

Database altered.



SQL&gt; alter database open;

Database altered.


SQL&gt; drop tablespace OT_DATA_02 including contents;

Tablespace dropped.

SQL&gt; drop tablespace OT_DATA_03 including contents;

Tablespace dropped.

SQL&gt; drop tablespace OT_DATA_04 including contents;

Tablespace dropped.

SQL&gt; drop tablespace OT_DATA_05 including contents;

Tablespace dropped.

SQL&gt; drop tablespace OT_DATA_06 including contents;

Tablespace dropped.

SQL&gt; drop tablespace OT_DATA_07 including contents;

Tablespace dropped.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Final check:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SQL&gt; select tablespace_name, file_name from dba_data_files;

TABLESPACE_NAME                FILE_NAME
------------------------------ -------------------------------------------------------
OT_DATA_01                     /oratest/oradata/datafiles/ot_data_01.dbf
BILL_DATA                      /oratest/oradata/datafiles/bill_data01.dbf
USERS                          /oratest/oradata/datafiles/users01.dbf
APP_DATA                       /oratest/oradata/datafiles/app_data01.dbf
SYSAUX                         /oratest/oradata/datafiles/sysaux01.dbf
UNDOTBS1                       /oratest/oradata/datafiles/undotbs101.dbf
SYSTEM                         /oratest/oradata/datafiles/system01.dbf

12 rows selected.
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Update:&lt;br /&gt;
I want to thank &lt;a href="http://damir-vadas.blogspot.com"&gt;Damir Vadas&lt;/a&gt; for noticing unnecessary cataloging of backup pieces in this demo case.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
Metalink ID 102786.1&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-7271915131623139356?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/U-1LiATqBGxWn2ZGofA80RQaoAk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/U-1LiATqBGxWn2ZGofA80RQaoAk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/U-1LiATqBGxWn2ZGofA80RQaoAk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/U-1LiATqBGxWn2ZGofA80RQaoAk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/YzmMbay9efg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/7271915131623139356/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=7271915131623139356&amp;isPopup=true" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7271915131623139356?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/7271915131623139356?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/YzmMbay9efg/partial-restore-of-database.html" title="Partial restore of a database" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>9</thr:total><feedburner:origLink>http://msutic.blogspot.com/2010/01/partial-restore-of-database.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcFQXg5fSp7ImA9WxBREEQ.&quot;"><id>tag:blogger.com,1999:blog-2530682427657016426.post-1032236559195060797</id><published>2009-12-29T11:18:00.002+01:00</published><updated>2009-12-29T14:23:30.625+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-29T14:23:30.625+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="RMAN" /><title>Validating backups and database files using RMAN</title><content type="html">The most critical tasks for every DBA are database backup and recovery procedures. Knowledge of all Oracle backup and recovery scenarios is practically the most essential skill. For almost every problem there is some solution, but if you can't restore/recover data you are in deep trouble.&lt;br /&gt;
&lt;br /&gt;
To avoid possible problems it is important to regularly monitor backups and to perform validations using various tools. You can't say that you have valid backup until you successfully perform test restore on another machine. There are several methods to validate backups taken with RMAN. Restores on another machine is the best validation method and you should perform it regularly according how critical your database is. Big benefit from performing test restores is valuable practice you'll get.&lt;br /&gt;
&lt;br /&gt;
&lt;span id="fullpost"&gt;&lt;br /&gt;
&lt;br /&gt;
Another method for validating backups is using RMAN commands.&lt;br /&gt;
As a part of my daily tasks I'am using this simple RMAN script for backup validation:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql"&gt;run
{
restore database validate;
restore archivelog from time 'sysdate-1' validate;
restore controlfile validate;
restore spfile validate;
}
&lt;/pre&gt;&lt;br /&gt;
In this script I'am doing this checks:&lt;br /&gt;
- check most recent RMAN database backup&lt;br /&gt;
- check most recent RMAN archivelog(s) backup&lt;br /&gt;
- check most recent controlfile backup&lt;br /&gt;
- check most recent RMAN spfile backup&lt;br /&gt;
&lt;br /&gt;
To check older backups just set &lt;b&gt;SET UNTIL clause&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
Using RESTORE VALIDATION I can verify whether database could be successfully restored or not using existing backups.&lt;br /&gt;
&lt;br /&gt;
It is good practice to automate this tasks and then grep logs for errors. RESTORE VALIDATE operation takes time and it consumes valuable resources so you have to think about when to schedule validation.&lt;br /&gt;
&lt;br /&gt;
You can consider this RMAN validation as addition to your regular trial recoveries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;About using RMAN to check Logical &amp; Physical Database Corruption&lt;/b&gt;&lt;br /&gt;
&lt;blockquote&gt;During a RMAN backup or RMAN 'backup validate' every block currently used or previously used is read into memory then written to another portion of memory. During this memory to memory write the block is checked for corruption. Therefore RMAN's BACKUP command with the VALIDATE and CHECK LOGICAL clauses  allow a Database Adminstrator to quickly check for both physical and logical corruption. If the initialization parameter DB_BLOCK_CHECKSUM=TRUE, specifying CHECK LOGICAL detects all types of corruption that are possible to detect.&lt;br /&gt;
&lt;/blockquote&gt;&lt;br /&gt;
&lt;b&gt;Physical corruption&lt;/b&gt; can be defined as a damage to the internal data structure and prevents Oracle from being able to read the data in the corrupted blocks.&lt;br /&gt;
&lt;b&gt;Logical corruption&lt;/b&gt; is situation when Oracle is able to find the data, but data values are incorrect.&lt;br /&gt;
&lt;br /&gt;
To validate all datafiles execute:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;RMAN&gt; run
2&gt; {
3&gt; allocate channel c1 type disk;
4&gt; backup check logical validate database;
5&gt; release channel c1;
6&gt; }&lt;/pre&gt;&lt;br /&gt;
After validate is complete query &lt;b&gt;v$database_block_corruption&lt;/b&gt; to see if there are any rows listed there. Additionally you can check alert log for corruptions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
REFERENCES:&lt;br /&gt;
Metalink notes: [ID 338607.1], [ID 283053.1], [ID 428570.1]&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2530682427657016426-1032236559195060797?l=msutic.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/6tJtIexy3F20Dvk3YJIXI5SRBEg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6tJtIexy3F20Dvk3YJIXI5SRBEg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/6tJtIexy3F20Dvk3YJIXI5SRBEg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/6tJtIexy3F20Dvk3YJIXI5SRBEg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/MarkoSuticsOracleBlog/~4/iQofprztRfQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://msutic.blogspot.com/feeds/1032236559195060797/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2530682427657016426&amp;postID=1032236559195060797&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1032236559195060797?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2530682427657016426/posts/default/1032236559195060797?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/MarkoSuticsOracleBlog/~3/iQofprztRfQ/validating-backups-and-database-files.html" title="Validating backups and database files using RMAN" /><author><name>Marko Sutic</name><uri>http://www.blogger.com/profile/08926232581329666732</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="23" height="32" src="http://2.bp.blogspot.com/_Bp6OlLfAv_c/SzUPISuFSDI/AAAAAAAAAS0/82NPKlGtYq4/S220/ja_slika_3.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://msutic.blogspot.com/2009/12/validating-backups-and-database-files.html</feedburner:origLink></entry></feed>

