df -hTFilesystem Type Size Used Avail Use% Mounted on/dev/mapper/VolGroup-lv_root ext4 43G 20G 22G 48% /tmpfs tmpfs 3.9G 109M 3.8G 3% /dev/shm/dev/sda1 ext4 477M 85M 364M 19% /bootfree total used free shared buffers cachedMem: 817478458102322364552111112196636731784-/+ buffers/cache: 48818123292972Swap: 16777212016777212su - gridopatch lspatches22502505;ACFS Patch Set Update : 11.2.0.4.160419 (22502505)23054319;OCW Patch Set Update : 11.2.0.4.160719 (23054319)24732075;Database Patch Set Update : 11.2.0.4.170418 (24732075)exitsu - oraclesqlplus / as sysdbaselect PROPERTY_VALUE from database_properties where PROPERTY_NAME='NLS_RDBMS_VERSION';PROPERTY_VALUE--------------------------------------------------11.2.0.4.0select name,db_unique_name,open_mode,database_role from v$database;NAME DB_UNIQUE_NAME OPEN_MODE DATABASE_ROLE--------- ------------------------------ -------------------- ----------------DGT dgts READ WRITE PRIMARY
升级GI
# 关闭数据库 shutdown immediatecd /oradata/softwareunzip V839960-01.zip# root用户下,安装cvuqdisk## cvuqdisk存于oracle安装介质的rpm目录下,解压缩database的安装介质即可看到此包cd /oradata/software/database/rpm/export CVUQDISK_GRP=asmadminrpm -ivh cvuqdisk-1.0.10-1.rpm# 创建GI的新HOME目录su - gridmkdir -p /u01/app/12.2.0/gridchown -R grid:oinstall /u01/app/12.2.0chmod -R 775 /u01/app/12.2.0cd /u01/app/12.2.0/gridunzip /oradata/software/V840012-01.zipsqlplus / as sysasm# 如果不设置这个参数,11.2默认是到/dev/raw/*查找asm disk,但12C 默认是到/dev/sd*去查alter system set asm_diskstring='/dev/raw/*' scope=both;# 不修改compatible安装时会报错col COMPATIBILITY form a10col DATABASE_COMPATIBILITY form a10col NAME form a20select group_number, name,compatibility, database_compatibility from v$asm_diskgroup;GROUP_NUMBER NAME COMPATIBIL DATABASE_C------------ -------------------- ---------- ----------1 DATA 11.2.0.0.010.1.0.0.02 FRA 11.2.0.0.010.1.0.0.0asmcmd setattr -G DATA compatible.asm 11.2.0.4.0asmcmd setattr -G FRA compatible.asm 11.2.0.4.0select group_number, name,compatibility, database_compatibility from v$asm_diskgroup;GROUP_NUMBER NAME COMPATIBIL DATABASE_C------------ -------------------- ---------- ----------1 DATA 11.2.0.4.010.1.0.0.02 FRA 11.2.0.4.010.1.0.0.0# 开始图形化安装export DISPLAY=10.240.4.150:0.0unset ORACLE_HOMEunset ORACLE_BASEunset ORACLE_SIDcd /u01/app/12.2.0/grid./gridSetup.sh
确保数据库实例已经关闭后,点YES
# root用户下执行,交互确认都输入y,时间较长,耐心等待完成/u01/app/12.2.0/grid/rootupgrade.shOverwrite it? (y/n) y # ...2017/06/2117:45:31 CLSRSC-482: Running command: 'srvctl upgrade model -s 11.2.0.4.0 -d 12.2.0.1.0 -p first'2017/06/2117:45:46 CLSRSC-482: Running command: 'srvctl upgrade model -s 11.2.0.4.0 -d 12.2.0.1.0 -p last'dgts 2017/06/2117:45:48 /u01/app/12.2.0/grid/cdata/dgts/backup_20170621_174548.olr 0dgts 2017/06/08 18:10:20 /u01/app/11.2.0.4/grid/cdata/dgts/backup_20170608_181020.olr - CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'dgts'CRS-2673: Attempting to stop 'ora.evmd' on 'dgts'CRS-2677: Stop of 'ora.evmd' on 'dgts' succeededCRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'dgts' has completedCRS-4133: Oracle High Availability Services has been stopped.CRS-4123: Oracle High Availability Services has been started.2017/06/2118:03:27 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
# 执行预升级脚本检查java -jar $ORACLE_BASE/product/12.2.0/db_1/rdbms/admin/preupgrade.jarPreupgrade generated files:/u01/app/oracle/cfgtoollogs/dgts/preupgrade/preupgrade.log /u01/app/oracle/cfgtoollogs/dgts/preupgrade/preupgrade_fixups.sql /u01/app/oracle/cfgtoollogs/dgts/preupgrade/postupgrade_fixups.sqlSQL> @/u01/app/oracle/cfgtoollogs/dgts/preupgrade/preupgrade_fixups.sql#--------------------------------------------------------------------------------------------Executing Oracle PRE-Upgrade Fixup ScriptAuto-Generated by: Oracle Preupgrade Script Version: 12.2.0.1.0 Build: 1Generated on: 2017-06-1700:54:45For Source Database: DGTSource Database Version: 11.2.0.4.0For Upgrade to Version: 12.2.0.1.0 FixupCheck Name Status Further DBA Action---------- ------ ------------------dictionary_stats Passed NonePL/SQL procedure successfully completed.#--------------------------------------------------------------------------------------------# 使用dbua图形化工具升级DBcd /u01/app/oracle/product/12.2.0/db_1/binexport DISPLAY=10.240.4.150:0.0./dbua
# 没有执行preupgrade_fixups.sql,按提示手动执行以下命令EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;# 停止原11g数据库shutdown immediatevi /home/oracle/.bash_profileexport ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1sqlplus / as sysdba#--------------------------------------------------------------------------------------------SQL*Plus: Release 12.2.0.1.0 Production on Sat Jun 1701:50:542017Copyright (c) 1982, 2016, Oracle. All rights reserved.Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL> #--------------------------------------------------------------------------------------------col COMP_ID for a10col COMP_NAME for a40selectsubstr(comp_id,1,15) comp_id,substr(comp_name,1,30) comp_name,substr(version,1,10) version,statusfrom dba_registry order by modified;COMP_ID COMP_NAME VERSION STATUS---------- ---------------------------------------- -------------------- ----------------------CATALOG Oracle Database Catalog Views 12.2.0.1.0 VALIDCATPROC Oracle Database Packages and T 12.2.0.1.0 INVALIDOWM Oracle Workspace Manager 12.2.0.1.0 VALIDXDB Oracle XML Database 12.2.0.1.0 VALID# 检查orattabcat /etc/oratab+ASM:/u01/app/12.2.0/grid:N # line added by Agentdgts:/u01/app/oracle/product/12.2.0/db_1:N