<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3743585359130906790</id><updated>2012-01-09T18:32:29.587Z</updated><category term='tuning'/><category term='duplicate'/><category term='rman'/><category term='ddl'/><category term='backups'/><category term='unexpected results'/><category term='solutions'/><category term='sql'/><category term='crontab'/><category term='oracle'/><title type='text'>Don't Believe Acronyms!</title><subtitle type='html'>Another DBA blog in the blogosphere.  Odd bits and pieces about Oracle administration - when I remember to post!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-5539410610572793903</id><published>2011-05-27T17:34:00.004+01:00</published><updated>2011-05-27T17:39:03.976+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rman'/><category scheme='http://www.blogger.com/atom/ns#' term='backups'/><category scheme='http://www.blogger.com/atom/ns#' term='crontab'/><title type='text'>Last Sunday</title><content type='html'>Our production databases are backed up with one of two schedules.&amp;nbsp; Most days our backups are sent offsite and retained for 3 months before being returned.&amp;nbsp; But on the last Sunday of each month, our backups are archived for a longer period of time.&amp;nbsp; Therefore the RMAN backups and Veritas catalogs need to be retained for up to 7 years!&lt;br /&gt;&lt;br /&gt;Us Linux DBAs love &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;cron&lt;/span&gt; for scheduling jobs. These fancy software schedulers with their dependencies and clever logic have never really replaced a really dense, difficult to read &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;crontab&lt;/span&gt; file. And that's just the way we like it in order to keep our jobs!&lt;br /&gt;&lt;br /&gt;Now, crontab doesn't have a built-in facility for deciding whether a particular day is the 'last' or 'first' of the month (or quarter, or year).&amp;nbsp; Our current backup regime relies on a separate &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;cron&lt;/span&gt; job to create a lock file, earlier in the day, then each individual backup script checks for existence of that file before deciding which tape schedule and retention policy to use.&lt;br /&gt;&lt;br /&gt;I thought there was a slightly more elegant way of achieving this.&amp;nbsp; Here's what I came up with:&lt;br /&gt;&lt;br /&gt;We have a simple script called &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;islastsunday&lt;/span&gt; which compares the current date with the date of the last Sunday in the month (from the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;cal&lt;/span&gt; command).&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;[ $(cal | awk '{print $1}' | tr -s '[:blank:]' '\n' | tail -1) = $(date +%d) ]&lt;/span&gt;&lt;/blockquote&gt;In our crontab file we have two entries for our backup, as follows:&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;# Check if day is LAST SUNDAY of Month. If NOT, run the regular backup&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;30 00 * * * islastsunday || (rman-job.sh level_0_tape ORCL &amp;gt; level_0_tape_ORCL.log 2&amp;gt;&amp;amp;1; rman-job.sh level_0_tape ORCL2 &amp;gt; level_0_tape_ORCL2.log 2&amp;gt;&amp;amp;1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;# Check if day is LAST SUNDAY of Month. If it IS, run the Monthly backup&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;30 00 * * * islastsunday &amp;amp;&amp;amp; (rman-job.sh level_0_tape_LS ORCL &amp;gt; level_0_tape_LS_ORCL.log 2&amp;gt;&amp;amp;1; rman-job.sh level_0_tape_LS ORCL2 &amp;gt; level_0_tape_LS_ORCL2.log 2&amp;gt;&amp;amp;1)&lt;/span&gt;&lt;/blockquote&gt;Both schedules run at the same time, but only one of them will actually execute, depending upon the day of the month. The actual backup commands are bracketed, so that they are ALL dependent upon the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;islastsunday&lt;/span&gt; script, and will all run with the same retention policy, even if the backups continue to run after midnight (i.e. in Monday!).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-5539410610572793903?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/5539410610572793903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=5539410610572793903&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/5539410610572793903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/5539410610572793903'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2011/05/last-sunday.html' title='Last Sunday'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-2829418030340588444</id><published>2011-05-20T17:34:00.001+01:00</published><updated>2011-05-20T17:35:14.468+01:00</updated><title type='text'>Cold Backup RMAN Fun and Games</title><content type='html'>Here's an RMAN oddity.&amp;nbsp; If anyone could explain it, I'd be grateful.&lt;br /&gt;&lt;br /&gt;We were moving a database to a new server.&amp;nbsp; Same OS, same version of Oracle (10.2.0.4).&amp;nbsp; The database is in Archivelog mode, but to keep things easy, we decided to do an offline, consistent backup.&lt;br /&gt;&lt;br /&gt;So, we shutdown the database, then mounted it and performed an RMAN backup to a flash_recovery_area on a&amp;nbsp;shared NFS filesystem:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;backup device type disk database plus archivelog include current controlfile;&lt;/span&gt;&lt;/blockquote&gt;The backup worked fine. So we logged on to the new server, made sure that we could see the NFS-mounted FRA, and issued the Duplicate command.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;run {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate channel d1 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate channel d2 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate channel d3 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate channel d4 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate auxiliary channel da1 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate auxiliary channel da2 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate auxiliary channel da3 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;allocate auxiliary channel da4 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;duplicate target database to CATDB;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;}&lt;/span&gt;&lt;/blockquote&gt;Oddly, it didn't work.&amp;nbsp; It returned an error saying that a backup could not be found.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;Starting restore at 20-MAY-11&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;released channel: da1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;released channel: da2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;released channel: da3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;released channel: da4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-00571: ===========================================================&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-00571: ===========================================================&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-03002: failure of Duplicate Db command at 20/05/2011 15:25:38&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-03015: error occurred in stored script Memory Script&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-06026: some targets not found - aborting restore&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-06100: no channel to restore a backup or copy of datafile 1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;"&gt;RMAN-06100: no channel to restore a backup or copy of datafile 2&lt;/span&gt;&lt;br /&gt;etc...&lt;/blockquote&gt;If we tried using automatic channel allocations for the restore, it still did not find our disk backup, but tried restoring older tape backups.&amp;nbsp; Not what we wanted.&lt;br /&gt;&lt;br /&gt;So, we tried backing it up again.&amp;nbsp; Backing up just the archivelogs.&amp;nbsp; Just the database.&amp;nbsp; Nada!&amp;nbsp; The same error every time we tried to Duplicate.&lt;br /&gt;&lt;br /&gt;In desperation, I tried opening up our original DB and running an online backup.&amp;nbsp; Luckily the database was small and the backup quick.&amp;nbsp; I then shut it down and re-mounted to prevent the users from changing anything.&lt;br /&gt;&lt;br /&gt;This time, upon trying the Duplicate command (this time with an&amp;nbsp;"until sequence" inserted)&amp;nbsp;it all worked as expected!&lt;br /&gt;&lt;br /&gt;So it looks like a wee bug.&amp;nbsp; If you've got a database in Archivelog mode, but you perform an offline backup, RMAN seems to get confused and have trouble deciding which backups to restore.&lt;br /&gt;&lt;br /&gt;We know it's not a general problem with offline backups, as we've duplicated DBs in Noarchivelog mode on this system before.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-2829418030340588444?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/2829418030340588444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=2829418030340588444&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/2829418030340588444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/2829418030340588444'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2011/05/cold-backup-rman-fun-and-games.html' title='Cold Backup RMAN Fun and Games'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-4507917450718305811</id><published>2011-03-28T13:03:00.004+01:00</published><updated>2011-03-28T18:13:05.953+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unexpected results'/><category scheme='http://www.blogger.com/atom/ns#' term='ddl'/><title type='text'>When is DDL not DDL?</title><content type='html'>If you ever thought that the LAST_DDL_TIME on a table &lt;u&gt;only&lt;/u&gt; tells you the last time that DDL was performed &lt;b&gt;directly&lt;/b&gt; upon that table, then think again.&lt;br /&gt;&lt;br /&gt;We recently noticed some tables which appeared to have been recently changed, yet we couldn't find any related DDL changes.&lt;br /&gt;&lt;br /&gt;Then we remembered that we regularly rebuild a handful of indexes (once a week, on Sunday morning) for performance/plan-stability reasons.&lt;br /&gt;&lt;br /&gt;Could it be that rebuilding an index resets the LAST_DDL_TIME for the index's table?&lt;br /&gt;&lt;br /&gt;Let's find out.&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;SQL&amp;gt; create table poo (x date);&lt;br /&gt;&lt;br /&gt;Table created.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; create index poodex on poo(x);&lt;br /&gt;&lt;br /&gt;Index created.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; select object_name, &lt;br /&gt;to_char(last_ddl_time, 'DD-Mon-YYYY HH24:MI:ss')&lt;br /&gt;2 from dba_objects where object_name like 'POO%';&lt;br /&gt;&lt;br /&gt;OBJECT_NAME TO_CHAR(LAST_DDL_TIM&lt;br /&gt;----------- --------------------&lt;br /&gt;POO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22-Mar-2011 10:09:51&lt;br /&gt;POODEX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22-Mar-2011 10:09:51&lt;br /&gt;&lt;br /&gt;SQL&amp;gt; alter index poodex rebuild online;&lt;br /&gt;&lt;br /&gt;Index altered.&lt;br /&gt;&lt;br /&gt;SQL&amp;gt;  select object_name, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to_char(last_ddl_time, 'DD-Mon-YYYY HH24:MI:ss')&lt;br /&gt;2   from dba_objects where object_name like 'POO%';&lt;br /&gt;&lt;br /&gt;OBJECT_NAME TO_CHAR(LAST_DDL_TIM&lt;br /&gt;----------- --------------------&lt;br /&gt;POO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22-Mar-2011 10:11:31&lt;br /&gt;POODEX&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22-Mar-2011 10:11:31&lt;/blockquote&gt;&lt;br /&gt;Yup!  In a surprising (to me) result, it looks as though rebuilding an index does indeed reset LAST_DDL_TIME on the table, even though we are not performing DDL on the table directly.&lt;br /&gt;&lt;br /&gt;In my opinion, this is a misleading result.&lt;br /&gt;&lt;br /&gt;Thanks to Matt Penny for doing all the work and investigation and telling me to publish the results!&lt;br /&gt;&lt;br /&gt;EDIT:&amp;nbsp; Thanks to Neil below for suggestions of other events which may or may not cause this behaviour.&lt;br /&gt;&lt;br /&gt;I have tested creating, amending, re-compiling and dropping a procedure, but this does &lt;u&gt;not&lt;/u&gt; cause a change in LAST_DDL_TIME for the dependent table.&lt;br /&gt;&lt;br /&gt;Example as follows:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;14:16:55 PETE @ ETEST1D &amp;gt; create table foo (foocol number(5));&lt;br /&gt;&lt;br /&gt;Table created.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;14:17:20 PETE @ ETEST1D &amp;gt; @lastddl&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:17:20&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;14:18:35 PETE @ ETEST1D &amp;gt; create procedure fooproc is&lt;br /&gt;14:19:13&amp;nbsp;&amp;nbsp; 2&amp;nbsp; v_var varchar2(10);&lt;br /&gt;14:19:26&amp;nbsp;&amp;nbsp; 3&amp;nbsp; begin&lt;br /&gt;14:19:31&amp;nbsp;&amp;nbsp; 4&amp;nbsp; null;&lt;br /&gt;14:19:38&amp;nbsp;&amp;nbsp; 5&amp;nbsp; exception&lt;br /&gt;14:19:42&amp;nbsp;&amp;nbsp; 6&amp;nbsp; when others then null;&lt;br /&gt;14:19:45&amp;nbsp;&amp;nbsp; 7&amp;nbsp; end;&lt;br /&gt;14:19:47&amp;nbsp;&amp;nbsp; 8&amp;nbsp; /&lt;br /&gt;&lt;br /&gt;Procedure created.&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;14:19:50 PETE @ ETEST1D &amp;gt; @lastddl&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:17:20&lt;br /&gt;FOOPROC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:19:50&lt;br /&gt;&lt;br /&gt;14:20:06 PETE @ ETEST1D &amp;gt; create or replace procedure fooproc is&lt;br /&gt;14:20:31&amp;nbsp;&amp;nbsp; 2&amp;nbsp; v_var varchar2(10);&lt;br /&gt;14:20:34&amp;nbsp;&amp;nbsp; 3&amp;nbsp; begin&lt;br /&gt;14:20:36&amp;nbsp;&amp;nbsp; 4&amp;nbsp; select to_char(foocol)&lt;br /&gt;14:21:02&amp;nbsp;&amp;nbsp; 5&amp;nbsp; into v_var&lt;br /&gt;14:21:07&amp;nbsp;&amp;nbsp; 6&amp;nbsp; from foo;&lt;br /&gt;14:21:14&amp;nbsp;&amp;nbsp; 7&amp;nbsp; exception&lt;br /&gt;14:21:17&amp;nbsp;&amp;nbsp; 8&amp;nbsp; when others then null;&lt;br /&gt;14:21:18&amp;nbsp;&amp;nbsp; 9&amp;nbsp; end;&lt;br /&gt;14:21:19&amp;nbsp; 10&amp;nbsp; /&lt;br /&gt;&lt;br /&gt;Procedure created.&lt;br /&gt;&lt;br /&gt;14:21:20 PETE @ ETEST1D &amp;gt; @lastddl&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:17:20&lt;br /&gt;FOOPROC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:21:20&lt;br /&gt;&lt;br /&gt;14:21:31 PETE @ ETEST1D &amp;gt; alter procedure fooproc compile;&lt;br /&gt;&lt;br /&gt;Procedure altered.&lt;br /&gt;&lt;br /&gt;14:22:07 PETE @ ETEST1D &amp;gt; @lastddl&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:17:20&lt;br /&gt;FOOPROC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:22:07&lt;br /&gt;&lt;br /&gt;14:22:13 PETE @ ETEST1D &amp;gt; drop procedure fooproc;&lt;br /&gt;&lt;br /&gt;Procedure dropped.&lt;br /&gt;&lt;br /&gt;14:22:40 PETE @ ETEST1D &amp;gt; @lastddl&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;------------------------------ ------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:17:20&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Despite creating and dropping procedure, the LAST_DDL_TIME of the depdendent table is not changed. Exactly as expected.&lt;br /&gt;&lt;br /&gt;Now trying with a comment (which is a DDL command):&lt;br /&gt;&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;14:24:20 PETE @ ETEST1D &amp;gt; comment on table foo is 'FOO is a test table';&lt;br /&gt;&lt;br /&gt;Comment created.&lt;br /&gt;&lt;br /&gt;14:24:25 PETE @ ETEST1D &amp;gt; @lastddl&lt;/blockquote&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;br /&gt;OBJECT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TO_CHAR(LAST_DDL_TIME,'DD-MON-&lt;br /&gt;------------------------------ ------------------------------&lt;br /&gt;FOO&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 28-Mar-2011 14:24:25&lt;/blockquote&gt;&lt;br /&gt;Again - as expected.&amp;nbsp; A DDL command against the table changes the LAST_DDL_TIME.&lt;br /&gt;&lt;br /&gt;This makes it all the more surprising that running a DDL command against an index will change LAST_DDL_TIME for its parent table.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-4507917450718305811?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/4507917450718305811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=4507917450718305811&amp;isPopup=true' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/4507917450718305811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/4507917450718305811'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2011/03/when-is-ddl-not-ddl.html' title='When is DDL not DDL?'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-1238104206280053907</id><published>2010-07-15T14:10:00.002+01:00</published><updated>2010-07-22T18:03:57.602+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='solutions'/><title type='text'>Table Comparison Signature</title><content type='html'>We've been working on a data archiving project to move old data from the production schema in one database into an archive schema in a different tablespace, on a remote server.&lt;br /&gt;&lt;br /&gt;We copy data from a production table (let's call it &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;PROD.FINANCE_TAB&lt;/span&gt; into a pre-existing  table in an archive schema (e.g. &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;ARCH.FINANCE_TAB&lt;/span&gt;).&amp;nbsp; The fact that they are in a different database is actually irrelevant to the problem at hand.&lt;br /&gt;&lt;br /&gt;If&amp;nbsp; &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;PROD.FINANCE_TAB&lt;/span&gt; were to change structure (due to an added column or a datatype change), the archive transaction may fail.&amp;nbsp; So we need to test whether the table structure is the same in both schemas.&lt;br /&gt;&lt;br /&gt;I Googled to take a look at how people usually do this and the result isn't pretty.&amp;nbsp; It usually takes three separate queries: one to find tables with the same columns, but different datatypes or sizes and two others to find tables with extra or missing columns.&lt;br /&gt;&lt;br /&gt;This is cumbersome, but at least shows you what the differences are. In our case, though, we don't care what's different.&amp;nbsp; Just knowing that there is a difference is enough for us to stop processing the archive run and return control to the DBA.&lt;br /&gt;&lt;br /&gt;So we came up with the following query which builds a quasi-hash value for the table structure:&lt;br /&gt;&lt;blockquote style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="407240410-15072010"&gt;&lt;span style="font-family: Courier New;"&gt;select  sum(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ora_hash(COLUMN_NAME||&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  DATA_TYPE||&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  to_char(NVL(DATA_LENGTH,0))||&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  to_char(NVL(DATA_SCALE,0))||&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  to_char(NVL(DATA_PRECISION,0))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )  t_hash&lt;br /&gt;from all_tab_columns&lt;br /&gt;where table_name = '&amp;amp;table_name'&lt;br /&gt;and  owner =&amp;nbsp;'&lt;span class="181184416-22072010"&gt;&amp;amp;owner';&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; t_signature&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;----------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 141887801613&lt;/span&gt;&lt;/blockquote&gt;This signature is unique to the table structure.&amp;nbsp; It returns a different value if a column is added or dropped, or if its datatype, size or scale changes.&lt;br /&gt;&lt;br /&gt;We based a function on the query which we could execute for each archive table in both PROD and ARCHIVE schema.&amp;nbsp; If the signatures matched, we could be confident that the table structure had not changed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-1238104206280053907?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/1238104206280053907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=1238104206280053907&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/1238104206280053907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/1238104206280053907'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2010/07/table-comparison-signature.html' title='Table Comparison Signature'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-5252395265866714207</id><published>2008-12-23T14:19:00.005Z</published><updated>2010-07-15T11:43:16.566+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='duplicate'/><category scheme='http://www.blogger.com/atom/ns#' term='rman'/><title type='text'>RMAN Duplicate Gotchas - Part 2: Standby DB Restores and Redo Log Group</title><content type='html'>In &lt;a href="http://dbaoraclestuff.blogspot.com/2008/12/rman-duplicate-gotchas.html"&gt;my previous post&lt;/a&gt; I discussed identifying which media you would need to use when performing a restore in order to duplicate a database via RMAN.&lt;br /&gt;&lt;br /&gt;In this post, I'll discuss a couple of other issues that you may come across; although, admittedly, they are fairly uncommon.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Standby DB Restores&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Like a lot of other sites we maintain a physical standby database, managed using Dataguard, ready to use as a failover instance, in case of problems with the main RAC database.  This database is the source for all backups, to avoid overloading the production servers.  This leads to a small gotcha when performing any restores from the production database to create a duplicate or clone DB.&lt;br /&gt;&lt;br /&gt;When backing-up we connect, as expected to the standby database and the RMAN repository catalog, as below:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;rman catalog=rman/password@catalog_db target=sys/passwd@standby_db&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;RMAN then backs up the file contents from the standby database location, as expected, but because the database has the same DBID as the production database, they are marked as having the file names of the production service.&lt;br /&gt;&lt;br /&gt;When you come to perform the RMAN duplicate using the standby DB as target will not work correctly.  When attempting to create the duplicate database's controlfile RMAN will barf, saying that it cannot use a standby controlfile as source for a duplicate.  You therefore have to connect to your production server directly to run the DUPLICATE command:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;rman catalog=rman/password@catalog_db target=sys/passwd@prod_db auxiliary=sys/passwd@clone_db&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In addition, you will likely need to amend the parameters which are passed to your tape backup software to ensure that it knows where to find the backup files.  If, like us, you have separate backup servers for production and other environments, you will need to pass in the relevant policy, backup server and original backup client names which were used to perform the backup:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;allocate channel t1 type sbt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;allocate auxiliary channel ta1 type sbt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;allocate channel d1 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;allocate auxiliary channel da1 type disk;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;send 'NB_ORA_POLICY=PROD_POLICY,NB_ORA_SERV=prod_bkup_server,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;NB_ORA_CLIENT=prod_db_server';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This also means, as seen above, that you will need to allocate channels (and auxiliary channels) manually, rather than relying on any default channgels you may have defined in your clone database environment.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Redo Log Groups&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Oracle allows you to create any almost any number of redo log groups on a database and to number them with any numbering scheme you fancy.   At our site, the production groups are numbered with a 3-digit scheme, 101, 201, 301, etc, with each group containing multiple log members.&lt;br /&gt;&lt;br /&gt;Unfortunately, there is a 'feature' which will crash your DUPLICATE in this particular case.  RMAN attempts to re-create the redo log groups from the target system, but the code obviously cannot cope with redo log group numbers which are more than 2-digits wide.  We therefore are forced to include the LOGFILE clause with the DUPLICATE command to re-number the groups and allow the command to complete:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;duplicate target database to CLONEDB&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;until scn 36511896776&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;logfile&lt;/span&gt;&lt;span style="font-family: courier new;"&gt; GROUP 1 ('/u01/ oradata/CLONEDB/redo01_1.dbf',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                 '/u02/oradata/CLONEDB/redo01_2.dbf') SIZE 500M,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        GROUP 2 ('/u01/oradata/CLONEDB/redo02_1.dbf',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                 '/u02/oradata/CLONEDB/redo02_2.dbf') SIZE 500M,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        GROUP 3 ('/u01/oradata/CLONEDB/redo03_1.dbf',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                 '/u02/oradata/CLONEDB/redo03_2.dbf') SIZE 500M,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        GROUP 4 ('/u01/oradata/CLONEDB/redo04_1.dbf',&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                 '/u02/oradata/CLONEDB/redo05_2.dbf') SIZE 500M  REUSE;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you forget to add the LOGFILE clause first time around (as I did), don't despair.  The database restore will have already completed.  Simply re-run the DUPLICATE command with the additional clause - RMAN knows that the datafiles are now in place and things should pick-up from there.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-5252395265866714207?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/5252395265866714207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=5252395265866714207&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/5252395265866714207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/5252395265866714207'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2008/12/rman-duplicate-gotchas-part-2-standby.html' title='RMAN Duplicate Gotchas - Part 2: Standby DB Restores and Redo Log Group'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-3216697738284658196</id><published>2008-12-01T16:48:00.002Z</published><updated>2008-12-23T12:02:03.793Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='duplicate'/><category scheme='http://www.blogger.com/atom/ns#' term='rman'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>RMAN Duplicate Gotchas - Part 1: Identifying the Media</title><content type='html'>I've recently been doing quite a few RMAN Duplicate Database jobs, in order to create dev and test systems as copies of our production server.&lt;br /&gt;&lt;br /&gt;The production database is a 2-node RAC cluster, but each of our test systems are single-instance databases.  This causes one or two odd issues which aren't always obvious until you've hit them at least once.&lt;br /&gt;&lt;br /&gt;In this post I'll discuss the first tricky issue which I came across:  &lt;span style="font-weight: bold; font-style: italic;"&gt;Identifying the Media&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;At my current job (as in most IT departments), each day the most recent backup tapes are removed from the tape robot and sent off-site to a secure storage facility.  The company I work for doesn't have the resource to maintain duplexed tapes (i.e. one on-site and one off-site) and, at present, for reasons too complicated to go into here, the production system doesn't have a flash recovery area, so the backups are written to tape, and tape only.&lt;br /&gt;&lt;br /&gt;All this means that when a test database refresh is requested, it is critical to identify the set of tapes on which the required backups reside.  So, once you've decided to which point of time you wish to restore, it's necessary to identify exactly which tapes you need to recall in order to load into the robot.&lt;br /&gt;&lt;br /&gt;1.  Log into RMAN (Target and Catalog) and list the backups you're interested in.  E.g:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;rman catalog=rman/password@catalog_db target&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;RMAN&gt; list backup;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;BS Key  Size       Device Type Elapsed Time Completion Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;------- ---------- ----------- ------------ ---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1063429 1.87G      SBT_TAPE    00:03:36     26-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        BP Key: 1063435   Status: AVAILABLE  Compressed: NO  Tag: TAG20081126T020905&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        Handle: m9k0kn62_1_1   &lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;Media&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  List of Archived Logs in backup set 1063429&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  ---- ------- ---------- --------- ---------- ---------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  1    58271   36469897611 25-NOV-08 36470958889 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  1    58272   36470958889 25-NOV-08 36472168625 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  1    58273   36472168625 25-NOV-08 36472947809 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  1    58274   36472947809 25-NOV-08 36473847271 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;BS Key  Size       Device Type Elapsed Time Completion Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;------- ---------- ----------- ------------ ---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1063430 1.86G      SBT_TAPE    00:03:44     26-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        BP Key: 1063436   Status: AVAILABLE  Compressed: NO  Tag: TAG20081126T020905&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        Handle: mak0kn62_1_1   &lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;Media&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  List of Archived Logs in backup set 1063430&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  ---- ------- ---------- --------- ---------- ---------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  2    61976   36471707453 25-NOV-08 36472752913 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  2    61977   36472752913 25-NOV-08 36473892837 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  2    61978   36473892837 25-NOV-08 36475824974 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  2    61979   36475824974 25-NOV-08 36477342218 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;BS Key  Type LV Size       Device Type Elapsed Time Completion Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;------- ---- -- ---------- ----------- ------------ ---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1063514 Full    19.00M     SBT_TAPE    00:00:30     26-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        BP Key: 1063521   Status: AVAILABLE  Compressed: NO  Tag: TAG20081126T021254&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        Handle: c-2982994484-20081126-01   &lt;/span&gt;&lt;span style="font-weight: bold;font-family:courier new;" &gt;Media&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  Standby Control File Included: Ckp SCN: 36476925621   Ckp time: 25-NOV-08&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;[It's interesting to note that LIST BACKUP command in RMAN returns a label (in &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;bold &lt;/span&gt;&lt;span style="font-style: italic;"&gt;above) indicating that a media reference should be displayed, but I have yet to see any information listed here in any recent version of Oracle (9i or 10g on Windows or Linux).]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can use the COMPLETED AFTER and/or COMPLETED BEFORE clauses to narrow down the list of displayed backup sets.  And don't forget to list the backups starting with the most recent full, or level-0, backup, including any incrementals.&lt;br /&gt;&lt;br /&gt;Make a note of the backup TAGs that you wish to check.  At this point it's probably also sensible to make a note of which SCN you want to restore to.  I find it much easier to cross-reference an SCN with the backup report than an exact point-in-time.&lt;br /&gt;&lt;br /&gt;2.  Now, Log into the RMAN catalog as the RMAN user:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sqlplus rman/password@catalog_db&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3.  Run the following SQL command.  Enter a comma-separated, single-quoted list of tags  as identified in step 1 (as many as you like - I've used two here, for simplicity):&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;select tag, bs_key, bp_key, start_time, media &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;from bp &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;where tag in(&amp;amp;list_of_tags.);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Enter value for list_of_tags: 'TAG20081126T020905','TAG20081126T021254'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;old   3: where tag in(&amp;amp;list_of_tags.)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;new   3: where tag in('TAG20081126T020905','TAG20081126T021254')&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG                                                 BS_KEY  BP_KEY  START_TIM MEDIA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;------------------ ------- ------- --------- ----------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T020905                  1063426    1063432 26-NOV-08 000304&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T020905                  1063427    1063433 26-NOV-08 000310&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T020905                  1063428    1063434 26-NOV-08 000304&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T020905                  1063429    1063435 26-NOV-08 000304&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T020905                  1063430    1063436 26-NOV-08 000304&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;TAG20081126T021254                  1063514    1063521 26-NOV-08 000304&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Output is as above.  The media column shows the label of the tape that the backup piece is stored on.&lt;br /&gt;&lt;br /&gt;Now you know which tapes are going to be required for your restore, you can recall them from the storage company.&lt;br /&gt;&lt;br /&gt;Next post I will consider the next "gotcha" on my list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-3216697738284658196?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/3216697738284658196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=3216697738284658196&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/3216697738284658196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/3216697738284658196'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2008/12/rman-duplicate-gotchas.html' title='RMAN Duplicate Gotchas - Part 1: Identifying the Media'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3743585359130906790.post-8551388792743434045</id><published>2008-11-28T17:17:00.001Z</published><updated>2008-12-01T16:45:57.571Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='tuning'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>Available January</title><content type='html'>I've just discovered that my current contract, with a healthcare company in Hampshire, will not be extended beyond the end of the year.  So, in the current economic climate, I've decided to start a blog in order to drum up more business.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;My primary skills are in troubleshooting and tuning Oracle systems, from entire databases to individual SQL queries.&lt;br /&gt;&lt;br /&gt;If you have an application running on an Oracle database and you need someone to investigate an issue on that system, get in touch.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;"My name is Peter Moore. I am a professionally qualified and highly experienced database administrator with extensive knowledge and skills in Oracle database technologies from V5 to Oracle10gR2 gained over the past twenty years. I have experience working with various Oracle toolsets, on different platforms, demonstrating a hard-working, self-motivated attitude. I am approachable, enthusiastic, and an effective communicator."&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As that bumpf, culled directly from my CV, shows, this blog is primarily intended to help me find work. If you require help with any Oracle RDBMS related activities, get in touch.&lt;br /&gt;&lt;p style="margin-left: 36pt; text-indent: -18pt;" class="MsoBodyText"&gt;&lt;span style="font-family: Garamond;" lang="EN-US"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-weight: bold;"&gt;Key Skills:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Oracle versions 5 to 10gR2.&lt;br /&gt;Platforms:  Windows NT, Compaq/DEC OpenVMS, Sun Solaris, Hewlett Packard HP-UX, IBM AIX, Linux.&lt;br /&gt;Installation, tuning, optimisation and monitoring of Oracle database instances, including migrations and upgrades.&lt;br /&gt;Backup and recovery, both manual and using Recovery Manager (RMAN).&lt;br /&gt;Database cloning using RMAN.&lt;br /&gt;Oracle Dataguard and Oracle RAC configuration and administration.&lt;br /&gt;Parallel query and parallel DML configuration and tuning.&lt;br /&gt;SQL and PL/SQL coding, tuning and trouble-shooting.&lt;br /&gt;SQL*Net and Oracle Names configuration.&lt;br /&gt;SQL*Plus and the Enterprise Manager Grid Control suite of tools.&lt;br /&gt;UNIX system administration on Sequent Dynix/ptx.&lt;br /&gt;UNIX korn shell scripting.&lt;br /&gt;Problem identification and solving.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3743585359130906790-8551388792743434045?l=dbaoraclestuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbaoraclestuff.blogspot.com/feeds/8551388792743434045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3743585359130906790&amp;postID=8551388792743434045&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/8551388792743434045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3743585359130906790/posts/default/8551388792743434045'/><link rel='alternate' type='text/html' href='http://dbaoraclestuff.blogspot.com/2008/11/available-january.html' title='Available January'/><author><name>Pete</name><uri>http://www.blogger.com/profile/17366331102790168465</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_1AL04zEYUuk/SL076DSqhJI/AAAAAAAAAHA/QOTyw1D91mE/S220/South+Park+Pete.jpg'/></author><thr:total>0</thr:total></entry></feed>
