<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Harsha on Medium]]></title>
        <description><![CDATA[Stories by Harsha on Medium]]></description>
        <link>https://medium.com/@harshaskm?source=rss-247882bb9c2b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Harsha on Medium</title>
            <link>https://medium.com/@harshaskm?source=rss-247882bb9c2b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:17:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harshaskm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Postgresql vs Oracle]]></title>
            <link>https://medium.com/@harshaskm/postgresql-vs-oracle-e2beb1dc50d4?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2beb1dc50d4</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 06 Sep 2017 00:08:15 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:11.467Z</atom:updated>
            <content:encoded><![CDATA[<h3>Synopsis</h3><p>This is an effort to record most important readings I have done/doing going through the PostgreSql Online documentation.</p><h4>Differences between Oracle and Postgresql</h4><p><strong>#</strong></p><p><strong>PostgreSql</strong></p><p><strong>Oracle</strong></p><p>1$$ quoted stringNo such feature2Partitioned tables are managed through inheritance, needs triggers on the Master table to make it happen.Partition is a concept in Oracle with so many features around it to make it work better3Various subqueries in a From clause can reference data in each other (using Lateral keyword)No such feature4Does not look like there is anything known has a stored procedure (you have to write a function which will be made use of like a procedure — mostly without returning anything)Stored Procedure is available and different from function5No such featurePackages6Database user seems to be tied with the OS loginOracle is free from such tie up7Referencing data on disk in csv etc format is very easyIn Oracle you have to make changes to listener to have Heterogenous config (if my memory serves better!) and you will then be able to access files through sql8Generally I found that everything Oracle does in terms of SQL is possible through Postgres and on top of it they have certain features which is much more user friendly like for example /d to describe a table /q to exit etcOracle is strong in terms of very well shaped concepts like the Stored Procedures that we saw above or the Partitions, it might not have those minor things like /d in postgresql but that does not hamper the functioning or it does not handicap one from getting work done.9Array feature which can be used in a sqlDoes not seem to be readily available in Oracle (needs some googling to confirm)10Offset clause can be used to retrieve rows in setsNo such feature11Boolean data type of 1 byteSuch data type is not directly available but one can use number(1) or char(1) indirectly12Geometric types, Network address typesI don’t think these data types are available in Oracle (need to find)13Jason Types is supported (There are two JSON data types: json and jsonb)Oracle supports Jason but only in 12c.14Shutdown related:</p><ul><li>SIGTERM</li><li>SIGINT</li><li>SIGQUIT</li></ul><p>This one is not any different from Oracle, only the names are different:</p><ul><li>Shutdown;</li><li>Shutdown immediate;</li><li>Shutdown abort;</li></ul><p>15During server startup, parameter settings can be passed to the postgres command via the -c command-line parameter. For example:</p><p><strong><em>postgres -c log_connections=yes -c log_destination=’syslog’</em></strong></p><p>No such feature16By default object names can be of length 63 characters, it could be controlled through a init parameter max_identifier_lengthI guess there is no way to influence the length of object names in Oracle and by default I know it to be 30 characters in length.17Short options shown <a href="https://www.postgresql.org/docs/9.6/static/runtime-config-short.html"><strong>here</strong></a> not very sure if it would be required for a production database day to day operations, but good to know.No such feature18Roles: as per the document roles can be configured either to work as Oracle db user or as Oracle db role</p><p>Meaning if a role is created with ‘login’ privilege then it acts as a user, else it is a role.</p><p>Roles can be assigned to other roles (which could also be a db user).</p><p>Note: DB user/Create user are both virtual, ultimately it is a role in the db with/without login privilege</p><p>Unlike Postgresql role and db user are both distinct in Oracle.19Ownership of objects can be transferred one at a time using ALTER commands, for example:</p><p>ALTER TABLE bobs_table OWNER TO alice;</p><p>No such feature20Alternatively, the REASSIGN OWNED command can be used to reassign ownership of all objects owned by the role-to-be-dropped to a single other role. Because REASSIGN OWNED cannot access objects in other databases, it is necessary to run it in each database that contains objects owned by the role. (Note that the first such REASSIGN OWNED will change the ownership of any shared-across-databases objects, that is databases or tablespaces, that are owned by the role-to-be-dropped.)No such feature21Drop owned by ;</p><p>Will drop all the objects of the role/user, leaving the user/role intact.</p><p>No such feature22Dropdb on the shell or Drop database inside the psql (client) can be used to drop a particular databaseOne could use DBCA to drop databases (but certain times I have seen it fail).23Tablespace pg_global contains shared system catalogsEquivalent to system tablespace in Oracle24Pg_default tablespace is used to host template0 and template1 databases, (and, therefore, will be the default tablespace for other databases as well, unless overridden by a TABLESPACE clause in CREATE DATABASE)Almost equivalent to Users tablespace in Oracle25Looks like in Pg vaccum of a table happens irrespective of changes happening in that table or not.</p><p>Meaning a small look up table which contains static data will get a vaccum done. (even if autovaccum is disabled and/or even if this small lookup table does not go through any DMLs, meaning frozen static data).</p><p>As per the online doc, this is done in order to replace the XIDs (transaction IDs) in such tables with frozen XIDs, else there will be data loss.</p><p>The main reason for this is that the XIDs revert to 0 if the transactions in a database exceeds 4 billion.</p><p>There is no such limitation in Oracle, you could choose to skip and not compact a table (reduce HWM regain space from a table) and still not have any data loss.26It is suggested to reindex b-tree indexes periodically to improve performance (basically defrag and sequentialize data in it)Whereas in Oracle you don’t have to reindex b-tree indexes27Unlike Oracle PG does not dump server log continuously on its own through a init parameter, but you would have to redirect the logging of the process to a file, just like how you would use 1&gt; 2&gt; for log and error redirection for a unix command.Oracle would log automatically into the diag folder that is set in the init parameters.28Pg_dump could be used to extract data and piped to psql to import it into another database (if need be onto a db which resides on a remote host) in one single command, example:</p><p><strong>pg_dump -h host1 dbname | psql -h host2 dbname</strong></p><p>No such feature29Domain that can be defined in Postgresql, as per the documentation, if there is a particular constraint that you would want to use for multiple tables, you can create a domain and then use the same.</p><p>You could find complete info and example here:</p><p><a href="https://www.postgresql.org/docs/9.1/static/sql-createdomain.html">PostgreSQL: Documentation: 9.1: CREATE DOMAIN</a></p><p>No such feature30Postgresql views are not updateable by default, you can do the same using “an unconditional On Update Do Instead”.</p><p>In Postgresql 9.1 and above you can create a “view trigger”</p><p>From online blogs it also seems like ‘Do Instead’ rules are not applicable for versions below 8.4</p><p>But: From Postgresql 9.3 onwards simple views are directly updatable.</p><p>Oracle lets updating of views by default, no additional coding required to make it happen.</p><p>*Like I have mentioned in the box Postgresql column, from Postgresql 9.3 onwards both Oracle and Postgresql become same feature wise, because Postgresql here on lets one update simple-views (meaning the data would be propagated to the downstream table).</p><p>31Postgresql9.5 onwards Row Level Security is supported through security policies. Security policies will be controlled by the DBA not the application.</p><p>RLS offers strong security as it is enforced by the database</p><p>Oracle has “Oracle Label Security” to implement the same, but I wouldn’t think it would be free, one might have to buy additional license to use it.32PG suggests to reindex as one of the maintenance job on a database (this is basically to address fragmentation)Whereas in Oracle there is no need to maintain btree indexes, they are auto maintained33In a sql query we can directly deduct a date_column value from now, for example:</p><p><em>select usename, </em><strong><em>now()-backend_start</em></strong><em> as tot_session_time from pg_stat_activity;</em></p><p>Which would return the username and the who is connected to the database and how long as the connection been there</p><p>In Oracle you cannot + — etc between 2 date columns of a table or for that matter even with sysdate.34<br>PAGE_BREAK: PageBreak</p><h4>Equivalent commands/views/concepts between Postgresql and Oracle</h4><p><strong>#</strong></p><p><strong>PostgreSql</strong></p><p><strong>Oracle</strong></p><p>1pg_dump, pg_dumpallexpdmp2pg_hba.confYet to confirm but <strong>pg_hba.conf</strong> in Postgresql seems like an equivalent of <strong>init.ora</strong> in Oracle3pg_file_settings (I guess even pg_settings is same as v$parameter)v$parameter4Postgresql.conf (there is also a file postgresql.auto.conf which will store all the settings that has been done through alter system, the doc says not to edit this file manually).init.ora5Committing a transaction and acknowledging to the client can be done with conditions in terms of before or after writing to local disk or remote standby db etc, this can be controlled through the parameter synchronous_commit.</p><p>At the same time, this setting could be controlled at individual transaction level!</p><p>Just not sure about this detail in Oracle, makes me wonder how less I know in terms of this particular information!6** random_page_cost ** seems to be a very important parameter, need to read better about it…7Looks like the Truncate command works the same in both the DB, but for some reason the online doc has put a note which says: “The disadvantage is that strict MVCC semantics are violated.”</p><p>Also, the doc says you have to follow the truncate with a vaccum command.</p><p>Truncate in Oracle does all the same as Postgresql.8WAL filesRedo log files9If the destination where WAL log files are to be copied is full the db will start writing to a folder named pg_xlog, in case this folder fills up, db will shutdownSame behaviour when trying to archive oracle archive redo logs.10Use pg_basebackup can be used to perform base backup (in terms of Oracle hot backup)</p><p>This puts the database into the backup mode automatically and starts archiving the database in the format that you choose (plain or tar), switches off the backup mode immediately after backup.</p><p>There is no guarantee that all WAL files required for the backup are archived at the end of backup. If you are planning to use the backup for an archive recovery and want to ensure that all required files are available at that moment, you need to include them into the backup by using -x option.</p><p>Same can be done through scripts in RMAN.11pg_stat_activityv$session</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2beb1dc50d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS EMR explained]]></title>
            <link>https://medium.com/datatoolbox/aws-emr-explained-4bbdeffabb87?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4bbdeffabb87</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[elastic-map-reduce]]></category>
            <category><![CDATA[aws-emr]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 14:13:03 GMT</pubDate>
            <atom:updated>2017-09-06T06:47:44.856Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*j_3U9JTd2fBZlDmTXUnWTw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*P8NeB4SjekY_DIjfVS0Buw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*dMw3hGpQK4X-l9kMYKUHiA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*hdtlpOyPxYHe--DEDe6JrQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*k6FsLWxjYeqKkV6QIuJULg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*iWjHraXtrGbNtpXr3x9Bcg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*IIX3QoUI-XkLVJvZtsUAvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ANY3dSgBpj_DMIJdByZzCA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Otwd35hNi14tIiW713fumQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HoYoVP7yWhrdWIXMGFvdwQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*BYhXhh66lGBC_sX5BCCADA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gRSWgOVMFF-Z8ZJ51weoZA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*NIQtYMryfhJhMH7BHketCw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*VCK1OPIaZ8cP37Qb7naYqQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*95efRJwNXc0vw-CpaRC_TQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Z1mEXXjuf8m4RRWRc3uOKA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*L3H4PrOFU1J23PxehuK3NA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*CCjSpY1ylQTBavbQf2BZbw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*8fiD7XmB-6We0NXuos9hxQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*r3xoDDS2Vsfvw3UoDJptQw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*hkl4UCt6VSmlqy_O41nwVA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*1zyUwqmdxCuaVdpMOcFJsA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Uzsqmo6Hhs93Ruygpgwjpg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*w2cB9xFgZYbce0gWiZCCqg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*pZtBXOD7yVgoOJ3qCr3KQQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*OCaqxurfVpplHElfvPP6Fw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*qVo_7r9j8-M7Xse-C8TkqQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4bbdeffabb87" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/aws-emr-explained-4bbdeffabb87">AWS EMR explained</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database recovery scenarios — Scenario III — Loss of Redo Log group in Inactive state]]></title>
            <link>https://medium.com/datatoolbox/database-recovery-scenarios-scenario-iii-loss-of-redo-log-group-in-inactive-state-318d4187750c?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/318d4187750c</guid>
            <category><![CDATA[oracle-recovery]]></category>
            <category><![CDATA[databaserecovery]]></category>
            <category><![CDATA[loss-of-redo-log-group]]></category>
            <category><![CDATA[lost-redo-log]]></category>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 12 Jun 2013 05:36:10 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:05.559Z</atom:updated>
            <content:encoded><![CDATA[<p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>sqlplus / as sysdba</strong><br>SQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 12 07:25:55 2013<br>Copyright © 1982, 2010, Oracle. All rights reserved.<br>Connected to:<br>Oracle Database 11g Enterprise Edition Release 11.2.0.1.0–64bit Production<br>With the Partitioning, Oracle Label Security, OLAP, Data Mining,<br>Oracle Database Vault and Real Application Testing options</p><p>SQL&gt; <strong>select</strong><br><strong>2 f.group#, f.member</strong><br><strong>3 , (select l.bytes/1024/1024 from v$log l where l.group# = f.group# ) mb</strong><br><strong>4 , (select l.archived from v$log l where l.group# = f.group# ) archived</strong><br><strong>5 , (select l.status from v$log l where l.group# = f.group# ) status</strong><br><strong>6 from v$logfile f</strong><br><strong>7 ;</strong></p><p>GROUP# MEMBER MB ARC STATUS<br> — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -<br>5 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\ONLINELOG\O1_MF_5_8TVJ77MS_.LOG 100 YES INACTIVE<br>5 D:\APP\ADMIN\NEBULA\FLASH\NEBULA\ONLINELOG\O1_MF_5_8TVJ78Y0_.LOG 100 YES INACTIVE<br>6 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\ONLINELOG\O1_MF_6_8TVJ7HVQ_.LOG 100 YES ACTIVE<br>6 D:\APP\ADMIN\NEBULA\FLASH\NEBULA\ONLINELOG\O1_MF_6_8TVJ7LPW_.LOG 100 YES ACTIVE<br>7 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\ONLINELOG\O1_MF_7_8VFV8QQS_.LOG 100 NO CURRENT<br>7 D:\APP\ADMIN\NEBULA\FLASH\NEBULA\ONLINELOG\O1_MF_7_8VFV93FL_.LOG 100 NO CURRENT<br>6 rows selected.</p><p>SQL&gt; <strong>host</strong></p><p><strong>NOTE:</strong><br><em>Backup the database (just in case):</em></p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>rman target /</strong></p><p>Recovery Manager: Release 11.2.0.1.0 — Production on Wed Jun 12 07:26:41 2013<br>Copyright © 1982, 2009, Oracle and/or its affiliates. All rights reserved.<br>connected to target database: NEBULA (DBID=3996618124)</p><p>RMAN&gt; <strong>show all;</strong></p><p>using target database control file instead of recovery catalog<br>RMAN configuration parameters for database with db_unique_name NEBULA are:<br>CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default<br>CONFIGURE BACKUP OPTIMIZATION OFF; # default<br>CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default<br>CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default<br>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default<br>CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default<br>CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br>CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default<br>CONFIGURE MAXSETSIZE TO UNLIMITED; # default<br>CONFIGURE ENCRYPTION FOR DATABASE OFF; # default<br>CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default<br>CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default<br>CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default<br>CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘D:\APP\PRODUCT\11.2.0\DBHOME_64\DATABASE\SNCFNEBULA.ORA’; # default</p><p>RMAN&gt; <strong>configure backup optimization on;</strong><br>new RMAN configuration parameters:<br>CONFIGURE BACKUP OPTIMIZATION ON;<br>new RMAN configuration parameters are successfully stored</p><p><strong>NOTE:</strong><br><em>I want the controlfile, spfile to be backed up along with the DB backup. (comes handy)</em></p><p>RMAN&gt; <strong>configure controlfile autobackup on;</strong></p><p>new RMAN configuration parameters:<br>CONFIGURE CONTROLFILE AUTOBACKUP ON;<br>new RMAN configuration parameters are successfully stored</p><p>RMAN&gt; <strong>list backup;</strong></p><p>specification does not match any backup in the repository</p><p>RMAN&gt; <strong>backup database;</strong></p><p>Starting backup at 12-JUN-13<br>allocated channel: ORA_DISK_1<br>channel ORA_DISK_1: SID=5 device type=DISK<br>channel ORA_DISK_1: starting full datafile backup set<br>channel ORA_DISK_1: specifying datafile(s) in backup set<br>input datafile file number=00001 name=D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSTEM_8TC1NQPY_.DBF<br>input datafile file number=00003 name=D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_UNDOTBS1_8TC1OK15_.DBF<br>input datafile file number=00002 name=D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSAUX_8TC1O654_.DBF<br>input datafile file number=00004 name=D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_USERS_8TC1PBZ3_.DBF<br>channel ORA_DISK_1: starting piece 1 at 12-JUN-13<br>channel ORA_DISK_1: finished piece 1 at 12-JUN-13<br>piece handle=D:\APP\ADMIN\NEBULA\FLASH\NEBULA\BACKUPSET\2013_06_12\O1_MF_NNNDF_TAG20130612T072721_8VHTNVCB_.BKP<br>tag=TAG20130612T072721 comment=NONE<br>channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25<br>Finished backup at 12-JUN-13</p><p>Starting Control File and SPFILE Autobackup at 12-JUN-13<br>piece handle=D:\APP\ADMIN\NEBULA\FLASH\NEBULA\AUTOBACKUP\2013_06_12\O1_MF_S_817889327_8VHTQKXC_.BKP comment=NONE<br>Finished Control File and SPFILE Autobackup at 12-JUN-13</p><p>RMAN&gt; <strong>list backup;</strong></p><p>List of Backup Sets<br>===================<br>BS Key Type LV Size Device Type Elapsed Time Completion Time<br> — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -<br>1 Full 1.06G DISK 00:01:16 12-JUN-13<br>BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20130612T072721<br>Piece Name: D:\APP\ADMIN\NEBULA\FLASH\NEBULA\BACKUPSET\2013_06_12\O1_MF_NNNDF_TAG20130612T072721_8VHTNVCB_.BKP<br>List of Datafiles in backup set 1<br>File LV Type Ckp SCN Ckp Time Name<br> — — — — — — — — — — — — — — — — — <br>1 Full 1764352 12-JUN-13 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSTEM_8TC1NQPY_.DBF<br>2 Full 1764352 12-JUN-13 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSAUX_8TC1O654_.DBF<br>3 Full 1764352 12-JUN-13 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_UNDOTBS1_8TC1OK15_.DBF<br>4 Full 1764352 12-JUN-13 D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_USERS_8TC1PBZ3_.DBF<br>BS Key Type LV Size Device Type Elapsed Time Completion Time<br> — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -<br>2 Full 12.92M DISK 00:00:03 12-JUN-13<br>BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20130612T072847<br>Piece Name: D:\APP\ADMIN\NEBULA\FLASH\NEBULA\AUTOBACKUP\2013_06_12\O1_MF_S_817889327_8VHTQKXC_.BKP<br>SPFILE Included: Modification time: 11-JUN-13<br>SPFILE db_unique_name: NEBULA<br>Control File Included: Ckp SCN: 1764437 Ckp time: 12-JUN-13</p><p>RMAN&gt; <strong>exit</strong></p><p>Recovery Manager complete.</p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>dir</strong></p><p>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\oradata\NEBULA\ONLINELOG<br>11-Jun-13 01:59 PM &lt;DIR&gt; .<br>11-Jun-13 01:59 PM &lt;DIR&gt; ..<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_5_8TVJ77MS_.LOG<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7HVQ_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV8QQS_.LOG<br>3 File(s) 314,574,336 bytes<br>2 Dir(s) 33,649,733,632 bytes free<br>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<br>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;del O1_MF_5_8TVJ77MS_.LOG<br>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG\O1_MF_5_8TVJ77MS_.LOG<br>The process cannot access the file because it is being used by another process.</p><p><strong>NOTE:</strong><br><em> I used Unlocker1.9.2.exe from </em><a href="http://www.filehippo.com/download_unlocker/"><em>http://www.filehippo.com/download_unlocker/</em></a><br><em> to unlock the redo log file from Oracle.exe and be able to delete the same</em><br><em> to simulate loss of file from outside of oracle, else I would have to</em><br><em> shutdown Oracle delete file and restart oracle, which is not an exact simulation.</em></p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>dir</strong></p><p>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\oradata\NEBULA\ONLINELOG<br>12-Jun-13 07:48 AM &lt;DIR&gt; .<br>12-Jun-13 07:48 AM &lt;DIR&gt; ..<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7HVQ_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV8QQS_.LOG<br>2 File(s) 209,716,224 bytes<br>2 Dir(s) 33,648,365,568 bytes free</p><p><strong>NOTE:</strong><br><em>Notice? that I have deleted the logfile group 5,</em><br><em> which was shown as inactive in the sql I fired in the very beginning.</em></p><p>Let’s get back to Sql Prompt:</p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>exit</strong></p><p><strong>NOTE:</strong><br><em>Check to see if Oracle is alive:</em></p><p>SQL&gt; <strong>select open_mode from v$database;</strong><br>OPEN_MODE<br> — — — — — — — — — — <br>READ WRITE</p><p>SQL&gt; <strong>conn test/test</strong><br>Connected.</p><p>SQL&gt; <strong>create table test ( t number );</strong><br>Table created.</p><p><strong>NOTE:</strong><br><em>We have deleted an Inactive Redo Log group file and the DB is not affected,</em><br><em> I do not see any new entries in the alert log file I am still able to</em><br><em> connect to different schema and issue commands.</em></p><p><em>What would happen if we delete the other redo log file which is in the FRA which belongs to group 5?</em></p><p><strong>Let’s do it: Before which, I will show you the status of different logfile groups:</strong></p><p>SQL&gt; <strong>conn sys as sysdba</strong><br>Enter password:<br>Connected.</p><p>SQL&gt; <strong>select group#, status from v$log;</strong><br>GROUP# STATUS<br> — — — — — — — — — — — — — <br>5 INACTIVE<br>6 INACTIVE<br>7 CURRENT</p><p>SQL&gt; <strong>host</strong><br>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>cd \app\admin\nebula\flash\NEBULA\ONLINELOG</strong><br>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\flash\NEBULA\ONLINELOG<br>11-Jun-13 01:59 PM &lt;DIR&gt; .<br>11-Jun-13 01:59 PM &lt;DIR&gt; ..<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_5_8TVJ78Y0_.LOG<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7LPW_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV93FL_.LOG<br>3 File(s) 314,574,336 bytes<br>2 Dir(s) 33,648,291,840 bytes free</p><p>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>del O1_MF_5_8TVJ78Y0_.LOG</strong></p><p>D:\app\admin\nebula\flash\NEBULA\ONLINELOG\O1_MF_5_8TVJ78Y0_.LOG<br>The process cannot access the file because it is being used by another process.</p><p><strong>NOTE:</strong><br><em>I will go back to windows explorer and use the Unlocker to unlock this file,</em><br><em> so that I can delete it — without having to shutdown oracle.</em></p><p>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\flash\NEBULA\ONLINELOG<br>12-Jun-13 07:58 AM &lt;DIR&gt; .<br>12-Jun-13 07:58 AM &lt;DIR&gt; ..<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7LPW_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV93FL_.LOG<br>2 File(s) 209,716,224 bytes<br>2 Dir(s) 33,753,149,440 bytes free</p><p><strong>NOTE:</strong><br><em>File is gone…</em><br><em> lets go back to Sql Prompt:</em></p><p>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>exit</strong><br>SQL&gt; <strong>show user</strong><br>USER is “SYS”</p><p><strong>NOTE:</strong><br><em>No new/worrying entries in alert log yet</em><br><em> Let’s try to do some more stuff to check Oracle’s reaction.</em></p><p>SQL&gt; <strong>conn test/test</strong><br>Connected.</p><p>SQL&gt; <strong>select * from cat; — This is the previously created table.</strong><br>TABLE_NAME TABLE_TYPE<br> — — — — — — — — — — — — — — — — — — — — -<br>TEST TABLE</p><p>SQL&gt; <strong>create table test1 ( test1 number );</strong><br>Table created.</p><p>SQL&gt; <strong>insert into test1 values ( 1 );</strong><br>1 row created.</p><p>SQL&gt; <strong>commit;</strong><br>Commit complete.</p><p>SQL&gt; <strong>conn / as sysdba</strong><br>Connected.</p><p>SQL&gt; <strong>select group#, status from v$log;</strong><br>GROUP# STATUS<br> — — — — — — — — — — — — — <br>5 INACTIVE<br>6 INACTIVE<br>7 CURRENT</p><p><strong>NOTE:</strong><br><em>Oracle online doc says: The damaged inactive online redo log group</em><br><em> eventually halts normal database operation. Reinitialize the damaged</em><br><em> group manually by issuing the ALTER DATABASE CLEAR LOGFILE statement</em><br><em> as described in this section.</em></p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 INACTIVE YES<br>6 INACTIVE YES<br>7 CURRENT NO</p><p><strong>NOTE:</strong><br><em>In this case, the Inactive redo that I chose is Archived,</em><br><em> for which Oracle asks us to “Reinitialize the damaged log group”</em></p><p>SQL&gt; <strong>alter database clear logfile group 5;</strong><br>alter database clear logfile group 5<br>*<br>ERROR at line 1:<br>ORA-00603: ORACLE server session terminated by fatal error<br>ORA-27153: wait operation failed<br>ORA-27300: OS system dependent operation:WaitForSingleObject failed with<br>status: 5<br>ORA-27301: OS failure message: Access is denied.<br>ORA-27302: failure occurred at: skgpwwait1<br>Process ID: 1716<br>Session ID: 393 Serial number: 2176</p><p><strong>Note:</strong><br><em>I read through the alert log and there were messages that the</em><br><em> OS file is missing and Oracle is unable to access the file</em><br><em> (the one that we deleted), also it had listed many trace files</em><br><em> where it had dumped Stack Trace.</em></p><p><strong>What Oracle (docs) says about this?:</strong></p><p><strong>Failure of CLEAR LOGFILE Operation</strong><br>The ALTER DATABASE CLEAR LOGFILE statement can fail with an I/O error due to media failure when it is not possible to: Relocate the redo log file onto alternative media by re-creating it under the currently configured redo log filename<br>Reuse the currently configured log filename to re-create the redo log file because the name itself is invalid or unusable (for example, due to media failure)<br>In these cases, the ALTER DATABASE CLEAR LOGFILE statement (before receiving the I/O error) would have successfully informed the control file that the log was being cleared and did not require archiving. The I/O error occurred at the step in which the CLEAR LOGFILE statement attempts to create the new redo log file and write zeros to it. This fact is reflected in V$LOG.CLEARING_CURRENT.</p><p><strong>The sql session through which I had issued the clear logfile group command is broken, check below:</strong></p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>ERROR:<br>ORA-03114: not connected to ORACLE</p><p>SQL&gt; <strong>exit</strong><br>Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0–64bit Production<br>With the Partitioning, Oracle Label Security, OLAP, Data Mining,<br>Oracle Database Vault and Real Application Testing options</p><p><strong>NOTE:</strong><br><em>Irrespective of the above error message while trying to clear the log group,</em><br><em> Oracle has created both the log files in their respective location:</em></p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\oradata\NEBULA\ONLINELOG<br>12-Jun-13 08:07 AM &lt;DIR&gt; .<br>12-Jun-13 08:07 AM &lt;DIR&gt; ..<br>12-Jun-13 08:07 AM 104,858,112 O1_MF_5_8VHX002F_.LOG<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7HVQ_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV8QQS_.LOG<br>3 File(s) 314,574,336 bytes<br>2 Dir(s) 33,530,855,424 bytes free</p><p>D:\app\admin\nebula\oradata\NEBULA\ONLINELOG&gt;<strong>cd \app\admin\nebula\flash\NEBULA\ONLINELOG</strong><br>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\flash\NEBULA\ONLINELOG<br>12-Jun-13 08:07 AM &lt;DIR&gt; .<br>12-Jun-13 08:07 AM &lt;DIR&gt; ..<br>12-Jun-13 08:07 AM 104,858,112 O1_MF_5_8VHX0BKZ_.LOG<br>09-Jun-13 02:40 PM 104,858,112 O1_MF_6_8TVJ7LPW_.LOG<br>11-Jun-13 01:26 PM 104,858,112 O1_MF_7_8VFV93FL_.LOG<br>3 File(s) 314,574,336 bytes<br>2 Dir(s) 33,530,834,944 bytes free</p><p>D:\app\admin\nebula\flash\NEBULA\ONLINELOG&gt;<strong>sqlplus / as sysdba</strong><br>SQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 12 08:17:51 2013<br>Copyright © 1982, 2010, Oracle. All rights reserved.<br>Connected to:<br>Oracle Database 11g Enterprise Edition Release 11.2.0.1.0–64bit Production<br>With the Partitioning, Oracle Label Security, OLAP, Data Mining,<br>Oracle Database Vault and Real Application Testing options</p><p><strong>NOTE:</strong><br><em>Check this, we din crash the DB:</em></p><p>SQL&gt; <strong>select open_mode from v$database;</strong><br>OPEN_MODE<br> — — — — — — — — — — <br>READ WRITE</p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 UNUSED YES<br>6 INACTIVE YES<br>7 CURRENT NO</p><p>SQL&gt; <strong>conn test/test</strong><br>Connected.</p><p>SQL&gt; <strong>select * from cat;</strong><br>TABLE_NAME TABLE_TYPE<br> — — — — — — — — — — — — — — — — — — — — -<br>TEST TABLE — Table that we created much before deleting the log group<br>TEST1 TABLE — Table created after deleting log group</p><p>SQL&gt; <strong>drop table test;</strong><br>Table dropped.</p><p>SQL&gt; <strong>purge recyclebin;</strong><br>Recyclebin purged.</p><p>SQL&gt; <strong>select * from test1;</strong><br>TEST1<br> — — — — — <br>1<br>SQL&gt; <strong>insert into test1 values ( 2 );</strong><br>1 row created.</p><p>SQL&gt; <strong>commit;</strong><br>Commit complete.</p><p><strong>NOTE:</strong><br><em> OK, that’s enough proof that the DB is still up and running.</em></p><p><em>I will now keep switching the log files and check if the newly</em><br><em> created log file is in a usable state by the DB,</em><br><em> meanwhile I am keeping a tab on the alert log file to check for any errors.</em></p><p>SQL&gt; <strong>conn / as sysdba</strong><br>Connected.</p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 UNUSED YES<br>6 INACTIVE YES<br>7 CURRENT NO</p><p>SQL&gt; <strong>alter system switch logfile;</strong><br>System altered.</p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 CURRENT NO<br>6 INACTIVE YES<br>7 ACTIVE NO</p><p>SQL&gt; <strong>alter system switch logfile;</strong><br>System altered.</p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 ACTIVE NO<br>6 CURRENT NO<br>7 ACTIVE YES</p><p>SQL&gt; <strong>alter system switch logfile;</strong><br>System altered.</p><p>SQL&gt; <strong>select group#, status, archived from v$log;</strong><br>GROUP# STATUS ARC<br> — — — — — — — — — — — — — — -<br>5 ACTIVE YES<br>6 ACTIVE YES<br>7 CURRENT NO</p><p><strong>NOTE:</strong><br><em>Did you notice how the logfile changed from one state to another?</em><br><em> And also it was archived successfully, while at this, Oracle did</em><br><em> not list any new error message in the alert log.</em><br><em> I want to also show you that the table and the data in the TEST schema is intact:</em></p><p>SQL&gt; <strong>conn test/test</strong><br>Connected.</p><p>SQL&gt; <strong>select * from cat;</strong><br>TABLE_NAME TABLE_TYPE<br> — — — — — — — — — — — — — — — — — — — — -<br>TEST1 TABLE<br>SQL&gt; <strong>select * from test1;</strong><br>TEST1<br> — — — — — <br>1<br>2</p><p><strong>So we simulated loss of a Redo log group which was in Inactive state and recovered successfully from the same.</strong></p><p><strong>In this session we used the command to ‘clear redo log group’, but there is another way to get it done, I will show the</strong> <strong>same in next session.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=318d4187750c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/database-recovery-scenarios-scenario-iii-loss-of-redo-log-group-in-inactive-state-318d4187750c">Database recovery scenarios — Scenario III — Loss of Redo Log group in Inactive state</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database recovery scenarios — Scenario II — Loss of all controlfiles, no Backup available]]></title>
            <link>https://medium.com/datatoolbox/database-recovery-scenarios-scenario-ii-loss-of-all-controlfiles-no-backup-available-76c77887628b?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c77887628b</guid>
            <category><![CDATA[loss-of-controlfiles]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[databaserecovery]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Tue, 11 Jun 2013 04:51:34 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:09.482Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Scenario II</strong></h4><h4>Loss of all controlfiles and no Backup available:</h4><p><strong>Note:</strong><br>1. To simulate the same, I am deleting the Controlfiles in OS<br>2. I have highlighted the commands that I have issued, to recognize the same easily.</p><p>D:\&gt;cd app\admin\nebula\oradata\<strong>controlfiles</strong></p><p>D:\app\admin\nebula\oradata\controlfiles&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\oradata\controlfiles<br>09-Jun-13 02:29 PM &lt;DIR&gt; .<br>09-Jun-13 02:29 PM &lt;DIR&gt; ..<br>09-Jun-13 02:32 PM 13,484,032 OMF_CONTROL_0.CTL<br>09-Jun-13 02:32 PM 13,484,032 OMF_CONTROL_1.CTL<br>2 File(s) 26,968,064 bytes<br>2 Dir(s) 35,559,276,544 bytes free</p><p>D:\app\admin\nebula\oradata\controlfiles&gt;<strong>sqlplus / as sysdba</strong><br>SQL*Plus: Release 11.2.0.1.0 Production on Sun Jun 9 14:33:11 2013<br>Copyright © 1982, 2010, Oracle. All rights reserved.<br>Connected to:<br>Oracle Database 11g Enterprise Edition Release 11.2.0.1.0–64bit Production<br>With the Partitioning, Oracle Label Security, OLAP, Data Mining,<br>Oracle Database Vault and Real Application Testing options</p><p>SQL&gt; <strong>select open_mode from v$database;</strong><br>OPEN_MODE<br> — — — — — — — — — — <br>READ WRITE</p><p>SQL&gt; <strong>alter database backup controlfile to trace as ‘d:\temp\create_controlfile.sql’;</strong><br>Database altered.</p><p>SQL&gt; <strong>host dir d:\temp\create_controlfile.sql</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of d:\temp<br>09-Jun-13 02:33 PM 6,064 CREATE_CONTROLFILE.SQL<br>1 File(s) 6,064 bytes<br>0 Dir(s) 35,559,456,768 bytes free</p><p>SQL&gt; <strong>shutdown immediate;</strong><br>Database closed.<br>Database dismounted.<br>ORACLE instance shut down.</p><p>SQL&gt; <strong>host</strong><br>Microsoft Windows [Version 6.1.7601]<br>Copyright © 2009 Microsoft Corporation. All rights reserved.</p><p>D:\app\admin\nebula\oradata\controlfiles&gt;<strong>dir</strong><br>Volume in drive D has no label.<br>Volume Serial Number is 8000–605B<br>Directory of D:\app\admin\nebula\oradata\controlfiles<br>09-Jun-13 02:29 PM &lt;DIR&gt; .<br>09-Jun-13 02:29 PM &lt;DIR&gt; ..<br>09-Jun-13 02:33 PM 13,484,032 OMF_CONTROL_0.CTL<br>09-Jun-13 02:33 PM 13,484,032 OMF_CONTROL_1.CTL<br>2 File(s) 26,968,064 bytes<br>2 Dir(s) 35,559,342,080 bytes free</p><p>D:\app\admin\nebula\oradata\controlfiles&gt;<strong>del .</strong><br>D:\app\admin\nebula\oradata\controlfiles\*, Are you sure (Y/N)? <strong>y</strong><br>D:\app\admin\nebula\oradata\controlfiles&gt;<strong>exit</strong></p><p>SQL&gt; <strong>startup;</strong><br>ORACLE instance started.<br>Total System Global Area 1620115456 bytes<br>Fixed Size 2176208 bytes<br>Variable Size 1258294064 bytes<br>Database Buffers 352321536 bytes<br>Redo Buffers 7323648 bytes<br>ORA-00205: error in identifying control file, check alert log for more info</p><p>SQL&gt; <strong>shutdown immediate;</strong><br>ORA-01507: database not mounted<br>ORACLE instance shut down.</p><p>SQL&gt; <strong>startup nomount;</strong><br>ORACLE instance started.<br>Total System Global Area 1620115456 bytes<br>Fixed Size 2176208 bytes<br>Variable Size 1258294064 bytes<br>Database Buffers 352321536 bytes<br>Redo Buffers 7323648 bytes</p><p>SQL&gt; CREATE CONTROLFILE REUSE DATABASE “NEBULA” NORESETLOGS ARCHIVELOG<br>2 MAXLOGFILES 50<br>3 MAXLOGMEMBERS 3<br>4 MAXDATAFILES 300<br>5 MAXINSTANCES 8<br>6 MAXLOGHISTORY 584<br>7 LOGFILE<br>8 GROUP 5 (<br>9 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\ONLINELOG\O1_MF_5_8TVJ77MS_.LOG’,<br>10 ‘D:\APP\ADMIN\NEBULA\FLASH\NEBULA\ONLINELOG\O1_MF_5_8TVJ78Y0_.LOG’<br>11 ) SIZE 100M BLOCKSIZE 512,<br>12 GROUP 6 (<br>13 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\ONLINELOG\O1_MF_6_8TVJ7HVQ_.LOG’,<br>14 ‘D:\APP\ADMIN\NEBULA\FLASH\NEBULA\ONLINELOG\O1_MF_6_8TVJ7LPW_.LOG’<br>15 ) SIZE 100M BLOCKSIZE 512<br>16 DATAFILE<br>17 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSTEM_8TC1NQPY_.DBF’,<br>18 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_SYSAUX_8TC1O654_.DBF’,<br>19 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_UNDOTBS1_8TC1OK15_.DBF’,<br>20 ‘D:\APP\ADMIN\NEBULA\ORADATA\NEBULA\DATAFILE\O1_MF_USERS_8TC1PBZ3_.DBF’<br>21 CHARACTER SET WE8MSWIN1252<br>22 ;<br>Control file created.<br>SQL&gt; <strong>alter database open;</strong><br>Database altered.<br>SQL&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c77887628b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/database-recovery-scenarios-scenario-ii-loss-of-all-controlfiles-no-backup-available-76c77887628b">Database recovery scenarios — Scenario II — Loss of all controlfiles, no Backup available</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Database recovery scenarios — Loss of all controlfiles; Recovery using RMAN backup]]></title>
            <link>https://medium.com/datatoolbox/database-recovery-scenarios-loss-of-all-controlfiles-recovery-using-rman-backup-2bb057beeaab?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2bb057beeaab</guid>
            <category><![CDATA[oracle]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Sun, 09 Jun 2013 09:12:14 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:08.533Z</atom:updated>
            <content:encoded><![CDATA[<p>I found that there is so much available on net already, with regard to documentation required for recovery scenarios, yet, I want to try and come up with a writeup, which would try to address it with much more clarity and ease of use.</p><p>I am sure there might be innumerable scenarios, I will try my best to cover as much as possible — Step by Step:</p><p>I will choose controlfiles to start with:</p><p><strong>Scenario 1</strong></p><p><strong><em>Loss of all controlfiles; Recovery using RMAN backup:</em></strong></p><p>Please note that I am using a complete installation (not XE) of 11g), for these experiments:</p><p>SQL&gt; select * from v$version;</p><p>BANNER — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>Oracle Database 11g Enterprise Edition Release 11.2.0.1.0–64bit Production PL/SQL Release 11.2.0.1.0 — Production CORE 11.2.0.1.0 Production TNS for 64-bit Windows: Version 11.2.0.1.0 — Production NLSRTL Version 11.2.0.1.0 — Production</p><p>SQL&gt;</p><p>Lets begin:</p><figure><img alt="LossOfCtrlFileRecoveryScenario_I" src="https://cdn-images-1.medium.com/max/917/0*h3N4hi_oNQGjWPA5.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2bb057beeaab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/database-recovery-scenarios-loss-of-all-controlfiles-recovery-using-rman-backup-2bb057beeaab">Database recovery scenarios — Loss of all controlfiles; Recovery using RMAN backup</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a formatted date string and execute a command all at once]]></title>
            <link>https://medium.com/datatoolbox/build-a-formatted-date-string-and-execute-a-command-all-at-once-e2ae4644e275?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2ae4644e275</guid>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Sun, 09 Dec 2012 05:59:02 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:16.897Z</atom:updated>
            <content:encoded><![CDATA[<p>I have a requirement to prepare a clone of our production database (as it was 15 days ago) every morning, in our test Oracle Server.</p><p>1. I need to copy the hot backup files onto the test server (ofcourse there could be better ways, but I choose to do it like this):</p><p>Command I used to copy over hot backup files from production to test server: (cron tasked it):</p><p><em>rsync -tv oracle@prodserver:/d01/backup/incrbkup/* /d01/backup/incrbkup/ &gt;&gt; /d01/log/incrbkup_copy.log</em></p><p>2. RMAN script to clone the database:</p><p>Set of scripts required to perform RMAN based recovery for a given date is all prepared and tested (will post in a few days).</p><p>The script accepts a date as an input in this format: ‘dd-mon-yyyy hh:mi:ss pm’</p><p>And it will use the necessary hot backup files to prepare a clone db as of that date and time.</p><p>3. Execute the RMAN script with an older date to clone the database:</p><p>All I needed now was to build a date string which will be as of 15 days ago and in a particular format to execute the previously mentioned rman scripts.</p><p>Here is how I came up with it:</p><p>If you need date to be echoed you would:</p><p><em>echo `date`</em></p><p>This would echo date in the format that I need for my script:</p><p><em>echo “‘“`date +%d</em>-%b-%Y` “01:00:00 pm’”</p><p><strong>Dissection</strong>: I found that I had to embed the single quote that I need in the output inside of a double quote so thats how the command begins “ ‘ “</p><p>And then I issue the date command but that date command must be embedded within a key named ‘grave accent’ (strange, but I found on google that’s how it’s called).</p><p>Grave Accent: this key is on the left of number ‘1’ and above the ‘Tab’ key.</p><p>Next step was to find out a way to get the same format output for an older date:</p><p>I found that this does the trick: <em>date -d “-15 days”</em></p><p>So I built this onto the previous command like this:</p><p><em>echo “‘“`date -d “-15 days” +%d</em>-%b-%Y` “01:00:00 pm’”</p><p>That certainly worked.</p><p>Now I needed to embed the name of the script start.sh onto the above string, I used the double quote that already embeds the single quote to get the same done as following:</p><p><em>echo “./start.sh ‘“`date -d “-15 days” +%d-%b-%Y` “01:00:00 pm’”</em></p><p>Now the complete string is ready to be invoked, I got the script name and also passing the old date inside a single quote, the only thing left was to find a way to execute the prepared string. Where I found that eval command does it for us:</p><p><em>eval “./start.sh ‘“`date -d “-15 days” +%d-%b-%Y` “01:00:00 pm’”</em></p><p>So just made a new cron task entry with the above command, and now I get to schedule cloning of my production server, but as it was 15 days ago.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2ae4644e275" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/build-a-formatted-date-string-and-execute-a-command-all-at-once-e2ae4644e275">Build a formatted date string and execute a command all at once</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10046 trace levels]]></title>
            <link>https://medium.com/datatoolbox/10046-trace-levels-c976672e85c8?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c976672e85c8</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-trace]]></category>
            <category><![CDATA[oracle-trace-level]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 05 Dec 2012 09:22:23 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:14.472Z</atom:updated>
            <content:encoded><![CDATA[<p>Different levels to which it could be set</p><p><em>10046 Trace Level | Description</em></p><ul><li>1 Basic trace level. Like the standard SQL_TRACE trace file. Provides statistics for parse, execute, fetch, commit and rollback database calls.</li><li>4 Displays bind variables</li><li>8 Displays wait statistics</li><li>12 Displays wait statistics and bind variables</li></ul><p>example: alter system set events=’10046 trace name context forever, level 12&#39;;</p><p>Another thing I found about trace files: There is an sql that we fired when the trace level was set to 12, we were expecting to find the bind variables info in the trace file, but we couldnt, I happened to raise a TAR for the same, stating that for a few sqls, we dont happen to see the bind variable info in the trace file.</p><p>In this TAR I learnt that the bind variables info was not missing the trace file but was actually at the end of the trace file. As in, the sql which missed the bind variable info, was followed by a lot of recursive sqls, which were fired for the purpose of fetching rows for this sql. And at the end of the recursive sqls, the bind variable info was dumped.</p><p>Meaning, bind variable info is not put onto the trace file untill the stmt execution is completed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c976672e85c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/10046-trace-levels-c976672e85c8">10046 trace levels</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trace file re-creation problem in unix]]></title>
            <link>https://medium.com/datatoolbox/trace-file-re-creation-problem-in-unix-b02f8d8f8e22?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b02f8d8f8e22</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[trace-file]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[oradebug]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 05 Dec 2012 09:13:59 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:19.864Z</atom:updated>
            <content:encoded><![CDATA[<p>I faced this problem, where if I happen to stop and start tracing for a db user, between which if I happen to delete the trace file, then the file would not get created again! (backend was a linux box).</p><p>The reason why you have a problem under Unix is that the trace file is not closed — even if you set sql_trace to false. There is, however, a method for sorting the problem out using oradebug. This is not, alas, very elegant — but may be adequate in many cases where a DBA is exerting external control of the tracing.</p><p>Start up SQL*Plus as sysdba, locate the process id (oracle or unix) of the target user, e.g.</p><p><em>select spid, pid from v$process where addr = ( select paddr from v$session where sid = 99 )</em><br><em>;</em></p><p><em>oradebug setorapid {the pid above}</em></p><p>or</p><p><em>oradebug setospid {the spid above}</em></p><p>then</p><p><em>oradebug flush</em> — flushes any remaining data to the trace file</p><p><em>oradebug close_trace</em> — closes the trace file.</p><p>The nice thing about the close_trace option is that you can do it even after you have deleted the trace file from the operating system level. In fact in most cases you may have to delete the trace file before you issue a close_trace, otherwise you may find that Oracle re-opens to write the next bit of trace information to it, and the problem simply repeats itself.</p><p>References: [<a href="http://www.jlcomp.demon.co.uk/faq/sql_trace_2.html,">article</a>]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b02f8d8f8e22" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/trace-file-re-creation-problem-in-unix-b02f8d8f8e22">Trace file re-creation problem in unix</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DataDictionary ER]]></title>
            <link>https://medium.com/datatoolbox/datadictionary-er-4c17089fbc53?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c17089fbc53</guid>
            <category><![CDATA[metadata-er]]></category>
            <category><![CDATA[metadata-relationship]]></category>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[oracle-metadata]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 05 Dec 2012 08:59:56 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:16.797Z</atom:updated>
            <content:encoded><![CDATA[<p>Some of the relationships that I have captured of the data dictionary views.</p><p>1)</p><p><em>select * from v$sql_plan a</em></p><p><em>where (a.hash_value, a.address)</em></p><p><em>in (select hash_value, address) from v$sqltext;</em></p><p>2)</p><p><em>select owner, segment_name, segment_type from dba_extents</em></p><p><em>where file_id = &amp;p1</em></p><p><em>and &amp;p2 between block_id and block_id + blocks -1</em></p><p><em>;</em></p><p>p1 and p2 in the above are from:</p><p><em>select p1 “File #”, p2 “Block #”, p3 “Reason code” from v$session_wait</em></p><p><em>where event = ‘buffer busy waits’</em></p><p><em>;</em></p><p>If the output from repeatedly running query on v$session_wait shows that a block or a range of blocks is experiencing waits, querying on dba_extents as above should show the name and type of the segment.</p><p>Once the segment is identified, the v$segment_statistics performance view facilitates real-time monitoring of segment-level statistics. This enables the DBA to identify performany problems associated with individual tables or indexes, as shown below:</p><p><em>select object_name, statistic_name, value from v$segment_statistics</em></p><p><em>where object_name = ‘&lt;object_name&gt; identified from the previous sqls’</em></p><p><em>;</em></p><p>We can also query the dba_data_files to determine the file_name for the file involved in the wait by using the P1 value from v$session_wait for the file_id.</p><p>This and more very usefull information can be found from this article by <a href="http://www.dba-oracle.com/art_builder_bbw.htm,">Guy Harrison</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c17089fbc53" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/datadictionary-er-4c17089fbc53">DataDictionary ER</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generate explain plan for a historical stmt]]></title>
            <link>https://medium.com/datatoolbox/generate-explain-plan-for-a-historical-stmt-2f13097cb811?source=rss-247882bb9c2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f13097cb811</guid>
            <category><![CDATA[oracle]]></category>
            <category><![CDATA[tuning]]></category>
            <category><![CDATA[explain-plan]]></category>
            <dc:creator><![CDATA[Harsha]]></dc:creator>
            <pubDate>Wed, 05 Dec 2012 08:15:30 GMT</pubDate>
            <atom:updated>2017-09-06T04:27:12.433Z</atom:updated>
            <content:encoded><![CDATA[<p>Basically I am creating an explain plan from an sql which is in v$sql_plan table.</p><p>Fire an sql:</p><p>select</p><p>‘xx’ statement_id, 0 plan_id, timestamp, NULL remarks,</p><p>a.operation, a.options, a.object_node, a.object_owner, a.object_name,</p><p>object_alias, null object_instance, object_type, a.optimizer,</p><p>a.search_columns, a.id, a.parent_id, a.depth, a.position, a.cost,</p><p>a.cardinality, a.bytes, a.other_tag, a.partition_start,</p><p>a.partition_stop, a.partition_id, a.other, a.distribution,</p><p>a.cpu_cost, a.io_cost, a.temp_space, a.access_predicates,</p><p>a.filter_predicates, projection, time</p><p>,qblock_name ,OTHER_XML</p><p>from v$sql_plan a</p><p>where</p><p>(a.hash_value,a.address) in</p><p>(select HASH_VALUE,ADDRESS from v$sqltext</p><p>— use upper case UNIQUE_STRING here to avoid other statements with the unique string!</p><p>where sql_text like lower(‘%UNIQUE\_STRING%’) escape ‘\’);</p><p>SELECT * FROM table(DBMS_XPLAN.DISPLAY(‘plan_table’, ‘xx’,’ALL’));</p><p>The advantage of doing the above: you will get to see the exact thing that really happened in the back-end, and not the explain plan that you generated before firing it actually to the database.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f13097cb811" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatoolbox/generate-explain-plan-for-a-historical-stmt-2f13097cb811">Generate explain plan for a historical stmt</a> was originally published in <a href="https://medium.com/datatoolbox">datatoolbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>