標籤:
探索Oracle之資料庫升級九
12.1.0.1 Update 12.1.0.2
一、檢查當前資料庫版本及系統資訊
[[email protected] ~]$ lsb_release -aLSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarchDistributor ID: RedHatEnterpriseServerDescription: Red Hat Enterprise Linux Server release 5.8 (Tikanga)Release: 5.8Codename: Tikanga[[email protected] ~]$ uname -aLinux db01 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Li[[email protected] DBData]$ df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol00 53G 26G 24G 52% //dev/sda1 99M 13M 82M 14% /boottmpfs 4.0G 1.1G 3.0G 26% /dev/shmSQL> select * from v$version;BANNER CON_ID-------------------------------------------------------------------------------- ----------Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0PL/SQL Release 12.1.0.1.0 - Production 0CORE 12.1.0.1.0 Production 0TNS for Linux: Version 12.1.0.1.0 - Production 0NLSRTL Version 12.1.0.1.0 - Production 0SQL> col comp_name format a40SQL> col version format a13SQL> col control format a8SQL> col status format a15SQL> set line 300SQL> set pagesize 800SQL> select comp_name,version,control,status from dba_server_registry;COMP_NAME VERSION CONTROL STATUS---------------------------------------- ------------- -------- ---------------Oracle Database Vault 12.1.0.1.0 SYS VALIDOracle Application Express 4.2.0.00.27 SYS VALIDOracle Label Security 12.1.0.1.0 SYS VALIDSpatial 12.1.0.1.0 SYS VALIDOracle Multimedia 12.1.0.1.0 SYS VALIDOracle Text 12.1.0.1.0 SYS VALIDOracle Workspace Manager 12.1.0.1.0 SYS VALIDOracle XML Database 12.1.0.1.0 SYS VALIDOracle Database Catalog Views 12.1.0.1.0 SYS VALIDOracle Database Packages and Types 12.1.0.1.0 SYS VALIDJServer JAVA Virtual Machine 12.1.0.1.0 SYS VALIDOracle XDK 12.1.0.1.0 SYS VALIDOracle Database Java Packages 12.1.0.1.0 SYS VALIDOLAP Analytic Workspace 12.1.0.1.0 SYS VALIDOracle OLAP API 12.1.0.1.0 SYS VALIDOracle Real Application Clusters 12.1.0.1.0 SYS OPTION OFF16 rows selected.
二、刪除EM
[[email protected] ~]$ emctl stop dbconsoleSQL> @$ORACLE_HOME/rdbms/admin/emremove.sqlold 69: IF (upper('&LOGGING') = 'VERBOSE')new 69: IF (upper('VERBOSE') = 'VERBOSE')PL/SQL procedure successfully completed.[[email protected] ~]$ rm –rf $ORACLE_HOME/$HOSTNAME[[email protected] ~]$ rm –rf $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole_*
三、備份資料庫
RMAN> backup database plus archivelog delete input format '/DBBackup/Phycal/full_%U.bak';Starting backup at 02-DEC-14current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log backup setchannel ORA_DISK_1: specifying archived log(s) in backup setinput archived log thread=1 sequence=48 RECID=1 STAMP=865232107input archived log thread=1 sequence=49 RECID=2 STAMP=865232108input archived log thread=1 sequence=50 RECID=3 STAMP=865232110input archived log thread=1 sequence=51 RECID=4 STAMP=865232124input archived log thread=1 sequence=52 RECID=5 STAMP=865232126input archived log thread=1 sequence=53 RECID=6 STAMP=865232129input archived log thread=1 sequence=54 RECID=7 STAMP=865232130input archived log thread=1 sequence=55 RECID=8 STAMP=865232199input archived log thread=1 sequence=56 RECID=9 STAMP=865232199input archived log thread=1 sequence=57 RECID=10 STAMP=865232203input archived log thread=1 sequence=58 RECID=11 STAMP=865232203input archived log thread=1 sequence=59 RECID=12 STAMP=865232203input archived log thread=1 sequence=60 RECID=13 STAMP=865232203input archived log thread=1 sequence=61 RECID=14 STAMP=865232209input archived log thread=1 sequence=62 RECID=15 STAMP=865232380channel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBBackup/Phycal/full_05pp4pfs_1_1.bak tag=TAG20141202T061940 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: deleting archived log(s)archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_48_b7st3cbs_.arc RECID=1 STAMP=865232107archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_49_b7st3d69_.arc RECID=2 STAMP=865232108archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_50_b7st3fwr_.arc RECID=3 STAMP=865232110archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_51_b7st3wto_.arc RECID=4 STAMP=865232124archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_52_b7st3ydw_.arc RECID=5 STAMP=865232126archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_53_b7st41h9_.arc RECID=6 STAMP=865232129archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_54_b7st428n_.arc RECID=7 STAMP=865232130archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_55_b7st66z1_.arc RECID=8 STAMP=865232199archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_56_b7st67ox_.arc RECID=9 STAMP=865232199archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_57_b7st6c1b_.arc RECID=10 STAMP=865232203archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_58_b7st6c22_.arc RECID=11 STAMP=865232203archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_59_b7st6c6y_.arc RECID=12 STAMP=865232203archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_60_b7st6c7o_.arc RECID=13 STAMP=865232203archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_61_b7st6kq8_.arc RECID=14 STAMP=865232209archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_62_b7stcwmv_.arc RECID=15 STAMP=865232380Finished backup at 02-DEC-14Starting backup at 02-DEC-14using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00004 name=/DBData/WOO12C/datafile/o1_mf_undotbs1_b7gh653v_.dbfinput datafile file number=00001 name=/DBData/WOO12C/datafile/o1_mf_system_b7gh4dtv_.dbfinput datafile file number=00003 name=/DBData/WOO12C/datafile/o1_mf_sysaux_b7gh21p2_.dbfinput datafile file number=00006 name=/DBData/WOO12C/datafile/o1_mf_users_b7gh6409_.dbfchannel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBData/fast_recovery_area/WOO12C/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stcyyx_.bkp tag=TAG20141202T061942 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:36channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00014 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_sysaux_b7gknfyd_.dbfinput datafile file number=00013 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_system_b7gknfmp_.dbfinput datafile file number=00015 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_users_b7gkngh6_.dbfchannel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBData/fast_recovery_area/WOO12C/0847D2A3397B02B0E0533307A8C077E9/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stgzdo_.bkp tag=TAG20141202T061942 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:55channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00009 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_sysaux_b7ghrvm2_.dbfinput datafile file number=00008 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_system_b7ghrvnw_.dbfinput datafile file number=00010 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_users_b7ght9rv_.dbfchannel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBData/fast_recovery_area/WOO12C/08D98EA3271835F9E0533307A8C068EE/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stlll8_.bkp tag=TAG20141202T061942 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:55channel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00007 name=/DBData/WOO12C/datafile/o1_mf_sysaux_b7gh7gjq_.dbfinput datafile file number=00005 name=/DBData/WOO12C/datafile/o1_mf_system_b7gh7gkl_.dbfchannel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBData/fast_recovery_area/WOO12C/08D970F59616336FE0533307A8C03C35/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stn9ly_.bkp tag=TAG20141202T061942 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:01:05Finished backup at 02-DEC-14Starting backup at 02-DEC-14current log archivedusing channel ORA_DISK_1channel ORA_DISK_1: starting archived log backup setchannel ORA_DISK_1: specifying archived log(s) in backup setinput archived log thread=1 sequence=63 RECID=16 STAMP=865232715channel ORA_DISK_1: starting piece 1 at 02-DEC-14channel ORA_DISK_1: finished piece 1 at 02-DEC-14piece handle=/DBBackup/Phycal/full_0app4pqb_1_1.bak tag=TAG20141202T062515 comment=NONEchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01channel ORA_DISK_1: deleting archived log(s)archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_63_b7stpbxz_.arc RECID=16 STAMP=865232715Finished backup at 02-DEC-14Starting Control File and SPFILE Autobackup at 02-DEC-14piece handle=/DBData/fast_recovery_area/WOO12C/autobackup/2014_12_02/o1_mf_s_865232716_b7stpfto_.bkp comment=NONEFinished Control File and SPFILE Autobackup at 02-DEC-14
四、上傳解壓12.1.0.2安裝介質,並解壓縮
[[email protected] ~]$ ll p17694377_121020*-rw-r--r-- 1 oracle oinstall 1673517582 Dec 2 05:38 p17694377_121020_Linux-x86-64_1of8.zip-rw-r--r-- 1 oracle oinstall 1014527110 Nov 28 02:44 p17694377_121020_Linux-x86-64_2of8.zip[[email protected] ~]$ unzip p17694377_121020_Linux-x86-64_1of8.zip[[email protected] ~]$ unzip p17694377_121020_Linux-x86-64_2of8.zip
五、建立使用者安裝12.1.0.2的軟體目錄
[[email protected] ~]$ cd /DBSoft/Product/[[email protected] Product]$ ls12.1.0[[email protected] Product]$ mkdir -p 12.1.0.2/db_1[[email protected] Product]$ lltotal 8drwxr-xr-x 3 oracle oinstall 4096 Nov 20 05:39 12.1.0drwxr-xr-x 3 oracle oinstall 4096 Dec 2 07:57 12.1.0.2
六、開始安裝:
七、軟體安裝完成之後執行root.sh指令碼
[[email protected] ~]# /DBSoft/Product/12.1.0.2/db_1/root.shPerforming root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /DBSoft/Product/12.1.0.2/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]:The contents of "dbhome" have not changed. No need to overwrite.The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n)[n]: y Copying oraenv to /usr/local/bin ...The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed byDatabase Configuration Assistant when a database is createdFinished running generic part of root script.Now product-specific root actions will be performed.[[email protected] ~]#
八、至此升級安裝已經完成。
九、完成之後檢查資料庫版本:
SQL> set line 300SQL> set pagesize 1000SQL> r 1* select * from v$versionBANNER CON_ID-------------------------------------------------------------------------------- ----------Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0PL/SQL Release 12.1.0.2.0 - Production 0CORE 12.1.0.2.0 Production 0TNS for Linux: Version 12.1.0.2.0 - Production 0NLSRTL Version 12.1.0.2.0 - Production 0
十、檢查各組件版本:
SQL> select comp_name,version,control,status from dba_server_registry;COMP_NAME VERSION CONTROL STATUS---------------------------------------- ------------- -------- ---------------Oracle Database Vault 12.1.0.2.0 SYS VALIDOracle Application Express 4.2.5.00.08 SYS VALIDOracle Label Security 12.1.0.2.0 SYS VALIDSpatial 12.1.0.2.0 SYS VALIDOracle Multimedia 12.1.0.2.0 SYS VALIDOracle Text 12.1.0.2.0 SYS VALIDOracle Workspace Manager 12.1.0.2.0 SYS VALIDOracle XML Database 12.1.0.2.0 SYS VALIDOracle Database Catalog Views 12.1.0.2.0 SYS VALIDOracle Database Packages and Types 12.1.0.2.0 SYS VALIDJServer JAVA Virtual Machine 12.1.0.2.0 SYS VALIDOracle XDK 12.1.0.2.0 SYS VALIDOracle Database Java Packages 12.1.0.2.0 SYS VALIDOLAP Analytic Workspace 12.1.0.2.0 SYS VALIDOracle OLAP API 12.1.0.2.0 SYS VALIDOracle Real Application Clusters 12.1.0.2.0 SYS OPTION OFF16 rows selected.
十一、檢查資料庫失效對象,是沒有失效的對象,如果有的話執行utlrcmp.sql重新編譯
SQL> select owner, object_name, object_type, status from dba_objects where status=\'INVALID\' order by 1, 2,3;no rows selectedSQL>
十一、open 所有PDBs,並查看PDBs狀態
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB01 MOUNTED 4 WOO_ORA11G MOUNTEDSQL> alter pluggable database all open;Pluggable database altered.SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB01 READ WRITE NO 4 WOO_ORA11G READ WRITE NO
探索Oracle之資料庫升級九 12.1.0.1 Update 12.1.0.2