{"id":144,"date":"2015-11-16T18:22:43","date_gmt":"2015-11-16T17:22:43","guid":{"rendered":"http:\/\/anjo.pt\/wp\/keyword-oracle\/?p=144"},"modified":"2015-11-17T20:27:22","modified_gmt":"2015-11-17T19:27:22","slug":"how-to-drop-corrupted-pdb","status":"publish","type":"post","link":"https:\/\/anjo.pt\/keyword-oracle\/2015\/11\/16\/how-to-drop-corrupted-pdb\/","title":{"rendered":"How to drop corrupted PDB?"},"content":{"rendered":"<p>Today on my test system I did delete by mistake all the datafiles from one PDB on Oracle 12.1.0.2.<\/p>\n<p>Then, when I wanted to drop it from the CDB, I was getting the error:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nSQL&gt; drop pluggable database PDB2_C2 including datafiles;\r\ndrop pluggable database PDB2_C2 including datafiles\r\n*\r\nERROR at line 1:\r\nORA-01116: error in opening database file 19\r\nORA-01110: data file 19: '\/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf'\r\nORA-27041: unable to open file\r\nLinux-x86_64 Error: 2: No such file or directory\r\nAdditional information: 3\r\n<\/pre>\n<p>After I tried to see if RMAN would propose any solution, knowing that there were no backups or archivelogs.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nRMAN&gt; advise failure;\r\n\r\nDatabase Role: PRIMARY\r\n\r\nList of Database Failures\r\n=========================\r\n\r\nFailure ID Priority Status    Time Detected Summary\r\n---------- -------- --------- ------------- -------\r\n62         CRITICAL OPEN      16-NOV-15     System datafile 19: '\/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf' is corrupt\r\n22         CRITICAL OPEN      16-NOV-15     System datafile 19: '\/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf' is missing\r\n\r\nanalyzing automatic repair options; this may take some time\r\nallocated channel: ORA_DISK_1\r\nchannel ORA_DISK_1: SID=31 device type=DISK\r\nanalyzing automatic repair options complete\r\n\r\nMandatory Manual Actions\r\n========================\r\n1. If file \/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf was unintentionally renamed or moved, restore it\r\n2. Contact Oracle Support Services if the preceding recommendations cannot be used, or if they do not fix the failures selected for repair\r\n3. Please contact Oracle Support Services to resolve failure 62: System datafile 19: '\/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf' is corrupt\r\n\r\nOptional Manual Actions\r\n=======================\r\nno manual actions available\r\n\r\nAutomated Repair Options\r\n========================\r\nno automatic repair options available\r\n<\/pre>\n<p>With the help of my Trivadis colleague Daniele Massimi quickly we found the solution.<br \/>\nThe CDB was now in mount mode.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sqlplus \/ as sysdba\r\n\r\nSQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 16 17:28:43 2015\r\nCopyright (c) 1982, 2014, Oracle.  All rights reserved.\r\nConnected to an idle instance.\r\n\r\nSQL&gt; startup\r\nORACLE instance started.\r\n\r\nTotal System Global Area 1509949440 bytes\r\nFixed Size                  2924640 bytes\r\nVariable Size             973082528 bytes\r\nDatabase Buffers          520093696 bytes\r\nRedo Buffers               13848576 bytes\r\nDatabase mounted.\r\nORA-01157: cannot identify\/lock data file 19 - see DBWR trace file\r\nORA-01110: data file 19: '\/shared\/oradata\/NONRAC\/PDB2_CLONE2\/system01.dbf'\r\n\r\nSQL&gt; alter database datafile 19 offline drop;\r\nalter database datafile 19 offline drop\r\n*\r\nERROR at line 1:\r\nORA-01516: nonexistent log file, data file, or temporary file &quot;19&quot;\r\n\r\nSQL&gt; alter session set container=PDB2_C2;\r\nSession altered.\r\n\r\nSQL&gt; alter database datafile 19 offline drop;\r\nDatabase altered.\r\n\r\nSQL&gt; alter session set container=cdb$root;\r\nSession altered.\r\n\r\nSQL&gt; alter database open;\r\nDatabase altered.\r\n\r\nSQL&gt; drop pluggable database PDB2_C2 including datafiles;\r\nPluggable database dropped.\r\n<\/pre>\n<p>Moral of the story: be careful when deleting files. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today on my test system I did delete by mistake all the datafiles from one PDB on Oracle 12.1.0.2. Then, when I wanted to drop it from the CDB, I was getting the error: SQL&gt; drop pluggable database PDB2_C2 including datafiles; drop pluggable database PDB2_C2 including datafiles * ERROR at line 1: ORA-01116: error in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[],"class_list":{"0":"post-144","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-oracle","7":"category-oracle-12c","8":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/comments?post=144"}],"version-history":[{"count":1,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/144\/revisions"}],"predecessor-version":[{"id":145,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/144\/revisions\/145"}],"wp:attachment":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/media?parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/categories?post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/tags?post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}