oracle 10g 10.2.0.4 32位升级到64位

32位升到64位有以下几种方法:

1.copy datafile后运行脚本升级

2.rman restore后运行脚本升级

3.通过exp/imp,expdp/impdp的transfer tablespace表空间传输

https://blog.csdn.net/jolly10/article/details/82491614

 

下面的测试是通过rman restore进行升级的过程。

准备将以前安装的所有32位的oracle服务器都升级到64位。

1.当前环境:

[root@qht115 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.6 (Tikanga)
[oracle@qht115 Disk1]$ uname -a
Linux qht115 2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
[oracle@qht115 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jul 6 12:22:20 2018

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

操作是redhat 5.6 64位的,数据库是10.2.0.4 32位的,目标是只升级数据库到64位,oracle版本号暂不改变。

2. 获取数据库完整的文件,方法可以是冷备份的一致性copy,或者rman完整恢复。

我是通过rman恢复的一个全备份。

[oracle@qht115 orcl]$ pwd
/u01/oradata/orcl
[oracle@qht115 orcl]$ ls
clt_stats01.dbf   CSPSPACE_003.dbf  redo01.log  sysaux01.dbf
control01.ctl     l5mspace01.dbf    redo02.log  system01.dbf
control02.ctl     magspace01.dbf    redo03.log  temp01.dbf
control03.ctl     mtrxspace01.dbf   redo04.log  undotbs01.dbf
CSPSPACE_001.dbf  mtrxspace02.dbf   redo05.log  users01.dbf
CSPSPACE_002.dbf  qhtdata01.dbf     redo06.log

先备份一下,防止升级出现 问题:

[oracle@qht115 orcl]$ cp /u01/oradata/orcl/* /u01/oradata/orcl_bak

将32位的oracle软件改名,接着安装64位的oracle:

[oracle@qht115 u01]$ mv /u01/app /u01/app_32bit
[oracle@qht115 u01]$ echo $ORACLE_HOME
/u01/app/oracle/product/10201
[oracle@qht115 u01]$ mkdir -p /u01/app/oracle/product/10201

3.下载64位的oracle 软件,包括 10.2.0.1的基本包以及10.2.0.4的升级包。

https://pan.baidu.com/disk/home?#/all?vmode=list&path=%2F%E6%B5%B7%E9%87%8FIT%E8%B5%84%E6%96%99%20%2B%20%E5%90%84%E7%A7%8D%E5%B9%B3%E5%8F%B0%E4%B8%8B%E7%9A%84Oracle%E5%AE%89%E8%A3%85%E6%96%87%E4%BB%B6%20%2B%20%E5%85%AC%E5%BC%80%E8%AF%BE%E5%BD%95%E5%83%8F%20%2B%20%E5%90%84%E7%A7%8D%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B%E8%B5%84%E6%96%99%2FLinux%20Oracle%20%E5%AE%89%E8%A3%85%E5%8C%85%2Foracle%2010.2.0.1%20-%2010.2.0.5%20for%20linux%20x86-64

4.安装及打10.2.0.4的patch,这里过程就忽略了。

sqlplus或rman时如果出现error while loading shared libraries: libaio.so.1,解决办法:

https://blog.csdn.net/jolly10/article/details/82219603

ORACLE_HOME不改变,继续是/u01/app/oracle/product/10201,安装好后:

[oracle@qht115 u01]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jul 6 05:15:02 2018

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

5.准备spfile,先建立spfile中需要的目录

[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/adump
[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/bdump
[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/cdump
[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/udump
[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/dpdump
[oracle@qht115 oracle]$ mkdir -p /u01/app/oracle/admin/orcl/archive
[oracle@qht115 dbs]$ mkdir -p /u01/app/oracle/admin/orcl/flash_recovery_area

从其它库中找一个pfile复制到新库

SQL>  create pfile='$ORACLE_HOME/dbs/initorcl.ora' from spfile;

File created.
[oracle@qht106 dbs]$ scp initorcl.ora 172.17.61.115:/u01/app/oracle/product/10201/dbs

注销掉pfile.ora的#*.use_indirect_data_buffers=TRUE,这个参数是32位能需要用到的,扩展SGA到超过1.7G的。

并新增加参数 _SYSTEM_TRIG_ENABLED = false,关闭DDL审核触发器。

SQL> startup nomount pfile='/u01/app/oracle/product/10201/dbs/initorcl.ora';
ORACLE instance started.

6.建立spfile,通过spfile启动来升级数据库。

SQL> create spfile from pfile;
SQL> shutdown immediate;
SQL> startup upgrade;

7.编译对象

SQL> @?/rdbms/admin/utlirp.sql

由于是32bit升级到64bit,这个脚本必须执行,从utlirp.sql的说明有这么一段:

@$ORACLE_HOME/rdbms/admin/catupgrd.sql  --这个脚本跨版本必须使用,由于我没有跨版本就可以不执行。

 

重新启动数据库后用utlrp编译失效对象

SQL> shutdown immediate;
SQL> startup

@?/rdbms/admin/utlrp.sql 

第一次居然执行失败,执行的过程中被异常中止了,查一下无效对象:

SQL>  SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);

  COUNT(*)
----------
       553

utlrp.sql执行过程中出现问题,无效的对象太多,通过依次执行下列语句

$ cd /u01/app/oracle/product/102/db_1/olap/admin/

SQL> @?/olap/admin/catnoamd.sql

SQL> @?/olap/admin/catnoaps.sql

SQL> @?/olap/admin/catnoxoq.sql

SQL> @?/olap/admin/olapidrp.plb

SQL>@?/olap/admin/olap.sql SYSAUX TEMP;

然后再次执行

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

再次查询

SQL> SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);

  COUNT(*)
----------
        47


SQL> select OWNER#,NAME,TYPE# FROM obj$ WHERE status IN (4, 5, 6);

    OWNER# NAME                                TYPE#
---------- ------------------------------ ----------
        62 PBMET_DEAL                              5
        62 PB_240_100116_OFFICE                    5
        62 PB_240_100116_AGENCY                    5
        62 PB_240_100116_USER                      5
        62 PB_240_100116_ID_ADV                    5
         1 EQUIPMENT                               5
         1 TRAVEL_EXPENSE                          5
         1 OFFICE_EXPENSE                          5
         1 TRAVEL_EXPENSE_AMEND                    5
       109 BIN$z263+iALaj/gQBGsaj06iA==$0         12
       109 BIN$z263+iATaj/gQBGsaj06iA==$0         12

    OWNER# NAME                                TYPE#
---------- ------------------------------ ----------
       118 BIN$2GfZeoQNJ5PgQBGsaj0U6w==$0         12
       118 BIN$2GfZeoQOJ5PgQBGsaj0U6w==$0         12
       118 BIN$2GfZeoQPJ5PgQBGsaj0U6w==$0         12
        74 BIN$88DotI6S0SbgQBGsaj1hLw==$0         12
        74 BIN$88DotI6T0SbgQBGsaj1hLw==$0         12
        74 BIN$88DvQXQpT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQqT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQtT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQuT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQxT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQyT8LgQBGsaj1huw==$0         12

    OWNER# NAME                                TYPE#
---------- ------------------------------ ----------
        74 BIN$88DvQXQ1T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQ2T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQ5T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQ6T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQ9T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXQ+T8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRBT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRCT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRFT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRGT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRJT8LgQBGsaj1huw==$0         12

    OWNER# NAME                                TYPE#
---------- ------------------------------ ----------
        74 BIN$88DvQXRKT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRNT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXROT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRRT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRST8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRVT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRWT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRZT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRaT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXRdT8LgQBGsaj1huw==$0         12
        74 BIN$88DvQXReT8LgQBGsaj1huw==$0         12

    OWNER# NAME                                TYPE#
---------- ------------------------------ ----------
        62 BIN$YndrJa7PGMLgUBGsaj0KGA==$0         12
       109 BIN$CUXaB1pKD3fgUBGsaj1uUg==$0         12
       109 BIN$CUXaB1pMD3fgUBGsaj1uUg==$0         12

47 rows selected.

这47个对象都不是系统文件,大多是recyclebin的文件,可以忽略。

8.验证升级结果:

SQL> select comp_name,version,status from sys.dba_registry;  --检查升级组件,看一是否都是valid的

COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
Oracle Enterprise Manager
10.2.0.4.0                     VALID

OLAP Catalog
10.2.0.4.0                     VALID

Spatial
10.2.0.4.0                     VALID


COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
Oracle interMedia
10.2.0.4.0                     VALID

Oracle XML Database
10.2.0.4.0                     VALID

Oracle Text
10.2.0.4.0                     VALID


COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
Oracle Expression Filter
10.2.0.4.0                     VALID

Oracle Rule Manager
10.2.0.4.0                     VALID

Oracle Workspace Manager
10.2.0.4.3                     VALID


COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
Oracle Data Mining
10.2.0.4.0                     VALID

Oracle Database Catalog Views
10.2.0.4.0                     VALID

Oracle Database Packages and Types
10.2.0.4.0                     VALID


COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
JServer JAVA Virtual Machine
10.2.0.4.0                     VALID

Oracle XDK
10.2.0.4.0                     VALID

Oracle Database Java Packages
10.2.0.4.0                     VALID


COMP_NAME
--------------------------------------------------------------------------------
VERSION                        STATUS
------------------------------ -----------
OLAP Analytic Workspace
10.2.0.4.0                     VALID

Oracle OLAP API
10.2.0.4.0                     VALID


17 rows selected.
SQL>  select * from utl_recomp_errors;

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
     53498
31-AUG-18 05.08.27.615939 PM
ORA-04045: errors during recompilation/revalidation of PUBLIC.TRAVEL_EXPENSE
ORA-00980: synonym translation is no longer valid

     53496
31-AUG-18 05.08.27.618088 PM

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
ORA-04045: errors during recompilation/revalidation of PUBLIC.OFFICE_EXPENSE
ORA-00980: synonym translation is no longer valid

     53499
31-AUG-18 05.08.27.628482 PM
ORA-04045: errors during recompilation/revalidation of PUBLIC.TRAVEL_EXPENSE_AME
ND

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
ORA-00980: synonym translation is no longer valid

     53027
31-AUG-18 05.08.38.243209 PM
ORA-04045: errors during recompilation/revalidation of L5M.PBMET_DEAL
ORA-00980: synonym translation is no longer valid


      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
     53029
31-AUG-18 05.08.38.244892 PM
ORA-04045: errors during recompilation/revalidation of L5M.PB_240_100116_OFFICE
ORA-00980: synonym translation is no longer valid

     53030
31-AUG-18 05.08.38.246403 PM

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
ORA-04045: errors during recompilation/revalidation of L5M.PB_240_100116_AGENCY
ORA-00980: synonym translation is no longer valid

     53031
31-AUG-18 05.08.38.248002 PM
ORA-04045: errors during recompilation/revalidation of L5M.PB_240_100116_USER
ORA-00980: synonym translation is no longer valid

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------

     53032
31-AUG-18 05.08.38.249578 PM
ORA-04045: errors during recompilation/revalidation of L5M.PB_240_100116_ID_ADV
ORA-00980: synonym translation is no longer valid

     53497

      OBJ#
----------
ERROR_AT
---------------------------------------------------------------------------
COMPILE_ERR
--------------------------------------------------------------------------------
31-AUG-18 05.08.38.385742 PM
ORA-04045: errors during recompilation/revalidation of PUBLIC.EQUIPMENT
ORA-00980: synonym translation is no longer valid


9 rows selected.

有9个对象无法编译,这个不影响的,都不是系统对象。

 

[oracle@qht115 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Fri Jul 6 06:25:52 2018

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select count(*) from l5m.TM_HEADER
  2  ;

  COUNT(*)
----------
       444

最后不要忘记生成密码文件,取消_SYSTEM_TRIG_ENABLED = false后重启一下数据库

此至,数据库及软件都升级到了64bit。

 

参考:

https://blog.csdn.net/tianlesoftware/article/details/7262215

你可能感兴趣的:(ORACLE,10G)