<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7032512792942232766</id><updated>2018-05-11T10:14:49.887-05:00</updated><category term="oracle"/><category term="11gR2"/><category term="rman"/><category term="11g"/><category term="linux"/><category term="tuning"/><category term="bind variables"/><category term="security"/><category term="dba"/><category term="sql"/><category term="asm"/><category term="cbo"/><category term="em12c"/><category term="irc"/><category term="jonathan lewis"/><category term="oca"/><category term="partitions"/><category term="youtube"/><category term="ADR"/><category term="backup"/><category term="blogs"/><category term="diagnostics"/><category term="pl/sql"/><category term="postgresql"/><category term="pythian"/><category term="sql developer"/><category term="12c"/><category term="asmm"/><category term="athf"/><category term="blogger"/><category term="bugs"/><category term="feuerstein"/><category term="indexes"/><category term="java"/><category term="joins"/><category term="memory"/><category term="nfs"/><category term="python"/><category term="recovery"/><category term="rhel"/><category term="sqlplus"/><category term="statistics"/><category term="authentication"/><category term="bands"/><category term="centos"/><category term="children"/><category term="constraints"/><category term="cpu"/><category term="csalter"/><category term="csscan"/><category term="data guard"/><category term="date"/><category term="dnfs"/><category term="documentation"/><category term="golden gate"/><category term="grid"/><category term="i/o"/><category term="infiniband"/><category term="jealousy"/><category term="ldap"/><category term="listener"/><category term="lnnvl"/><category term="materialized view logs"/><category term="materialized views"/><category term="microsoft"/><category term="migration"/><category term="money"/><category term="movies"/><category term="mssql"/><category term="music"/><category term="mysql"/><category term="networking"/><category term="nls"/><category term="null"/><category term="ojdbc"/><category term="oss"/><category term="parallel"/><category term="passwords"/><category term="patches"/><category term="penny arcade"/><category term="pga"/><category term="redhat"/><category term="restore"/><category term="roles"/><category term="schneier"/><category term="sprintf"/><category term="sql injection"/><category term="terror"/><category term="time"/><category term="tkyte"/><category term="ultimate frisbee"/><category term="upgrade"/><category term="warcraft"/><category term="x86_64"/><category term="zfssa"/><category term="10gR2"/><category term="ACID"/><category term="PSU"/><category term="aang"/><category term="active directory"/><category term="advanced queues"/><category term="analytics"/><category term="animal"/><category term="apocalypto"/><category term="asmcmd"/><category term="assm"/><category term="autotrace"/><category term="avatar"/><category term="ayb"/><category term="barracuda"/><category term="bct"/><category term="ben stein"/><category term="beta"/><category term="bigfile"/><category term="birthday"/><category term="black"/><category term="bomb"/><category term="bomber net"/><category term="buddy rich"/><category term="buggery"/><category term="caddyshack"/><category term="calypso"/><category term="charity"/><category term="child&#39;s play"/><category term="cli"/><category term="clob"/><category term="commit"/><category term="communism"/><category term="copy"/><category term="corruption"/><category term="cri moer"/><category term="cx_oracle"/><category term="datatypes"/><category term="db2"/><category term="dbwr"/><category term="design"/><category term="developers"/><category term="diagnostic pack"/><category term="dilbert"/><category term="dogs"/><category term="doug"/><category term="dst"/><category term="duplication"/><category term="electric mayhem"/><category term="em"/><category term="em dbconsole"/><category term="explain plan"/><category term="family"/><category term="features"/><category term="gallery"/><category term="gcj"/><category term="gifted"/><category term="gimp"/><category term="global temporary tables"/><category term="gmail"/><category term="hali"/><category term="happy new year"/><category term="harry belafonte"/><category term="hash"/><category term="hasselhoff"/><category term="hazing"/><category term="help"/><category term="history"/><category term="hjr"/><category term="horses"/><category term="hospitals"/><category term="hurra torpedo"/><category term="hype"/><category term="inkscape"/><category term="internet"/><category term="jboss"/><category term="john paul jones"/><category term="jonathan coulton"/><category term="kevin federline"/><category term="keys"/><category term="kids"/><category term="kitchen appliances"/><category term="ksh"/><category term="launchy"/><category term="leap second"/><category term="liam"/><category term="library"/><category term="licensing"/><category term="load"/><category term="locks"/><category term="log miner"/><category term="lolcats"/><category term="lore"/><category term="marching band"/><category term="metalink"/><category term="monitoring"/><category term="morans"/><category term="mufc"/><category term="muppets"/><category term="nascar"/><category term="nerf"/><category term="nocoug"/><category term="nothing important"/><category term="nub"/><category term="ocp"/><category term="ocr"/><category term="oel"/><category term="oem"/><category term="office"/><category term="oms"/><category term="ora-00600"/><category term="ora-01403"/><category term="oracle restart"/><category term="orly"/><category term="osama"/><category term="otn"/><category term="pan&#39;s labyrinth"/><category term="paranoia"/><category term="paranoid android"/><category term="partition exchange"/><category term="pascal"/><category term="paypal"/><category term="permissions"/><category term="phones"/><category term="pidgin"/><category term="pio"/><category term="proxy users"/><category term="pumpkins"/><category term="puschitz"/><category term="putty"/><category term="quest"/><category term="quickie"/><category term="radiohead"/><category term="rage against the machine"/><category term="razr"/><category term="read consistency"/><category term="red son"/><category term="resignation"/><category term="revolution"/><category term="rhetoric"/><category term="roller coasters"/><category term="routing"/><category term="salt"/><category term="seagal"/><category term="securefile"/><category term="seppuku"/><category term="sga"/><category term="sheboygan"/><category term="shutdown"/><category term="sniper rifles"/><category term="snpp"/><category term="soviet union"/><category term="srvctl"/><category term="standby"/><category term="sun"/><category term="superman"/><category term="sysdba"/><category term="taz"/><category term="tbcsu"/><category term="technorati"/><category term="the onion"/><category term="tkprof"/><category term="toad"/><category term="tora"/><category term="transactions"/><category term="tumblr"/><category term="ubuntu"/><category term="uek"/><category term="ussr"/><category term="utlirp"/><category term="utlrp"/><category term="uw"/><category term="vacation"/><category term="victorops"/><category term="wait"/><category term="walmart"/><category term="warren buffett"/><category term="weblogic"/><category term="what-a-screw"/><category term="wifi"/><category term="windows"/><category term="wtf"/><category term="xkcd"/><category term="yearbook"/><category term="young"/><category term="zero wing"/><title type='text'>die Seilerwerks</title><subtitle type='html'>IT/Databases/PostgreSQL Stuff Mostly. Maybe Oracle From Time-to-Time.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.seiler.us/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default'/><link rel='alternate' type='text/html' href='http://www.seiler.us/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default?start-index=26&amp;max-results=25'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>392</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-727993782011343408</id><published>2018-04-30T12:55:00.000-05:00</published><updated>2018-05-02T13:01:46.568-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mssql"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="postgresql"/><category scheme="http://www.blogger.com/atom/ns#" term="sql"/><title type='text'>Beware (Sort-Of) Ambiguous Column Names In Sub-Selects</title><content type='html'>This morning I received an UPDATE statement from a developer that I was testing. It ran without errors but then I saw that it updated 5 rows when it should have only updated 3. The reason gave me a little shock so I whipped up a simple test-case to reproduce the problem.&lt;br /&gt;&lt;br /&gt;First we create two tables:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CREATE TABLE foo (&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; id int&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , name varchar(30)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CREATE TABLE&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CREATE TABLE bar (&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; id int&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , foo_id int&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , description varchar(100)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;CREATE TABLE&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we insert some data:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INSERT INTO foo (id, name) VALUES&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; (1, &#39;Dev&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (2, &#39;QA&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (3, &#39;Preprod&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (4, &#39;Prod&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INSERT 0 4&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INSERT INTO bar (id, foo_id, description)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; VALUES (1, 1, &#39;A&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (2, 2, &#39;B&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (3, 2, &#39;C&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (4, 2, &#39;D&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; , (5, 3, &#39;E&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;INSERT 0 5&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here I&#39;m using a SELECT rather than the original UPDATE just to test. This could (should) be done as a join, but I was sent something like this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT COUNT(*)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM bar&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE foo_id = (SELECT id FROM foo WHERE name=&#39;QA&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;count&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;(1 row)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Fair enough. It does the same thing as a join. However what I was sent was actually this (note the column name in the subquery):&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT COUNT(*)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;FROM bar&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;WHERE foo_id = (SELECT foo_id FROM foo WHERE name=&#39;QA&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp;count&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;-------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;(1 row)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I would expect an error since foo_id does not exist in table foo, like this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;SELECT foo_id FROM foo WHERE name=&#39;QA&#39;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;ERROR:&amp;nbsp; 42703: column &quot;foo_id&quot; does not exist&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;LINE 1: SELECT foo_id FROM foo WHERE name=&#39;QA&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Instead, it basically selected EVERYTHING in the bar table. Why?&lt;br /&gt;&lt;br /&gt;I posted this dilemma in the PostgreSQL Slack channel, and others were similarly surprised by this. &lt;a href=&quot;http://ryanguill.com/&quot; target=&quot;_blank&quot;&gt;Ryan Guill&lt;/a&gt; tested and confirmed the same behavior not only in Postgres, but also in Oracle, MS SQL, &amp;amp; MySQL.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://rainwatr.blogspot.com/&quot; target=&quot;_blank&quot;&gt;Cindy Wise&lt;/a&gt; observed that it is probably using the foo_id field from the bar table in the outer query, which does make sense. It&#39;s comparing foo_id to itself (while also running the almost-but-not-quite-entirely-pointless subquery to foo table), which will of course return true, so it grabs every row in the bar table.&lt;br /&gt;&lt;br /&gt;This seems like a very easy trap to fall into if you&#39;re not careful with your column names. Considering this was originally in the form of an UPDATE query, it can be a destructive mistake that would execute successfully and could be rather hard to trace back.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/727993782011343408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2018/04/beware-sort-of-ambiguous-column-names.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/727993782011343408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/727993782011343408'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2018/04/beware-sort-of-ambiguous-column-names.html' title='Beware (Sort-Of) Ambiguous Column Names In Sub-Selects'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-6467790568209765157</id><published>2018-04-14T11:53:00.000-05:00</published><updated>2018-04-14T11:53:46.307-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="postgresql"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>How (Not) to Change Passwords in PostgreSQL</title><content type='html'>A few months ago I was doing some testing on a development PostgreSQL database and watching the postgresql server log (akin to Oracle&#39;s alert log). I was skimming for lines relevant to my testing when I noticed something chilling:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: alter user john password &#39;IloveDBAs&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The username and password have obviously been changed but the point is plain: PostgreSQL printed the password value in plain text to the log file. A few tests of my own confirmed that whenever the PASSWORD specification is used in a CREATE USER or ALTER USER command, it will be printed to the server log:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: create user john password &#39;badidea&#39;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: alter user john password &#39;alsobad&#39;;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The way around this in psql is to use the \PASSWORD command. When creating a new user, do not specify the password at creation time, just use \PASSWORD later:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# create user susan;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;CREATE ROLE&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# \password susan&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Enter new password:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Enter it again:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# \password john&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Enter new password:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Enter it again:&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, like most password-change processes, you&#39;re asked to enter it twice and the input is not echoed to the screen. The log will show this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: create user susan;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: ALTER USER susan PASSWORD &#39;md5d311d09782068f6a2391358ae512e113&#39;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOG:&amp;nbsp; statement: ALTER USER john PASSWORD &#39;md5a7e4187c1c977ed2e700e880dac11f15&#39;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can see the passwords are still printed, but they are md5-hashed now.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, this only works when I&#39;m using psql. If a developer is using a GUI tool that offers a feature to change a password, they could very well be doing the same bad command under the hood.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note: this behavior was originally observed by me in PostgreSQL 9.2 but it&#39;s still the case in 9.6 and 10.2. From &lt;a href=&quot;https://www.postgresql.org/message-id/CAHJZqBDe1-oiYtdh5pcWLAhr3jsDMFQg4miv3PYADH3YWKqZ2w%40mail.gmail.com&quot; target=&quot;_blank&quot;&gt;a discussion that was had with the pgsql-admin community&lt;/a&gt;, it&#39;s not likely to be changed any time soon.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/6467790568209765157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2018/04/how-not-to-change-passwords-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6467790568209765157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6467790568209765157'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2018/04/how-not-to-change-passwords-in.html' title='How (Not) to Change Passwords in PostgreSQL'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-762655151454826645</id><published>2018-02-09T14:31:00.002-06:00</published><updated>2018-02-09T14:31:31.733-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="postgresql"/><title type='text'>The Transition (or: How I Learned to Stop Worrying and Love PostgreSQL)</title><content type='html'>&lt;i&gt;Note: Yes I &lt;a href=&quot;http://www.seiler.us/2007/08/dr-statslove-or-how-i-learned-to-stop.html&quot; target=&quot;_blank&quot;&gt;re-(ab)used the title&lt;/a&gt;.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://4.bp.blogspot.com/-VSUy2KpPfAI/Wn4FBEQR4ZI/AAAAAAAAGOI/dLTnF3luGo4AQsHDjA-doRloLSGX5A9zwCLcBGAs/s1600/dr-strangelove-or-how-i-learned-to-stop-worrying-and-love-the-bomb-170-1200-1200-675-675-crop-000000.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;675&quot; data-original-width=&quot;1200&quot; height=&quot;180&quot; src=&quot;https://4.bp.blogspot.com/-VSUy2KpPfAI/Wn4FBEQR4ZI/AAAAAAAAGOI/dLTnF3luGo4AQsHDjA-doRloLSGX5A9zwCLcBGAs/s320/dr-strangelove-or-how-i-learned-to-stop-worrying-and-love-the-bomb-170-1200-1200-675-675-crop-000000.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;As some of you may know (if you follow me on twitter), after 16 years as an Oracle DBA, I made a career shift last summer. I hung up the Oracle spurs (and that sweet Oracle Ace vest) and threw on a pair of &lt;a href=&quot;http://www.postgresql.org/&quot; target=&quot;_blank&quot;&gt;PostgreSQL&lt;/a&gt; chaps. I had always been a fan and very casual user of PostgreSQL for many years, even gently lobbying the folks at &lt;a href=&quot;http://www.pythian.com/&quot; target=&quot;_blank&quot;&gt;Pythian&lt;/a&gt; to add PostgreSQL DBA services to their offering (to no avail).&lt;br /&gt;&lt;br /&gt;I&#39;m taking this fresh start to also jump-start my blogging, hoping to write about interesting notes as I dive deeper in the PostgreSQL world (and even some Hadoop as I get into that). I&#39;m just over 6 months into my new adventure and loving it. I&#39;m excited to be dealing a lot more with an open source community, and interacting daily with some contributors via Slack.&lt;br /&gt;&lt;br /&gt;Over the past 6 months, I&#39;ve compiled a list of topics to write about. If I can remember the details or find my notes, I&#39;ll hopefully be writing regularly on these topics!&lt;br /&gt;&lt;br /&gt;So, I hope to see more of you regularly here. Stay tuned!</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/762655151454826645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2018/02/the-transition-or-how-i-learned-to-stop.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/762655151454826645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/762655151454826645'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2018/02/the-transition-or-how-i-learned-to-stop.html' title='The Transition (or: How I Learned to Stop Worrying and Love PostgreSQL)'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://4.bp.blogspot.com/-VSUy2KpPfAI/Wn4FBEQR4ZI/AAAAAAAAGOI/dLTnF3luGo4AQsHDjA-doRloLSGX5A9zwCLcBGAs/s72-c/dr-strangelove-or-how-i-learned-to-stop-worrying-and-love-the-bomb-170-1200-1200-675-675-crop-000000.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-2229598644377669330</id><published>2016-01-28T11:55:00.002-06:00</published><updated>2016-01-28T15:35:06.613-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="em"/><category scheme="http://www.blogger.com/atom/ns#" term="em12c"/><category scheme="http://www.blogger.com/atom/ns#" term="monitoring"/><category scheme="http://www.blogger.com/atom/ns#" term="oem"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="victorops"/><title type='text'>Sending notifications from Oracle Enterprise Manager to VictorOps</title><content type='html'>We use &lt;a href=&quot;https://victorops.com/&quot; target=&quot;_blank&quot;&gt;VictorOps &lt;/a&gt;for our paging/notification system, and we&#39;re pretty happy with it so far. On the DBA team, we&#39;ve just been using a simple email gateway to send notifications from Oracle Enterprise Manager (EM) to VictorOps. Even then, we can only send the initial notification and not really send an automated recovery without more hacking than its worth. Not a big deal, but would be nice to have some more functionality.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So yesterday I decided I&#39;d just sort it all out since &lt;a href=&quot;http://victorops.force.com/knowledgebase/articles/Integration/Alert-Ingestion-API-Documentation/&quot; target=&quot;_blank&quot;&gt;VictorOps has a nice REST API&lt;/a&gt; and Enterprise Manager has a nice &lt;a href=&quot;http://docs.oracle.com/cd/E24628_01/doc.121/e24473/notification.htm#EMADM13040&quot; target=&quot;_blank&quot;&gt;OS script notification method framework&lt;/a&gt;. The initial result can be found on my github: &lt;a href=&quot;https://github.com/dtseiler/bin/blob/master/entmgr_to_victorops.sh&quot; target=&quot;_blank&quot;&gt;entmgr_to_victorops.sh&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It doesn&#39;t do anything fancy, but will handle the messages sent by your notification rules and pass them on to VictorOps. It keys on the incident ID to track which events it is sending follow-up (ie RECOVERY) messages for.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please do let me know if you have any bugs, requests, suggestions for it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Many thanks to Sentry Data Systems (my employer) for allowing me to share this code. It isn&#39;t mind-blowing stuff but should save you a few hours of banging your head against a wall.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/2229598644377669330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2016/01/sending-notifications-from-oracle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2229598644377669330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2229598644377669330'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2016/01/sending-notifications-from-oracle.html' title='Sending notifications from Oracle Enterprise Manager to VictorOps'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-4094485251647227234</id><published>2015-11-10T16:03:00.001-06:00</published><updated>2015-11-10T17:21:29.623-06:00</updated><title type='text'>Just XFS Things</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot; , &amp;quot;courier&amp;quot; , monospace;&quot;&gt;$ uptime&lt;br /&gt;&lt;br /&gt; 16:36:42 up 4 days, 12:28, 6 users, load average: 1029.20, 995.42, 865.77&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;See&amp;nbsp;&lt;a href=&quot;https://www.centos.org/forums/viewtopic.php?f=47&amp;amp;t=52412&quot;&gt;https://www.centos.org/forums/viewtopic.php?f=47&amp;amp;t=52412&lt;/a&gt; and&amp;nbsp;&lt;a href=&quot;https://access.redhat.com/solutions/532663&quot;&gt;https://access.redhat.com/solutions/532663&lt;/a&gt; (requires RedHat subscription) for details. And defrag your XFS volumes.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/4094485251647227234/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2015/11/just-xfs-things.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4094485251647227234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4094485251647227234'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2015/11/just-xfs-things.html' title='Just XFS Things'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-4117651983302053523</id><published>2015-07-21T16:50:00.000-05:00</published><updated>2015-08-09T21:27:39.772-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="date"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="leap second"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="rhel"/><category scheme="http://www.blogger.com/atom/ns#" term="time"/><title type='text'>The Leap Second is No Laughing Matter (if you have java on an older Linux kernel)</title><content type='html'>Earlier this month we began getting frequent email warnings from our EM12c server that some agents were experiencing read time outs. Then we saw that the emagent java process was using A LOT of CPU, regularly around 500% but sometimes as high as 800% as seen from &quot;top&quot;. Restarting the agent did nothing.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I opened an SR with Oracle Support, where I was first instructed to apply a JDBC patch and then a PSU agent patch. No change in behavior.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://courtneyllamas.com/&quot; target=&quot;_blank&quot;&gt;Courtney Llamas&lt;/a&gt; from the Oracle EM team reached out and suggested it might be due to the leap second, directing me to these MOS docs:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Enterprise Manager Management Agent or OMS CPU Use Is Excessive near Leap Second Additions on Linux (Doc ID 1472651.1)&lt;/li&gt;&lt;li&gt;Leap Second Hang - CPU Can Be Seen at 100% (Doc ID 1472421.1)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;The workaround is to restart ntpd (or reboot the server):&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# /etc/init.d/ntpd stop&lt;br /&gt;#  date -s &quot;`date`&quot;    (reset the system clock)&lt;br /&gt;# /etc/init.d/ntpd start&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I monitored top while my system admin restarted ntpd and reset the clock. As soon as he did, java CPU usage dropped like a rock.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://reactiongifs.me/wp-content/uploads/2013/08/shia-labeouf-magic-gif.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://reactiongifs.me/wp-content/uploads/2013/08/shia-labeouf-magic-gif.gif&quot; height=&quot;179&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;While I&#39;m incredibly grateful that Courtney provided the solution in basically 5 minutes, I&#39;m even more upset that Oracle Support had me doing everything but for the 20 days that my original SR has been open.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Of course the real joke is on me, since I first reported the error on July 1 and we all joked on twitter how it was probably due the leap second. The fault also lies with me since I failed to notice that our kernel version (2.6.32-220) was still vulnerable to this (fixed in 2.6.32-279). See &lt;a href=&quot;http://www.pythian.com/blog/handling-the-leap-second-linux/&quot; target=&quot;_blank&quot;&gt;Maris Elsins&#39; great write-up&lt;/a&gt;&amp;nbsp;(which I apparently skimmed too lightly).&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/4117651983302053523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2015/07/the-leap-second-is-no-laughing-matter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4117651983302053523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4117651983302053523'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2015/07/the-leap-second-is-no-laughing-matter.html' title='The Leap Second is No Laughing Matter (if you have java on an older Linux kernel)'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-8018021624247624249</id><published>2015-07-21T12:12:00.002-05:00</published><updated>2015-07-21T12:12:46.172-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="12c"/><category scheme="http://www.blogger.com/atom/ns#" term="features"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>Upgrade to Oracle 12c, Get the Huge Trace Files for Free!</title><content type='html'>Last week we began testing a copy of our production database on Oracle 12c (12.1.0.2). This past weekend we were alerted that the disk holding our ADR diagnostic directory was near full. We noticed some pretty big (and recent) trace files there. Then it happened twice more. This last time filled the disk before we could get to it (thankfully only dev, and during the evening), meaning it filled up fast. The largest file was over 18GB and it only took 6 hours to get that big.&lt;br /&gt;&lt;br /&gt;I saved the three biggest trace files to a large NFS mount and did a trace file purge just to get our dev database back up. When I looked at those files, I saw they were all sqlplus sessions running the same DELETE statement after reports like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;----- Cursor Obsoletion Dump sql_id=7q0kj0sp5k779 -----&lt;br /&gt;Parent cursor obsoleted 1 time(s). maxchild=1024 basephd=0xae2a2ca308 phd=0xae2a2ca308&lt;br /&gt;----- Dump Cursor sql_id=7q0kj0sp5k779 xsc=0x7ffbf191fd50 cur=0x7ffbf2702670 -----&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;At first I thought it was a user session setting some oddball trace event. However our team found &lt;b&gt;DocID 1955319.1 (Huge Trace Files Created Containing &quot;----- Cursor Obsoletion Dump sql_id=%s -----&quot;)&lt;/b&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Long story short, it&#39;s an unpublished bug introduced in 12.1.0.2 with the cursor obsoletion diagnostic dump &quot;ehancement&quot;. I don&#39;t think they intended this though, even though they did say &quot;Huge&quot;. The workaround is to disable it completely, via this hidden parameter:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;alter system set &quot;_kks_obsolete_dump_threshold&quot; = 0;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is this note at the end though:&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Note: The underlying  cursor sharing problem should always be highlighted and investigated to ensure that the reason for the  non-sharing is known and fully understood.&lt;/blockquote&gt;Which is definitely good advice.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/8018021624247624249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2015/07/upgrade-to-oracle-12c-get-huge-trace.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/8018021624247624249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/8018021624247624249'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2015/07/upgrade-to-oracle-12c-get-huge-trace.html' title='Upgrade to Oracle 12c, Get the Huge Trace Files for Free!'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-2306752854358152950</id><published>2015-01-06T15:32:00.000-06:00</published><updated>2015-01-06T15:38:30.590-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="ksh"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>Returning Error Codes from sqlplus to Shell Scripts</title><content type='html'>When I have to run SQL scripts, I prefer to do it via executable ksh scripts (I use ksh because it&#39;s usually an Oracle pre-requisite so I can rely on it being installed). One thing that I&#39;ve just recently started adding into my scripts is exiting sqlplus on error and returning the ORA error code. This is done via the &lt;a href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve052.htm&quot; target=&quot;_blank&quot;&gt;WHENEVER SQLERROR&lt;/a&gt; feature of sqlplus:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;sqlplus / as sysdba &amp;lt;&amp;lt;EOF&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whenever sqlerror exit sql.sqlcode&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alter tablespace foo&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&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; rename to foo_old;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create tablespace foo&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datafile size 100m;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alter table foo move tablespace $TABLESPACE_NAME nocompress;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;EOF&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;RETURN_CODE=$?&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;if [ $RETURN_CODE -ne 0 ]; then&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;*** Tablespace renaming error code $RETURN_CODE. ***&quot;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit $RETURN_CODE;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;fi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this example we rename a tablespace and then create a new tablespace in its place and move a table there. It seems rather contrived but this is actually what I&#39;m doing to move tables to an uncompressed and unencrypted tablespace to test storage vendor deduplication claims. But I digress ...&lt;br /&gt;&lt;br /&gt;To test this, I used a tablespace that doesn&#39;t exist. This results in an ORA-00959 error when the tablespace does not exist. However, the return code I get was 191. I spent a good portion of the day testing and retesting with all sorts of debug output until I stumbled across &lt;a href=&quot;http://stackoverflow.com/questions/14734131/managing-error-handling-while-running-sqlplus-from-shell-scripts#comment39232347_14829264&quot; target=&quot;_blank&quot;&gt;this comment&lt;/a&gt;. Since Linux (and I&#39;m told Unix) return codes only go up to 255, the ORA sqlcode value of 959 is wrapped until there is a remainder. The value of 191 is the difference, achieved simply by modulo operation: &lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;959 % 256 = 191&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&amp;nbsp;And suddenly the skies were cleared.&lt;br /&gt;&lt;br /&gt;As always, hope this helps!</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/2306752854358152950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2015/01/returning-error-codes-from-sqlplus-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2306752854358152950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2306752854358152950'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2015/01/returning-error-codes-from-sqlplus-to.html' title='Returning Error Codes from sqlplus to Shell Scripts'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-2383805665544839447</id><published>2014-11-12T10:13:00.002-06:00</published><updated>2014-11-12T10:13:38.383-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="backup"/><category scheme="http://www.blogger.com/atom/ns#" term="copy"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><title type='text'>Making Copies of Copies with Oracle RMAN</title><content type='html'>&lt;div dir=&quot;ltr&quot;&gt;I recently had need to make a copy of an image copy in Oracle rman. Since it wasn&#39;t immediately obvious to me, I thought it was worth sharing once I had it sorted out. I was familiar with making a backup of a backup, but had never thought about making a copy of a copy.&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;First you need to create an image copy of your database or tablespace. For the sake of example, I&#39;ll make a copy of the FOO tablespace. The key is to assign a tag to it that you can use for later reference. I&#39;ll use the tag &quot;DTSCOPYTEST&quot;:&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;backup as copy&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tablespace foo&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag &#39;DTSCOPYTEST&#39;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format &#39;+DG1&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;So I have my image copy in the DG1 tablespace. Now say we want to make copy of that for some testing purpose and put it in a different diskgroup. For that, we need the &quot;BACKUP AS COPY COPY&quot; command, and we&#39;ll want to specify the copy we just took by using the tag that was used:&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;backup as copy&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; copy of tablespace foo&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from tag &#39;DTSCOPYTEST&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tag &#39;DTSCOPYTEST2&#39;&lt;/span&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; format &#39;+DG2&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As you&#39;d guess, RMAN makes a copy of the first copy, writing it to the specified format location.&lt;br /&gt;&lt;br /&gt;As always, hope this helps! &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/2383805665544839447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/11/making-copies-of-copies-with-oracle-rman.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2383805665544839447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2383805665544839447'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/11/making-copies-of-copies-with-oracle-rman.html' title='Making Copies of Copies with Oracle RMAN'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-7093567814428582851</id><published>2014-11-04T22:28:00.001-06:00</published><updated>2014-11-04T22:28:19.371-06:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="corruption"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="recovery"/><category scheme="http://www.blogger.com/atom/ns#" term="restore"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><title type='text'>The Importance of Backups (A Cautionary Block Recovery Tale)</title><content type='html'>Just wanted to share a quick story with everyone. As I was in the airport waiting to fly to Oracle OpenWorld this year, I noticed a flurry of emails indicating that part of our storage infrastructure for our standby production database had failed. Long story short, my co-workers did a brilliant job of stabilizing things and keeping recovery working. However, we ended up with more than a few block corruptions.&lt;br /&gt;&lt;br /&gt;Using the RMAN command &quot;validate database&quot;, we could then see the list of corrupt blocks in the v$database_block_corruption view. All that was needed was to run &quot;recover corruption list&quot; in RMAN, which will dig into datafile copies and backups to do what it can to repair or replace the corrupt blocks and then recover the datafiles. Of course, nothing is ever that easy for us!&lt;br /&gt;&lt;br /&gt;The storage we were writing our weekly backups to had been having problems and the latest weekly had failed. We ended up having to back 2 weeks into backups to get the datafile blocks and archivelogs to eventually complete the corruption recovery. I also immediately moved our backups to more reliable storage as well so that we&#39;re never in the situation of wondering whether or not we have the backups we need.&lt;br /&gt;&lt;br /&gt;So, triple-check your backup plan, validate your backups and TEST RECOVERY SCENARIOS! You can&#39;t say your backups are valid until you use them to perform a restore/recovery, and you don&#39;t want to find out the hard way that you forgot something.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/7093567814428582851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/11/the-importance-of-backups-cautionary.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7093567814428582851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7093567814428582851'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/11/the-importance-of-backups-cautionary.html' title='The Importance of Backups (A Cautionary Block Recovery Tale)'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-7717411070315766153</id><published>2014-10-22T23:00:00.001-05:00</published><updated>2014-10-22T23:00:35.061-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="data guard"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>ORA-16534 When Converting to/from Snapshot Standby with DataGuard Broker</title><content type='html'>We here at Seilerwerks Industries (not really) have been using snapshot standby databases to refresh an array of unit test databases from a common primary. During the business day, these would be converted to snapshot standby databases for testing, then overnight they are converted back to physical standby and recovered up to the master again.&lt;br /&gt;&lt;br /&gt;However we ran into one problem the other week. I noticed that the test3 database was still in physical standby mode well into the business day. Trying to manually convert returned this error:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;DGMGRL&amp;gt; convert database test3 to snapshot standby&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Converting database &quot;test3&quot; to a Snapshot Standby database, please wait...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Error:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-16534: switchover, failover or convert operation in progress&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at &quot;SYS.DBMS_DRS&quot;, line 157&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06512: at line 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A quick search of MOS yielded bug 13716797&amp;nbsp;(ORA-16534 from the broker when setting apply-off),&amp;nbsp;which simply suggested restarting the problem database when encountering that error. However doing so did not get me any further. That&#39;s when the I checked the Data Guard Broker configuration:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;DGMGRL&amp;gt; show configuration;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configuration - testdb&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; Protection Mode: MaxPerformance&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; Databases:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test1 - Primary database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test5 - Physical standby database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test6 - Snapshot standby database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test3 - Physical standby database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test4 - Snapshot standby database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Fast-Start Failover: DISABLED&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configuration Status:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-16610: command &quot;CONVERT DATABASE test6&quot; in progress&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;DGM-17017: unable to determine configuration status&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Looks like I have two databases stuck in physical standby mode, test3 and also test6. And the configuration is specifically complaining about test6. So I restarted that database and, sure enough, I was then able to convert both back to snapshots:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;DGMGRL&amp;gt; show configuration;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configuration - testdb&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; Protection Mode: MaxPerformance&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; Databases:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test1 - Primary database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test5 - Snapshot standby database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test6 - Snapshot standby database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test3 - Snapshot standby database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; test4 - Snapshot standby database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Fast-Start Failover: DISABLED&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Configuration Status:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SUCCESS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It was very interesting to me to see one member of the Data Guard configuration prevent me from performing an operation on a different member. Hopefully this helps one of you in the future.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/7717411070315766153/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/10/ora-16534-when-converting-tofrom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7717411070315766153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7717411070315766153'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/10/ora-16534-when-converting-tofrom.html' title='ORA-16534 When Converting to/from Snapshot Standby with DataGuard Broker'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-1242379186923848277</id><published>2014-10-01T23:07:00.001-05:00</published><updated>2014-10-01T23:07:50.266-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="advanced queues"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>Advanced Queue Quickie: Errors and Privileges</title><content type='html'>File this one under the misleading-errors department. One of my developers was working with a new queue. He pinged me when he got this error trying to create a job that used the queue:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ERROR at line 1:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ORA-27373: unknown or illegal event source queue&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ORA-06512: at &quot;SYS.DBMS_ISCHED&quot;, line 124&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ORA-06512: at &quot;SYS.DBMS_SCHEDULER&quot;, line 314&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ORA-06512: at line 2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The CREATE_JOB statement was:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;DBMS_SCHEDULER.CREATE_JOB(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;job_name =&amp;gt; &#39;foo.bar_q_job&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;job_type =&amp;gt; &#39;PLSQL_BLOCK&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;job_action =&amp;gt; &#39;begin foo.bar_pkg.consume_bar_queue(); end;&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;queue_spec =&amp;gt; &#39;BAR.BAR_Q, FOO_BAR_AGENT&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;enabled =&amp;gt; true,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;comments =&amp;gt; &#39;This is a job to consume the bar.bar_q entries that affect foo.&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;After a few minutes of banging our heads, it became obvious that this was a permissions problem. The queue was owned by BAR, the job was being created as FOO. The ORA error message could/should have made this more obvious, in my opinion.&lt;br /&gt;&lt;br /&gt;Anyway, the fix was simply to grant access to FOO:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;DBMS_AQADM.GRANT_QUEUE_PRIVILEGE(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; privilege &amp;nbsp;=&amp;gt; &#39;ALL&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; queue_name =&amp;gt; &#39;bar.bar_q&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; grantee &amp;nbsp; &amp;nbsp;=&amp;gt; &#39;foo&#39; );&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;Hope this saves some banged heads for others.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/1242379186923848277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/10/advanced-queue-quickie-errors-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1242379186923848277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1242379186923848277'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/10/advanced-queue-quickie-errors-and.html' title='Advanced Queue Quickie: Errors and Privileges'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-560045788276974961</id><published>2014-09-10T23:06:00.001-05:00</published><updated>2014-09-10T23:06:03.467-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><title type='text'>NOFILENAMECHECK Parameter Causes DUPLICATE DATABASE To Ignore DB_CREATE_FILE_DEST?</title><content type='html'>Last week I was creating a new testing database from a backup of our demo database, both under Oracle 11.2.0.3. I grabbed one of my old scripts to handle the duplicate function, which looked similar to this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;connect auxiliary /;&lt;br /&gt;run {&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; duplicate database to testdb&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; backup location &#39;$BACKUPDIR&#39;&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; nofilenamecheck;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;One important difference between the demo database and this new test database is that the original demo database lives on a filesystem and the new database was to go onto ASM on a different host. I had copied the syntax from the old script and kicked it off. I made sure that the db_create_file_dest was set to the ASM diskgroup. However the restore would fail as RMAN tried to write to the filesystem path used by the original demo database, which didn&#39;t exist on this host, instead of the ASM diskgroup.&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Definitely puzzling to me. I double-checked &lt;a href=&quot;http://docs.oracle.com/cd/B28359_01/backup.111/b28273/rcmsynta020.htm#CHDEHIGF&quot; target=&quot;_blank&quot;&gt;the documentation for NOFILENAMECHECK&lt;/a&gt;, which only suggested that it did a check for matching filenames, but didn&#39;t state that it would cause the issue I was seeing. The summary saying that it would prevent RMAN from checking for a name collision, which it does to prevent from overwriting existing files on the same host.&lt;br /&gt;&lt;br /&gt;However what I found is that having NOFILENAMECHECK in my command resulted in RMAN restoring the files to the original path, ignoring my db_create_file_dest specifications. When I removed the NOFILENAMECHECK specification from the RMAN command, the files were restored to the ASM diskgroup as intended.&lt;br /&gt;&lt;br /&gt;MOS Support documents 1375864.1 and 874352.1 suggest using the DB_FILE_NAME_CONVERT parameter but I found this was not necessary when I set the DB_FILE_CREATE_DEST parameter, as long as I didn&#39;t use NOFILENAMECHECK. I couldn&#39;t find anything in MOS about NOFILENAMECHECK forcing the restore to use a certain location though. </content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/560045788276974961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/09/nofilenamecheck-parameter-causes.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/560045788276974961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/560045788276974961'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/09/nofilenamecheck-parameter-causes.html' title='NOFILENAMECHECK Parameter Causes DUPLICATE DATABASE To Ignore DB_CREATE_FILE_DEST?'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-4525235876531772236</id><published>2014-08-21T15:35:00.000-05:00</published><updated>2014-08-21T16:02:37.465-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="partitions"/><title type='text'>ORA-14048 When Adding Composite Partition</title><content type='html'>Fresh off the heels of my earlier composite partitioning post, I just ran into this confusing issue:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; alter table p_objects&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add partition p201410&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;values less than (to_date(&#39;2014/11/01&#39;,&#39;yyyy/mm/dd&#39;))&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;subpartition p201410_spdts values (&#39;DTS&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spfoo values (&#39;FOO&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spbar values (&#39;BAR&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spsys values (&#39;SYS&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spsysaux values (&#39;SYSAUX&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;11 &amp;nbsp;tablespace tbs1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;12 &amp;nbsp;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tablespace tbs1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;*&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ERROR at line 11:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-14048: a partition maintenance operation may not be combined with other&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;operations&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The error doesn&#39;t quite make it easy to determine what the problem is. Turns out that the tablespace/storage clause of the ALTER TABLE ... ADD PARTITION has to come prior to the subpartitions definition. Simply moving that part of the statement a few rows up yields success:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; alter table p_objects&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add partition p201410&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;values less than (to_date(&#39;2014/11/01&#39;,&#39;yyyy/mm/dd&#39;))&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;tablespace tbs1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;subpartition p201410_spdts values (&#39;DTS&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spfoo values (&#39;FOO&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spbar values (&#39;BAR&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spsys values (&#39;SYS&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201410_spsysaux values (&#39;SYSAUX&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;11 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp;12 &amp;nbsp;;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Again, probably obvious to most of you. It wasn&#39;t as obvious to decipher when I was trying to add a partition with over 6,300 subpartitions. As always:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-vzBY1-dDReo/U_ZYG0kEBBI/AAAAAAAAAgA/-YOEtTYFnWg/s1600/notasmartman.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://1.bp.blogspot.com/-vzBY1-dDReo/U_ZYG0kEBBI/AAAAAAAAAgA/-YOEtTYFnWg/s1600/notasmartman.jpg&quot; height=&quot;167&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/4525235876531772236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/08/fresh-off-heels-of-my-earlier-composite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4525235876531772236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/4525235876531772236'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/08/fresh-off-heels-of-my-earlier-composite.html' title='ORA-14048 When Adding Composite Partition'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-vzBY1-dDReo/U_ZYG0kEBBI/AAAAAAAAAgA/-YOEtTYFnWg/s72-c/notasmartman.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-1263297127758208658</id><published>2014-08-21T14:28:00.001-05:00</published><updated>2014-08-21T14:28:22.452-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="partitions"/><title type='text'>Adding New Partitions with Custom Subpartition Definition (Range-List)</title><content type='html'>As part of a project for work I wanted to create a script that would create a new range partition but also pre-create all the list subpartitions. By default the subpartitions would be created based on the subpartition template. However for various reasons which I won&#39;t get into we don&#39;t update or use the subpartition template. I wanted to define the subpartition list as part of the ALTER TABLE ... ADD PARTITION statement. I assumed it was perfectly acceptable but didn&#39;t see any obvious examples in my hasty web searching, so I thought I&#39;d share on myself.&lt;br /&gt;&lt;br /&gt;I start by creating my composite range-list partitioned table:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;SQL&amp;gt; create table p_objects&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 2 &amp;nbsp;tablespace tbs1&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 3 &amp;nbsp;partition by range(rdate)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;subpartition by list(owner)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 5 &amp;nbsp;subpartition template&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 6 &amp;nbsp;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;subpartition spsys values (&#39;SYS&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition spsysaux values (&#39;SYSAUX&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp; 9 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;10 &amp;nbsp;(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;11 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201301 values less than (to_date(&#39;2013/02/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;12 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201302 values less than (to_date(&#39;2013/03/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;13 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201303 values less than (to_date(&#39;2013/04/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;14 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201304 values less than (to_date(&#39;2013/05/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201305 values less than (to_date(&#39;2013/06/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;16 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201306 values less than (to_date(&#39;2013/07/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;17 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201307 values less than (to_date(&#39;2013/08/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;18 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201308 values less than (to_date(&#39;2013/09/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;19 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201309 values less than (to_date(&#39;2013/10/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;20 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201310 values less than (to_date(&#39;2013/11/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;21 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201311 values less than (to_date(&#39;2013/12/01&#39;,&#39;YYYY/MM/DD&#39;)),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partition p201312 values less than (to_date(&#39;2014/01/01&#39;,&#39;YYYY/MM/DD&#39;))&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;23 &amp;nbsp;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;24 &amp;nbsp;as select object_id&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;25 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, owner&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;26 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, object_name&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;27 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, object_type&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;28 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, to_date(trunc(dbms_random.value(&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;29 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to_char(to_date(&#39;2013/01/01&#39;,&#39;YYYY/MM/DD&#39;),&#39;J&#39;),&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;30 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to_char(to_date(&#39;2013/12/31&#39;,&#39;YYYY/MM/DD&#39;),&#39;J&#39;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;31 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)),&#39;J&#39;) rdate&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;32 &amp;nbsp;from all_objects&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;33 &amp;nbsp;where owner in (&#39;SYS&#39;,&#39;SYSAUX&#39;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace; font-size: x-small;&quot;&gt;Table created.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This creates the partitions with 2 subpartitions each, per my defined template. For example:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;PARTITION_NAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBPARTITION_NAME&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;------------------------------ ------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;P201301 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P201301_SPSYS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201301_SPSYSAUX&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;P201302 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P201302_SPSYS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201302_SPSYSAUX&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;P201303 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P201303_SPSYS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201303_SPSYSAUX&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next I&#39;ll add two more partitions, one with no subpartition definition specified and another with a custom definition:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; alter table p_objects&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add partition p201408&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;values less than (to_date(&#39;2014/09/01&#39;,&#39;yyyy/mm/dd&#39;));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; alter table p_objects&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;add partition p201409&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 3 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;values less than (to_date(&#39;2014/10/01&#39;,&#39;yyyy/mm/dd&#39;))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;subpartition p201409_spdts values (&#39;DTS&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201409_spsys values (&#39;SYS&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;, subpartition p201409_spsysaux values (&#39;SYSAUX&#39;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 9 &amp;nbsp;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Table altered.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The results:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;PARTITION_NAME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBPARTITION_NAME&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;------------------------------ ------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;P201408 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P201408_SPSYS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201408_SPSYSAUX&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;P201409 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;P201409_SPDTS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201409_SPSYS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&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;P201409_SPSYSAUX&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;You can see that the first statement just used the subpartition template as defined in the original CREATE TABLE statement. The second uses the list I defined in the ALTER TABLE statement. I could have only defined the SPDTS subpartition and it would have only used that one and not used SYS or SYSAUX subpartitions at all.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Hopefully this post helps a few of you in your searching when faced with a similar task. This was probably obvious to most of you but the mind starts to slip for some of us.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/1263297127758208658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/08/adding-new-partitions-with-custom.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1263297127758208658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1263297127758208658'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/08/adding-new-partitions-with-custom.html' title='Adding New Partitions with Custom Subpartition Definition (Range-List)'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-608929420226608026</id><published>2014-07-13T15:11:00.000-05:00</published><updated>2014-07-13T15:11:31.901-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="12c"/><category scheme="http://www.blogger.com/atom/ns#" term="asm"/><category scheme="http://www.blogger.com/atom/ns#" term="asmm"/><category scheme="http://www.blogger.com/atom/ns#" term="cpu"/><category scheme="http://www.blogger.com/atom/ns#" term="memory"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>ASM Startup Fails With ORA-04031 After Adding CPUs</title><content type='html'>A few weeks ago we upgraded one of our production server, adding another CPU tray. This brought the number of CPU cores from 80 to 160, and took us from 2Tb of RAM to 4Tb (just in time for Oracle to announce the in-memory database in 12.1.0.2!).&lt;br /&gt;&lt;br /&gt;However when I went to start things up, ASM wasn&#39;t starting up, giving me these errors:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ORA-04031: unable to allocate 32 bytes of shared memory (&quot;shared pool&quot;,&quot;unknown object&quot;,&quot;KKSSP^550&quot;,&quot;kglseshtSegs&quot;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;ORA-04031: unable to allocate 392 bytes of shared memory (&quot;shared pool&quot;,&quot;unknown object&quot;,&quot;sga heap(1,1)&quot;,&quot;kdlwss&quot;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;ORA-04031: unable to allocate 560 bytes of shared memory (&quot;shared pool&quot;,&quot;unknown object&quot;,&quot;sga heap(1,1)&quot;,&quot;KKSSP&quot;)&lt;br /&gt;RBAL (ospid: 59427): terminating the instance due to error 4031&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;A quick search of MOS turned up this gem: &lt;br /&gt;&lt;br /&gt;Unable To Start ASM (ORA-00838 ORA-04031) On 11.2.0.3/11.2.0.4 If OS CPUs # &amp;gt; 64. (Doc ID 1416083.1), with this cause:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;In 11.2.0.3/11.2.0.4, the &quot;PROCESSES&quot; parameter will be default to &quot;available CPU cores * 80 + 40&quot; (in the ASM spfile).  As the default value for &quot;MEMORY_TARGET&quot; is based on &quot;PROCESSES&quot;, it can be insufficient if there is a large number of CPU cores or large number of diskgroups which could cause issues (i.e. Grid Infrastructure stack fails to stop with ORA-04031 etc) per &lt;a href=&quot;https://support.oracle.com/epmos/faces/BugDisplay?id=13605735&quot;&gt;Bug:13605735&lt;/a&gt; &amp;amp; &lt;a href=&quot;https://support.oracle.com/epmos/faces/BugDisplay?id=12885278&quot;&gt;Bug:12885278&lt;/a&gt;, it is recommended to increase the value of MEMORY_MAX_TARGET &amp;amp; MEMORY_TARGET before upgrading/installing to 11.2.0.3/11.2.0.4 (does not apply to 10g ASM). &lt;/blockquote&gt;&lt;br /&gt;We followed the workaround of increasing the ASM memory_target (and memory_max_size) to 4Gb (from 500Mb) and things started up just fine.&lt;br /&gt;&lt;br /&gt;We&#39;ve since actually increased the memory even more in ASM to see even better performance but I haven&#39;t taken the time yet to precisely understand where that is coming from. I&#39;ll be sure to write another post to detail that.&lt;br /&gt;&lt;br /&gt;For now we&#39;re definitely enjoying the bigger shared pool and buffer caches in 11.2. We&#39;re definitely excited to dig into the in-memory options in the upcoming 12.1.0.2.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/608929420226608026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/07/asm-startup-fails-with-ora-04031-after.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/608929420226608026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/608929420226608026'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/07/asm-startup-fails-with-ora-04031-after.html' title='ASM Startup Fails With ORA-04031 After Adding CPUs'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-1734706492986747809</id><published>2014-06-03T14:55:00.000-05:00</published><updated>2014-06-03T14:55:44.851-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="golden gate"/><category scheme="http://www.blogger.com/atom/ns#" term="PSU"/><title type='text'>Beware April 2014 PSU and Golden Gate Integrated Capture Users</title><content type='html'>When the latest quarterly Patch Set Update (PSU) came out from Oracle, we planned to get it in place as soon as reasonable due to our need to stay current with security patches, and my need to apply what I had assumed were well-tested bug fixes for our 11.2.0.3 installations. However we were in for an unpleasant surprise.&lt;br /&gt;&lt;br /&gt;We first applied the April 2014 PSU on our staging &amp;amp; development database hosts and things ran fine. After two weeks, we put it into production. The next morning we noticed that our Golden Gate extracts were abending with a message like this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;2014-05-13 01:41:44 ERROR OGG-02077 Extract encountered a read error in the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;asynchronous reader thread and is abending: Error code 600, error message:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-00600: internal error code, arguments: [knlogcPackColList:101], [1], [], [], [],[], [], [], [], [], [], [].&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Obviously the PSU was the only change from the day before when these GoldenGate extracts ran fine. The error itself seemed to match Bug 16306373 (OGG Lightweight capture fails with ORA-600 [knlogcPackColList:101]), which affects integrated capture extracts, which was what we were trying to use.&lt;br /&gt;&lt;br /&gt;So we had two questions to answer:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Was it really the PSU, and if so do we need to rollback?&lt;/li&gt;&lt;li&gt;Why didn&#39;t we see this in development/staging?&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The answer to #2 came pretty quickly: the extracts had been stopped prior to applying the PSU in development and were never restarted. Our use of GoldenGate is for a new project that is still not quite solid in form, and so the extracts might be shut down for weeks at a time. However the DBA team was not aware of this (something that will be added to the checklist in the future) and so that part was never tested. We decided to turn the extracts on and, sure enough, we saw the problem within 30 minutes.&lt;br /&gt;&lt;br /&gt;As far as #1, we opened an SR with Oracle Support. At first they assured us it wasn&#39;t the PSU, but within a few hours had started backing away from that confidence and by the end of the day were suggesting we roll back. However we decided to hold off on that due to the luxury of not needing those extracts to run quite yet (we had just been capturing data in production to make sure we could handle the workload). That gave us and Oracle Support some breathing room to get it fixed.&lt;br /&gt;&lt;br /&gt;Eventually Oracle Support did confirm that it was Bug 16306373. The patch for this bug, however, conflicted with another patch we had installed. So they created a new merge patch&amp;nbsp;MLR 18689166 for us. This was applied that evening to just our development database home, and immediately we saw more problems.&lt;br /&gt;&lt;br /&gt;First, regularly-scheduled materialized view refreshes were failing with:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06508: PL/SQL: could not find program unit being called: &quot;SYS.DBMS_SNAPSHOT&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Then we saw DataPump exports failing with:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-06508: PL/SQL: could not find program unit being called: &quot;SYS.DBMS_LOGREP_UTIL&quot;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On top of that, GoldenGate gave us these errors trying to unregister the extract:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;GGSCI (stagingdb) 14&amp;gt; unregister extract ext1ol database&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ERROR: Cannot register or unregister EXTRACT EXTFOO because of the following SQL error: OCI Error ORA-01775: looping chain of synonyms (status = 1775).&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It definitely looked like something in that patch had hosed the catalog. Oracle quickly found the problem:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;The problem with the invalid dictionary objects after the installation of patch 18689166 is due to the execution of script e1102000.sql that is being called from postinstall.sql&amp;nbsp;&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;b&gt;e1102000.sql is a downgrade scripts and removes some objects from the data dictionary resulting in other dependent objects to become invalid.&amp;nbsp;&lt;/b&gt;&lt;/blockquote&gt;&lt;br /&gt;It is here that I should point out that Oracle had this merge patch in their QA for over 4 days. I could have seriously hurt myself from simultaneously rolling my eyes and face-palming as violently as I did.&lt;br /&gt;&lt;br /&gt;The fix was to restart the instance into UPGRADE mode and run the catupgrd.sql script from $ORACLE_HOME/rdbms/admin, which rebuilds the catalog. We confirmed that this did fix the problem in DEV, and proceeded to patch the other databases, this time commenting out the call to e1102000.sql n the postinstall.sql script, per Oracle&#39;s workaround.&lt;br /&gt;&lt;br /&gt;So, not only did the April 2014 PSU introduce a bug, but then the patch for that bug made things incredibly worse. We were fortunate in that we did not yet &lt;i&gt;need &lt;/i&gt;the GoldenGate extracts in production. However many others will not have that luxury and will want to double-check that bug and the PSU if they&#39;re using GoldenGate and integrated capture.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/1734706492986747809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/06/beware-april-2014-psu-and-golden-gate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1734706492986747809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1734706492986747809'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/06/beware-april-2014-psu-and-golden-gate.html' title='Beware April 2014 PSU and Golden Gate Integrated Capture Users'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-2448876944645338396</id><published>2014-05-12T15:34:00.000-05:00</published><updated>2014-05-12T15:34:25.680-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="data guard"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="standby"/><title type='text'>archive_lag_target Works in SE</title><content type='html'>&lt;i&gt;TL;DR: The archive_lag_target parameter will force log archiving in Standard Edition. &lt;/i&gt;&lt;br /&gt;&lt;br /&gt;Just a quick note here that I wanted to share since I didn&#39;t see anything directly confirming this when I was searching around. &lt;br /&gt;&lt;br /&gt;I have an Oracle 11gR2 Standard Edition (SE) database that I&#39;m also maintaining a manual standby for, since Oracle Data Guard is not available in SE. I created a metric extension in EM12c to alert me if the standby is more than 1 hour behind the primary. However since this is a very low-activity database, archive logs were not switching even once an hour. Obviously, I could include a command to force a log switch/archive in the script that I use to push archivelogs to the standby. However we all know that with Data Guard on Enterprise Edition (EE), one would use the &lt;a href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e40402/initparams009.htm#REFRN10003&quot; target=&quot;_blank&quot;&gt;archive_lag_target initialization parameter&lt;/a&gt; to set the desired maximum standby lag. Oracle enforces this by performing a log switch at most every X seconds, where X is the number specified by the archive_lag_target value. By default this is set to 0, which disables the feature.&lt;br /&gt;&lt;br /&gt;I had assumed that archive_lag_target would only work in EE but decided to give it a try and was pleasantly surprised to see that it does work as intended in SE. So I can set archive_lag_target=900 to specify a 15 minute maximum log archiving (it would be more frequent if the database activity warranted an earlier switch).</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/2448876944645338396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/05/archivelagtarget-works-in-se.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2448876944645338396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2448876944645338396'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/05/archivelagtarget-works-in-se.html' title='archive_lag_target Works in SE'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-6703360846413189586</id><published>2014-04-25T11:24:00.002-05:00</published><updated>2014-04-25T11:24:55.874-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="em12c"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>Don&#39;t Fear the EM12c Metric Extensions</title><content type='html'>A few weeks ago, our customer support team asked us to automate part of their checklist that looks at the number of active sessions in our production database. In EM12c, this seemed like a no-brainer with the Average Active Sessions metric. So I added this to my production incident ruleset and went back to another project. Over the next few days we&#39;d get pinged by EM12c but the support folks would say it shouldn&#39;t. After taking a look we realized that we should be looking at USER sessions, excluding the BACKGROUND sessions Oracle creates to run the instance (like DBWn and LGWR).&lt;br /&gt;&lt;br /&gt;The trouble was that I couldn&#39;t find a metric for just the user sessions. I had resolved myself to having a scheduler job or script run the SQL that I wanted and send an email if it was over my critical threshold. On a whim I put a message out to twitter, and thankfully &lt;a class=&quot;vt-p&quot; href=&quot;https://twitter.com/leight0nn/status/454286616375205888&quot; target=&quot;_blank&quot;&gt;my friend Leighton answered&lt;/a&gt;. He suggested I look at adding a metric extension, something still foreign to me. I had seen the term in the EM12c interface but it sounded like some kind of plugin interface. Turns out it&#39;s simply another way of saying &quot;user-defined metrics&quot;. Honestly, if they were labelled that way I would have started playing with them much sooner (subtle criticism).&lt;br /&gt;&lt;br /&gt;So a quick search turned up a &lt;a class=&quot;vt-p&quot; href=&quot;https://www.youtube.com/watch?v=_Sxg-m_jFyY&quot; target=&quot;_blank&quot;&gt;great video that showed just how simple it was to create a metric extension&lt;/a&gt; based on a SQL query. In just a few minutes I had the metric extension created, tested and published. You can create many different types of metric extensions all target types, but in my case a simple SQL query for a database instance was all I needed:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;select count(*) from v$session&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;where type=&#39;USER&#39; and status=&#39;ACTIVE&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I then define the warning and critical thresholds for the count and it&#39;s done! I added it to my ruleset (removing the stock Average Active Sessions metric) and haven&#39;t looked back.&lt;br /&gt;&lt;br /&gt;Since then I&#39;ve created a few other metric extensions, for example a standby lag check on a standard edition physical standby. My only regret is not taking the time to learn about these sooner. I suggest anyone using EM12c do so sooner rather than later.</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/6703360846413189586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/04/dont-fear-em12c-metric-extensions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6703360846413189586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6703360846413189586'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/04/dont-fear-em12c-metric-extensions.html' title='Don&#39;t Fear the EM12c Metric Extensions'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-7522313585687243519</id><published>2014-04-17T09:00:00.000-05:00</published><updated>2014-04-17T09:00:00.302-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="clob"/><category scheme="http://www.blogger.com/atom/ns#" term="golden gate"/><category scheme="http://www.blogger.com/atom/ns#" term="log miner"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="securefile"/><title type='text'>Supplemental Logging and Securefiles Causing DBWn to Block</title><content type='html'>A few weeks back, we began making changes to prepare for using Oracle Golden Gate. One of the first steps required is to enable &quot;minimal supplemental logging&quot; at the database level. We did this during an evening maintenance window. However by the time the morning workload picked up, we started seeing a lot of sessions blocking, and the root blocker was one of the DB Writer (DBWn) processes.&lt;br /&gt;&lt;br /&gt;Looking at the blocked sessions, a query similar to this was a common theme:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;UPDATE foo&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SET foo_data = :data, foo_time = systimestamp&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;WHERE foo_id = :id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This statement was run by many sessions from our webservers as part of a page load process. Very high-frequency call rate. We knew that the only change in the database was the minimal supplemental logging. Obviously we were preparing to turn it off, but took some time to look into it. It is important to note that for the most part the contention was only with sessions running this update statement.&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Looking at the table involved, one unique feature was that foo_data field is an encrypted CLOB, which Oracle refers to as a securefile in 11g.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;SQL&amp;gt; desc foo&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Null? &amp;nbsp;&amp;nbsp;   Type&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; --------------- -------- ----------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; FOO_ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NOT NULL VARCHAR2(64)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; FOO_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CLOB ENCRYPT&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt; FOO_TIME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NOT NULL TIMESTAMP(6)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;We opened an SR with Oracle and they pointed us to this unpublished bug:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;&lt;b&gt;Bug 9351684  : SECUREFILE - CACHE NOLOGGING CAUSES HIGH WRITE COMPLETE WAITS&lt;/b&gt; &lt;br /&gt;  &lt;br /&gt;They described it for us as:&lt;/span&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;Confirmed as &quot;not a bug&quot; in this bug.&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;text-align: left; width: 575px;&quot;&gt; It was stated:  &quot;write complete waits in this case are unfortunately, expected and can not be avoided/tuned. Even for NOLOGGING case there is a short invalidation redo that must be generated, and for correct crash recovery, dbwr must wait for redo to be written to disk first before data blocks can be written.&quot;&lt;/span&gt;&lt;/blockquote&gt;Basically telling us that this is working as intended and there is no workaround if you&#39;re using securefiles. For us it was important that we move forward with Golden Gate, so we would need to have a solution that let us keep minimal supplemental logging on. Looking closer, we knew that this table was on an encrypted tablespace already, so we felt comfortable changing the table so that it used a regular &quot;basicfile&quot; CLOB:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;SQL&amp;gt; desc foo&lt;br /&gt; Name &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;                                     Null?&amp;nbsp;&amp;nbsp;&amp;nbsp;    Type&lt;br /&gt; --------------- -------- ----------------------------&lt;br /&gt; FOO_ID &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NOT NULL VARCHAR2(64)&lt;br /&gt; FOO_DATA &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CLOB&lt;br /&gt; FOO_TIME &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NOT NULL TIMESTAMP(6) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since making this change, the problems have gone away. Obviously we were lucky in that we could change the table to not use securefiles. If you have a table that sees a lot of DML with securefiles, you&#39;re probably going to have a painful experience with supplemental logging. Beware!</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/7522313585687243519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/04/supplemental-logging-and-securefiles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7522313585687243519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7522313585687243519'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/04/supplemental-logging-and-securefiles.html' title='Supplemental Logging and Securefiles Causing DBWn to Block'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-6373715109356726373</id><published>2014-04-15T14:07:00.001-05:00</published><updated>2014-04-15T14:11:46.419-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="10gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><title type='text'>RMAN Redundancy is not a Viable Retention Policy</title><content type='html'>&lt;div style=&quot;margin-bottom: 0.5em; margin-top: 0.5em;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;i&gt;&lt;a class=&quot;vt-p&quot; href=&quot;http://www.pythian.com/blog/rman-redundancy-is-not-a-viable-retention-policy/&quot;&gt;Originally posted by me on the Pythian blog&lt;/a&gt;. This is an older post that I somehow forgot to post on my own blog, but another recent redundancy foul-up reminded me of it.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The story you are about to read is based on actual events. Names and paths have been changed to protect the innocent. I call this scenario “The Perfect Storm” because it took just the right combination of events and configurations. Sadly, this doesn’t make it an unlikely occurrence, so I’m posting it here in hopes that you’ll be able to save yourselves before it’s too late.&lt;br /&gt;&lt;br /&gt;I have always had a preternatural dislike for using REDUNDANCY as a retention policy for Oracle RMAN, greatly preferring RECOVERY WINDOW instead, simply because REDUNDANCY doesn’t really guarantee anything valuable to me, whereas RECOVERY WINDOW guarantees that I’ll be able to do a point-in-time recovery to anytime within the past x days. Plus, I had already been burned once by a different client using REDUNDANCY. With the story I’m about to tell, this dislike has turned into violent hatred. I’m going to be light on the technical details, but I hope you’ll still feel the full pain.&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;First some table setting:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Standalone 10.2.0.2 instance (no RAC, no DataGuard/Standby)&lt;/li&gt;&lt;li&gt;RMAN retention policy set to REDUNDANCY 2&lt;/li&gt;&lt;li&gt;Backups stored in the Flash Recovery Area (FRA)&lt;/li&gt;&lt;/ul&gt;A few months ago, we had a datafile corruption on this relatively new instance (data had been migrated from an old server about a week prior). The on-call DBA followed up the page by checking for corruptions in the datafile with this command:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;RMAN&amp;gt; backup check logical datafile &#39;/path/to/foobar_data.dbf&#39;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This, my friends, led to the major fall, though we did not know it for many hours. You see, the FRA was already almost full. This causes the FRA to automatically delete obsolete files to free up space. That last backup command, while only intended to check for logical corruption, did actually perform a backup of the file, and rendered the earliest backup of the file obsolete since there were two newer copies. That earliest file happened to be from the level 0 backup from which we would later want to restore.&lt;br /&gt;&lt;br /&gt;Of course, at first we didn’t know why the file was missing. Logs showed that it was on disk no less than two hours before the problem started. Later, scanning the alert log for the missing backup filename yielded this:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Deleted Oracle managed file /path/to/flash_recovery_area/FOO_DB/backupset/2008_12_01/o1_xxxx.bkp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Oracle deleted the one backup file that we needed!&lt;br /&gt;&lt;br /&gt;Even worse, it wasn’t until this time on a Monday night that we realized that the level 0 taken the previous weekend had failed to push the backup files to tape because of a failure on the NetBackup server. The problem was reported as part of Monday morning’s routine log checks, but the missing files had not yet been pushed to tape.&lt;br /&gt;&lt;br /&gt;In the end, we were able to drop and restore the tablespace to a previous point in time on a test instance from another backup file and exp/imp data back over. It was ugly, but it got things back online. Many DBAs better than myself gave their all on this mission.&lt;br /&gt;&lt;br /&gt;To summarize, the ingredients:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Oracle RMAN&lt;/li&gt;&lt;li&gt;CONFIGURE RETENTION POLICY TO REDUNDANCY 2;&lt;/li&gt;&lt;li&gt;Flash Recovery Area near full, obediently deleting obsolete files.&lt;/li&gt;&lt;li&gt;Tape backup failure&lt;/li&gt;&lt;/ul&gt;Add in an innocent backup command and . . . BOOM! Failure Surprise.&lt;br /&gt;&lt;br /&gt;The two biggest points to take away are&lt;span style=&quot;background-color: white; color: #343434; font-family: proxima-nova, Verdana, Arial, sans-serif; font-size: 14.399999618530273px; line-height: 1.5em;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Tape backup failures are still serious backup failures and should be treated as such, even if you backup to disk first.&lt;/li&gt;&lt;li&gt;REDUNDANCY is not a viable retention policy. In my house, it is &lt;i&gt;configuration non grata&lt;/i&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/6373715109356726373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/04/rman-redundancy-is-not-viable-retention.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6373715109356726373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/6373715109356726373'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/04/rman-redundancy-is-not-viable-retention.html' title='RMAN Redundancy is not a Viable Retention Policy'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-5217012756501146498</id><published>2014-04-07T08:00:00.000-05:00</published><updated>2014-04-07T12:18:31.422-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="em12c"/><category scheme="http://www.blogger.com/atom/ns#" term="migration"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><category scheme="http://www.blogger.com/atom/ns#" term="upgrade"/><title type='text'>Migrating (and Upgrading!) Your EM12c Repository Database</title><content type='html'>This week I migrated our EM12c repository database to a new server as part of its promotion to production status. Just to make it a little more exciting, the migration also involved an in-flight upgrade from 11.2.0.3 to 11.2.0.4. Much of this post is directly inspired by &lt;a class=&quot;vt-p&quot; href=&quot;http://martincarstenbach.wordpress.com/2011/10/17/move-the-em12c-repository-database/&quot; target=&quot;_blank&quot;&gt;Martin Bach&#39;s post on the same subject&lt;/a&gt;. I ran into a few other snags that weren&#39;t mentioned so I thought it would be worthwhile to document the experience here for your benefit.&lt;br /&gt;&lt;br /&gt;I&#39;m assuming you have all the software installed (and patched to the latest PSU, right?). Alright then, let&#39;s begin!&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;h3&gt;Stop OMS&lt;/h3&gt;&lt;div&gt;We want to make sure there are no more changes coming, and nothing needs to access the repository database, so be sure to stop all OMS instances:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ emctl stop oms -all&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3&gt;Backup PFILE&lt;/h3&gt;&lt;div&gt;We need to get the pfile for the current repo and copy it into place on new host:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; create pfile=&#39;/mnt/emrepo_backup/initemrepo.ora&#39; from spfile;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I use /mnt/emrepo_backup here because that is the directory that I&#39;ll be backing the database up to and copying to the new host after. If you create your pfile somewhere else, be sure to copy it to the new host under $ORACLE_HOME/dbs/&lt;/div&gt;&lt;h3&gt;&lt;/h3&gt;&lt;h3&gt;Backup Repo Database&lt;/h3&gt;&lt;div&gt;Next we backup the repo database. Here&#39;s a snippet from my ksh script that I used:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;#!/bin/ksh&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;BACKUPDIR=/mnt/emrepo_backup&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;LOGFILE=backup_emrepo.log&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;mkdir -p $BACKUPDIR&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;rman log=$LOGFILE &amp;lt;&amp;lt;EOF&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;connect target /&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;set echo on&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;run {&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allocate channel c1 device type disk format &#39;$BACKUPDIR/%U&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allocate channel c2 device type disk format &#39;$BACKUPDIR/%U&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allocate channel c3 device type disk format &#39;$BACKUPDIR/%U&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allocate channel c4 device type disk format &#39;$BACKUPDIR/%U&#39;;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; backup as compressed backupset database&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; include current controlfile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; plus archivelog;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;EOF&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When the backup is finished, review the RMAN log and make note of which backup piece contains the controlfile backup. We&#39;ll need to refer to it by name as part of the restore process.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If your backup directory is an NFS mount, then you can simply unmount it from here and mount it to the new server. Otherwise, be sure to copy the files there after the backup is complete, for example:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ scp -r /mnt/emrepo_backup newhost:/path/to/emrepo_backup&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After this, it should be safe to shutdown the old repository database.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ sqlplus / as sysdba&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; shutdown immediate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you use Oracle Restart:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ srvctl stop database -d emrepo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ srvctl disable database -d emrepo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3&gt;Prepare New Host for Repo DB&lt;/h3&gt;&lt;div&gt;Now we need to set things up on the new host for the emrepo DB.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4&gt;Create oratab Entry&lt;/h4&gt;&lt;div&gt;First let&#39;s create an entry in /etc/oratab for this DB under the new 11.2.0.4 home. For example:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;emrepo:/oracle/app/product/11.2.0.4:N&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4&gt;Edit PFILE and Create SPFILE&lt;/h4&gt;&lt;div&gt;Then let&#39;s copy that parameter file into place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ . oraenv&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORACLE_SID = [oracle] ? emrepo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;The Oracle base has been set to /oracle/app&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ cd $ORACLE_HOME/dbs/&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ cp /mnt/emrepo_backup/initemrepo.ora .&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now edit that file and make sure you update the parameters that require updating. In my case, I&#39;m using Oracle Managed Files (OMF) so I set db_create_file_dest and db_create_online_log_dest_1. I also set db_recovery_file_dest for the FRA. I then set the control_files parameter to specify where I want the control file(s) restored to from the backup when I get to that point.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, Martin Bach noted in his blog post that he did not have to specify a db_file_name_convert or log_file_name_convert. I was having some difficulty during the restore phase, and added these parameters out of pure speculation. They didn&#39;t help the problem, but I left them in for the duration of my process. I only mention this as an FYI if you end up comparing your settings to mine.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you have all your parameters set as desired, create the SPFILE:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ sqlplus / as sysdba&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; create spfile from pfile;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, let us restore ourselves the database.&lt;/div&gt;&lt;h3&gt;&lt;/h3&gt;&lt;h3&gt;Restore Repo DB on New Host&lt;/h3&gt;&lt;div&gt;The restore was done largely as part of a ksh script, which I&#39;ll reference snippets of here. Let&#39;s start by defining some variables:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;BACKUPDIR=/mnt/emrepo_backup&lt;br /&gt;DESTDIR=/oracle/app/oradata/data/EMREPO&lt;/span&gt;&lt;br /&gt;&lt;h4&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Restore Controlfile and Mount Database&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;From the script, we call RMAN to start the instance in nomount mode, restore the controlfile from the specified backuppiece and mount the database:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;rman log=$LOGFILE &amp;lt;&amp;lt;EOF&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;connect target /&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;set echo on&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;startup force nomount;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;restore controlfile from &#39;$BACKUPDIR/1abcd123_1_1&#39;;&lt;br /&gt;alter database mount;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;catalog start with &#39;$BACKUPDIR&#39; noprompt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;EOF&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;We end by cataloging the backup files, as you can see.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Generate SET NEWNAME Script&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Here I dip into sqlplus to generate an script for RMAN to call SET NEWNAME for each of the datafiles. Without this, RMAN would try to restore the datafiles to their old paths on the original host. Here I set them for the path that OMF will use:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;sqlplus -s /nolog &amp;lt;&amp;lt;EOF&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;connect / as sysdba&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;set head off pages 0 feed off echo off verify off&lt;br /&gt;set lines 200&lt;br /&gt;spool rename_datafiles.rman&lt;br /&gt;select &#39;set newname for datafile &#39; || FILE# || &#39; to &#39;&#39;&#39; || &#39;$DESTDIR/datafile/&#39; || substr(name,instr(name,&#39;/&#39;,-1)+1) || &#39;&#39;&#39;;&#39; from v\$datafile;&lt;br /&gt;select &#39;set newname for tempfile &#39; || FILE# || &#39; to &#39;&#39;&#39; || &#39;$DESTDIR/tempfile/&#39; || substr(name,instr(name,&#39;/&#39;,-1)+1) || &#39;&#39;&#39;;&#39; from v\$tempfile;&lt;br /&gt;spool off&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;EOF&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h4&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Restore &amp;amp; Recover Database&lt;/span&gt;&lt;/h4&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now we&#39;re ready to restore the database and perform recovery. Again, we call RMAN and run this:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;run {&lt;br /&gt;&amp;nbsp; allocate channel c1 device type disk;&lt;br /&gt;&amp;nbsp; allocate channel c2 device type disk;&lt;br /&gt;&amp;nbsp; allocate channel c3 device type disk;&lt;br /&gt;&amp;nbsp; allocate channel c4 device type disk;&lt;br /&gt;&amp;nbsp; @rename_datafiles.rman&lt;br /&gt;&amp;nbsp; restore database;&lt;br /&gt;&amp;nbsp; switch datafile all;&lt;br /&gt;&amp;nbsp; switch tempfile all;&lt;br /&gt;&amp;nbsp; recover database;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;At this point we&#39;re done with the restore and recovery. Normally I would OPEN RESETLOGS, but remember that we&#39;re restoring this to an 11.2.0.4 home, so we still need to UPGRADE the database!&lt;/span&gt;&lt;br /&gt;&lt;h3&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt;&lt;h3&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Open and Upgrade Database&lt;/span&gt;&lt;/h3&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;First we still call OPEN RESETLOGS, but with the UPGRADE option. This replaces the &quot;STARTUP UPGRADE&quot; command you would find in the &lt;a class=&quot;vt-p&quot; href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e23633/upgrade.htm#UPGRD12408&quot; target=&quot;_blank&quot;&gt;manual upgrade instructions&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ sqlplus / as sysdba&lt;br /&gt;SQL&amp;gt; alter database open resetlogs upgrade;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now we follow the rest of the manual upgrade instructions, I&#39;ll just post the commands here, but you should definitely review the documentation:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ cd $ORACLE_HOME/rdbms/admin&lt;br /&gt;$ sqlplus / as sysdba&lt;br /&gt;SQL&amp;gt; spool upgrade.log&lt;br /&gt;SQL&amp;gt; @catupgrd.sql&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-- Start database again&lt;br /&gt;SQL&amp;gt; startup;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-- Check status of components, some will be fixed by utlrp.sql&lt;br /&gt;SQL&amp;gt; @utlu112s.sql&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;-- Rebuild everything&lt;br /&gt;SQL&amp;gt; @catuppst.sql&lt;br /&gt;SQL&amp;gt; @utlrp.sql&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;-- Confirm everything is OK now&lt;br /&gt;SQL&amp;gt; SELECT count(*) FROM dba_invalid_objects;&lt;br /&gt;SQL&amp;gt; SELECT distinct object_name FROM dba_invalid_objects;&lt;br /&gt;SQL&amp;gt; @utlu112s.sql&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;The utlu112s.sql should now report all components as VALID. If not, you&#39;ll want to refer to &lt;a class=&quot;vt-p&quot; href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e23633/upgrade.htm#UPGRD12409&quot; target=&quot;_blank&quot;&gt;the upgrade documentation for troubleshooting&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;At the point the database is upgraded and open. Make sure you have a listener running and that the new database is registered. The only thing &amp;nbsp;left is the tell your OMS servers to look for the repository database in its new location.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3&gt;Update OMS Repository Settings&lt;/h3&gt;&lt;div&gt;First we need to start just the administration server:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ emctl start oms -admin_only&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;This is necessary if you used the &quot;-all&quot; option when stopping OMS earlier. If you did not use &quot;-all&quot; then the admin server should still be running.&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Now, update the store_repos_details setting in the OMS configuration:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ emctl config oms -store_repos_details -repos_port 1521 \&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -repos_sid emrepo -repos_host newhost.mydomain.com \&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -repos_user sysman -repos_pwd xxx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Repeat this step for all your OMS servers (emctl should remind you to do so when changing the config). Then on each, completely shutdown and restart OMS:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;$ emctl stop oms -all&lt;br /&gt;$ emctl start oms&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;And that should be it! Don&#39;t forget to drop/delete the database from the original server when you&#39;re comfortable doing so.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/5217012756501146498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/04/migrating-and-upgrading-your-em12c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/5217012756501146498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/5217012756501146498'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/04/migrating-and-upgrading-your-em12c.html' title='Migrating (and Upgrading!) Your EM12c Repository Database'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-7434923267926477195</id><published>2014-03-30T18:43:00.001-05:00</published><updated>2014-04-08T16:38:45.456-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="materialized view logs"/><category scheme="http://www.blogger.com/atom/ns#" term="materialized views"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>ORA-00600 [kkzlpllg:5] When Dropping MView Log</title><content type='html'>&lt;span style=&quot;font-family: inherit;&quot;&gt;This week a co-worker and I have been doing some rapid-fire testing to improve fast-refresh performance on an old materialized view, which does some summary aggregations on a 1.9 &lt;b&gt;&lt;i&gt;billion &lt;/i&gt;&lt;/b&gt;row (and growing) master table. One of the things we tested was using the &lt;a class=&quot;vt-p&quot; href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_6003.htm#SQLRF54214&quot; target=&quot;_blank&quot;&gt;new-in-11gR2 COMMIT SCN feature&lt;/a&gt;. There is a great &lt;a class=&quot;vt-p&quot; href=&quot;http://www.adellera.it/blog/2009/11/03/11gr2-materialized-view-logs-changes/&quot; target=&quot;_blank&quot;&gt;blog post describing the benefits of this feature by Alberto Dell&#39;Era&lt;/a&gt;. To quickly summarize and over-simplify, it provides a much faster way to update rows in the materialized view log that are eligible for refresh and purging. This definitely sounds like something we&#39;d want, so let&#39;s roll!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Well we quickly hit a snag when testing our creation script the second time around, when it wouldn&#39;t let us drop the materialized view log:&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; DROP MATERIALIZED VIEW LOG ON FOO.BAR&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;*&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ERROR at line 1:&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;ORA-00600: internal error code, arguments: [kkzlpllg:5], [], [], [], [], [],[], [], [], [], [], []&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;We found that we also could no longer perform fast refreshes of the materialized view, getting the same ORA-00600 error. Our initial MOS search turned up &lt;a class=&quot;vt-p&quot; href=&quot;https://support.oracle.com/epmos/faces/DocContentDisplay?id=14158012.8&quot; target=&quot;_blank&quot;&gt;Doc ID 14158012.8, which indicates Bug 14158012 (Orphan rows in SNAP_LOGDEP$ causes ORA-600 [kkzlpllg:5])&lt;/a&gt;. The bug description is:&lt;/span&gt;&lt;/div&gt;&lt;blockquote class=&quot;tr_bq&quot; style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;With this bug, when there are orphan rows in SNAP_LOGDEP$ with RSCN=NULL,&lt;br /&gt; &lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;a CREATE MATERIALIZED VIEW or DROP MATERIALIZED VIEW statement will report&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;ORA-600 [kkzlpllg:5].&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;I verified that we did have such NULL RSCN values in SNAP_LOGDEP$ related to the master table here.&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br style=&quot;font-family: Tahoma; orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;SQL&amp;gt; select d.tableobj#, o.name&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp; 2&amp;nbsp; from sys.snap_logdep$ d, sys.obj$ o&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp; 3&amp;nbsp; where d.tableobj# = o.obj#&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp; 4&amp;nbsp; and o.name=&#39;BAR&#39;&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp; 5&amp;nbsp; and d.rscn is null;&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp;TABLEOBJ# NAME&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;---------- ------------------------------&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 605668&amp;nbsp;BAR&lt;/span&gt;&lt;br style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot; /&gt;&lt;span style=&quot;orphans: 2; text-align: -webkit-auto; widows: 2;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 605668&amp;nbsp;BAR&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Unfortunately, that doc also said there was &lt;b&gt;no workaround&lt;/b&gt; other than to apply a one-off patch (otherwise fixed in 11.2.0.4 and 12c)! Not exactly the quick fix we were hoping for.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;However, we did some more searching and found &lt;a class=&quot;vt-p&quot; href=&quot;https://support.oracle.com/epmos/faces/DocContentDisplay?id=1310296.1&quot; target=&quot;_blank&quot;&gt;Doc 1310296.1:&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;a class=&quot;vt-p&quot; href=&quot;https://support.oracle.com/epmos/faces/DocContentDisplay?id=1310296.1&quot; target=&quot;_blank&quot;&gt;Internal Error ORA-00600 [kkzlpllg:5] When Executing Drop Materialized View Log&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Pretty much the same thing, only this gives us a workaround:&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Since the information stored in the Materialized View log is bogus in any case, the Materialized View Log is not useable anymore. The only option is to drop this object and re-create it. To make this possible, a dummy non-NULL value needs to be written into the RSCN column for that table.&lt;/span&gt;&lt;/blockquote&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;So we update those rows to set RSCN to a dummy value (9999):&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SQL&amp;gt; UPDATE snap_logdep$&lt;br /&gt;&amp;nbsp; 2 &amp;nbsp;SET RSCN = 9999&lt;br /&gt;&amp;nbsp; 3 &amp;nbsp;WHERE tableobj# = 605668&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; 4 &amp;nbsp;AND RSCN IS NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;And we were able to drop the materialized view log and resume testing afterwards.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Hopefully this article saves someone from hitting the same initial roadblock that I did. Especially nice to see the Oracle support docs contradicting themselves!&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;We also made another interesting find with this particular materialized view that I&#39;ll be blogging about later. Definitely an eye-opener, face-palmer and forehead-smacker all in one.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;UPDATE - 8 April 2014&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Nothing mind blowing, but a little time saver if you know the object name. This doesn&#39;t take the owner into account, so &lt;a class=&quot;vt-p&quot; href=&quot;https://www.youtube.com/watch?v=Jmg86CRBBtw&quot; target=&quot;_blank&quot;&gt;be careful out there&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;update snap_logdep$&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;set rscn = 9999&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;where tableobj# = (&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select distinct d.tableobj#&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; from sys.snap_logdep$ d, sys.obj$ o&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where d.tableobj# = o.obj#&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and d.rscn is null&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and o.name=&#39;BAR&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;and rscn is null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;commit;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/7434923267926477195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/03/ora-00600-kkzlpllg5-when-dropping-mview.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7434923267926477195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/7434923267926477195'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/03/ora-00600-kkzlpllg5-when-dropping-mview.html' title='ORA-00600 [kkzlpllg:5] When Dropping MView Log'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-1499000296838354441</id><published>2014-03-26T13:44:00.000-05:00</published><updated>2014-03-26T13:51:57.202-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="12c"/><category scheme="http://www.blogger.com/atom/ns#" term="backup"/><category scheme="http://www.blogger.com/atom/ns#" term="bigfile"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><category scheme="http://www.blogger.com/atom/ns#" term="parallel"/><category scheme="http://www.blogger.com/atom/ns#" term="rman"/><title type='text'>Battling Bigfile Backup Bottlenecks</title><content type='html'>Last Friday I kicked off a database backup to an NFS destination, using the standard &quot;backup as compressed backupset database&quot; syntax. Loyal readers of this blog may recall that I&#39;m the proud custodian of a 25 Tb database, so this backup normally takes a few days, with an expected completion on Monday morning. However it was still running on Wednesday, and reviewing the logs I saw that there was just 1 channel (of the original 8) still running. The backup file that this channel was writing happened to include our largest bigfile datafile, which weighs in at nearly &lt;i&gt;8 Tb&lt;/i&gt;. Reviewing my new backup script I realized that I had neglected to specify a SECTION SIZE parameter. An example of its usage is:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;RMAN&amp;gt; backup as compressed backupset&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;2&amp;gt; section size 64G&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;3&amp;gt; database;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Without it, RMAN has decided to create a backup piece that bundled my 8 Tb datafile with a few others and then write it out to disk on one channel. Obviously this isn&#39;t what we wanted.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I&#39;m not a big fan of bigfile tablespaces, primarily because you lose the benefits of parallelism when huge files can only be handled by a single channel, as with datafile copy operations and backups. In 11g, however, &lt;a class=&quot;vt-p&quot; href=&quot;http://docs.oracle.com/cd/E25054_01/backup.1111/e10642/rcmbckad.htm#BRADV89543&quot; target=&quot;_blank&quot;&gt;Oracle has introduced multi-section backups via the SECTION SIZE&lt;/a&gt; option for RMAN backups. This option tells RMAN to break a large file into sections of the specified size so that the work can be done in parallel. If the specified size is larger than the file, then it is simply ignored for that file.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is a limitation in that the file can be split into a maximum of 256 sections. So, if you specify a section size that would result in more than 256 sections being created, Oracle RMAN will increase the size so that &lt;i&gt;exactly &lt;/i&gt;256 sections are created. This is still enforced today in Oracle 12c.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Another limitation in Oracle 11g is that multi-section backups cannot be done with image copy backups. Those must still be done as a whole file and so can still be a huge bottleneck. However &lt;a class=&quot;vt-p&quot; href=&quot;http://docs.oracle.com/cd/E16655_01/backup.121/e17630/rcmbckba.htm#BRADV665&quot; target=&quot;_blank&quot;&gt;this is no longer a problem in Oracle 12c&lt;/a&gt;, and multi-section image copy backups are possible. I&#39;m looking forward to using this as we also use image copy backups as part of our recovery strategy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;To highlight the parallel benefits, I ran a compressed backup of a 1.5 Tb bigfile tablespace using 8 channels. The first one does NOT use&amp;nbsp;section&amp;nbsp;size and so only goes over one channel:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Starting backup at 2014/03/25 14:35:41&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;channel c1: backup set complete, elapsed time: 17:06:09&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Finished backup at 2014/03/26 07:41:51&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The second one uses a section size of 64 Gb (otherwise same command &amp;amp; file):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Starting backup at 2014/03/26 07:41:52&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Finished backup at 2014/03/26 09:48:33&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can see the huge impact made by making use of the multi-section backup option. A single channel took over 17 hours to back it up. Using 8 channels with a section size of 64 Gb took only just over 2 hours. Eyeballing the log shows an average of around 6 minutes per section. Definitely much better than waiting for a single channel to do all the work when the rest of the system is waiting.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/1499000296838354441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/03/battling-bigfile-backup-bottlenecks.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1499000296838354441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/1499000296838354441'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/03/battling-bigfile-backup-bottlenecks.html' title='Battling Bigfile Backup Bottlenecks'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7032512792942232766.post-2995536054597544644</id><published>2014-03-16T15:50:00.000-05:00</published><updated>2014-03-16T15:50:18.831-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="11gR2"/><category scheme="http://www.blogger.com/atom/ns#" term="materialized view logs"/><category scheme="http://www.blogger.com/atom/ns#" term="materialized views"/><category scheme="http://www.blogger.com/atom/ns#" term="oracle"/><title type='text'>Why Is My MView Log Not Purging?</title><content type='html'>&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;A few weeks ago we saw one of our tablespaces growing at a rate much higher than the others. Taking a look we saw that the biggest users of space were two materialized view logs, one being 110 Gb and the other 60 Gb. These logs were in place to facilitate the fast refresh of two materialized views, one for each log/table. These materialized views did some aggregations (sum) throughout the day on some important base table data. The fast refreshes were completing successfully many times a day, but the logs were not being purged as expected.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;In our case, there was only one mview performing a fast refresh on those base tables, so the mview logs should have been completely purged after each refresh. They certainly shouldn&#39;t be growing to over 100+ Gb. Looking at the data in the mview log, all records had a SNAPTIME$$ value of &quot;4000/01/01 00:00:00&quot;, which is the default value for records in the mview log that &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;have not been refreshed. Once they are refreshed, the SNAPTIME$$ value gets set to SYSDATE and can then be evaluated for purging.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;But why was this value not being updated after refresh?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;For those of you unfamiliar with the role of materialized view logs, I&#39;ll share this primer from Tim Hall via his &lt;a href=&quot;http://www.oracle-base.com/articles/misc/materialized-views.php#create-materialized-view-logs&quot; target=&quot;_blank&quot;&gt;excellent Oracle-Base article&lt;/a&gt;:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Since a complete refresh involves truncating the materialized view  segment and re-populating it using the related query, it can be quite  time consuming and involve a considerable amount of network traffic when  performed against a remote table. To reduce the replication costs,  materialized view logs can be created to capture all changes to the base  table since the last refresh. This information allows a fast refresh,  which only needs to apply the changes rather than a complete refresh of  the materialized view.&lt;/blockquote&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;Digging deeper led me to MOS DocId &lt;/span&gt;&lt;/span&gt;236233.1, which tells us that Oracle compares the MLOG$_&amp;lt;TABLE_NAME&amp;gt;.SNAPTIME$$ value against the SYS.SLOG$SNAPTIME:&lt;br /&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Rows in the MView log are unnecessary if their refresh timestamps MLOG$&lt;i&gt;&amp;lt;table_name&amp;gt;.SNAPTIME$$ are older or equal than the oldest entry in SLOG$.SNAPTIME for this log.&lt;br /&gt;  &lt;br /&gt;  &lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;MLOG$&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;lt;table_name&amp;gt;.SNAPTIME$$ &amp;lt;= MIN (SLOG$.SNAPTIME)&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Here&#39;s where we saw the real problem.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;SQL&amp;gt; select MOWNER,MASTER,SNAPSHOT,SNAPID,SNAPTIME,SSCN,USER#&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;2  from sys.slog$&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;3  where mowner=&#39;FOO&#39; and master=&#39;BAR&#39;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;no rows selected &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;If the purge mechanism checks SLOG$.SNAPTIME then of course nothing is going to happen, as the materialized view is NOT registered in SYS.SLOG$!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We re-created the MVIEW from scratch on our development database and had the same results, which indicates it&#39;s something systemic in Oracle so we opened an SR. After the standard back-and-forth of trying the same things over and over, Oracle Support said that this was actually expected behavior:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;  This mview is defined as fast refreshable with aggregates.   The mv log is defined with PRIMARY KEY INCLUDING NEW VALUES.&lt;br /&gt;  &lt;br /&gt;  &lt;b&gt;In order to support fast refresh the mv log should include ROWID as well.&lt;/b&gt;  Please review the Restrictions on Fast Refresh on Materialized Views with   Aggregates located here:&lt;br /&gt;     &lt;a href=&quot;http://docs.oracle.com/cd/E11882_01/server.112/e25554/basicmv.htm#DWHSG8203&quot; target=&quot;_blank&quot;&gt;http://docs.oracle.com/cd/E11882_01/server.112/e25554/basicmv.htm#DWHSG8203&lt;/a&gt;&lt;/blockquote&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;     There are additional restrictions depending on the operations performed.   As an example, SEQUENCE should also need to be added to the mv log if direct   loads are performed on new_invoice_record.&lt;/blockquote&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This turned out to be the case. We recreated the mview log with the ROWID specification, then re-created the materialized view and, sure enough, the mview was registered in SYS.SLOG$ and refreshes were purging the log as expected.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;I was more than a little frustrated then that Oracle would let us create the MVIEW without any warnings or errors in the first place. The database obviously detected something wrong since it wouldn&#39;t register them in SYS.SLOG$. Their last response was that, since the MVIEW itself was refreshing successfully, no error should be reported. This fails to address the question for me, so I&#39;m going to push back a little harder and will share what I find.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;For now, though, we need to schedule a maintenance window to recreate these materialized views and their logs and see if we can reclaim some disk space afterward (perhaps a future post!).&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.seiler.us/feeds/2995536054597544644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.seiler.us/2014/03/why-is-my-mview-log-not-purging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2995536054597544644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7032512792942232766/posts/default/2995536054597544644'/><link rel='alternate' type='text/html' href='http://www.seiler.us/2014/03/why-is-my-mview-log-not-purging.html' title='Why Is My MView Log Not Purging?'/><author><name>Don Seiler</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//1.bp.blogspot.com/-E-k12cjfWk8/VLlvDwJGj6I/AAAAAAAAAm8/muOGZtYyK1I/s122/*'/></author><thr:total>0</thr:total></entry></feed>