{"id":484,"date":"2021-05-07T18:47:16","date_gmt":"2021-05-07T16:47:16","guid":{"rendered":"https:\/\/anjo.pt\/keyword-oracle\/?p=484"},"modified":"2021-05-19T11:39:51","modified_gmt":"2021-05-19T09:39:51","slug":"recover-oem-repository-from-old-schema-backup","status":"publish","type":"post","link":"https:\/\/anjo.pt\/keyword-oracle\/2021\/05\/07\/recover-oem-repository-from-old-schema-backup\/","title":{"rendered":"Recover OEM repository from old schema backup"},"content":{"rendered":"\n<p>Things not always go right, and recently I had to recover the OEM repository using a one month old datapump backup. Only SYSMAN schema was corrupted, and I did not touch the other schemas.<\/p>\n\n\n\n<p>I probably still miss doing some things and this post is mostly a note to make it faster for other people going through the process and not having a DB backup&#8230; <\/p>\n\n\n\n<p>A full restore of the database would be certainly a much better and efficient solution than the one below. \ud83d\ude42<\/p>\n\n\n\n<p>To recover the corrupted SYSMAN schema where the OEM repository resides, first I drop it and then I did:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# Restore user\nimpdp schemas=SYSMAN directory=BACKUP_DIR dumpfile=expdp_sysman_april2021.dmp include=USER\n\n# Restore system grants:\nSQL&gt; grant execute on dbms_crypto to sysman;\nSQL&gt; grant execute on dbms_lock to sysman;\nSQL&gt; grant execute on dbms_rls to sysman;\nSQL&gt; grant execute on dbms_aq to sysman;\nSQL&gt; grant execute on dbms_aqadm to sysman;\nSQL&gt; grant execute on dbms_alert to sysman;\n\n# Restore other object grants \nimpdp directory=BACKUP_DIR dumpfile=expdp_sysman_april2021.dmp include=GRANT\n\n# Restore data\nimpdp schemas=SYSMAN directory=BACKUP_DIR dumpfile=expdp_sysman_april2021.dmp \n\n# Restart queues\n\/* select &#039;exec DBMS_AQADM.START_QUEUE(queue_name =&gt; &#039;&#039;SYSMAN.&#039;||name||&#039;&#039;&#039;);&#039; from dba_queues where enqueue_enabled like &#039;%NO%&#039; and owner=&#039;SYSMAN&#039; order by 1; *\/\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.MGMT_ADMINMSG_BUS&#039;,true,true);\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.EM_CNTR_QUEUE&#039;,true,true);\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.EM_LOADERJOB_QUEUE&#039;,true,true);\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.EM_EVENT_BUS&#039;,true,true);\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.EM_NOTIFY_Q&#039;,true,true);\nSQL&gt; exec dbms_aqadm.start_queue(&#039;SYSMAN.EM_GROUP_EVENT_Q&#039;,true,true);\nSQL&gt; exec DBMS_AQADM.START_QUEUE(&#039;SYSMAN.EM_JOB_STATUS_UPD_Q&#039;);\nSQL&gt; exec DBMS_AQADM.START_QUEUE(&#039;SYSMAN.MGMT_HOST_PING_Q&#039;);\nSQL&gt; exec DBMS_AQADM.START_QUEUE(&#039;SYSMAN.MGMT_LOADER_Q&#039;);\nSQL&gt; exec DBMS_AQADM.START_QUEUE(&#039;SYSMAN.MGMT_NOTIFY_INPUT_Q&#039;);\nSQL&gt; exec DBMS_AQADM.START_QUEUE(&#039;SYSMAN.MGMT_TASK_Q&#039;);\nSQL&gt; commit;\n\n# Perform partitionion maintenance (as SYSMAN):\nSQL&gt; exec gc_interval_partition_mgr.partition_maintenance;\nSQL&gt; exec mgmt_audit_admin.add_audit_partition;\n<\/pre><\/div>\n\n\n<p>Start OEM again:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nemctl start oms\n<\/pre><\/div>\n\n\n<p>Unblock the agents (Setup &#8211; Manage Cloud Control &#8211; Agents &#8211; select blocked agents + &#8220;unblock&#8221;) and on each monitored host, clear the agent state, restart it and test:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nemctl clearstate agent\nemctl stop agent\nemctl start agent\nemctl control agent runCollection $(hostname -f):host Response\nemctl status agent\n<\/pre><\/div>\n\n\n<p>After this, OEM was running again without problems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Things not always go right, and recently I had to recover the OEM repository using a one month old datapump backup. Only SYSMAN schema was corrupted, and I did not touch the other schemas. I probably still miss doing some things and this post is mostly a note to make it faster for other people [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":{"0":"post-484","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-oms","7":"czr-hentry"},"_links":{"self":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/484","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\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/comments?post=484"}],"version-history":[{"count":2,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"predecessor-version":[{"id":487,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/posts\/484\/revisions\/487"}],"wp:attachment":[{"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anjo.pt\/keyword-oracle\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}