{"id":9000,"date":"2016-09-30T14:13:37","date_gmt":"2016-09-30T12:13:37","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/"},"modified":"2016-09-30T14:13:37","modified_gmt":"2016-09-30T12:13:37","slug":"oracle-12c-and-rman-automatic-datafile-creation","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/","title":{"rendered":"Oracle 12c and RMAN automatic datafile creation"},"content":{"rendered":"<h2>By William Sescu<\/h2>\n<p>A lot of new features popped up with RMAN 12c, like \u00a0Expansion of Multi-section support, or Simplified cross-platform migration and many many more. However, in this post I would like to highlight a small, but very helpful new feature which I demonstrated during my session at the SOUG day.<\/p>\n<p>The automatic datafile creation<\/p>\n<p>In earlier versions of Oracle, you might run into situations where you create a new tablespace, and some objects into it, and then, all of a sudden, the DB crashes or the datafile is lost, without ever being backed up.<\/p>\n<p>This is where the following command comes into play:<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">alter database create datafile &lt;NAME&gt;;<\/pre>\n<p>However, in Oracle 12c, this is done automatically for you, in case you use RMAN.<\/p>\n<p>Lets create a tablespace and afterwards resize the datafile.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">SQL&gt; create tablespace dbi datafile '\/home\/oracle\/rman\/dbi01.dbf' size 16M;\n\nTablespace created.\n\nSQL&gt; alter database datafile '\/home\/oracle\/rman\/dbi01.dbf' resize 32M;\n\nDatabase altered.<\/pre>\n<p>Now lets create a table in the new tablespace.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">SQL&gt; create table t_dbi tablespace dbi as select * from dba_objects;\n\nTable created.\n\nSQL&gt; select count(*) from t_dbi;\n\n  COUNT(*)\n----------\n    120130\n<\/pre>\n<p>Afterwards, we simulate an error and then check what Oracle says.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">$ echo destroy &gt; \/home\/oracle\/rman\/dbi01.dbf<\/pre>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">SQL&gt; alter system flush buffer_cache; \n\nSystem altered. \n\nSQL&gt; select count(*) from t_dbi; \nselect count(*) from t_dbi \n* \nERROR at line 1: \nORA-03135: connection lost contact Process ID: 25538 \nSession ID: 387 Serial number: 55345<\/pre>\n<p class=\"brush: actionscript3; gutter: true; first-line: 1\">From the alert.log<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">Errors in file \/u00\/app\/oracle\/diag\/rdbms\/ocm121\/OCM121\/trace\/OCM121_ora_25904.trc:\nORA-01157: cannot identify\/lock data file 11 - see DBWR trace file\nORA-01110: data file 11: '\/home\/oracle\/rman\/dbi01.dbf'<\/pre>\n<p>Ok. Datafile is gone, and we have no backup. Lets do a preview to see, how Oracle would restore the datafile.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">RMAN&gt; restore ( datafile 11 ) preview;\n\nStarting restore at 30-SEP-2016 15:46:27\nusing target database control file instead of recovery catalog\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=355 device type=DISK\nallocated channel: ORA_DISK_2\nchannel ORA_DISK_2: SID=126 device type=DISK\n\ndatafile 11 will be created automatically during restore operation\nusing channel ORA_DISK_1\nusing channel ORA_DISK_2\n\nList of Archived Log Copies for database with db_unique_name OCM121\n=====================================================================\n\nKey     Thrd Seq     S Low Time\n------- ---- ------- - --------------------\n519     1    529     A 30-SEP-2016 12:23:00\n        Name: +FRA\/OCM121\/ARCHIVELOG\/2016_09_30\/thread_1_seq_529.454.923931563\n\nrecovery will be done up to SCN 7346834\nMedia recovery start SCN is 7346834\nRecovery must be done beyond SCN 7346834 to clear datafile fuzziness\nFinished restore at 30-SEP-2016 15:46:28<\/pre>\n<p>As you can see in the preview output, Oracle will create the datafile automatically for us. Ok. Lets try it.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">RMAN&gt; restore ( datafile 11 );\n\nStarting restore at 30-SEP-2016 15:48:29\nusing channel ORA_DISK_1\nusing channel ORA_DISK_2\n\ncreating datafile file number=11 name=\/home\/oracle\/rman\/dbi01.dbf\nrestore not done; all files read only, offline, or already restored\nFinished restore at 30-SEP-2016 15:48:31\n\nRMAN&gt; recover datafile 11;\n\nStarting recover at 30-SEP-2016 15:49:17\nusing channel ORA_DISK_1\nusing channel ORA_DISK_2\n\nstarting media recovery\nmedia recovery complete, elapsed time: 00:00:02\n\nFinished recover at 30-SEP-2016 15:49:20\n\nRMAN&gt; alter database datafile 11 online;\n\nStatement processed<\/pre>\n<p>Ready. We can now access our table again without running the &#8220;alter database create datafile&#8221; command during the restore. And the resize to 32M was also done for us. However, the resize came during the recovery part.<\/p>\n<pre class=\"brush: actionscript3; gutter: true; first-line: 1\">$ ls -l dbi01.dbf\n-rw-r----- 1 oracle asmadmin 33562624 Sep 30 15:52 dbi01.dbf<\/pre>\n<p>From my point of view, a small, but quite helpful feature.<\/p>\n<p>One last remark. I have done my demo with Oracle 12cR1 with July 2016 PSU. In that version, the RMAN PREVIEW command has a bug, which says that you cannot recover into a consistent state, even if you can. \u00a0After applying the following OnOff patch on top of July PSU 2016, the RMAN PREVIEW command works as expected.<\/p>\n<p>Patch 20315311: RMAN-5119: RECOVERY CAN NOT BE DONE TO A CONSISTENT STATE<\/p>\n<p>Cheers,<\/p>\n<p>William<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By William Sescu A lot of new features popped up with RMAN 12c, like \u00a0Expansion of Multi-section support, or Simplified cross-platform migration and many many more. However, in this post I would like to highlight a small, but very helpful new feature which I demonstrated during my session at the SOUG day. The automatic datafile [&hellip;]<\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[209],"type_dbi":[],"class_list":["post-9000","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-oracle-12c"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Oracle 12c and RMAN automatic datafile creation - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Oracle 12c and RMAN automatic datafile creation\" \/>\n<meta property=\"og:description\" content=\"By William Sescu A lot of new features popped up with RMAN 12c, like \u00a0Expansion of Multi-section support, or Simplified cross-platform migration and many many more. However, in this post I would like to highlight a small, but very helpful new feature which I demonstrated during my session at the SOUG day. The automatic datafile [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-30T12:13:37+00:00\" \/>\n<meta name=\"author\" content=\"Oracle Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oracle Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\"},\"author\":{\"name\":\"Oracle Team\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"headline\":\"Oracle 12c and RMAN automatic datafile creation\",\"datePublished\":\"2016-09-30T12:13:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\"},\"wordCount\":321,\"commentCount\":0,\"keywords\":[\"Oracle 12c\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\",\"name\":\"Oracle 12c and RMAN automatic datafile creation - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\"},\"datePublished\":\"2016-09-30T12:13:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.dbi-services.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Oracle 12c and RMAN automatic datafile creation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#website\",\"url\":\"https:\/\/www.dbi-services.com\/blog\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee\",\"name\":\"Oracle Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g\",\"caption\":\"Oracle Team\"},\"url\":\"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Oracle 12c and RMAN automatic datafile creation - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/","og_locale":"en_US","og_type":"article","og_title":"Oracle 12c and RMAN automatic datafile creation","og_description":"By William Sescu A lot of new features popped up with RMAN 12c, like \u00a0Expansion of Multi-section support, or Simplified cross-platform migration and many many more. However, in this post I would like to highlight a small, but very helpful new feature which I demonstrated during my session at the SOUG day. The automatic datafile [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/","og_site_name":"dbi Blog","article_published_time":"2016-09-30T12:13:37+00:00","author":"Oracle Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Oracle Team","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/"},"author":{"name":"Oracle Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"headline":"Oracle 12c and RMAN automatic datafile creation","datePublished":"2016-09-30T12:13:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/"},"wordCount":321,"commentCount":0,"keywords":["Oracle 12c"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/","url":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/","name":"Oracle 12c and RMAN automatic datafile creation - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2016-09-30T12:13:37+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/oracle-12c-and-rman-automatic-datafile-creation\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Oracle 12c and RMAN automatic datafile creation"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/66ab87129f2d357f09971bc7936a77ee","name":"Oracle Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f711f7cd2c9b09bf2627133755b569fb5be0694810cfd33033bdd095fedba86d?s=96&d=mm&r=g","caption":"Oracle Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/oracle-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=9000"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/9000\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=9000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=9000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=9000"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=9000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}