您好,登錄后才能下訂單哦!
環境
目前環境10.2.0.4
OS版本 linux5.5
新環境數據庫版本:11.2.0.4.17
OS 版本: linx6.5
一.安裝
在192.0.2.12機器上安裝軟件
11.2.0.4 并打上11.2.0.4.170418
注意:在11.2.0.4上打上最新的PSU,
這樣就不用跑兩次catbundle.sql,減少停機時間。
二 檢查
1. 在升級之前,確保所有的組件和對象都是valid:
select substr(comp_name,1,40) comp_name, status, substr(version,1,10) version from dba_registry order by comp_name;
COMP_NAME STATUS VERSION
-------------------------------------------------------------------------------- ---------------------- --------------------
JServer JAVA Virtual Machine VALID 10.2.0.4.0
OLAP Analytic Workspace VALID 10.2.0.4.0
OLAP Catalog VALID 10.2.0.4.0
Oracle Data Mining VALID 10.2.0.4.0
Oracle Database Catalog Views VALID 10.2.0.4.0
Oracle Database Java Packages VALID 10.2.0.4.0
Oracle Database Packages and Types VALID 10.2.0.4.0
Oracle Enterprise Manager VALID 10.2.0.4.0
Oracle Expression Filter VALID 10.2.0.4.0
Oracle interMedia VALID 10.2.0.4.0
Spatial VALID 10.2.0.4.0
SQL> select substr(object_name,1,40) object_name,substr(owner,1,15) owner,object_type
from dba_objects where status='INVALID' order by owner,object_type;
no rows selected --針對對象
如果有invalid的對象,運行utlrp.sql重新編譯對象。
三、升級前工作
1.
從11gR2的Oracle Home下拷貝以下文件至一個臨時文件夾:
$ORACLE_HOME/rdbms/admin/utlu112i.sql
2.
SQL> ! pwd
/home/oracle10g
SQL> spool upgrade_info.log
SQL> set time on
18:34:03 SQL> set timing on
18:34:09 SQL> @/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/utlu112i.sql
**********************************************************************
Elapsed: 00:00:04.40
18:34:41 SQL> spool off ;
保存此文件upgrade_info.log
3.檢查腳本
set timing on
SQL> set time on
19:35:54 SQL> @/u03/arch/dbupgdiag.sql
Enter location for Spooled output:
Enter value for 1: /u03/arch/
Upload db_upg_diag_erpdb_11_Jul_2017_0736.log from "/u03/arch/" directory
Elapsed: 00:00:00.00
編譯失效對象
SQL> @utlrp.sql
四:異機恢復
1.備份數據庫
腳本如下:
run{
crosscheck archivelog all;
crosscheck backup;
delete noprompt obsolete;
delete noprompt expired backup;
allocate channel d1 type disk ;
allocate channel d2 type disk;
backup format '/u03/bk/%T_%d_%s_%p.bk' tag 'full_data' database ;
backup format '/u03/bk/%T_%d_%s_%p.arc' tag 'full_arc' archivelog all delete all input ;
backup format '/u03/bk/%T_%d_%s_%p.ctl' tag 'full_ctl' current controlfile;
release channel d1;
release channel d2;
}
2. 把pfile initerpdb.ora 和密碼文件orapwerpdb scp到192.0.2.12 上
3.把備份文件mount到192.0.2.12上,省去copy耗時間的麻煩。
4.修改pfile文件添加
_optim_dict_stats_at_db_cr_upg = false-此參數為了在運行catupgrd.sql慢的問題
5.在192.0.2.102
啟數據庫
startup nomount
rman target /
startup nomount
restore controlfile from '/u03/bk/20170712_ERPDB_12_1.ctl'
run
{
set newname for datafile 1 to '/u01/app/oracle/oradata/erpdb/sys01.bdf';--- 如果是asm可以改為磁盤組'+dgdata'
set newname for datafile 2 to '/u01/app/oracle/oradata/erpdb/syu02.bdf';
set newname for datafile 3 to '/u01/app/oracle/oradata/erpdb/sy03.bdf';
set newname for datafile 4 to '/u01/app/oracle/oradata/erpdb/sy04.bdf';
restore database;
switch datafile all;
recover database;
}
6.在生產庫手動切3-4歸檔, (一下操作需要停生產庫的業務)
如果數據庫量大的話,備份歸檔日志
backup format '/u03/bk/%T_%d_%s_%p.arc' tag 'full_arc' archivelog all delete all input ; --
并應用日志。
7. catalog backuppiece '/u03/bk/20170712_ERPDB_17_1.arc'; --注冊備份集
restore archivelog from sequence 48 until sequence 52; 還原
recover database;
8.臨時表空間
Select 'alter database rename file '''||NAME||''' to'''||'/目錄/tempfile/'||''';' from v$tempfile;
alter database rename file '/u03/app/oracle/oradata/erpdb/temp01.dbf' to'/u01/app/oracle/oradata/erpdb/temp01.dbf';
9.redo日志
select 'alter database rename file '''||MEMBER||''' to'''||'目錄/redofile/'||''';'from v$logfile;
alter database rename file '/u03/app/oracle/oradata/erpdb/redo03.log' to'/u01/app/oracle/oradata/erpdb/redo03.log';
alter database rename file '/u03/app/oracle/oradata/erpdb/redo02.log' to'/u01/app/oracle/oradata/erpdb/redo02.log';
alter database rename file '/u03/app/oracle/oradata/erpdb/redo01.log' to'/u01/app/oracle/oradata/erpdb/redo01.log';
10. alter database open resetlogs upgrade;
spool upgrade.log
@?/rdbms/admin/catupgrd.sql --此步驟時間比較長(本測試在95分鐘)
spool off ;
創建spfile文件
create spfile from pfile ;
startup
ALTER SYSTEM SET compatible='11.2.0.0.0' SCOPE=SPFILE;
exec dbms_stats.gather_dictionary_stats;
編譯對象
@?/rdbms/admin/utlrp.sql
數據庫層面應用PSU
SQL> @?/rdbms/admin/catbundle.sql psu apply
說明:
至此10gR2升級到11.2.0.4完成。其實在生產數據庫升級時,升級性能測試比較重要也會和業務配合,需要考慮很多問題如:
1.應用中間件jdk
2.應用在10g-11R2的特性的用法。
3.壓力測試
4.sql語句的性能(SPA測試)
參考文檔
手動升級到 Oracle Database 11gR2 (11.2)的完整核對清單 (文檔 ID 1674333.1)
數據庫 升級/降級 兼容性矩陣 (文檔 ID 1577660.1)
收集數據庫升級/遷移診斷信息的腳本 (dbupgdiag.sql) (文檔 ID 1577288.1)
如何下載并運行Oracle數據庫預升級實用程序 (文檔 ID 1577379.1)
Script. to Collect DB Upgrade/Migrate Diagnostic Information (dbupgdiag.sql) [ID 556610.1]
During A Manual Database Upgrade To 11.2, Gathering DictionaryStatistics Takes Too Long (catupgrd.sql, cmpupend.sql) [ID 1425763.1
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。