美文网首页
ORACLE19.3 升級之路 之 01(ADG 升级 [11.

ORACLE19.3 升級之路 之 01(ADG 升级 [11.

作者: 轻飘飘D | 来源:发表于2020-08-13 00:28 被阅读0次

ADG 升级 [11.2.0.1 -> 11.2.0.4]


目标

ORACLE ADG 环境下将 11.2.0.1 升级到 11.2.0.4

思路

停快速故障轉移功能;主库暂停归档传输;备库安装新版本软件,备库启动到mount;主库安装软件,主库升级数据库,主库启用归档传输,备库开启日志恢复。

注意

11.2.0.4新版软件安装到一个新目录下,注意copy之前的spfile、密码文件、network file、dg_broker_config文件(监听配置文件的静态监听部分需要修改),备库只升级软件版本。数据库升级是通过主库升级后通过应用主库归档完成升级和同步的。

概要步骤

1.停快速故障轉移功能
2.主库暂停归档向备库传输
3.备库在新目录下安装新版本软件
4.备库启动到mount状态
5.主库安装软件,升级数据库
6.主库启用归档向备库传输
7.检查备库、主库升级情况
8.修改 compatible 参数(主备)
9.ADG环境DB重启
10.切换到最大可用模式

具体步骤

1.停快速故障轉移功能

[oracle@mppay2 ~]$ dgmgrl sys/123456

DGMGRL> show configuration

DGMGRL>stop observer
DGMGRL>disable fast_start failover;

DGMGRL> show configuration;

Configuration - my_dg_cfg
  Protection Mode: MaxAvailability
  Databases:
    mppay1 - Primary database
    mppay2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

2.主库暂停归档向备库传输

DGMGRL> show database mppay1

Database - mppay1
  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    MPPAYUAT
Database Status:
SUCCESS

edit configuration set protection mode as MaxPerformance;
edit database 'mppay1' set state='TRANSPORT-OFF';
edit database 'mppay1' set property LogXptMode ='ASYNC';
edit database 'mppay2' set property LogXptMode ='ASYNC';
show database 'mppay1';
#主庫
SQL> show parameter dg_broker;  

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1           string  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1MPPAY1.dat
dg_broker_config_file2           string  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2MPPAY1.dat
dg_broker_start              boolean     TRUE

#備機
SQL> show parameter dg_broker;

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
dg_broker_config_file1           string  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1MPPAY2.dat
dg_broker_config_file2           string  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2MPPAY2.dat
dg_broker_start              boolean     TRUE

3.备库在新目录下安装新版本软件
3.1 关闭数据库,监听。

[oracle@mppay2 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1

[oracle@mppay2 ~]$ which sqlplus 
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus

[oracle@mppay2 ~]$ sqlplus / as sysdba

SQL> shutdown immediate;

SQL> exit

[oracle@mppay2 ~]$ lsnrctl stop

3.2 在新目录下安装Oracle 11.2.0.4 软件(only oftware)
--安裝時路徑選擇 新的 ORACLE_HOME
--编辑oracle环境变量,修改ORACLE_HOME为新的目录

vim /home/oracle/.bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1

3.3 copy 配置文件

[oracle@oracle2 admin]$ cp /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/*.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/

--修正listener.ora 及 tnsnames.ora 中ORACLE_HOME

cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMPPAYUAT.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1MPPAY2.dat /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2MPPAY2.dat /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMPPAYUAT /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/

4.备库启动到mount状态

[oracle@mppay2 ~]$ which lsnrctl 

[oracle@mppay2~]$ lsnrctl start
[oracle@mppay2~]$ sqlplus / as sysdba
SQL> startup mount;

5.主库安装软件,升级数据库

5.1 在新目录下安装Oracle 11.2.0.4 软件(only oftware)
--安裝時選擇新的 ORACLE_HOME ,注:监听不需要配置
--编辑oracle用户环境变量,修改ORACLE_HOME新目录

vim .bash_profile
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1

5.2 关闭数据库,监听

[oracle@mppay1 ~]$ lsnrctl stop
[oracle@mppay1 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1

[oracle@mppay1 ~]$ which sqlplus 
/u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus

[oracle@mppay1 ~]$ sqlplus / as sysdba 
SQL> spool /home/oracle/upgrade01.log
SQL> @/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/utlu112i.sql
SQL> spool off
--根据提示修正不符合升级条件的地方,清空回收站
SQL> purge DBA_RECYCLEBIN;
SQL> select count(*) from DBA_RECYCLEBIN;
--查看无效对象
SQL> select count(*) from dba_objects where status<>'VALID';
SQL> EXECUTE dbms_stats.gather_dictionary_stats;
SQL> shutdown immediate

5.3 copy 配置文件

[oracle@oracle2 admin]$ cp /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/*.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/

--修正listener.ora 、 tnsnames.ora 中ORACLE_HOME

cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfileMPPAYUAT.ora /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr1MPPAY1.dat /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/dr2MPPAY1.dat /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/
cp /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwMPPAYUAT /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/

5.4 升级数据库

[oracle@mppay1 dbs]$ which sqlplus
/u01/app/oracle/product/11.2.0.4/dbhome_1/bin/sqlplus

[oracle@mppay1 dbs]$ sqlplus / as sysdba
SQL> startup UPGRADE

set echo on
spool /home/oracle/update02.log
set time on
SQL>@/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/catupgrd.sql
--3o分钟(做完后自動shutdown immediate)

SQL> sqlplus / as sysdba
SQL> startup
SQL> select count(*) from dba_objects where status<>'VALID';
456

SQL> @/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/utlrp.sql

SQL> select count(1) from dba_objects where status<>'VALID';
0

SQL> @/u01/app/oracle/product/11.2.0.4/dbhome_1/rdbms/admin/utlu112s.sql

SQL> select count(1) from dba_objects where status<>'VALID';
0

SQL> EXECUTE dbms_stats.gather_dictionary_stats;

SQL> shutdown immediate
SQL> startup

5.5主库启动监听
[oracle@mppay1 ~]$ lsnrctl start

5.6查看oratab
[oracle@mppay1 ~]$ cat /etc/oratab

5.7查看Broker配置

DGMGRL> show configuration

Configuration - my_dg_cfg
  Protection Mode: MaxPerformance
  Databases:
    mppay1 - Primary database
    mppay2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS

6.1主库启用归档向备库传输

DGMGRL> edit database 'mppay1' set state='TRANSPORT-ON';

DGMGRL> show database 'mppay1'
Database - mppay1
  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    DG
Database Status:
SUCCESS

--查看备库日志应用情况

DGMGRL> show database 'mppay2';

Database - mppay2

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       18 minutes 39 seconds (computed 1 second ago)
  Apply Rate:      22.45 MByte/s
  Real Time Query: OFF
  Instance(s):
    MPPAYUAT

Database Status:
SUCCESS

#1小时后
DGMGRL> show database 'mppay2';                                
Database - mppay2
  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       0 seconds (computed 1 second ago)
  Apply Rate:      728.00 KByte/s
  Real Time Query: OFF
  Instance(s):
    DG
Database Status:
SUCCESS

6.2 DGMGRL 显示主备正常 open 备库 (如上查看配置)
SQL> alter database open;

DGMGRL> show database 'mppay2';

Database - mppay2

  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   0 seconds (computed 1 second ago)
  Apply Lag:       0 seconds (computed 1 second ago)
  Apply Rate:      0 Byte/s
  Real Time Query: ON
  Instance(s):
    MPPAYUAT

Database Status:
SUCCESS

DGMGRL> show configuration

Configuration - my_dg_cfg

  Protection Mode: MaxPerformance
  Databases:
    mppay1 - Primary database
    mppay2 - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

7.检查备库、主库升级情况

SQL> 
set linesize 150
set pagesize 9999
col comp_name format a40

SQL> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;

COMP_NAME                VERSION            STATUS
---------------------------------------- ------------------------------ --------------------------------------------
Oracle Application Express       3.2.1.00.10            INVALID
Oracle Enterprise Manager        11.2.0.4.0         VALID
Oracle Multimedia            11.2.0.4.0         VALID
Oracle XML Database          11.2.0.4.0         VALID
Oracle Expression Filter         11.2.0.4.0         VALID
Oracle Rules Manager             11.2.0.4.0         VALID
Oracle Workspace Manager         11.2.0.4.0         VALID
Oracle Database Catalog Views        11.2.0.4.0         VALID
Oracle Database Packages and Types   11.2.0.4.0         VALID
JServer JAVA Virtual Machine         11.2.0.4.0         VALID
Oracle XDK               11.2.0.4.0         VALID
Oracle Database Java Packages        11.2.0.4.0         VALID

12 rows selected.

SQL> select count(*) from dba_objects where status<>'VALID';
  COUNT(*)
----------
     0

SQL> select * from utl_recomp_errors;
            no rows selected

SQL> select ACTION_TIME,ACTION,NAMESPACE,VERSION,ID from registry$history;
    19-OCT-18 12.54.28.668386 PM                VIEW INVALIDATE          8289601
    9-OCT-18 12.54.28.834581 PM                  UPGRADE                  SERVER      11.2.0.4.0

8.修改 compatible 参数(主备)
-- 切记这个参数已修改,此次升级操作就无法回退,一定要在应用经过测试之后修改。

SQL> show parameter compatible

NAME                     TYPE    VALUE
------------------------------------ ----------- ------------------------------
compatible               string  11.2.0.0.0


SQL> alter system set compatible='11.2.0.4.0' scope=spfile;
  1. ADG环境DB重启

關閉主機DB
SHUTDOWN IMMEDIATE;
關閉監聽
lsnrctl stop

關閉備機DB
SHUTDOWN IMMEDIATE;
關閉備機監聽
lsnrctl stop

啟動備機監聽
lsnrctl start

啟動備機DB
startup;

啟動主機監聽
lsnrctl start

啟動主機DB
startup;

SQL> show parameter comp;
NAME                     VALUE
------------------------------------ ---------------------------------
cell_offload_compaction                ADAPTIVE
compatible                             11.2.0.4.0
nls_comp                               BINARY
plsql_v2_compatibility           FALSE
  1. 切换到最大可用模式
DGMGRL> edit database 'mppay1' set property LogXptMode ='SYNC';
DGMGRL> edit database 'mppay2' set property LogXptMode ='SYNC';
DGMGRL> edit configuration set protection mode as MaxAvailability;

安装 oracle 11g r2 时出现错误 调用makefile /oracle/app/oracle/product/11.2.0.4/db_1/sysman/lib/ins_emagent.mk的目标nmo时出错。

主要因为C库的问题,解决办法就是手动指定C库位置出现agent nmhs问题后,
找到$ORACLE_HOME/sysman/lib/ins_emagent.mk文件,在文件里找字符串 $(MK_EMAGENT_NMECTL)
替换为$(MK_EMAGENT_NMECTL) -lnnz11
注意:lnnz和$(MK_EMAGENT_NMECTL)之间有空格
然后点“重试“按钮就可以了


修/u01/app/oracle/product/11.2.0/db_1/ctx/lib/ins_ctx.mk,将 ctxhx: $(CTXHXOBJ)
$(LINK_CTXHX)\ (CTXHXOBJ) \(INSO_LINK) 修改为:
ctxhx: $(CTXHXOBJ) -static
$(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/stdc.a
点击Retry继续安装。


启动数据库到mount状态出现如下问题,则如下处理

SQL> startup mount;
ORA-00845: MEMORY_TARGET not supported on this system

[root@XAG110 ~]# df -h | grep shm
tmpfs                       1.5G  709M  788M  48% /dev/shm
[root@XAG110 ~]# cat /etc/fstab | grep tmpfs
[root@XAG110 ~]# mount -o remount,size=4G /dev/shm
[root@XAG110 ~]# df -h | grep shm
tmpfs                       4.0G  709M  3.4G  18% /dev/shm

SQL> startup mount;
            Database mounted.

相关文章

网友评论

      本文标题:ORACLE19.3 升級之路 之 01(ADG 升级 [11.

      本文链接:https://www.haomeiwen.com/subject/srmvdktx.html