{"id":203,"date":"2015-05-10T10:44:40","date_gmt":"2015-05-10T08:44:40","guid":{"rendered":"http:\/\/www.dolicapax.org\/?p=203"},"modified":"2015-11-02T04:49:20","modified_gmt":"2015-11-02T03:49:20","slug":"workaround-for-ovmm-database-restore-bug-ovca-2-0-2-ovm3-2-8-x","status":"publish","type":"post","link":"https:\/\/www.dolicapax.org\/?p=203","title":{"rendered":"Workaround for OVMM database restore BUG &#8211; OVCA 2.0.2  &#8211; OVM3.2.8.x"},"content":{"rendered":"<p><strong>If you ever have to restore the Oracle Virtual Machine Manager database using the provided RestoreDatabase.sh, chances are that you will end up with a bunch of corrupted or missing tables in the back-end MySQL database schema. Specifically, all tables with 0 rows will be dysfunctional after successful restore. In turn this prevents management of compute-nodes, virtual machines and other resources.<\/strong><\/p>\n<p>I don&#8217;t know which other versions of OVM might be affected, but the latest 2.0.2 software release for the Virtual Compute Appliance certainly is.<\/p>\n<p>I wrote a workaround that will identify, drop and re-create the corrupted tables. No guarantees, but it did the trick here. Perhaps it can save someone a bit of a headache.<\/p>\n<address>===== CUSTOMER BUG REPORT =====<\/p>\n<p>Description<br \/>\n&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>Assorted errors related to missing tables after restoring OVMM database using provided tools.<\/p>\n<p>Example:<\/p>\n<p>While trying to stop a VM server:<\/p>\n<p>OVMAPI_6000E Internal Error: Caught during commit: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table &#8216;ovs.Mgr_ServerStoppingEvent&#8217; doesn&#8217;t exist<\/p>\n<p>Affected Versions<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\nOracle Virtual Compute Appliance Software Release 2.0.2<br \/>\nOracle VM Manager Software Release 3.2.8.x<\/p>\n<p>Working Theory<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>All ovs tables with 0 rows are corrupted during restore.<\/p>\n<p>Steps to repdroduce<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>1. Restore OVMM database using \/u01\/app\/oracle\/ovm-manager-3\/ovm_shell\/tools\/RestoreDatabase.sh<\/p>\n<p>2. Query all tables in ovs schema<\/p>\n<p>3. Look for ERROR 1146<\/p>\n<p>Workaround<br \/>\n&#8212;&#8212;&#8212;-<\/p>\n<p>1)<br \/>\nservice ovmm stop ; service ovmm_mysql stop<\/p>\n<p>2)<\/p>\n<p>sudo -u oracle \/bin\/bash \/u01\/app\/oracle\/ovm-manager-3\/ovm_shell\/tools\/RestoreDatabase.sh AutoFullBackup-20150510_0100<\/p>\n<p>3)<\/p>\n<p>service ovmm_mysql start<\/p>\n<p>4)<\/p>\n<p>This should identify, drop and re-create affected tables:<\/p>\n<p>\/usr\/bin\/mysql -D ovs -b -f -s -u root -pWelcome1 -S \/u01\/app\/oracle\/mysql\/data\/mysqld.sock -e &#8220;show tables;&#8221; | awk &#8216;{print &#8220;select count(*) from &#8221; $1 &#8220;;&#8221; }&#8217; | \/usr\/bin\/mysql -D ovs -b -f -s -u root -pWelcome1 -S \/u01\/app\/oracle\/mysql\/data\/mysqld.sock 2&gt;&amp;1 &gt;\/dev\/null | grep &#8220;ERROR 1146&#8221; | awk &#8211;field-separator=\\&#8217; &#8216;{print &#8220;drop table &#8221; $2 &#8220;;\\ncreate table &#8221; $2&#8243;(m_id bigint,m_data longblob,primary key (m_id));&#8221;}&#8217; | \/usr\/bin\/mysql -D ovs -b -f -s -u root -pWelcome1 -S \/u01\/app\/oracle\/mysql\/data\/mysqld.sock<\/p>\n<p>5)<\/p>\n<p>service ovmm start<\/p>\n<\/address>\n","protected":false},"excerpt":{"rendered":"<p>If you ever have to restore the Oracle Virtual Machine Manager database using the provided RestoreDatabase.sh, chances are that you will end up with a bunch of corrupted or missing tables in the back-end MySQL database schema. Specifically, all tables &hellip; <a href=\"https:\/\/www.dolicapax.org\/?p=203\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"_links":{"self":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/203"}],"collection":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":3,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/205"}],"wp:attachment":[{"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dolicapax.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}