{"id":786,"date":"2015-11-21T14:03:32","date_gmt":"2015-11-21T13:03:32","guid":{"rendered":"https:\/\/www.krombusch.de\/?p=786"},"modified":"2021-11-01T12:36:38","modified_gmt":"2021-11-01T11:36:38","slug":"oracle-upgrade-auf-11-2-0-4","status":"publish","type":"post","link":"https:\/\/www.krombusch.de\/?p=786","title":{"rendered":"Oracle-Upgrade auf 11.2.0.4"},"content":{"rendered":"<p>Die schlechte Nachricht: Man vergisst jedes Mal was. IMMER.<br \/>\nDie gute Nachricht: Ist nicht so schlimm. Kann nachgeholt werden. Kostet aber Zeit.<\/p>\n<p>Im Folgenden wird von einer Windows-Installation mit zwei Instanzen ausgegangen. Das Upgrade wird von remote ausgef\u00fchrt, deshalb alle Aktionen soweit als m\u00f6glich per Skript.<br \/>\nGesamte Zeitdauer: Backup + 3 Stunden<\/p>\n<p><!--more--><\/p>\n<p>Parameter:<br \/>\nSetup-CDs wurden nach c:\\temp\\11.2.0.4 entpackt. Patches aus dem OTN nach c:\\temp\\patch, neuer opatch nach c:\\temp\\opatch<br \/>\naltes ORACLE_HOME: c:\\oracle\\product\\11.2.0\\db_home1<br \/>\nneues ORACLE_HOME: c:\\oracle\\product\\11.2.0.4\\db_home1<br \/>\nInstanzen hei\u00dfen im Beispiel Inst1 und Inst2<\/p>\n<p>cmd &#8222;Als Administrator ausf\u00fchren&#8220;<br \/>\ncd c:\\temp<br \/>\nnet stop &#8222;OracleMTSRecoveryService&#8220;<br \/>\nnet stop &#8222;Distributed Transaction Coordinator&#8220;<br \/>\n.\\11.2.0.4\\database\\setup.exe<br \/>\nHier alle Optionen wie bei der &#8222;letzten&#8220; Installation.<\/p>\n<p>set ORACLE_HOME=c:\\oracle\\product\\11.2.0.4\\dbhome_1<br \/>\nmove %ORACLE_HOME%\\opatch %ORACLE_HOME%\\opatch.old<br \/>\nmove c:\\temp\\opatch %ORACLE_HOME%\\<br \/>\ncd .\\patch\\20833831<br \/>\n%ORACLE_HOME%\\Opatch\\opatch apply<br \/>\nDatum des Patches \u00fcberpr\u00fcfen mit %ORACLE_HOME%\\Opatch\\opatch lsinventory.<\/p>\n<p>set ORACLE_HOME=c:\\oracle\\product\\11.2.0\\dbhome_1<br \/>\nset ORACLE_SID=INST1<br \/>\nsqlplus sys\/ as sysdba<br \/>\nselect count(*) from all_objects where status=&#8217;INVALID&#8216;;<br \/>\n@?\\rdbms\\admin\\utlrp.sq<br \/>\n@C:\\oracle\\product\\11.2.0.4\\dbhome_1\\RDBMS\\ADMIN\\utlu112i.sql<br \/>\ncreate pfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\initINST1.ora&#8216; from spfile;<br \/>\ncreate spfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\SPFILEINST1.ORA&#8216; from pfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\initINST1.ora&#8216;;<br \/>\nexit<\/p>\n<p>copy C:\\oracle\\product\\11.2.0\\dbhome_1\\database\\PWDINST1.ora C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database<\/p>\n<p>Gleich werden die Instanzen runtergefahren. Mit dem Verzeichnis der Datenbankfiles selbst (c:\\u01\\&#8230;) passiert nichts.<\/p>\n<p>set ORACLE_SID=INST2<br \/>\nsqlplus sys\/ as sysdba<br \/>\nselect count(*) from all_objects where status=&#8217;INVALID&#8216;;<br \/>\n@?\\rdbms\\admin\\utlrp.sq<br \/>\n@C:\\oracle\\product\\11.2.0.4\\dbhome_1\\RDBMS\\ADMIN\\utlu112i.sql<br \/>\ncreate pfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\initINST2.ora&#8216; from spfile;<br \/>\ncreate spfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\SPFILEINST2.ORA&#8216; from pfile=&#8217;C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database\\initINST2.ora&#8216;;<br \/>\nshutdown immediate<br \/>\nexit<\/p>\n<p>copy C:\\oracle\\product\\11.2.0\\dbhome_1\\database\\PWDINST2.ora C:\\oracle\\product\\11.2.0.4\\dbhome_1\\database<\/p>\n<p>set ORACLE_SID=INST1<br \/>\nsqlplus sys\/ as sysdba<br \/>\nshutdown immediate<br \/>\nexit<\/p>\n<p>lsnrctl stop<br \/>\ncopy C:\\oracle\\product\\11.2.0\\dbhome_1\\network\\admin\\*.ora C:\\oracle\\product\\11.2.0.4\\dbhome_1\\network\\admin<br \/>\nACHTUNG FALLE: In der sqlnet.ora steht wahrscheinlich noch der Pfad zum alten ORACLE_HOME. Verhindert am Ende fr\u00f6hlich die Deinstallation der alten Software. Anpassen.<\/p>\n<p>sc delete OracleOraDb11g_home1TNSListener<br \/>\nset ORACLE_HOME=c:\\oracle\\product\\11.2.0.4\\dbhome_1<br \/>\ncd %ORACLE_HOME%\\bin<br \/>\nlsnrctl start<br \/>\n(Neuer Listener wird dadurch automatisch angelegt.)<\/p>\n<p>set ORACLE_HOME=c:\\oracle\\product\\11.2.0\\dbhome_1<br \/>\noradim -DELETE -SID INST1<br \/>\noradim -DELETE -SID INST2<\/p>\n<p>set ORACLE_HOME=c:\\oracle\\product\\11.2.0.4\\dbhome_1<br \/>\noradim -new -sid INST1 -startmode manual -srvcstart system -spfile<br \/>\noradim -new -sid INST1 -startmode manual -srvcstart system -spfile<br \/>\n(Ich w\u00fcrde Oracle-Instanzen immer manuell starten. Glaubenssache.)<\/p>\n<p>Ab jetzt parallel in zwei Terminals. Skripte laufen ca. 2 Stunden. Die meiste Zeit wird der Server damit besch\u00e4ftigt sein, Archivelogs auf die Platte(n) zu schreiben.<\/p>\n<p>cd %ORACLE_HOME%\\rdbms\\admin<br \/>\nset ORACLE_SID=INST1<br \/>\nsqlplus sys\/ as sysdba<br \/>\nstartup upgrade<br \/>\nspool c:\\temp\\INST1_11.2.0.4.log<br \/>\n@catupgrd.sql<br \/>\n&#8230;<br \/>\nsqlplus sys\/ as sysdba<br \/>\nstartup<br \/>\n@?\/rdbms\/admin\/utlrp.sql<br \/>\nexecute dbms_stats.gather_fixed_objects_stats;<br \/>\n@?\/rdbms\/admin\/catuppst.sql<br \/>\n&#8230;<br \/>\n@?\/rdbms\/admin\/utlu112s.sql<\/p>\n<p>set ORACLE_SID=INST2<br \/>\nsqlplus sys\/ as sysdba<br \/>\nstartup upgrade<br \/>\nspool c:\\temp\\INST2_11.2.0.4.log<br \/>\n@catupgrd.sql<br \/>\n&#8230;<br \/>\nsqlplus sys\/ as sysdba<br \/>\nstartup<br \/>\n@?\/rdbms\/admin\/utlrp.sql<br \/>\nexecute dbms_stats.gather_fixed_objects_stats;<br \/>\n@?\/rdbms\/admin\/catuppst.sql<br \/>\n&#8230;<br \/>\n@?\/rdbms\/admin\/utlu112s.sql<\/p>\n<p>set ORACLE_HOME=c:\\oracle\\product\\11.2.0\\dbhome_1<br \/>\ncd %ORACLE_HOME%\\deinstall<br \/>\n.\\deinstall.bat<br \/>\nWenn das nicht funktioniert:<br \/>\nset ORACLE_HOME=<br \/>\nc:\\oracle\\product\\11.2.0\\dbhome_1\\deinstall\\deinstall.bat<br \/>\nnet start &#8222;OracleMTSRecoveryService&#8220;<br \/>\nnet start &#8222;Distributed Transaction Coordinator&#8220;<\/p>\n<p>Auf invalid_objects pr\u00fcfen. Bei uns waren die ctx-Packages fehlerhaft:<br \/>\ngrant select on SYS.DBA_INDEXES to ctxsys;<br \/>\ngrant select on SYS.DBA_TRIGGERS to ctxsys;<br \/>\ngrant select on SYS.DBA_PART_KEY_COLUMNS to ctxsys;<br \/>\ngrant select on SYS.DBA_SEGMENTS to ctxsys;<\/p>\n<p>ACHTUNG FALLE: Die Config der dbconsole ist im alten ORACLE_HOME. Also im Zweifel schon gel\u00f6scht. M\u00f6glicherweise steht aber noch was in der Registry, was auf den alten Standort verweist. Bei uns stand der SYSMAN-Key mit den alten Pfaden noch unter HKLM\\Software\\Oracle. Key l\u00f6schen.<\/p>\n<p>set ORACLE_SID=INST1<br \/>\nset ORACLE_UNQNAME=INST1<br \/>\nset ORACLE_HOME=c:\\oracle\\product\\11.2.0.4\\dbhome_1<br \/>\n%ORACLE_HOME%\\bin\\emca -config dbcontrol db -repos recreate<br \/>\n(Erste Instanz wird automatisch auf Port 1158 erzeugt, zweite Instanz auf Port 5500).<br \/>\nWenn ORA-01017 kommt: In sqlnet.ora die Authentifizierung von NONE auf NTS umstellen).<\/p>\n<p>Pro Instanz im normalen Betrieb f\u00fcr ca. 1 Stunde laufen lassen:<br \/>\nDBMS_STATS.gather_system_stats(&#8218;Start&#8216;);<br \/>\nDBMS_STATS.gather_system_stats(&#8218;Stop&#8216;);<\/p>\n<p>Datenbank-Directories valide, oder steht da noch der alte Pfad?<br \/>\nSELECT * FROM dba_directories;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Die schlechte Nachricht: Man vergisst jedes Mal was. IMMER. Die gute Nachricht: Ist nicht so schlimm. Kann nachgeholt werden. Kostet [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-786","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/posts\/786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=786"}],"version-history":[{"count":4,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":819,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=\/wp\/v2\/posts\/786\/revisions\/819"}],"wp:attachment":[{"href":"https:\/\/www.krombusch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.krombusch.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}