<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns: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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CUYDQHc4eyp7ImA9WhBaFE4.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478</id><updated>2013-05-25T00:06:11.933+02:00</updated><category term="interval partitioning" /><category term="duplicate database" /><category term="recovery" /><category term="change management" /><category term="proxy" /><category term="ora files" /><category term="installation" /><category term="standby" /><category term="client connection" /><category term="lock" /><category term="tspitr" /><category term="cman" /><category term="raw trace" /><category term="resumable" /><category term="impdp" /><category term="diagnostics" /><category term="format" /><category term="listener" /><category term="ORA-39034" /><category term="partitioning" /><category term="oracle" /><category term="archivelog" /><category term="tnsnames" /><category term="dbnewid" /><category term="bind variable" /><category term="XA" /><category term="tape" /><category term="zabbix" /><category term="ORA-31603" /><category term="data pump" /><category term="real time apply" /><category term="oracle database" /><category term="utl_file" /><category term="rman" /><category term="recyclebin" /><category term="nfs" /><category term="su" /><category term="distributed transaction" /><category term="grid control" /><category term="management" /><category term="agent" /><category term="backup" /><category term="log rotation" /><title>Remigium</title><subtitle type="html">... about my professional issues</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://remigium.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>58</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Remigium" /><feedburner:info uri="remigium" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;D0EASXs_cCp7ImA9WhBVEEQ.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-4999134106541574798</id><published>2013-04-16T08:59:00.002+02:00</published><updated>2013-04-16T09:00:48.548+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-16T09:00:48.548+02:00</app:edited><title>Analyzing chained and migrated rows</title><content type="html">Two articles from the renowned authors:
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://jonathanlewis.wordpress.com/2009/04/30/analyze-this/"&gt;Analyze-this&lt;/a&gt; by J. Lewis&lt;br/&gt;
Shortcut:&lt;br/&gt;
&lt;pre&gt;
-- gathering statistics populates among others user_tables.chain_cnt
analyze table [tbl] compute statistics for table;
-- check gathered data
-- delete statistics 
-- otherwise the optimizer will use the chain_cnt to modify 
-- the cost of indexed access to the table
analyze table [tbl] delete statistics; 
exec dbms_stats.gather_table_stats([owner], [tbl]);
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://blog.tanelpoder.com/2009/11/04/detect-chained-and-migrated-rows-in-oracle/"&gt;Detect-chained-and-migrated-rows-in-oracle&lt;/a&gt; by T.Poder&lt;br/&gt;
Excerpt:&lt;br/&gt;
One way to estimate the impact of chained rows is to just look into the
"table fetch continued row" statistic - one can run query/workload and
measure this metric from v$sesstat (with snapper for example).
And one more way to estimate the total number of chained pieces would be to
run something like SELECT /*+ FULL(t) */ MIN(last_col) FROM t and see how
much the "table fetch continued row" metric increases throughout the full
table scan. The last_col would be the (physical) last column of the table.
Note that if a wide row is chained into let's say 4 pieces, then you'd
see the metric increase by 3 for a row where 4th row piece had to be
fetched.
&lt;/li&gt;
&lt;/ol&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/82PlAi94vIk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/4999134106541574798/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=4999134106541574798" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4999134106541574798?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4999134106541574798?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/82PlAi94vIk/analyzing-chained-and-migrated-rows.html" title="Analyzing chained and migrated rows" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/04/analyzing-chained-and-migrated-rows.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk4CSHg-fCp7ImA9WhBWF0s.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-9070816474698054943</id><published>2013-04-12T13:09:00.001+02:00</published><updated>2013-04-12T13:09:29.654+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-12T13:09:29.654+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dbnewid" /><category scheme="http://www.blogger.com/atom/ns#" term="duplicate database" /><title>Duplicating database manually on the same host</title><content type="html">The assumption is to create a copy of the database on the same host in order to run 2 independent database instances. It can be done in many ways:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;with RMAN&amp;nbsp;&lt;/li&gt;
&lt;li&gt;with expdp and standard dump&lt;/li&gt;
&lt;li&gt;with expdp and transportable tablespaces&lt;/li&gt;
&lt;li&gt;with cp command and dbnewid tool&lt;/li&gt;
&lt;/ul&gt;
I present here the last way.&lt;br /&gt;
&lt;pre class="brush: sql"&gt;
shutdown immediate;

