生產環境oracle10g升級至11g準備工作

liuhaimiao發表於2017-02-15
最近需要生產系統從10.2.0.5.升級到11.2.0.2.0
做了不少的準備工作,硬是在週末自己搭了測試環境,照著自己準備的升級步驟練習了一番。
除過基本的檢查,從Metalink上下載了最新的psu,和公司的資深dba確認後,提供了給了客戶。這樣資料庫就算是升級到11.2.0.2.10

主要有以下的步驟 :
1.new ORACLE_HOME(11g), old ORACLE_HOME (10g)
--這些需要提前提供給客戶,作為基本的約定
2.install oracle software 11.2.0.2.0 on production
--總共有7個DB,時間很緊,所以準備要充分
3.apply DB patch additional if needed
--patch詳細資訊參見 Note:16056267.8
11.2.0.2.10 (Apr 2013) Database Patch Set Update (PSU) Patch:16056267
4.init parameter tuning
--這個也是必需的,主要有三個方面
    11g裡面可能過期的引數,如user_dump......
     11g裡面新增加的引數,如diag....,有些需要考慮是否調優。
     10g裡面調優的隱含引數是否需要保留...
5.OS kernel tuning
--系統級的調優也是必須的。需要找專門的team來提供意見。
6.PET and Production compare
--準生產環境的準備,需要做足前期的測試工作。
7.confirm details with App team if have any concern.
--對於升級過程中的部分問題,如果不能確認,需要找開發或者其他的team來協調。

8.full backup or cold backup
--這個取決於具體的環境實施方案,保證充足的備份很重要,生產系統做cold backup應該很懸了。

9.check if there are crontab running or scheduled.
--這個需要提前考慮,一般的專案都會有系統監控,要保證在升級過程中排除不必要的影響。如果有goldengate同步之類的,也需要提前協調好,保證不會影響。
10.check if all database components are valid
--可以使用如下的sql來
select substr(comp_name,1,40) comp_name, status, 
substr(version,1,10) version from dba_registry 
order by comp_name;   --組建都應該是valid狀態。
11.check if all objects are valid 
--檢查object狀態也應該是valid.
if there are component or objects invalid, need to use utlrp.sql
to recompile
12.check if duplicate objects owned by SYS and SYSTEM Schema
--從dba_objects裡查詢,保證sys,system下的沒有重複的object,,以下是期望的結果,如果有其他的,需要檢視metalink文件來處理。Note,1030426.6

 OBJECT_NAME OBJECT_TYPE

------------------------------ -------------------
AQ$_SCHEDULES TABLE
AQ$_SCHEDULES_PRIMARY INDEX
DBMS_REPCAT_AUTH PACKAGE
DBMS_REPCAT_AUTH PACKAGE BODY

13.disable custom triggers
--為了排除trigger的導致的ddl影響,建議還是disable custom trigger.
14.Copy Pre-upgrade Information script. to a local folder
--建一個臨時的資料夾,把升級所需的指令碼複製過去。如指令碼rdbms/admin/utlu112i.sql 需要從11ghome下rdbms/admin提前複製過去。
15.Run Pre-upgrade Information Tool on target database (10g)
--spool一下,做升級前的檢查工作。
sqlplus / as sysdba
spool pre_upgrade_info.log
@utlu112i.sql
spool off
16.Check the output of the Pre-Upgrade Information Tool
--這裡需要注意warning資訊,清空recyclebin,保證timezone file必須是v4,要不升級100%失敗。還有要注意部分引數,根據提示進行修改。
17.backup  /etc/oratab,tnsnames.ora,listener.ora           sqlnet.ora,password file, pfile,spfile,profile
--備份必要的檔案,作為rollback的備份。
18.Copy Network files to 11g Home and modify the home in listener
--複製tnsnames.ora,listener.ora到11g home的對應目錄下。
19.Copy password file to 11g Home
--複製密碼檔案
20.Prepare a separate .bash_profile to set 11g environment variables
--profile檔案也需要做相應修改。


21.Collect dictionary stats
--使用如下的包來
EXEC DBMS_STATS.GATHER_DICTIONARY_STATS;
22.Stop Listener services of the target database.
--停掉監聽,開始升級
23.Shutdown the target database (10g)
--down掉資料庫,清空快取,這樣起來以後跑指令碼會排出很多干擾,速度也快一些。
24.Set working environment to 11g ORACLE_HOME. Make sure multiple ORACLE HOMEs are not in the PATH variable.
25.Copy spfile to 11g home.
26.stop source(10g) DB,Start the db in nomount,mount mode, and make necessary changes/adjustments in spfile with scope=spfile.
--這一步,需要修改compatible引數,調節一些引數。(之前的步驟進行引數調優的時候準備好的)  
最後create spfile from pfile;
27.Shutdown and startup the db in upgrade mode.
--啟動資料庫,使用spfile,
--startup upgrade
28.Run upgrade script. Exit the session after upgrade.
--這個是最關鍵的指令碼,執行時間也會長一些。,指令碼執行完成後,會自動shutfdown immediate
spool upgrade11g2.log
@?/rdbms/admin/catupgrd.sql
Spool off
Exit
29.Verify the log for errors. Ignore “table or view not found” errors
--如果有部分錯誤,需要檢查,如果有些錯誤如memory issue 不能忽略,需要重新執行指令碼
30.Startup the db in normal mode and run post upgrade information tool. Verify the status of each db component and address the failures.
--啟動資料庫,執行如下的指令碼。
spool post_upgrade_info.txt
@?/rdbms/admin/utlu112s.sql
Spool
31.Continue upgrade (new in 11g)  
--繼續執行指令碼,屬於post upgrade指令碼。
Spool upgrade11g2.log
@?/rdbms/admin/catuppst.sql
Spool off
32.Recompile invalid objects
33.enable custom triggers
--enable之前disable的trigger
34.update /etc/oratab with 11g home
--更改該配置,在某些應用中會用到。
35.rename spfile/pfile from 10g home
--保證10g的引數不被使用,保證不會有錯誤的操作導致不必要的麻煩。
36.Start Listener services of the target database with 11g HOME.
--確定後啟動監聽。
37.DBA sanity check(check if mv is able to refresh,db components are valid,check if there are ORA erros from logs)
--DBA先做一些簡單的sanity test.保證環境交給客戶之前不會有基本的錯誤。
38.Check the connectivity from client
--然後從客戶端進行測試,連線是否正常。
39.Backup of DB after upgrade
--進行必要的備份。
40.upgrade rman catalog if necessary
--如果使用rman做備份恢復,需要升級catalog
41.change crontab 
--可以修改crontab,使其生效。

--大體的步驟就以上這麼多,也希望大家拍磚,提供修正意見。:)

-------------------------------------------------------------------------------
2013-0714:補充:升級完之後 升級timezone file.
SQL> select *from v$timezone_file;

FILENAME                VERSION
-------------------- ----------
timezlrg_4.dat                4
需要升級到14,要不可能會有一些問題。 參照文件Note:977512.1:



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/223653/viewspace-2133585/,如需轉載,請註明出處,否則將追究法律責任。

相關文章