本文檔旨在提供指南和核對(duì)清單,用于將之前升級(jí)的數(shù)據(jù)庫(kù)從Oracle12c降級(jí)回以前的版本:11.2.0.3,11.2.0.2,11.1.0.7必須加以說(shuō)明的是,將數(shù)據(jù)庫(kù)實(shí)例從當(dāng)前版本降級(jí)到升級(jí)前的版本時(shí),數(shù)據(jù)庫(kù)不會(huì)返回到升級(jí)前的完全相同狀態(tài)。根據(jù)所涉及的版本,升級(jí)過(guò)程會(huì)進(jìn)行不可逆的更改。用戶(hù)使用降級(jí)過(guò)程可以打開(kāi)和訪(fǎng)問(wèn)以前版本的數(shù)據(jù)庫(kù)實(shí)例。這通常便已足夠??赡苄枰扇∑渌僮鳎ɡ缧遁d/重新安裝或重新升級(jí)到當(dāng)前補(bǔ)丁集級(jí)別來(lái)解決降級(jí)后的遺留問(wèn)題。如果目標(biāo)是讓實(shí)例返回與升級(jí)前完全相同的狀態(tài),則還應(yīng)使用包括完全恢復(fù)到升級(jí)前狀態(tài)在內(nèi)的其他過(guò)程。本文中討論的過(guò)程是基于腳本的降級(jí)。本文不介紹使用導(dǎo)出/導(dǎo)入、數(shù)據(jù)泵或其他方法將數(shù)據(jù)從一個(gè)版本移動(dòng)到另一個(gè)版本。您所降級(jí)到的版本的Oracle二進(jìn)制文件,在開(kāi)始降級(jí)過(guò)程之前應(yīng)該在服務(wù)器上可用/已安裝。如果您卸載了要降級(jí)到的Oracle可執(zhí)行文件,請(qǐng)重新安裝Oracle二進(jìn)制文件到正確的版本/補(bǔ)丁程序級(jí)別以降級(jí)。此過(guò)程旨在降級(jí)已成功升級(jí)到12c的數(shù)據(jù)庫(kù),并非用于從失敗的升級(jí)退回。您只能降級(jí)到升級(jí)前所用的版本和補(bǔ)丁程序級(jí)別。直接升級(jí)可以在版本10.2.0.5、11.1.0.7或版本11.2.0.2及更高版本上執(zhí)行??梢詫?duì)這些版本中除10.2.0.5之外的版本進(jìn)行降級(jí)。例如,如果通過(guò)應(yīng)用中間補(bǔ)丁程序11.1.0.7從Oracle11.1.0.6升級(jí)到Oracle12c(12.1.0),則不能降級(jí)到Oracle11.1.0.6。降級(jí)只能對(duì)直接升級(jí)版本執(zhí)行。例外:雖然可以對(duì)10.2.0.5直接升級(jí),但降級(jí)不適用于10.2.0.5。這是因?yàn)樵谏?jí)過(guò)程中,compatible參數(shù)已設(shè)置為最低11.0.0。這使得無(wú)法降級(jí)到10.2.0.5??梢越导?jí)的版本為11.1.0.7、11.2.0.2、11.2.0.3或更高版本。如果有任何補(bǔ)丁程序應(yīng)用到了從升級(jí)后的主目錄運(yùn)行的源數(shù)據(jù)庫(kù),則需要先回退,然后才能開(kāi)始降級(jí)過(guò)程。卸載和回退補(bǔ)丁程序的步驟記錄在所涉及補(bǔ)丁程序的自述文件中。未能卸載和回退補(bǔ)丁程序可能會(huì)導(dǎo)致無(wú)法降級(jí),包括無(wú)法重新驗(yàn)證字典對(duì)象。Exadata捆綁補(bǔ)丁程序示例,其過(guò)程為:卸載補(bǔ)丁程序示例:$opatchauto/u01/app/oracle/patches/14103267-rollback回退任何在補(bǔ)丁程序應(yīng)用過(guò)程中應(yīng)用的SQL:示例:SQL@rdbms/admin/catbundle_EXA__ROLLBACK.sql,用于回退SQL更改。解決方案降級(jí)前步驟-XMLDB組件在12c中是必需的。在升級(jí)到12c期間,將安裝XMLDB組件(如果未安裝)。從12c降級(jí)將刪除安裝的XDB組件-EnterpriseManager不支持降級(jí)。在降級(jí)之前,請(qǐng)重新配置OracleEM控件。請(qǐng)參閱OracleDatabaseUpgradeGuide12cRelease1(12.1)E17642-106DowngradingOracleDatabasetoanEarlierRelease6.6.5RestoringOracleEnterpriseManagerafterDowngradingOracleDatabase-升級(jí)到12c期間,將刪除DatabaseControl資料檔案庫(kù)。降級(jí)之后,請(qǐng)重新配置DBControl。Note870877.1HowToSaveOracleEnterpriseManagerDatabaseControlDataBeforeUpgradingTheSingleInstanceDatabaseToOtherRelease?Note876353.1HowToRestoreTheOracleEnterpriseManagerDataToDowngradeTheSingleInstanceDatabaseToPrevious/SourceRelease?-compatible參數(shù)不能已經(jīng)更改到12.1.0。-禁用DataVault(如果已啟用)。Note803948.1HowToUninstallOrReinstallDatabaseVaultin11g(UNIX)Note453902.1EnablingandDisablingOracleDatabaseVaultinWINDOWS-如果數(shù)據(jù)庫(kù)使用OracleLabelSecurity,則在新OracleDatabase12cOracle主目錄中運(yùn)行OracleLabelSecurity(OLS)預(yù)處理降級(jí)olspredowngrade.sql腳本(在$ORACLE_HOME/rdbms/admin上提供)。-時(shí)區(qū)版本應(yīng)相同。-取消設(shè)置并指向12c主目錄的ORA_TZFILE(如果已設(shè)置)。-如果數(shù)據(jù)庫(kù)上有OracleApplicationExpress,則必須將apxrelod.sql文件從OracleDatabase12c$ORACLE_HOME/apex/目錄復(fù)制到Oracle主目錄之外的目錄,例如系統(tǒng)上的臨時(shí)目錄以稍后執(zhí)行。-如果基于固定對(duì)象創(chuàng)建了對(duì)象,則刪除這些對(duì)象以避免可能的ORA-00600錯(cuò)誤。您可以在降級(jí)之后重新創(chuàng)建這些對(duì)象。-如果降級(jí)集群數(shù)據(jù)庫(kù),則徹底關(guān)閉實(shí)例并將CLUSTER_DATABASE初始化參數(shù)更改為FALSE。降級(jí)之后,必須將此參數(shù)設(shè)置回TRUE。滿(mǎn)足以上先決條件之后,可以繼續(xù)進(jìn)行降級(jí)。數(shù)據(jù)庫(kù)的降級(jí)步驟1)確保所有數(shù)據(jù)庫(kù)組件有效。只能從成功升級(jí)的數(shù)據(jù)庫(kù)執(zhí)行降級(jí)。要驗(yàn)證數(shù)據(jù)庫(kù)組件狀態(tài),請(qǐng)執(zhí)行以下查詢(xún)以SYS用戶(hù)身份連接到數(shù)據(jù)庫(kù)colcomp_idformata10colcomp_nameformata30colversionformata10colstatusformata8selectsubstr(comp_id,1,15)comp_id,substr(comp_name,1,30)comp_name,substr(version,1,10)version,statusfromdba_registry2)驗(yàn)證沒(méi)有屬于sys/system的無(wú)效對(duì)象selectowner,count(object_name)"Invalidobjectcount"fromdba_objectswherestatus!='VALID'andownerin('SYS','SYSTEM')groupbyowner;如果計(jì)數(shù)為零,則可以繼續(xù)降級(jí)。如果有無(wú)效對(duì)象,則執(zhí)行utlrp.sql多次,如果對(duì)象無(wú)法解析為有效狀態(tài),則不能繼續(xù)降級(jí)。建立SR或在DBA社區(qū)上發(fā)帖以尋求幫助?;蛘?,對(duì)于1和2,運(yùn)行以下腳本:Note556610.1ScripttoCollectDBUpgrade/MigrateDiagnosticInformation(dbupgdiag.sql)3)關(guān)閉數(shù)據(jù)庫(kù)Shutdownimmediate4)對(duì)12c數(shù)據(jù)庫(kù)做備份5)以降級(jí)模式啟動(dòng)數(shù)據(jù)庫(kù)Startupdowngrade;6)執(zhí)行降級(jí)腳本SqlSpooldowngrade.logSql@$ORACLE_HOME/rdbms/admin/catdwgrd.sql注:$ORACLE_HOME應(yīng)指向12c主目錄catdwgrd.sql腳本將數(shù)據(jù)庫(kù)中的所有組件降級(jí)到支持的主版本或補(bǔ)丁集版本(您最初升級(jí)時(shí)的版本)SqlspooloffSqlshutdownimmediateExitSQLPlusSqlexit;7)如果操作系統(tǒng)為L(zhǎng)INUX/UNIX:將以下環(huán)境變量更改為要降級(jí)到的源數(shù)據(jù)庫(kù):ORACLE_HOMEPATH編輯/etc/oratabor/var/opt/oracle/oratab以更改將數(shù)據(jù)庫(kù)映射到源數(shù)據(jù)庫(kù)Oracle主目錄如果操作系統(tǒng)是Windows,則完成以下步驟:a.停止所有Oracle服務(wù),包括OracleDatabase12c數(shù)據(jù)庫(kù)的OracleServiceSIDOracle服務(wù),其中SID是實(shí)例名稱(chēng)。例如,如果SID為ORCL,則在命令行提示符中輸入以下內(nèi)容:C:\NETSTOPOracleServiceORCLb.在命令提示符下,通過(guò)運(yùn)行ORADIM命令刪除Oracle服務(wù)。如果出現(xiàn)提示,則輸入此Windows系統(tǒng)上活動(dòng)標(biāo)準(zhǔn)用戶(hù)帳戶(hù)的口令。例如,如果SID為ORCL,則輸入以下命令:C:\ORADIM-DELETE-SIDORCLc.在命令提示符下,使用ORADIM命令創(chuàng)建要降級(jí)的數(shù)據(jù)庫(kù)的Oracle服務(wù)。C:\ORADIM-NEW-SIDSID-INTPWDPASSWORD-MAXUSERSUSERS-STARTMODEAUTO-PFILEORACLE_HOME\DATABASE\INITSID.ORA8)還原配置文件將配置文件(口令文件、參數(shù)文件等)還原到降級(jí)版本的ORACLE_HOME。9)如果這是OracleRAC數(shù)據(jù)庫(kù),則執(zhí)行以下命令以將數(shù)據(jù)庫(kù)修改為單實(shí)例模式:SETCLUSTER_DATABASE=FALSE10)從降級(jí)版本$ORACLE_HOME/rdbms/admin目錄執(zhí)行catrelod腳本。啟動(dòng)sqlplus,以具有sysdba權(quán)限的用戶(hù)SYS身份連接到數(shù)據(jù)庫(kù)實(shí)例,然后以升級(jí)模式啟動(dòng)數(shù)據(jù)庫(kù)::cd$ORACLE_HOME/rdbms/admin:sqlplussqlconnectsysassysdbasqlstartupupgradesqlspoolcatrelod.logsql@?/rdbms/admin/catrelod.sqlsqlspooloffcatrelod.sql腳本在降級(jí)的數(shù)據(jù)庫(kù)中重新加載各個(gè)數(shù)據(jù)庫(kù)組件的合適版本。11)運(yùn)行utlrp.sql腳本:SQL@utlrp.sqlSqlexit;utlrp.sql腳本重新編譯先前處于INVALID狀態(tài)的所有現(xiàn)有PL/SQL模塊,例如package、procedure、type等。12)檢查已降級(jí)數(shù)據(jù)庫(kù)的狀態(tài):Note556610.1ScripttoCollectDBUpgrade/MigrateDiagnosticInformation(dbupgdiag.sql)此sql腳本是一組查詢(xún)語(yǔ)句,用于提供用戶(hù)友好的輸出,以在升級(jí)前后診斷數(shù)據(jù)庫(kù)的狀態(tài)。腳本將創(chuàng)建名為db_upg_diag__.log的文件。13)降級(jí)之后,可能在sys用戶(hù)下發(fā)現(xiàn)無(wú)效的QT視圖。這是因?yàn)橐晥D已從基表中選擇了錯(cuò)誤的列。您需要重新創(chuàng)建這些視圖。請(qǐng)參閱說(shuō)明:Note1520209.1QT_*BUFERViewsInvalidafterdowngradefrom12C降級(jí)后步驟:1)如果您是降級(jí)到OracleDatabase11g版本1(11.1.0.7)并且數(shù)據(jù)庫(kù)中有OracleApplicationExpress,則轉(zhuǎn)到您將apxrelod.sql腳本復(fù)制到的目錄(在降級(jí)前步驟中)。運(yùn)行apxrelod.sql腳本以手動(dòng)重新加載OracleApplicationExpress:SQL@apxrelod.sql運(yùn)行apxrelod.sql腳本以避免程序包APEX_030200.WWV_FLOW_HELP由于以下錯(cuò)誤而成為INVALID狀態(tài):PLS-00201:identifier'CTX_DDL'mustbedeclared2)如果數(shù)據(jù)庫(kù)中啟用了OracleLabelSecurity,則執(zhí)行以下腳本a.從OracleDatabase12c的Oracle主目錄下將olstrig.sql腳本復(fù)制到要將數(shù)據(jù)庫(kù)降級(jí)到的版本的Oracle主目錄。b.從降級(jí)到的版本的Oracle主目錄,運(yùn)行olstrig.sql以在表上使用OracleLabelSecurity策略重新創(chuàng)建DML觸發(fā)器:SQL@olstrig.sql3)如果降級(jí)集群數(shù)據(jù)庫(kù),則必須運(yùn)行以下命令以降級(jí)OracleClusterwaredatabase配置:$srvctldowngradedatabase-ddb-unique-name-ooraclehome-tto_version其中db-unique-name是數(shù)據(jù)庫(kù)名稱(chēng)(而非實(shí)例名稱(chēng)),oraclehome是已降級(jí)數(shù)據(jù)庫(kù)的舊Oracle主目錄的位置,to_version是數(shù)據(jù)庫(kù)所降級(jí)到的數(shù)據(jù)庫(kù)版本
成都創(chuàng)新互聯(lián)公司主營(yíng)三臺(tái)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,成都app軟件開(kāi)發(fā)公司,三臺(tái)h5重慶小程序開(kāi)發(fā)公司搭建,三臺(tái)網(wǎng)站營(yíng)銷(xiāo)推廣歡迎三臺(tái)等地區(qū)企業(yè)咨詢(xún)
ORACLE10G 10.2.0.1升級(jí)到10.2.0.5 2014-06-06 17:23:17
OS: linux redhat 4 U8 64bit
DB: oracle 10.2.0.1
升級(jí):oracle 10.2.0.5
對(duì)當(dāng)前環(huán)境的查詢(xún)
查看磁盤(pán)空間使用情況
[root@dongyang ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 11G 6.2G 64% /
/dev/sda1 988M 42M 896M 5% /boot
tmpfs 1002M 0 1002M 0% /dev/shm
/dev/sdb1 12G 2.3G 9.0G 21% /u01
[root@dongyang ~]#
查看操作系統(tǒng)版本
[root@dongyang ~]# cat /proc/version
Linux version 2.6.32-200.13.1.el5uek (mockbuild@ca-build9.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Wed Jul 27 21:02:33 EDT 2011
[root@dongyang ~]# uname -r
2.6.32-200.13.1.el5uek
[root@dongyang ~]#
查看當(dāng)前數(shù)據(jù)庫(kù)版本
SQL select * from v$version;
select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL
查看oracle用戶(hù)環(huán)境變量
[oracle@dongyang ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
alias uni="uniread sqlplus"
export PATH
unset USERNAME
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export ORACLE_SID=fengzi
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATA_FORMAT="YYYY-MM-DD HH24:MI:SS"
export NLS_DATA_LANGUAGE="AMERICAN"
export DISPLAY=192.168.56.1:0.0
要先對(duì)數(shù)據(jù)庫(kù)進(jìn)行冷備與軟件備份
備份數(shù)據(jù)庫(kù)軟件(磁盤(pán)空間足夠)
[root@dongyang ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 18G 11G 6.2G 64% /
/dev/sda1 988M 42M 896M 5% /boot
tmpfs 1002M 0 1002M 0% /dev/shm
/dev/sdb1 12G 2.3G 9.0G 21% /u01
[root@dongyang ~]#
[root@dongyang ~]# mkdir /u02
[root@dongyang ~]# cd /u01
[root@dongyang u01]# cp -r * /u02
關(guān)閉當(dāng)前數(shù)據(jù)庫(kù)
[oracle@dongyang ~]$ echo $ORACLE_SID
fengzi
[oracle@dongyang ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jun 5 13:46:04 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL
登錄RMAN 啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài)
[oracle@dongyang ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jun 5 13:48:42 2014
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database (not started)
RMANstartup mount
database is already started
database mounted
備份當(dāng)前控制文件
RMAN backup current controlfile;
Starting backup at 05-JUN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=322 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=+DATA/fengzi/backupset/2014_06_05/ncnnf0_tag20140605t140242_0.380.849448965 tag=TAG20140605T140242 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 05-JUN-14
Starting Control File and SPFILE Autobackup at 05-JUN-14
piece handle=+DATA/fengzi/autobackup/2014_06_05/s_849447979.381.849448969 comment=NONE
Finished Control File and SPFILE Autobackup at 05-JUN-14
備份數(shù)據(jù)庫(kù)到 /u01/backup/目錄下
RMAN backup database format '/u01/backup/2014_06_01_%U';
Starting backup at 05-JUN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=+DATA/fengzi/datafile/system.277.842187103
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=/u01/backup/2014_06_01_27pa3431_1_1 tag=TAG20140605T140417 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00007 name=/u01/app/oracle/oradata/FENGZI/datafile/o1_mf_wer_9ns1wd2n_.dbf
input datafile fno=00008 name=/u01/app/oracle/oradata/yyyy12.dbf
input datafile fno=00009 name=/u01/app/oracle/oradata/tt.dbf
input datafile fno=00004 name=+DATA/fengzi/datafile/users2.dbf
input datafile fno=00005 name=+DATA/fengzi/datafile/undotbs.dbf
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=/u01/backup/2014_06_01_28pa345d_1_1 tag=TAG20140605T140417 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00003 name=+DATA/fengzi/datafile/sysaux.279.842187235
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=/u01/backup/2014_06_01_29pa3466_1_1 tag=TAG20140605T140417 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00002 name=+DATA/fengzi/datafile/undotbs1.dbf
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=/u01/backup/2014_06_01_2apa347j_1_1 tag=TAG20140605T140417 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=+DATA/fengzi/datafile/users1.dbf
channel ORA_DISK_1: starting piece 1 at 05-JUN-14
channel ORA_DISK_1: finished piece 1 at 05-JUN-14
piece handle=/u01/backup/2014_06_01_2bpa348d_1_1 tag=TAG20140605T140417 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
Finished backup at 05-JUN-14
Starting Control File and SPFILE Autobackup at 05-JUN-14
piece handle=+DATA/fengzi/autobackup/2014_06_05/s_849447979.382.849449239 comment=NONE
Finished Control File and SPFILE Autobackup at 05-JUN-14
RMAN
停止所有oracle服務(wù),太長(zhǎng)請(qǐng)自己看http //blog.itpub.net/29532781/viewspace-1177188/
oracle手動(dòng)升級(jí)有兩種方式,一種在安裝oracle軟件之后,安裝升級(jí)包,然后創(chuàng)建數(shù)據(jù)庫(kù);另一種在oracle數(shù)據(jù)庫(kù)創(chuàng)建以后,進(jìn)行升級(jí)。
下面主要介紹oracle數(shù)據(jù)庫(kù)創(chuàng)建后進(jìn)行的數(shù)據(jù)庫(kù)升級(jí)(10.2.0.1-10.2.0.4),代碼如下:
SQL --查看當(dāng)前數(shù)據(jù)庫(kù)版本
SQL select * from v$version;
SQL --給用戶(hù)scott解鎖
SQL alter user scott account unlock;
SQL --查看表空間
SQL select * from dba_tablespaces;
SQL --查看數(shù)據(jù)文件存放位置
SQL select * from dba_data_files;
SQL --創(chuàng)建測(cè)試表空間
SQL create tablespace ts_upgrade datafile '/u02/oradata/data/orcl/ts_upgrade01.dbf' size 5m autoextend on maxsize 30g;
SQL --創(chuàng)建用戶(hù)
SQL create user u_upgrade identified by "123456" default tablespace ts_upgrade temporary tablespace temp;
SQL --為用戶(hù)賦權(quán)
SQL grant connect,resource to u_upgrade;
SQL --創(chuàng)建測(cè)試表
SQL create table u_upgrade.dept as select * from scott.dept;
SQL select * from u_upgrade.dept;
[oracle@feegle ~]$ #停止em
[oracle@feegle ~]$ emctl stop dbconsole
[oracle@feegle ~]$ #停止sql*plus
[oracle@feegle ~]$ isqlplusctl stop
[oracle@feegle ~]$ #停止監(jiān)聽(tīng)
[oracle@feegle ~]$ lsnrctl stop
[oracle@feegle ~]$ #安裝升級(jí)包(p6810189_10204_Linux-x86-64.zip)
[oracle@feegle ~]$ #手動(dòng)升級(jí)數(shù)據(jù)庫(kù)
[oracle@feegle ~]$ sqlplus /nolog
SQL conn /as sysdba
SQL --以升級(jí)模式啟動(dòng)數(shù)據(jù)庫(kù)
SQL startup upgrade;
SQL --重建數(shù)據(jù)字典(建議關(guān)閉數(shù)據(jù)庫(kù)歸檔)
SQL spool upgrade.log
SQL @$ORACLE_HOME/rdbms/admin/catupgrd.sql
#####重建數(shù)據(jù)字典部分截圖#####
Oracle Database 10.2 Upgrade Status Utility 06-15-2012 18:27:56
.
Component Status Version HH:MM:SS
Oracle Database Server VALID 10.2.0.4.0 00:12:04
JServer JAVA Virtual Machine VALID 10.2.0.4.0 00:04:58
Oracle XDK VALID 10.2.0.4.0 00:00:32
Oracle Database Java Packages VALID 10.2.0.4.0 00:00:28
Oracle Text VALID 10.2.0.4.0 00:00:25
Oracle XML Database VALID 10.2.0.4.0 00:02:25
Oracle Workspace Manager VALID 10.2.0.4.3 00:00:43
Oracle Data Mining VALID 10.2.0.4.0 00:00:21
OLAP Analytic Workspace VALID 10.2.0.4.0 00:00:23
OLAP Catalog VALID 10.2.0.4.0 00:01:02
Oracle OLAP API VALID 10.2.0.4.0 00:00:53
Oracle interMedia VALID 10.2.0.4.0 00:03:52
Spatial VALID 10.2.0.4.0 00:01:37
Oracle Expression Filter VALID 10.2.0.4.0 00:00:12
Oracle Enterprise Manager VALID 10.2.0.4.0 00:01:18
Oracle Rule Manager VALID 10.2.0.4.0 00:00:10
.
Total Upgrade Time: 00:31:30
DOC#######################################################################
DOC#######################################################################
DOC
DOC The above PL/SQL lists the SERVER components in the upgraded
DOC database, along with their current version and status.
DOC
DOC Please review the status and version columns and look for
DOC any errors in the spool log file. If there are errors in the spool
DOC file, or any components are not VALID or not the current version,
DOC consult the Oracle Database Upgrade Guide for troubleshooting
DOC recommendations.
DOC
DOC Next shutdown immediate, restart for normal operation, and then
DOC run utlrp.sql to recompile any invalid application objects.
DOC
DOC#######################################################################
DOC#######################################################################
DOC#
SQL
#####重建數(shù)據(jù)字典部分截圖#####
SQL spool off
SQL --關(guān)閉數(shù)據(jù)庫(kù)
SQL shutdown immediate;
SQL --啟動(dòng)數(shù)據(jù)庫(kù)
SQL startup;
SQL --編譯無(wú)效對(duì)象
SQL @$ORACLE_HOME/rdbms/admin/utlrp.sql
#####編譯無(wú)效對(duì)象部分截圖#####
DOC 1. Query showing jobs created by UTL_RECOMP
DOC SELECT job_name FROM dba_scheduler_jobs
DOC WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC
DOC 2. Query showing UTL_RECOMP jobs that are running
DOC SELECT job_name FROM dba_scheduler_running_jobs
DOC WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC#
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END 2012-06-15 18:45:01
DOC The following query reports the number of objects that have compiled
DOC with errors (objects that compile with errors have status set to 3 in
DOC obj$). If the number is higher than expected, please examine the error
DOC messages reported with each object (using SHOW ERRORS) to see if they
DOC point to system misconfiguration or resource constraints that must be
DOC fixed before attempting to recompile these objects.
DOC#
OBJECTS WITH ERRORS
-------------------
DOC The following query reports the number of errors caught during
DOC recompilation. If this number is non-zero, please query the error
DOC messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC are due to misconfiguration or resource constraints that must be
DOC fixed before objects can compile successfully.
DOC#
ERRORS DURING RECOMPILATION
---------------------------
SQL
#####編譯無(wú)效對(duì)象部分截圖#####
SQL 驗(yàn)證升級(jí)
SQL --查看組件狀態(tài)
SQL --status=VALID
SQL select comp_name, version, status from sys.dba_registry;
SQL --查看表空間狀態(tài)
SQL select tablespace_name,status from dba_tablespaces;
SQL --查看用戶(hù)
SQL select username from dba_users;
SQL --查看用戶(hù)對(duì)象
SQL select object_name from dba_objects where owner='SCOTT';
SQL select object_name from dba_objects where owner='U_UPGRADE';
SQL select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
[oracle@feegle ~]$ #啟動(dòng)監(jiān)聽(tīng)
[oracle@feegle ~]$ lsnrctl start
[oracle@feegle ~]$ #啟動(dòng)EM
[oracle@feegle ~]$ emctl start dbconsole
[oracle@feegle ~]$ #啟動(dòng)SQL*PLUS
[oracle@feegle ~]$ isqlplusctl start
把GI 和 RAC從 11.2.0.3升級(jí)到11.2.0.4的主要步驟:
1. 升級(jí)GI
1) 下載11.2.0.4 GI軟件:
11.2.0.4的下載鏈接:
p13390677_112040_platform_3of7.zip是 Oracle Grid Infrastructure (includes Oracle ASM, Oracle Clusterware, and Oracle Restart)。
2) 安裝11.2.0.4 GI到一個(gè)新的ORACLE_HOME(不要停止舊的GI,所有節(jié)點(diǎn)GI都啟動(dòng))。
3) 安裝的時(shí)候選擇“Upgrade Oracle Grid Infrastructure or Oracle Automatic Storage Management”。
4) 安裝結(jié)束時(shí),根據(jù)提示用root用戶(hù)在各個(gè)節(jié)點(diǎn)依次執(zhí)行rootupgrade.sh 。
5) 修改grid用戶(hù)的環(huán)境變量ORACLE_HOME 和 PATH 等到新的路徑
6) 參考 11.2 GI 升級(jí)的官方文檔:
Oracle? Grid Infrastructure Installation Guide
11g Release 2 (11.2) for Linux
E41961-02
F How to Upgrade to Oracle Grid Infrastructure 11g Release 2
2. 升級(jí)RAC數(shù)據(jù)庫(kù)軟件
1) 下載 11.2.0.4數(shù)據(jù)庫(kù)軟件:
p13390677_112040_platform_1of7.zip
p13390677_112040_platform_2of7.zip
上面的兩個(gè)補(bǔ)丁包是Oracle Database (includes Oracle Database and Oracle RAC)。
2) 在安裝前一定要取消oracle用戶(hù)的ORACLE_BASE, ORACLE_HOME, ORACLE_SID等的設(shè)置。
3) 安裝 11.2.0.4 RAC 到一個(gè)新的ORACLE_HOME,選擇只安裝軟件不建庫(kù)(Install database software only)
4) 在安裝11.2.0.4的過(guò)程中設(shè)置正確的ORACLE_BASE and ORACLE_HOME.
5) 安裝的要求請(qǐng)參考11.2官方文檔:
Oracle? Real Application Clusters Installation Guide
11g Release 2 (11.2) for Linux and UNIX
E41962-03
3. 升級(jí)已有的數(shù)據(jù)庫(kù)
1) 升級(jí)前一定要備份數(shù)據(jù)庫(kù)。
2) 運(yùn)行utlu112i.sql 來(lái)進(jìn)行升級(jí)前的檢查(數(shù)據(jù)庫(kù)是啟動(dòng)的):
su - oracle
export ORACLE_HOME=舊的ORACLE_HOME
export ORACLE_SID=實(shí)例名
$ORACLE_HOME/bin/sqlplus / as sysdba
SQL @/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/utlu112i.sql ==這是新的ORACLE_HOME下面的腳本,修正這個(gè)腳本所發(fā)現(xiàn)的所有問(wèn)題。
3) 運(yùn)行11.2.0.4的DBUA來(lái)升級(jí)數(shù)據(jù)庫(kù):
新的ORACLE_HOME/bin/dbua
DBUA 將會(huì)執(zhí)行的工作:
-DBUA會(huì)從/etc/oratab獲得數(shù)據(jù)庫(kù)的信息
- 停止數(shù)據(jù)庫(kù)和DBConsole
- 在新的ORACLE_HOME創(chuàng)建密碼文件
- 拷貝spfile到新的ORACLE_HOME 并且去除obsolete的參數(shù)
- 在DBUA中可以選擇備份數(shù)據(jù)庫(kù)
- 在DBUA中可以把數(shù)據(jù)文件從file system/raw devices 遷移到ASM (需要保證diskgroup是mount的)
4) 修改oracle用戶(hù)的環(huán)境變量ORACLE_HOME 和 PATH 等到新的路徑
5) 請(qǐng)參考 數(shù)據(jù)庫(kù)升級(jí)到11.2的官方文檔
分享題目:怎么升級(jí)oracle補(bǔ)丁,oracle版本升級(jí)方法
轉(zhuǎn)載源于:http://m.rwnh.cn/article36/dscossg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站建設(shè)、虛擬主機(jī)、面包屑導(dǎo)航、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)