&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;shutdown immediate --shutdown cleanly a database to be copied&lt;/li&gt;
&lt;li&gt;change the database directory name to something different - it is needed in order to preserve original datafiles, when we would change their paths. By default the Oracle RDBMS deletes original data files when they exist under both paths (ie. old one and the new one; we use OMF) - by directory change we prevent this behaviour - for example new directory name would be TEST.ORIG. After whole operation we return back the original name.&lt;/li&gt;
&lt;li&gt;copy all the datafiles, logfiles and controlfiles to a new directory with cp command - for example cp -r TEST.ORIG TES2&lt;/li&gt;
&lt;li&gt;create new init.ora with new path to the controlfiles, new unique name and other paths with would conflict with &amp;nbsp; - for example create pfile='inittes2.ora' from spfile&lt;/li&gt;
&lt;li&gt;startup nomount - fix possible errors&lt;/li&gt;
&lt;li&gt;mount the database - fix possible errors&lt;/li&gt;
&lt;li&gt;change the data files paths - select 'alter database rename file '''||name||''' to '''||regexp_replace(name, '&lt;old prefix="prefix"&gt;', '&lt;new prefix="prefix"&gt;')||''';' ddl1 from v$datafile union all&amp;nbsp;select 'alter database rename file '''||name||''' to '''||regexp_replace(name, '&lt;old prefix="prefix"&gt;', '&lt;new prefix="prefix"&gt;')||''';' ddl1 from v$tempfile union all&amp;nbsp;select 'alter database rename file '''||member||''' to '''||regexp_replace(member, '&lt;old prefix="prefix"&gt;', '&lt;new prefix="prefix"&gt;')||''';' ddl1 from v$logfile&lt;/new&gt;&lt;/old&gt;&lt;/new&gt;&lt;/old&gt;&lt;/new&gt;&lt;/old&gt;&lt;/li&gt;
&lt;li&gt;shutdown immediate&lt;/li&gt;
&lt;li&gt;nid target=sys dbname=cd2; ensure open_cursors are more then all files of the database&lt;/li&gt;
&lt;li&gt;change parameter file db_name to new name&lt;/li&gt;
&lt;li&gt;startup mount&lt;/li&gt;
&lt;li&gt;alter database open resetlogs&lt;/li&gt;
&lt;li&gt;restore old files to the old path and startup the original database&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;/pre&gt;

&lt;div&gt;
Summarizing there are only 2 things, which one must care about - implicit removal of database files in old location (which must be prevented; not sure if this happens without OMF) and the &lt;i&gt;open_cursors&lt;/i&gt;&amp;nbsp;parameter, which must be set higher than the number of database files (not sure but better to count temporary and log files as well).&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/8CtQUFEFA_A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/9070816474698054943/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=9070816474698054943" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/9070816474698054943?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/9070816474698054943?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/8CtQUFEFA_A/duplicating-database-manually-on-same.html" title="Duplicating database manually on the same host" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/04/duplicating-database-manually-on-same.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkINSXs_cSp7ImA9WhBWF0s.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-826119217146644114</id><published>2013-04-12T12:03:00.003+02:00</published><updated>2013-04-12T13:03:18.549+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-12T13:03:18.549+02:00</app:edited><title>Login issues</title><content type="html">The 11g version brought some changes to the DEFAULT profile. Previously the &lt;b&gt;FAILED_LOGIN_ATTEMPTS&lt;/b&gt; parameter was always set to UNLIMITED and now it is now set to some value, which means schema locking after this value of failed logins will be crossed over. &lt;br&gt;
&lt;br&gt;
I must say I am puzzled with this. In general I understand the reason behind the FAILED_LOGIN_ATTEMPTS - it is against &lt;b&gt;password breaking brute force attacks&lt;/b&gt;. On the other hand it means that some 'lost' application host with wrong password becomes a point of a DoS attack. Which is better (or worse) hard to tell. &lt;br&gt;
Usually a database is located after some firewall (or two) as this is quite deep layer in the application stack. I usually meet with databases, where the schemas are application schemas, so exists a client application interface between a human and a database - passwords are encoded in the application configuration and direct access to a database itself is strictly limited. On the other hand there are users (though not numerous), who are allowed to make a direct connection and among them may be hidden a 'malicious' one.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;So, how do I imagine to deal with the configuration?&lt;/b&gt;&lt;br&gt;
I believe for application it is better to create another profile, which keeps the FAILED_LOGIN_ATTEMPTS parameter to UNLIMITED, because it is not so rare that there exists some forgotten application or script, which would block the schema and thus practically disables the application. Of course there is a monitoring system, but usually the delay in information feedback to human is ~5 minutes, there come another issues (multiple application hosts, and only one of them with wrong password; few applications sharing the same schema; scripts run from cron on different shell accounts; etc) and we get a noticeable delay in application work, where possible it was meant to work in 24x7 mode. And this may happen quite frequently and there is no need for malice.&lt;br&gt;
Further it would be reasonable to move direct users to another databases and possibly connect them through mix of additional schemas and/or database links, so that they would not be able to connect directly to the database with application schemas.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;The drawbacks&lt;/b&gt;?&lt;br&gt;
&lt;ul&gt;
&lt;li&gt;the human users have got performance penalty, if connected through another database or may try to break passwords if there will be no such prevention measures - so if it is a database with plenty of direct human users then this would not be so great idea&lt;/li&gt;
&lt;li&gt;&lt;a href="http://askdba.org/weblog/2012/01/11g-multiple-failed-login-attempt-can-block-new-application-connections/"&gt;11g: Multiple failed login attempt can block new application connections&lt;/a&gt; - shortly the 11g version has additional security feature against brute force attacks - if set to UNLIMITED there is enabled a delay when returning error message due to failed login attempt after first few attepmts. Due to the bug 7715339 such delayed session keeps library cache lock for prolonged period (due to enabled delay) and new sessions wait on this lock till the number hits sessions/processes ceiling. It is possible to disable the delay feature with &lt;i&gt;event='28401 trace name context forever, level 1'&lt;/i&gt;
&lt;/ul&gt;


&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/DqVKJhv9bQ0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/826119217146644114/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=826119217146644114" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/826119217146644114?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/826119217146644114?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/DqVKJhv9bQ0/login-issues.html" title="Login issues" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/04/login-issues.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04DRHczfCp7ImA9WhNbGU8.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-7551804833380847244</id><published>2013-01-23T09:32:00.003+01:00</published><updated>2013-01-23T09:32:55.984+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-23T09:32:55.984+01:00</app:edited><title>An issue with the UTL_FILE and file permissions</title><content type="html">Configuration in which only local user is able to write to indicated directory through UTL_FILE running sqlplus, and for any remote access or access by other users, the code will not work properly

Some time ago we met with a little weird behavior of a test database. The code in a package did some processing and wrote to specified directory. However it worked only if the user was logged on the database host as him. Calling the code remotely or locally from a different user (also the database owner) ended always with error about wrong operation on file (the writes were issued through UTL_FILE).&lt;br/&gt;
The os directory, which was aliased in the database, had mask 0777, so though not owned by oracle, should be accessible by the database.&lt;br/&gt;
&lt;br/&gt;
The explanation is the following:&lt;br/&gt;
While the aliased directory was accessible to anybody, the parent directory to it (ie. home directory of the user) was accessible only to him and his group. Thus if any user tried to use the code, the database can not have written to the destination as it requires at least rX permissions on every directory level. To make the code run was to add the oracle user to the local user group or change permissions on the local user home or anything like that.&lt;br/&gt;
But why the local user was able to perform the code successfully? This is bound with the way the connection to the database is handed to a user client. When it is done through listener simplifying it prepares a process/dispatcher, then forwards  the connection information to the client. If dealing with connection locally it is done differently - the database process becomes a child of the local user session and inherits user' permissions and thus is able to write to the otherwise inaccessible file.
&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/2RjHX5OPzfo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/7551804833380847244/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=7551804833380847244" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/7551804833380847244?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/7551804833380847244?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/2RjHX5OPzfo/an-issue-with-utlfile-and-file.html" title="An issue with the UTL_FILE and file permissions" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/01/an-issue-with-utlfile-and-file.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMGSXsyfCp7ImA9WhNbGU8.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-8863420843653631069</id><published>2013-01-23T09:07:00.000+01:00</published><updated>2013-01-23T09:07:08.594+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-23T09:07:08.594+01:00</app:edited><title>Conditions in UPDATE statements</title><content type="html">This is kind of a fix to common developer misuse.
I noticed that sometimes see the solution for searching more complex constructs as this:
&lt;pre&gt;
[..] where f1||f2||f3 in (select f1||f2||f3 from t1)
&lt;/pre&gt;
While in SELECT this is simply weird, because one may simply join 2 tables and specify conditions with f1=f1 etc., it may be considered when we play with DML. Of course this means the optimizer can not use indexes (unless there is some rather complex index on expression), but developers forget about very easy construct:
&lt;pre&gt;
[..] where (f1, f2, f3) in (select f1, f2, f3 from t1)
&lt;/pre&gt;
Now plans look much better and we still may create condition on several fields at once.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/XnVBECw59xY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/8863420843653631069/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=8863420843653631069" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8863420843653631069?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8863420843653631069?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/XnVBECw59xY/conditions-in-update-statements.html" title="Conditions in UPDATE statements" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/01/conditions-in-update-statements.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEAQXo6cSp7ImA9WhNbGU8.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-8474376224588769475</id><published>2013-01-23T08:54:00.000+01:00</published><updated>2013-01-23T08:54:00.419+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-23T08:54:00.419+01:00</app:edited><title>Confusion at partition maintenance</title><content type="html">Here an anecdote rather than a hint, but sometimes helps ;-). Once I have read about our &amp;quot;built-in&amp;quot; inability to find own errors and this is exactly about such case.&lt;br/&gt;
&lt;br/&gt;
Lately I tried to add a new partition for 2013 year to some table. It was subpartitioned, so the syntax little more complex (below - please note, this is with error).
&lt;pre&gt;
alter table schema1.tab1
add partition p1301 VALUES less than (201302) TABLESPACE tbs1 (
SUBPARTITION p1301_1 VALUES(1), 
SUBPARTITION p1301_2 VALUES(2),
SUBPARTITION p1301_3 VALUES(3), 
SUBPARTITION p1301_4 VALUES(4)));
&lt;/pre&gt;
I constructed the statement and tried to execute. But on and on I have got the same error:&lt;br/&gt;
&lt;pre&gt;
ORA-14048: a partition maintenance operation may not be combined with other operations
&lt;/pre&gt;.
And it was not as complex as I may miss an additional operation. So I stuck. After several minutes I ask a colleague of mine for help. He came to me and I have explained him the issue. At the same moment I realize what was wrong - additional parenthesis.&lt;br/&gt;
If it would be missing, the error message would be correct
&lt;pre&gt;
ORA-00907: missing right parenthesis
&lt;/pre&gt;
but with additional parenthesis the statement syntax suggests to the RDBMS something completely different, thus returning more enigmatic error, which in turn puzzled the RDBMS user - in this case me.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/5xGaYVBw1Co" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/8474376224588769475/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=8474376224588769475" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8474376224588769475?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8474376224588769475?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/5xGaYVBw1Co/confusion-at-partition-maintenance.html" title="Confusion at partition maintenance" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/01/confusion-at-partition-maintenance.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQHQ3k5fip7ImA9WhNbGU8.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-754882025937314877</id><published>2013-01-23T08:32:00.001+01:00</published><updated>2013-01-23T08:32:12.726+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-23T08:32:12.726+01:00</app:edited><title>Some notes on materialized views</title><content type="html">Few loosely notes on materialized views.&lt;br/&gt;
&lt;br/&gt;
It is possible to build a mview on a pre-built table. I like this feature mainly because one is able to drop such view and recreate it with slightly changed definition, while the data is preserved, which is very valuable especially when dealing with large source tables.&lt;br/&gt;
&lt;br/&gt;
Another observation is that sometimes the casting to right types is necessary. We met several times the situation when on Linux some mview definition worked properly while on AIX it failed due to not strong type casting, when the solution was to use CAST with precision to type and length (usually the problem core was longer VARCHAR2 than expected).&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/7CJ-lGzhHmE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/754882025937314877/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=754882025937314877" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/754882025937314877?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/754882025937314877?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/7CJ-lGzhHmE/some-notes-on-materialized-views.html" title="Some notes on materialized views" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2013/01/some-notes-on-materialized-views.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cMR304fyp7ImA9WhNWEU4.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-4877440105855733075</id><published>2012-12-10T11:24:00.002+01:00</published><updated>2012-12-10T11:24:46.337+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-12-10T11:24:46.337+01:00</app:edited><title>NoCOUG internal magazine</title><content type="html">NoCOUG internal magazine at http://www.nocoug.org/Journal/NoCOUG_Journal_YYYYMM.pdf, where YYYY - year, MM - one of 02,05,08,11&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/Ko4zA6VPXpk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/4877440105855733075/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=4877440105855733075" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4877440105855733075?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4877440105855733075?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/Ko4zA6VPXpk/nocoug-internal-magazine.html" title="NoCOUG internal magazine" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/12/nocoug-internal-magazine.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08MR3o5cSp7ImA9WhNQFE0.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-3930159600295924380</id><published>2012-11-20T12:10:00.000+01:00</published><updated>2012-11-20T12:11:26.429+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:11:26.429+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="duplicate database" /><category scheme="http://www.blogger.com/atom/ns#" term="standby" /><title>Duplicating for standby</title><content type="html">On the start I have a target database configured with OMF and specified unique db name. On the standby side I created an instance, started it and that's it. Oh, yeah - I copied password file from primary side to be able to connect to standby and configured listener with GLOBAL_DBNAME, which allows for registering a service for use in tnsnames.ora on both hosts. Of course I specified proper entries in tnsnames.ora as well.&lt;br /&gt;
There are possible many configurations for this duplication - combinations of a target database, a standby database and a catalog - of course a standby one is a must, but the rest is optional and may be avoided, although it complicates the matter a little.
I choose to use additionally to standby database also active target database. This avoids the trouble of applying all the redo logs from last backup.
&lt;pre&gt;
RMAN&gt; DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE;
&lt;/pre&gt;
First failure: the command failed with
&lt;i&gt;ORA-17628: Oracle error 19505 returned by remote Oracle server&lt;/i&gt;
on primary and &lt;i&gt;ORA-19505: failed to identify file "/oracle/oradata/ZABBIX/controlfile/o1_mf_855ys7j8_.ctl"&lt;br /&gt;
ORA-27040: file create error, unable to create file&lt;/i&gt; as 
 I did not create path for controlfile (so now mkdir -p /oracle/oradata/ZABBIX/controlfile/o1_mf_855ys7j8_.ctl).&lt;br /&gt;
&lt;br /&gt;
Second start and failure: 
&lt;pre&gt;
RMAN-03002: failure of Duplicate Db command at 11/13/2012 10:14:19
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
ORA-06550: line 1, column 17:
PLS-00201: identifier 'DBMS_RCVCAT.GETDBID' must be declared
ORA-06550: line 1, column 7:
&lt;/pre&gt;
I found at http://blog.csdn.net/tianlesoftware/article/details/6232292 that it is due to not specifying nocatalog when connecting with rman. And that really helped.
&lt;br /&gt;
Third try and this time I moved much ahead - I was wrong with assuming the online logs will be created according to the db_create_file_dest (so I should set db_create_online_log_dest_n at least to overcome this). However this time duplication is going forward - the data files are created according to the plan. &lt;br /&gt;
Because copy is done with &lt;i&gt;backup as copy reuse datafile X auxiliary format new&lt;/i&gt; then no useless copying to storage local to primary and all bytes goes directly to the standby files, which is nice
&lt;br /&gt;

&lt;br /&gt;
To finish the standby I need now to add standby log files (though this is optional) and set log_archive_dest_state_2 to enable. The managed standby is already run by the duplicate command. One may want to switch this to recovery using current logfile.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/fglQJFlTfTo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/3930159600295924380/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=3930159600295924380" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/3930159600295924380?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/3930159600295924380?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/fglQJFlTfTo/duplicating-for-standby.html" title="Duplicating for standby" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/11/duplicating-for-standby.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0AASXs5fyp7ImA9WhNQFE0.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-9194918232668404102</id><published>2012-11-20T12:06:00.000+01:00</published><updated>2012-11-20T12:09:08.527+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:09:08.527+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="distributed transaction" /><category scheme="http://www.blogger.com/atom/ns#" term="lock" /><category scheme="http://www.blogger.com/atom/ns#" term="XA" /><title>Distributed transactions holding locks on some resources</title><content type="html">
One of the main problems with XA transactions seems to be locking of rows by distributed transaction. While this is perfectly normal, when locking lasts a short time, it becomes a nightmare when it lasts forever. There are few scenarios, which may end up with such long-lasting lock.&lt;br/&gt;
Many comprehensive articles may be found on Metalink:
&lt;ol&gt;
&lt;li&gt;Solving locking problems in a XA environment [ID 1248848.1] - short, thorough and I like it&lt;/li&gt;
&lt;li&gt;Manually Resolving In-Doubt Transactions: Different Scenarios [ID 126069.1] - long and boring&lt;/li&gt;
&lt;/ol&gt;
In many scenarios the issue should resolve automatically. If this is not the case then theoretically the distributed transaction should be recognized by the resource manager as 'in-doubt' and show up in the dataset from the &lt;b&gt;dba_2pc_pending&lt;/b&gt; view. If so then a DBA should settle with a transaction manager administrator if the transaction 'in-doubt' should be commited or rollbacked and then on the resource manager side the DBA should call appropriately commit or rollback with force option and local transaction id as an argument. Sometimes additionally one needs to call &lt;b&gt;DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('[LOCAL_TRAN_ID]')&lt;/b&gt;;&lt;br/&gt;
Even easier such situation may be resolved from XA client side - we may prepare a fake client, which binds to the database as a side of the chosen distributed transaction and commit or rollback it according to the needs, while whole the cleaning will be done by standard mechanisms (which is recommended way of dealing with such issues) - such example client code may be obtained from the first mentioned article.&lt;br/&gt;
Yet another way of resolving the issue is the database reboot (but this is not always possible).&lt;br/&gt;
&lt;br/&gt;
The distributed transaction goes through few phases.&lt;br/&gt; 
When in 1st phase - not yet prepared - the locks are seen in v$lock view and diagnostic information is easy to obtain.&lt;br/&gt;
After prepare call and response those locks are no longer seen in &lt;b&gt;v$lock&lt;/b&gt; and then the diagnostics is more hard. Yet another possibility here is the transaction process on the transaction manager side was killed by the system - then we end up with an active transaction still blocking some resources, but there is no locks seen (there is however entry in the &lt;b&gt;v$locked_object&lt;/b&gt; view, so at least we may find objects on which there are some locked rows) and no session attached.&lt;br/&gt;
In this scenario we may use the excellent &lt;a href="http://blog.tanelpoder.com/files/scripts/gtrans.sql"&gt;view&lt;/a&gt; from Tanel Poder changing the equal join to a left join between &lt;b&gt;sys.x$k2gte2&lt;/b&gt; and &lt;b&gt;v$session&lt;/b&gt; - from this we may see that some transactions in x$k2gte2 have no corresponding row from the v$session view - these are our candidates for forced transaction finish - in x$k2gte2 we may find the global id of the transaction 'in-doubt' and the local id can be constructed from the join with &lt;b&gt;sys.x$ktcxb&lt;/b&gt; (&lt;b&gt;x$k2gte2.k2gtdxcb=x$ktcxb.ktcxbxba&lt;/b&gt;) on columns  &lt;b&gt;kxidusn, kxidslt, kxidsqn&lt;/b&gt; (it seems no need for left join here) so we may do something about it.&lt;br/&gt;
Once there was a workaround published on Metalink, which involved an insert into pending_trans$ and pending_session$, but I could not find it lately - so I suppose they recommend rather the use of fake client here. However one may still read about it after some google search - voila &lt;a href="http://tazlambert.wordpress.com/2011/11/24/ora-01591-lock-held-by-in-doubt-distributed-transaction-string/"&gt;http://tazlambert.wordpress.com/2011/11/24/ora-01591-lock-held-by-in-doubt-distributed-transaction-string/&lt;/a&gt; (look at the end of the article).&lt;br/&gt;
As a kind of curiosity I may add that I found even a x$k2gte2 entry, which had no corresponding entry in the &lt;b&gt;sys.x$ktuxe&lt;/b&gt; structure or the &lt;b&gt;v$transaction&lt;/b&gt; view. In sys.x$ktcxb there still was an entry however(that is why I assumed no left join needed here), but all the parts of local transaction id were equal to 0, so I suppose this trash has no impact on the database activity and the only way to clean it is a reboot.&lt;br/&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/xVHobbcRuCM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/9194918232668404102/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=9194918232668404102" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/9194918232668404102?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/9194918232668404102?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/xVHobbcRuCM/distributed-transactions-holding-locks.html" title="Distributed transactions holding locks on some resources" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/11/distributed-transactions-holding-locks.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EFSX89eCp7ImA9WhNQFE0.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-1364011060132145686</id><published>2012-11-20T09:10:00.000+01:00</published><updated>2012-11-20T12:06:58.160+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:06:58.160+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="distributed transaction" /><category scheme="http://www.blogger.com/atom/ns#" term="XA" /><title>XA on Oracle database</title><content type="html">The Oracle RDBMS is XA compliant from scratch - no adjustments needed - &lt;a href="http://www.orafaq.com/wiki/XA_FAQ"&gt;http://www.orafaq.com/wiki/XA_FAQ&lt;/a&gt; is a good starting point on this subject.&lt;br/&gt;
&lt;br/&gt;
One may create additional views for dealing with troublesome situations. The Oracle views v$XATRANS$ and V$PENDING_XATRANS$ may be created in order to help with diagnostics (they are created by running @?/rdbms/admin/xaview.sql).&lt;br/&gt;
Another very good view is accessible at &lt;a href="http://blog.tanelpoder.com/files/scripts/gtrans.sql"&gt;http://blog.tanelpoder.com/files/scripts/gtrans.sql&lt;/a&gt;. I usually change the join between sys.x$k2gte2 and v$session into LEFT JOIN as still it is possible to have on a database active distributed transactions not connected to any session.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/C-zH8HujUXY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/1364011060132145686/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=1364011060132145686" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1364011060132145686?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1364011060132145686?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/C-zH8HujUXY/xa-on-oracle-database.html" title="XA on Oracle database" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/11/xa-on-oracle-database.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcDQ3c9cSp7ImA9WhNaFUg.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-5051962590705805230</id><published>2012-11-14T14:27:00.000+01:00</published><updated>2013-01-30T13:47:52.969+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-30T13:47:52.969+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ORA-39034" /><category scheme="http://www.blogger.com/atom/ns#" term="impdp" /><category scheme="http://www.blogger.com/atom/ns#" term="ORA-31603" /><title>IMPDP and lacking internal import structures</title><content type="html">There are number of problems with importing data with impdp depending on the content parameter setting during export.
According to few articles on Metalink this is mostly due to the fact, that during import there are created implicitly some structures and this creation failed.
Today I just hit something like this.
I exported some schemas with content=data_only.
When importing I hit:
&lt;br /&gt;
&lt;pre&gt;ORA-39034: Table TABLE_DATA:"TEST"."SCHEDULER$_JOB_ARG" does not exist.
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UPATE_TD_ROW_IMP [62] 
TABLE_DATA:"TEST"."SCHEDULER$_JOB_ARG"
ORA-31603: object "SCHEDULER$_JOB_ARG" of type TABLE not found in schema "TEST"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 8364

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
0xb7f251c0     19208  package body SYS.KUPW$WORKER
0xb7f251c0      8385  package body SYS.KUPW$WORKER
0xb7f251c0     18770  package body SYS.KUPW$WORKER
0xb7f251c0      4226  package body SYS.KUPW$WORKER
0xb7f251c0      9082  package body SYS.KUPW$WORKER
0xb7f251c0      1688  package body SYS.KUPW$WORKER
0xb791dd40         2  anonymous block
&lt;/pre&gt;
To workaround this I assumed if I create this lacking table I'll be able to go further.
I run as sys
&lt;br /&gt;
&lt;pre&gt;create table "TEST"."SCHEDULER$_JOB_ARG" as select * from SCHEDULER$_JOB_ARGUMENT where rownum&lt;1 pre=""&gt;
and run import again.
One step forward.
I hit then:
&lt;pre&gt;ORA-39034: Table TABLE_DATA:"TEST"."SCHEDULER$_PROGRAM_ARG" does not exist.
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UPATE_TD_ROW_IMP [62] 
TABLE_DATA:"TEST"."SCHEDULER$_PROGRAM_ARG"
ORA-31603: object "SCHEDULER$_PROGRAM_ARG" of type TABLE not found in schema "TEST"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 8364

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
0xb7f251c0     19208  package body SYS.KUPW$WORKER
0xb7f251c0      8385  package body SYS.KUPW$WORKER
0xb7f251c0     18770  package body SYS.KUPW$WORKER
0xb7f251c0      4226  package body SYS.KUPW$WORKER
0xb7f251c0      9082  package body SYS.KUPW$WORKER
0xb7f251c0      1688  package body SYS.KUPW$WORKER
0xa9d3b2b8         2  anonymous block
&lt;/pre&gt;
Per analogiam I run:
&lt;pre&gt;create table "TEST"."SCHEDULER$_PROGRAM_ARG" as select * from SCHEDULER$_PROGRAM_ARGUMENT where rownum&lt;1 pre=""&gt;
Next step forward.
Now I hit
&lt;pre&gt;ORA-39034: Table TABLE_DATA:"TEST2"."RE$ACTION_IMP_TAB" does not exist.
ORA-39126: Worker unexpected fatal error in KUPW$WORKER.UPATE_TD_ROW_IMP [62] 
TABLE_DATA:"TEST2"."RE$ACTION_IMP_TAB"
ORA-31603: object "RE$ACTION_IMP_TAB" of type TABLE not found in schema "TEST2"

ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.KUPW$WORKER", line 8364

----- PL/SQL Call Stack -----
  object      line  object
  handle    number  name
0xb7f251c0     19208  package body SYS.KUPW$WORKER
0xb7f251c0      8385  package body SYS.KUPW$WORKER
0xb7f251c0     18770  package body SYS.KUPW$WORKER
0xb7f251c0      4226  package body SYS.KUPW$WORKER
0xb7f251c0      9082  package body SYS.KUPW$WORKER
0xb7f251c0      1688  package body SYS.KUPW$WORKER
0xb2aae570         2  anonymous block
&lt;/pre&gt;
Now I have no idea where I may find RE$ACTION_IMP_TAB structure, so I wished myself the structure is not important and it is enough to get the properly named object, so I simply created whatever.
&lt;pre&gt;create table "TEST2"."RE$ACTION_IMP_TAB" as select * from dual where rownum&amp;lt;1;
The load goes forward - I assume it should be ok. If I import jobs or chains, it would fail, but jobs or chains are a part of metadata, so problem solved.

Of course the best way is to dump with content=ALL (ie. default value), but sometimes one forgets or has no such choice - then the workaround would be useful.

And short update - the manually created objects have to be dropped manually as well.
&lt;!--1--&gt;&lt;/pre&gt;
&lt;!--1--&gt;&lt;/1&gt;&lt;/pre&gt;
&lt;!--1--&gt;&lt;/1&gt;&lt;/pre&gt;
&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/Jy4Nc0uPI_g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/5051962590705805230/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=5051962590705805230" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5051962590705805230?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5051962590705805230?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/Jy4Nc0uPI_g/impdp-and-non-existent-internal-import.html" title="IMPDP and lacking internal import structures" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/11/impdp-and-non-existent-internal-import.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04MSH89fSp7ImA9WhNbGU8.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-277521133895397286</id><published>2012-10-29T11:25:00.001+01:00</published><updated>2013-01-23T08:26:29.165+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-01-23T08:26:29.165+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="partitioning" /><category scheme="http://www.blogger.com/atom/ns#" term="zabbix" /><category scheme="http://www.blogger.com/atom/ns#" term="interval partitioning" /><title>Zabbix on Oracle - few notes</title><content type="html">We migrated Zabbix from MySQL to Oracle. &lt;br /&gt;
At the same time we moved to partitioning, &lt;a href="http://zabbixzone.com/zabbix/partitioning-tables"&gt;here&lt;/a&gt; excellent article how to do it on MySQL. On Oracle we partitioned the same tables, created the same indexes, but go with interval partitioning (it is nice to not have to create new partitions manually or program it) based upon weeks (the partitioning key is of NUMBER type and we need an equal interval value for every period, so month is out due to variable number of days).&lt;br /&gt;
&lt;br /&gt;
Almost no problems with upgrade to 2.0.2. We had to change the database however due to national character set - must be UTF-8, while we had previously fixed UTF16 - zabbix on Oracle is based mainly upon NVARCHAR2 type, and upgrade sets some columns to width bigger than 2000.&lt;br /&gt;
It is worth to enable CURSOR_SHARING to FORCE (actually I would say this is inevitable).&lt;br /&gt;
At the same time I would not recommend to use any automatic memory management (even ASMM). May be this is only our case, but frequently we run into ORA-4031 problems, which eventually ended with instance hangover or crash. As soon as I disabled any automatic memory management completely, the problems gone.&lt;br /&gt;
&lt;br /&gt;
In addition to partition maintenance here there is an action for job, which will drop the HISTORY% tables' old partitions:&lt;br /&gt;
&lt;pre class="brush: sql"&gt;&amp;nbsp;begin
&amp;nbsp; for cmd in (
&amp;nbsp;&amp;nbsp;&amp;nbsp; with 
&amp;nbsp;&amp;nbsp;&amp;nbsp; conf as (select 9+1 part_num_left from dual)
&amp;nbsp;&amp;nbsp;&amp;nbsp; select 'alter table '||p.table_name||' drop partition '||p.partition_name||' update global indexes'&amp;nbsp; ddl1 
&amp;nbsp;&amp;nbsp;&amp;nbsp; from 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user_tab_partitions p, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select tp.table_name, count(*) l_pnum 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from user_tab_partitions tp 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where tp.table_name like 'HISTORY%' 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by tp.table_name 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; having count(*)&amp;gt;(select part_num_left from conf)) t
&amp;nbsp;&amp;nbsp;&amp;nbsp; where 1=1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and p.table_name=t.table_name 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and p.table_name like 'HISTORY%' 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and p.partition_name&amp;lt;&amp;gt;'DONT_DELETE' 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and p.partition_position between 2 and (t.l_pnum-(select part_num_left from conf)) 
&amp;nbsp;&amp;nbsp;&amp;nbsp; order by p.table_name, p.partition_position)
&amp;nbsp; loop
&amp;nbsp;&amp;nbsp;&amp;nbsp; execute immediate cmd.ddl1;
&amp;nbsp; end loop;
end;

&lt;/pre&gt;

The partitions labeled DONT_DELETE are partitions on the first position of relevant tables. The label is due to the fact one can not drop the first partition from a table partitioned by interval. It is comfortable to create those partitions before the time we want to store in table in order to keep it empty. The code above drops partitions leaving last n ones (here 9 + DONT_DELETE). The line with condition on DONT_DELETE partition name is actually redundant as the code starts dropping from second partition.
&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/NmRxiH3yNG8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/277521133895397286/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=277521133895397286" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/277521133895397286?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/277521133895397286?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/NmRxiH3yNG8/zabbix-on-oracle-few-notes.html" title="Zabbix on Oracle - few notes" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/10/zabbix-on-oracle-few-notes.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcNQ3k6fCp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-5506562692643569251</id><published>2012-09-25T12:59:00.000+02:00</published><updated>2012-11-20T12:14:52.714+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:14:52.714+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="partitioning" /><title>Moving subpartitions</title><content type="html">In Oracle database MOVE operations are done on the segment level actually. Thus while simple table has its own segment, the partitioned one has none all the segments are bound with partitions. In case of subpartitions the same rule apply. So we move:
&lt;pre&gt;
ALTER TABLE simple_t MOVE TABLESPACE tblspace1;
ALTER TABLE partitioned_t MOVE PARTITION p1  TABLESPACE tblspace1;
ALTER TABLE subpartitioned_t MOVE SUBPARTITION s1 TABLESPACE tblspace1;
&lt;/pre&gt;
When we move all the segments with must however change the default tablespace value on the table level and possibly on the partition level if it has a different value.
&lt;pre&gt;
ALTER TABLE partitioned_t MODIFY DEFAULT ATTRIBUTES TABLESPACE tblspace1;
ALTER TABLE subpartitioned_t MODIFY DEFAULT ATTRIBUTES FOR PARTITION p1 TABLESPACE tblspace1;
&lt;/pre&gt;
ALTER TABLE t1 MODIFY DEFAULT ATTRIBUTES... is less known, but can be quite useful allowing for switching on and off Advanced Compression and some other segment parameters.&lt;br/&gt;
&lt;br/&gt;
This applies at least to the version 11.2 (do not check other docs).&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/wg7F7GiKBSE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/5506562692643569251/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=5506562692643569251" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5506562692643569251?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5506562692643569251?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/wg7F7GiKBSE/moving-subpartitions.html" title="Moving subpartitions" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/09/moving-subpartitions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcCQnc5fyp7ImA9WhBVEUQ.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-4885935852296175776</id><published>2012-08-17T14:58:00.002+02:00</published><updated>2013-04-17T11:14:23.927+02:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-04-17T11:14:23.927+02:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="diagnostics" /><category scheme="http://www.blogger.com/atom/ns#" term="client connection" /><category scheme="http://www.blogger.com/atom/ns#" term="cman" /><title>Problems with connection</title><content type="html">From time to time there happens different problems with connections to Oracle database. Below little report about those I have met.&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h2&gt;
problems on client&lt;/h2&gt;
Usually they are trivial and bound with tnsnames.ora. Wrong PATH variable (for example few ORACLE_HOME/bin entries), wrong LD_LIBRARY_PATH, entries in the tnsnames.ora with some unusual blank character, wrong syntax in this file, wrong service_name. For example today 2 different tnsnames.ora files, while part of programs uses the right one, and some the wrong one.&lt;br /&gt;
While trivial, sometimes hard to diagnose, especially by phone.&lt;br /&gt;
&lt;br /&gt;
Fortunately it is easy to get very detailed trace.
We need in sqlnet.ora few entries:
&lt;pre&gt;TRACE_LEVEL_CLIENT=16 #or SUPPORT
TRACE_FILE_CLIENT=mytrace #useful for identification
TRACE_DIRECTORY_CLIENT=traces #useful for location
&lt;/pre&gt;
The output is quite detailed and usually helpful in the diagnosis.
&lt;/li&gt;
&lt;li&gt;&lt;h2&gt;
problems on cman&lt;/h2&gt;
Of course if one uses it (we do).
I have met 3 major problems with it (and this is relevant for 11g version).&lt;br /&gt;
&lt;br /&gt;
The first one was with the raise of 11g version. The cman needs one rule to connect to itself. Till the 10g it was for example:
&lt;pre&gt;(RULE=(SRC=10.0.50.10)(DST=127.0.0.1)(SRV=cmon)(ACT=accept))
&lt;/pre&gt;
With 11g it must be (at least on Linux):
&lt;pre&gt;(RULE=(SRC=10.0.50.10)(DST=::1)(SRV=cmon)(ACT=accept))
&lt;/pre&gt;
The Metalink (ID 298916.1) still provides address 127.0.0.1 as a right one, and indeed the cman starts, but one can not connect to it with cmctl. Possibly it works, but one can not control it. I always needed to kill the cman process with kill utility to change anything (and no, we did not use it on production before the problem was solved).&lt;br /&gt;
&lt;br /&gt;
The second problem was with some older RDBMS versions (ie. before 10g) - we needed to add to simple rule some settings, for example:
&lt;pre&gt;(RULE=(SRC=10.0.50.12)(DST=10.0.60.11)(SRV=*)(ACT=accept)(ACTION_LIST=(mct=0)))
&lt;/pre&gt;
Usually it is enough to end with ACT attribute. This particular case with RDBMS servers on Windows kind os.&lt;br /&gt;
&lt;br /&gt;
The third one was with error in syntax. Once we loose somewhere in the middle of cman.ora a parenthesis. The cman kept all the rules from the time before error emergence, thus in the rules there were rules located before the point of error as well as those after it. When we added rules before that point and reloaded, everything was fine, if we added after, the rules were ignored. Because we always reloaded, the cman worked and for some time we were unaware of the problem at all.&lt;br /&gt;
The true incident we met, when were trying to restart the cman. It went down and we can not start it up. IIRC the returned error was about problem in the configuration file in the end of it (which of course was due to mess in parentheses). The solution here was to display the config with VIM and color the syntax. Eventually we found the place for lacking parenthesis. The problem was trivial, but not so obvious.&lt;br /&gt;&lt;br /&gt;To those three I add yet another - in our case it was lack of mapping IP-&amp;gt;hostname in /etc/hosts, possibly similar situation if no proper name in DNS service available (if used instead of /etc/hosts mapping). In result the cman service returned ORA-12529, even though the cman.ora configuration does not use host names at all (all rules with IP).&lt;br/&gt;
The same happens when the entry in /etc/hosts differs from DST hostname.&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;h2&gt;
problems on server&lt;/h2&gt;
Both problems on server had something to do with firewalls.&lt;br /&gt;
Once it was MTU parameter, which default value appeared too large after some firewall software update.&lt;br /&gt;
The other problem was with inactivity timeout. Some of our firewalls disconnect connections, on which there is no traffic during specified time. A solution here seems to be enabling dead connection detection (DCD) feature. This feature implementation is based upon sending for time to time some bytes as a heartbeat - thus there is some traffic on a connection, so it is not broken.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/Ger8Y9d7Q6s" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/4885935852296175776/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=4885935852296175776" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4885935852296175776?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4885935852296175776?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/Ger8Y9d7Q6s/problems-with-connection.html" title="Problems with connection" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/08/problems-with-connection.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUGSH85fip7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-6300969586636342815</id><published>2012-08-08T11:37:00.000+02:00</published><updated>2012-11-20T12:17:09.126+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:17:09.126+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="resumable" /><title>Automation while suspending the db work</title><content type="html">From some time the Oracle RDBMS supports a situation when due to some work lacks the space within db tablespaces. The AFTER SUSPEND trigger is called, so there is a place for kind of callback, one may set the RESUMABLE_TIMEOUT parameter or there is the DBA_RESUMABLE table with entries inserted after supend events.&lt;br/&gt;
&lt;br/&gt;
If I would imagine itself the best way to solve the suspend event it would be to run within the AFTER SUSPEND trigger a code which would add a new file to the tablespace, on which there is a lack of place. There are was even examples with such solution for 9i version, but it is not now at least with 11.2 version (not sure about 10g).
So what one may do?&lt;br/&gt;
&lt;br/&gt;
I meet this problem mostly on test/dev environments, so the solution do not need to be a complex one and I do not need to think about any special cases - all added files are of UNLIMITED size, so always the solution is to add a new file (unless the storage is fully used).
&lt;ol&gt;
&lt;li&gt;I have met with a solution based upon the AFTER SUSPEND trigger. In 11.2 we get ORA-30511 if trying to run some DDL (and adding a file is of such type). The practical usage now I see in the following - setting RESUMABLE_TIMEOUT to some higher value in order to allow a DBA to make a room for the operation in suspend state or/and inform such DBA by SMS or an alert generation&lt;/li&gt;
&lt;li&gt;use DBMS_SCHEDULER job to run from time to time a piece of code, which would add a new file&lt;/li&gt;
&lt;/ol&gt;

In my case the second solution has much more sense and is a real automation.
Because we mostly use Data Pump utilities to load test/dev databases, it usually enables 2h long suspend (or so) on the operation. In such case the best way is to create a procedure like this:
&lt;pre class="brush: sql"&gt;
CREATE OR REPLACE
PROCEDURE expand_resumable_tblspace
AS
  l_tblspace VARCHAR2(80);
  l_count pls_integer := 0;
BEGIN
  SELECT
    COUNT(*)
  INTO
    l_count
  FROM
    dba_resumable
  WHERE
    1               =1
  AND SUSPEND_TIME IS NOT NULL
  AND resume_time  IS NULL
  AND status        ='SUSPENDED' ;
  IF l_count        &gt; 0 THEN
    SELECT
      SUBSTR(regexp_substr(ERROR_MSG, 'tablespace [^[:blank:]]*', 1, 1, 'im'),
      12)
    INTO
      l_tblspace
    FROM
      dba_resumable
    WHERE
      1                       =1
    AND SUSPEND_TIME         IS NOT NULL
    AND resume_time          IS NULL
    AND status                ='SUSPENDED'
    AND rownum                &lt;2 ;
    IF SUBSTR(l_tblspace,1,4)!='TEMP' THEN
      EXECUTE immediate 'alter tablespace '||l_tblspace||
      ' add datafile size 1m autoextend on next 8m';
    ELSE
      EXECUTE immediate 'alter tablespace '||l_tblspace||
      ' add tempfile size 128m autoextend on next 128m';
    END IF;
  END IF;
EXCEPTION
WHEN OTHERS THEN
  SYS.DBMS_SYSTEM.KSDDDT;
  SYS.DBMS_SYSTEM.KSDWRT(2, SQLERRM);
  SYS.DBMS_SYSTEM.KSDFLS;
END;
/
&lt;/pre&gt;
and to run a job every let's say 5 minutes, which would call such procedure.&lt;br/&gt;
&lt;br/&gt;
Why take only one row from DBA_RESUMABLE? I assume there is not too much such events at a moment and the second one would be serviced with next job run.&lt;br/&gt;
&lt;br/&gt;
Why cut a tablespace name from ERROR_MSG and not from ERROR_PARAMETERx? I found that in some circumstances (different db version for example) the ERROR_PARAMETERx are set differently or not at all. For 11.2 IIRC the tablespace name was set in ERROR_PARAMETER4.&lt;br/&gt;
&lt;br/&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/MY-btLl6yH8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/6300969586636342815/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=6300969586636342815" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/6300969586636342815?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/6300969586636342815?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/MY-btLl6yH8/automation-while-suspending-db-work.html" title="Automation while suspending the db work" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/08/automation-while-suspending-db-work.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUBQ3w5fCp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-6578099782914293837</id><published>2012-08-07T11:29:00.000+02:00</published><updated>2012-11-20T12:17:32.224+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:17:32.224+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="recyclebin" /><title>Recycle bin and dropping tablespaces</title><content type="html">Today I hit an interesting issue. First the instance have not shut down within an hour. Second I could not drop a schema. The reason seems to be an entry in the recycle bin left after some table, which was bound with&amp;nbsp;a tablespace, which in turn&amp;nbsp;has been dropped apparently some time ago. So no tablespace, while the entry left and dropping the schema&amp;nbsp;or purging recycle bin have failed with error in recursive SQL. &lt;br /&gt;
&lt;br /&gt;
The solution quite simple - &lt;strong&gt;creating a new tablespace with the old name, then purging the recycle bin again&lt;/strong&gt; &lt;strong&gt;.&lt;/strong&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/5H_edRldzek" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/6578099782914293837/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=6578099782914293837" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/6578099782914293837?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/6578099782914293837?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/5H_edRldzek/recycle-bin-and-dropping-tablespaces.html" title="Recycle bin and dropping tablespaces" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/08/recycle-bin-and-dropping-tablespaces.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUMQ384eCp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-5717697492177651157</id><published>2012-07-19T09:15:00.000+02:00</published><updated>2012-11-20T12:18:02.130+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:18:02.130+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="log rotation" /><category scheme="http://www.blogger.com/atom/ns#" term="listener" /><title>Log rotation in 11g</title><content type="html">Till version 11g the log rotation may been easily done by lsnrctl and set log_file to new name. With advent of ADR if used it blocks this way.&lt;br /&gt;
Excellent article on the theme IMHO at &lt;a href="http://msutic.blogspot.com/2009/06/truncating-rotating-flushing.html"&gt;http://msutic.blogspot.com/2009/06/truncating-rotating-flushing.html&lt;/a&gt;.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/rJHotvItaSw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/5717697492177651157/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=5717697492177651157" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5717697492177651157?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/5717697492177651157?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/rJHotvItaSw/log-rotation-in-11g.html" title="Log rotation in 11g" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/07/log-rotation-in-11g.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQHRXg-fCp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-8421383939377132510</id><published>2012-07-18T14:07:00.000+02:00</published><updated>2012-11-20T12:18:54.654+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:18:54.654+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="change management" /><category scheme="http://www.blogger.com/atom/ns#" term="su" /><category scheme="http://www.blogger.com/atom/ns#" term="proxy" /><title>Su-like technology for Oracle db</title><content type="html">From time to time I meet with the situation when it comes to perform many changes on many db schemas provided as a set of scripts. &lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;The simplest way to do this is to logon sequentially to chosen schema and perform there all the necessary changes. This attitude has some drawbacks:&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;one needs to know a password to every schema visited&lt;/li&gt;
&lt;li&gt;one needs to perform authentication to db many times&lt;/li&gt;
&lt;li&gt;one needs to run many scripts&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;first improvement is to create master script, use CONNECT &amp;lt;&amp;lt;user&amp;gt;&amp;gt; command of sqlplus - but this still do not resolve providing passwords&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;so we may create a more powerful account, gathering all the needed privileges and use&lt;br /&gt;
ALTER SESSION SET CURRENT_SCHEMA=&amp;lt;&amp;lt;user&amp;gt;&amp;gt;; instead of CONNECT - this is a step in right direction and as long as scripts use simple objects and functionalities this way addresses all the inconveniences. Another ability is to prefix all the used objects.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;still yet we are far from perfectness - there are some functionalities which work wrong - the simplest example here is usage of private db links. Here we may use so called proxy users. Starting from 10gR2 these are available through sqlplus. We don't need a powerful user. We return back to use CONNECT, this time slightly modified. First we need an account with CREATE SESSION privilege. We need to alter all schemas, which we plan to make available:&lt;br /&gt;
ALTER USER &amp;lt;&amp;lt;user&amp;gt;&amp;gt; GRANT CONNECT THROUGH &amp;lt;&amp;lt;proxy user&amp;gt;&amp;gt; (we may revoke it with REVOKE CONNECT THROUGH). This time we connect to any so configured user through&lt;br /&gt;
CONNECT &amp;lt;&amp;lt;proxy user&amp;gt;&amp;gt;[&amp;lt;&amp;lt;user&amp;gt;&amp;gt;]/&amp;lt;&amp;lt;proxy user password&amp;gt;&amp;gt;. With this addressing all the problems is easy - we need to authenticate as only one user, so even though reconnecting many times, may use sqlplus variable substitution in order to provide a password only once.&lt;/li&gt;
&lt;/ul&gt;
There exists the special role BECOME USER, which apparently allows for similar behavior, however it is used for internal processing bound with Data Pump technology and rather not for use for "e;end users"e;.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/M1mhOURE-0U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/8421383939377132510/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=8421383939377132510" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8421383939377132510?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8421383939377132510?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/M1mhOURE-0U/su-like-technology-for-oracle-db.html" title="Su-like technology for Oracle db" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/07/su-like-technology-for-oracle-db.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQDQHczeip7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-1948975100658917069</id><published>2012-06-05T14:00:00.001+02:00</published><updated>2012-11-20T12:19:31.982+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:19:31.982+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="real time apply" /><category scheme="http://www.blogger.com/atom/ns#" term="standby" /><title>Enabling Real Time Apply on open standby</title><content type="html">Actually nothing special. One needs to stop the recovery, open standby in READ-ONLY mode and one again start the recovery.
&lt;pre class="brush: sql"&gt;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
ALTER DATABASE OPEN;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
&lt;/pre&gt;
There is however one trick - one needs to do this rather quick. It seems (at least for me) that even one archivelog behind the most actual means the managed replication will not start, waiting apparently on some flag indicating the end of previously written log. Thus copying to standby needed logs does not mean, the standby will apply them. It seems a condition is here that archivelog on standby should be "in transition" and the same log being current on primary.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/it-ClQAbElM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/1948975100658917069/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=1948975100658917069" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1948975100658917069?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1948975100658917069?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/it-ClQAbElM/enabling-real-time-apply-on-open.html" title="Enabling Real Time Apply on open standby" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/06/enabling-real-time-apply-on-open.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkQNSHwzfSp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-1528314715440653340</id><published>2012-06-04T15:25:00.001+02:00</published><updated>2012-11-20T12:19:59.285+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:19:59.285+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="standby" /><title>Error ORA-01031/ORA-00604 on communication with standby</title><content type="html">When I have hit the ORA-01031 error on version 10g, the cause was usually boring - badly configured connection primary&lt;-&gt;standby, lack of password file, improper permissions on such file, etc.
With 11g version the trivial error become more enigmatic. I checked connections, copied the password file from the primary and still got ORA-01031 on connection from the primary to the standby (and ORA-00604 on the connection from the standby to the primary). Finally under the link
&lt;a href="https://forums.oracle.com/forums/thread.jspa?messageID=10350931"&gt;https://forums.oracle.com/forums/thread.jspa?messageID=10350931&lt;/a&gt; I have found quite good explanation to my problem.
&lt;br&gt;
With the advent of 11g version DEFAULT profile has got some limitations - among others expired passwords. Due to this passwords go through grace time period, when "normal" user sees a message about grace time period. But automatically controlled connection to/from a standby gets lost with this behavior, while returned errors do not indicate the right solution, which is simple of course.
One may 
&lt;ul&gt;
&lt;li&gt;change a password (to solve temporarily) &lt;/li&gt;
&lt;li&gt;or change the DEFAULT profile&lt;/li&gt;
&lt;li&gt; or change SYS profile to less restrictive&lt;/li&gt;
&lt;/ul&gt;
One must remember that after any of those operations the current logfile needs to be applied on a standby in order to see a positive change.
After that automatic redo shipping started to work properly.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/-av4hlzFHds" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/1528314715440653340/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=1528314715440653340" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1528314715440653340?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/1528314715440653340?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/-av4hlzFHds/error-ora-01031ora-00604-on.html" title="Error ORA-01031/ORA-00604 on communication with standby" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/06/error-ora-01031ora-00604-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMHQHc6cSp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-4072211952604630844</id><published>2012-05-25T13:44:00.003+02:00</published><updated>2012-11-20T12:20:31.919+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:20:31.919+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="installation" /><title>Installation of Oracle RDBMS on Oracle Linux 6</title><content type="html">We install usually 2 Oracle products on database environments - RDBMS itself and Grid Control agent. 
The RDBMS binaries installation actually brings no problems - of course one needs X installation, which may be more than cautious sysadmin would like to install.
The Grid agent is other thing - there is number of additional packages to install in order to make the installation process smooth. The best way on Oracle Linux 5 was to install package oracle-validated, which depends on few other packages, which fully cover the agent needs.
With Oracle Linux 6 the package, which seems to be needed for that purpose is named oracle-rdbms-server-11gR2-preinstall (R must be in uppercase). 
However it seems it is not enough - additionally:
&lt;ul&gt;
&lt;li&gt;yum install libXp.so.6&lt;/li&gt;
&lt;li&gt;yum install libXt.so.6&lt;/li&gt;
&lt;li&gt;yum install libXtst.so.6&lt;/li&gt;
&lt;/ul&gt;
Despite that another problem is I try to install the agent in 10.2.0.5 version, so must have used -ignoreSysPrereqs option. And now failure - some errors in linking. I will switch to 11.1.0.1.&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/m14vIyOitqY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/4072211952604630844/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=4072211952604630844" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4072211952604630844?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/4072211952604630844?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/m14vIyOitqY/installation-of-oracle-rdbms-on-oracle.html" title="Installation of Oracle RDBMS on Oracle Linux 6" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/05/installation-of-oracle-rdbms-on-oracle.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMCQHw5cSp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-8739457447919019581</id><published>2012-05-16T16:03:00.001+02:00</published><updated>2012-11-20T12:21:01.229+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:21:01.229+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="archivelog" /><category scheme="http://www.blogger.com/atom/ns#" term="recovery" /><category scheme="http://www.blogger.com/atom/ns#" term="standby" /><title>Speeding up a standby recovery with incremental backup</title><content type="html">Lately I have found a description for recovering  using incremental backup. Despite speeding up a standby recovery (assuming the number of archivelogs to apply is much beyond the amount of changed data blocks) this method is useful for example for recovery from lost archivelog.
I found some good articles on the topic above:
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://dbakerber.wordpress.com/2011/12/20/incremental-recovery-of-standby-asm-and-rman/"&gt;http://dbakerber.wordpress.com/2011/12/20/incremental-recovery-of-standby-asm-and-rman/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://msutic.blogspot.com/2010/11/recover-from-incrementally-updated.html"&gt;http://msutic.blogspot.com/2010/11/recover-from-incrementally-updated.html&lt;/a&gt; - this one is especially very precise&lt;/li&gt;
&lt;/ol&gt;

My personal goal was to speed up a standby recovery. I did it on the 11.2.0.2 version. I assume here disk channel, but tape is the same or even simpler as one do not need to transfer backup files from the primary to the standby host assuming centralized backup facility. 
The receipt is as follows:
&lt;ol&gt;
&lt;li&gt;make an incremental backup from SCN, at which our standby stopped (or actually it is better to backup slightly more then is needed, thus SCN should be a little lower then the really needed). This could be as simple as this:&lt;br/&gt;
&lt;pre class="brush: sql"&gt;
BACKUP INCREMENTAL FROM SCN  60839640548 DATABASE TAG='SCN_BEFORE_60839650548';
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;make a copy of a current controlfile for standby:&lt;br/&gt;
&lt;pre class="brush: sql"&gt;
# from rman
BACKUP CURRENT CONTROLFILE FOR STANDBY;
# or from sqlplus
ALTER DATABASE CREATE PHYSICAL STANDBY CONTROLFILE AS '/tmp/control01.ctl';
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;transfer both backups to the standby - starting from here all&lt;/li&gt;
&lt;li&gt;restore control files with rman
&lt;pre class="brush: sql"&gt;
RESTORE STANDBY CONTROLFILE FROM '[controlfile path]';
&lt;/pre&gt;
or simply replace existing control files if using sqlplus
&lt;pre class="brush: sql"&gt;
cp [controlfile path] [CONTROL_FILES parameter value] # for every position in CONTROL_FILES parameter of course
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;now mount the standby instance 
&lt;pre class="brush: sql"&gt;
STARTUP NOMOUNT
ALTER DATABASE MOUNT STANDBY DATABASE;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;set STANDBY_FILE_MANAGEMENT to MANUAL (if set to AUTO)&lt;/li&gt;
&lt;li&gt;catalog all the already existing on standby datafiles to control file
&lt;pre class="brush: sql"&gt;
CATALOG START WITH '[datafile path]'; # for every datafile path 
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;add all non-existent datafiles with sqlplus or with help of command SQL of rman
&lt;pre class="brush: sql"&gt;
ALTER DATABASE CREATE DATAFILE [file_id]; 
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;now is the time for switching the database to cataloged copies of datafiles. The simplest way is to:
&lt;pre class="brush: sql"&gt;
SWITCH DATABASE TO COPY;
&lt;/pre&gt;
but if there were some non-existent files, which had to be added in the previous step, this will do not work.
The source 2 provides a way to workaround it:
&lt;pre class="brush: sql"&gt;
CHANGE COPY OF DATAFILE [file_id] UNCATALOG;
&lt;/pre&gt;
My way is to produce a script with a call to v$datafile:
&lt;pre class="brush: sql"&gt;
spool switch_files.rmn
SELECT 'SWITCH DATAFILE '||file_id||' TO COPY;' rmn1 FROM v$datafile ORDER BY file#;
spool off
&lt;/pre&gt;
then execute it and edit the spooled content to remove unnecessary entries - among those also tries to switch lately created datafile stubs (stubs are already seen by the instance, so actually no need to switch to them).
&lt;/li&gt;
&lt;li&gt;now almost finish - recover database with rman - NOREDO forces rman to not use archivelogs at all
&lt;pre class="brush: sql"&gt;
RECOVER DATABASE NOREDO;
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;the rest is possibly to fix some small issues with redologs, which means usually clear logfiles and to start managed standby recovery
&lt;ul&gt;
&lt;li&gt;it is interesting that in order to clear standby logfiles one needs to put at work the parameter log_file_name_convert&lt;/li&gt;
&lt;li&gt;it seems enabling the standby recovery may be performed at any SCN - we simply switch the recovery process from incremental backup to archived logs again. Now onwards we need to apply the logs requested by standby - assuming the managed standby, the log sequences are to be found in an alert log as entries about archive gaps.
&lt;pre class="brush: sql"&gt;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

And now we are with automatically running standby back again :-)&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/sh86RXFoHiw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/8739457447919019581/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=8739457447919019581" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8739457447919019581?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/8739457447919019581?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/sh86RXFoHiw/speeding-up-standby-recovery-with.html" title="Speeding up a standby recovery with incremental backup" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/05/speeding-up-standby-recovery-with.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIEQHo4eip7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-2597382015248102909</id><published>2012-05-10T15:04:00.000+02:00</published><updated>2012-11-20T12:21:41.432+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:21:41.432+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="impdp" /><category scheme="http://www.blogger.com/atom/ns#" term="data pump" /><title>Data Pump and db links</title><content type="html">The environment I work here with heavily relies on db links due to integration efforts. At the same time we create numerous test/dev environments for projects' needs.
Usually for test/dev environment we are not able to provide all the connections or data, while trying to provide 1 to 1 metadata structure. Of course part of it becomes INVALID, but that is ok. The point is to do an import at the lowest cost (in terms of time and writing), thus keep with a good principle, the IT staff should be &lt;b&gt;lazy&lt;/b&gt;.
&lt;b&gt;The problem is that during Data Pump imports the worker hangs on views built upon non-existing db links, possibly due to firewalling connections.&lt;/b&gt;
&lt;ol&gt;
&lt;li&gt;one may exclude schemas with db link (EXCLUDE=SCHEMA:" IN ('[username]')"&lt;/li&gt;
&lt;li&gt;one may define TNS aliases - in our case due to firewalls there was a need to indicate true databases (no matter that there was no proper schemas on them)&lt;/li&gt;
&lt;/ol&gt;&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/q0hPIy-sPFE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/2597382015248102909/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=2597382015248102909" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/2597382015248102909?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/2597382015248102909?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/q0hPIy-sPFE/data-pump-and-db-links.html" title="Data Pump and db links" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/05/data-pump-and-db-links.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIHR3gyeCp7ImA9WhNQFEw.&quot;"><id>tag:blogger.com,1999:blog-4238388508729730478.post-2267033208983059666</id><published>2012-04-19T10:39:00.000+02:00</published><updated>2012-11-20T12:22:16.690+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-11-20T12:22:16.690+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="recovery" /><category scheme="http://www.blogger.com/atom/ns#" term="tspitr" /><title>Automatic TSPITR and dealing with it</title><content type="html">The automatic TSPITR is very useful when we have an independent schema, which was logically corrupted by some of our actions. Let's say we started a batch processing, which is not a single transaction able to rollback, but rather hundreds of small changes to many tables and this processing failed being inside the run.&lt;br /&gt;
In the 11g database it is highly automated - theoretically one needs to run one RMAN command like below:&lt;br /&gt;
&lt;blockquote&gt;recover tablespace &lt;tablespace_name&gt; until time "to_date('2012-04-16 08:15:00','yyyy-mm-dd hh24:mi:ss')" auxiliary destination '/rman/aux';&lt;br /&gt;
&lt;/blockquote&gt;Lately we use it for exactly the same reason I mentioned above - we restored a schema from a time before processing.&lt;br /&gt;
&lt;br /&gt;
In the first place of course it is best not to recover at all, for example by making UNDO tablespace bigger (and I mean here a defense against ORA-01555 rather than making FLASHBACK TABLE operations possible).&lt;br /&gt;
However let's assume one is already in a trouble. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The automatic instance&lt;/b&gt;&lt;br /&gt;
According to our experience the most important thing is to tune the automatically run instance by providing additional settings.&lt;br /&gt;
The automatic instance by default runs on the following parameters:&lt;br /&gt;
&lt;blockquote&gt;System parameters with non-default values:&lt;br /&gt;
processes                = 50&lt;br /&gt;
sga_target               = 280M&lt;br /&gt;
db_block_size            = 8192&lt;br /&gt;
compatible               = "11.2.0.0.0"&lt;br /&gt;
log_archive_dest_1       = "location=/rman/aux"&lt;br /&gt;
db_files                 = 200&lt;br /&gt;
db_create_file_dest      = "/rman/aux"&lt;br /&gt;
db_name                  = "TEST"&lt;br /&gt;
db_unique_name           = "xgFy_tspitr_TEST"&lt;br /&gt;
&lt;/blockquote&gt;For us 2 things did not work well. The processes parameter was set too low - at the end of the whole TSPITR process the automatic instance failed due to exceeding the processes limit. This was probably due to some additional job processes, not sure why there were so many of them. Thus the processes value at 150 is much better setting.&lt;br /&gt;
Another thing to tune is the SGA_TARGET - for small transactions the default setting is probably ok - our process run smoothly through the files restore phase and majority of the recover phase, but not the whole. In our case doubling this value with setting 200M exclusively for shared pool helped, but this may vary.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What if it failed anyway&lt;/b&gt;&lt;br /&gt;
Failing the automatic/auxiliary instance is really a disaster to the TSPITR process, but we are able to run it again reusing partially the work done in the previous run. Unfortunately when failing the auxiliary instance removes all the files in auxiliary destination, which means we loose auxiliary control file and datafiles for UNDO, SYSTEM and SYSAUX. &lt;br /&gt;
The datafiles for recovered tablespaces are usually restored in the final production destination and they are left as of the moment of the auxiliary instance crash and this is what we could reuse, assuming the TSPITR process did not crash after open resetlogs operation. To use them we need to add to the RMAN RUN block CONFIGURE AUXNAME commands.&lt;br /&gt;
Depending on the TSPITR phase the whole process may fail leaving also files in the auxiliary destination, thus we are able to continue the TSPITR process manually. In such case first thing is to remove causes of the failure. One needs to create also its own pfile, where especially  important is to know the value of the db_name parameter - those parameters may be taken from alert.log file of the auxiliary instance. After that we start the auxiliary instance.&lt;br /&gt;
There is a clone control file in use, so we need to mount database as clone database (ALTER DATABASE MOUNT CLONE DATABASE;).&lt;br /&gt;
Open it was a little tricky - we had to use RMAN (and not SQLPLUS) and connect as to auxiliary instance (rman auxiliary /), then simply open with resetlogs. After this moment the rest is quite simple - the best way is to follow a log from some previous TSPITR (such log may be found on Metalink for example). One needs to set the recovered files as READ-ONLY and create an alias for a dictionary to use by Data Pump (it is good to set the same dictionary as in the primary database). Then goes an expdp (expdp &lt;username, we used sys&gt; dumpfile=&lt;dmp file name&gt; transport_tablespaces=&lt;list of tablespaces to export&gt;, possibly TRANSPORT_FULL_CHECK, if needed). &lt;br /&gt;
Afterwards one may close the auxiliary instance, as this is not needed anymore. Then impdp to the primary database, setting tablespace to READ-WRITE again and voila - the thing is done.&lt;br /&gt;
&lt;br /&gt;
Kudos to Pawel Smolarz :-)&lt;img src="http://feeds.feedburner.com/~r/Remigium/~4/D8DNja8WLmY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://remigium.blogspot.com/feeds/2267033208983059666/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=4238388508729730478&amp;postID=2267033208983059666" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/2267033208983059666?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/4238388508729730478/posts/default/2267033208983059666?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Remigium/~3/D8DNja8WLmY/automatic-tspitr-and-dealing-with-it.html" title="Automatic TSPITR and dealing with it" /><author><name>rems</name><uri>http://www.blogger.com/profile/11711851337018472556</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://remigium.blogspot.com/2012/04/automatic-tspitr-and-dealing-with-it.html</feedburner:origLink></entry></feed>
