首页 > 代码库 > 探索Oracle之数据库升级九 12.1.0.1 Update 12.1.0.2

探索Oracle之数据库升级九 12.1.0.1 Update 12.1.0.2

探索Oracle之数据库升级九

12.1.0.1 Update 12.1.0.2

一、检查当前数据库版本及系统信息

[oracle@db01 ~]$ lsb_release -a
LSB 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-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.8 (Tikanga)
Release: 5.8
Codename: Tikanga
[oracle@db01 ~]$ uname -a
Linux db01 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Li

[oracle@db01 DBData]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       53G 26G 24G 52% /
/dev/sda1 99M 13M 82M 14% /boot
tmpfs 4.0G 1.1G 3.0G 26% /dev/shm

SQL> select * from v$version;

BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production 0
PL/SQL Release 12.1.0.1.0 - Production 0
CORE 12.1.0.1.0 Production 0
TNS for Linux: Version 12.1.0.1.0 - Production 0
NLSRTL Version 12.1.0.1.0 - Production 0

SQL> col comp_name format a40
SQL> col version format a13
SQL> col control format a8
SQL> col status format a15
SQL> set line 300
SQL> set pagesize 800
SQL> select comp_name,version,control,status from dba_server_registry;

COMP_NAME VERSION CONTROL STATUS
---------------------------------------- ------------- -------- ---------------
Oracle Database Vault 12.1.0.1.0 SYS VALID
Oracle Application Express 4.2.0.00.27 SYS VALID
Oracle Label Security 12.1.0.1.0 SYS VALID
Spatial 12.1.0.1.0 SYS VALID
Oracle Multimedia 12.1.0.1.0 SYS VALID
Oracle Text 12.1.0.1.0 SYS VALID
Oracle Workspace Manager 12.1.0.1.0 SYS VALID
Oracle XML Database 12.1.0.1.0 SYS VALID
Oracle Database Catalog Views 12.1.0.1.0 SYS VALID
Oracle Database Packages and Types 12.1.0.1.0 SYS VALID
JServer JAVA Virtual Machine 12.1.0.1.0 SYS VALID
Oracle XDK 12.1.0.1.0 SYS VALID
Oracle Database Java Packages 12.1.0.1.0 SYS VALID
OLAP Analytic Workspace 12.1.0.1.0 SYS VALID
Oracle OLAP API 12.1.0.1.0 SYS VALID
Oracle Real Application Clusters 12.1.0.1.0 SYS OPTION OFF

16 rows selected.

二、删除EM

[oracle@db01 ~]$ emctl stop dbconsole
SQL> @$ORACLE_HOME/rdbms/admin/emremove.sql
old 69: IF (upper('&LOGGING') = 'VERBOSE')
new 69: IF (upper('VERBOSE') = 'VERBOSE')

PL/SQL procedure successfully completed.
[oracle@db01 ~]$ rm –rf $ORACLE_HOME/$HOSTNAME
[oracle@db01 ~]$ 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-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=48 RECID=1 STAMP=865232107
input archived log thread=1 sequence=49 RECID=2 STAMP=865232108
input archived log thread=1 sequence=50 RECID=3 STAMP=865232110
input archived log thread=1 sequence=51 RECID=4 STAMP=865232124
input archived log thread=1 sequence=52 RECID=5 STAMP=865232126
input archived log thread=1 sequence=53 RECID=6 STAMP=865232129
input archived log thread=1 sequence=54 RECID=7 STAMP=865232130
input archived log thread=1 sequence=55 RECID=8 STAMP=865232199
input archived log thread=1 sequence=56 RECID=9 STAMP=865232199
input archived log thread=1 sequence=57 RECID=10 STAMP=865232203
input archived log thread=1 sequence=58 RECID=11 STAMP=865232203
input archived log thread=1 sequence=59 RECID=12 STAMP=865232203
input archived log thread=1 sequence=60 RECID=13 STAMP=865232203
input archived log thread=1 sequence=61 RECID=14 STAMP=865232209
input archived log thread=1 sequence=62 RECID=15 STAMP=865232380
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBBackup/Phycal/full_05pp4pfs_1_1.bak tag=TAG20141202T061940 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel 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=865232107
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_49_b7st3d69_.arc RECID=2 STAMP=865232108
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_50_b7st3fwr_.arc RECID=3 STAMP=865232110
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_51_b7st3wto_.arc RECID=4 STAMP=865232124
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_52_b7st3ydw_.arc RECID=5 STAMP=865232126
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_53_b7st41h9_.arc RECID=6 STAMP=865232129
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_54_b7st428n_.arc RECID=7 STAMP=865232130
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_55_b7st66z1_.arc RECID=8 STAMP=865232199
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_56_b7st67ox_.arc RECID=9 STAMP=865232199
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_57_b7st6c1b_.arc RECID=10 STAMP=865232203
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_58_b7st6c22_.arc RECID=11 STAMP=865232203
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_59_b7st6c6y_.arc RECID=12 STAMP=865232203
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_60_b7st6c7o_.arc RECID=13 STAMP=865232203
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_61_b7st6kq8_.arc RECID=14 STAMP=865232209
archived log file name=/DBData/fast_recovery_area/WOO12C/archivelog/2014_12_02/o1_mf_1_62_b7stcwmv_.arc RECID=15 STAMP=865232380
Finished backup at 02-DEC-14
Starting backup at 02-DEC-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/DBData/WOO12C/datafile/o1_mf_undotbs1_b7gh653v_.dbf
input datafile file number=00001 name=/DBData/WOO12C/datafile/o1_mf_system_b7gh4dtv_.dbf
input datafile file number=00003 name=/DBData/WOO12C/datafile/o1_mf_sysaux_b7gh21p2_.dbf
input datafile file number=00006 name=/DBData/WOO12C/datafile/o1_mf_users_b7gh6409_.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBData/fast_recovery_area/WOO12C/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stcyyx_.bkp tag=TAG20141202T061942 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00014 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_sysaux_b7gknfyd_.dbf
input datafile file number=00013 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_system_b7gknfmp_.dbf
input datafile file number=00015 name=/DBData/WOO12C/0847D2A3397B02B0E0533307A8C077E9/datafile/o1_mf_users_b7gkngh6_.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBData/fast_recovery_area/WOO12C/0847D2A3397B02B0E0533307A8C077E9/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stgzdo_.bkp tag=TAG20141202T061942 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00009 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_sysaux_b7ghrvm2_.dbf
input datafile file number=00008 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_system_b7ghrvnw_.dbf
input datafile file number=00010 name=/DBData/WOO12C/08D98EA3271835F9E0533307A8C068EE/datafile/o1_mf_users_b7ght9rv_.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBData/fast_recovery_area/WOO12C/08D98EA3271835F9E0533307A8C068EE/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stlll8_.bkp tag=TAG20141202T061942 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00007 name=/DBData/WOO12C/datafile/o1_mf_sysaux_b7gh7gjq_.dbf
input datafile file number=00005 name=/DBData/WOO12C/datafile/o1_mf_system_b7gh7gkl_.dbf
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBData/fast_recovery_area/WOO12C/08D970F59616336FE0533307A8C03C35/backupset/2014_12_02/o1_mf_nnndf_TAG20141202T061942_b7stn9ly_.bkp tag=TAG20141202T061942 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 02-DEC-14
Starting backup at 02-DEC-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=63 RECID=16 STAMP=865232715
channel ORA_DISK_1: starting piece 1 at 02-DEC-14
channel ORA_DISK_1: finished piece 1 at 02-DEC-14
piece handle=/DBBackup/Phycal/full_0app4pqb_1_1.bak tag=TAG20141202T062515 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel 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=865232715
Finished backup at 02-DEC-14
Starting Control File and SPFILE Autobackup at 02-DEC-14
piece handle=/DBData/fast_recovery_area/WOO12C/autobackup/2014_12_02/o1_mf_s_865232716_b7stpfto_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 02-DEC-14
四、上传解压12.1.0.2安装介质,并解压缩
[oracle@db01 ~]$ 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
[oracle@db01 ~]$ unzip p17694377_121020_Linux-x86-64_1of8.zip
[oracle@db01 ~]$ unzip p17694377_121020_Linux-x86-64_2of8.zip

五、创建用户安装12.1.0.2的软件目录

[oracle@db01 ~]$ cd /DBSoft/Product/
[oracle@db01 Product]$ ls
12.1.0
[oracle@db01 Product]$ mkdir -p 12.1.0.2/db_1
[oracle@db01 Product]$ ll
total 8
drwxr-xr-x 3 oracle oinstall 4096 Nov 20 05:39 12.1.0
drwxr-xr-x 3 oracle oinstall 4096 Dec 2 07:57 12.1.0.2

六、开始安装:

七、软件安装完成之后执行root.sh脚本

[root@db01 ~]# /DBSoft/Product/12.1.0.2/db_1/root.sh
Performing 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 by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
[root@db01 ~]#

八、至此升级安装已经完成。

九、完成之后检查数据库版本:

SQL> set line 300
SQL> set pagesize 1000
SQL> r 
  1* select * from v$version

BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
TNS for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL 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 VALID
Oracle Application Express 4.2.5.00.08 SYS VALID
Oracle Label Security 12.1.0.2.0 SYS VALID
Spatial 12.1.0.2.0 SYS VALID
Oracle Multimedia 12.1.0.2.0 SYS VALID
Oracle Text 12.1.0.2.0 SYS VALID
Oracle Workspace Manager 12.1.0.2.0 SYS VALID
Oracle XML Database 12.1.0.2.0 SYS VALID
Oracle Database Catalog Views 12.1.0.2.0 SYS VALID
Oracle Database Packages and Types 12.1.0.2.0 SYS VALID
JServer JAVA Virtual Machine 12.1.0.2.0 SYS VALID
Oracle XDK 12.1.0.2.0 SYS VALID
Oracle Database Java Packages 12.1.0.2.0 SYS VALID
OLAP Analytic Workspace 12.1.0.2.0 SYS VALID
Oracle OLAP API 12.1.0.2.0 SYS VALID
Oracle Real Application Clusters 12.1.0.2.0 SYS OPTION OFF

16 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 selected

SQL>

十一、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 MOUNTED
SQL> 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