ITPub博客

首页 > 数据库 > Oracle > 【PDB升级】12.1.0.2的PDB升级到12.2.0.2的实验

【PDB升级】12.1.0.2的PDB升级到12.2.0.2的实验

原创 Oracle 作者:lhrbest 时间:2018-12-06 11:50:36 0 删除 编辑


【PDB升级】12.1.0.2的PDB升级到12.2.0.2的实验


12.1.0.2 PDB 升级到 12.2.0.2 的时候,不能选用 DBLINK 远程克隆的方式,因为源库是 12.1.0.2 的版本,不能夸版本远程克隆,否则报错:

SYS@cdb1212> create pluggable database pdblhr3 from PDBPROD2@dbl_PDBLHR1 CREATE_FILE_DEST = '/u01/app/oracle/oradata';

create pluggable database pdblhr3 from PDBPROD2@dbl_PDBLHR1 CREATE_FILE_DEST = '/u01/app/oracle/oradata'

                                                *

ERROR at line 1:

ORA-17630: Mismatch in the remote file protocol version client 2 server 3

参考: Creating a PDB Remote Clone from 12.1.0.2 to 12.2 Fails With ORA-17630 ( 文档 ID 2090019.1)

解决: Download and apply Patch 18633374 on the side that does not include the fix for Bug 18633374. The fix is included in 12.2 or later.

NOTE: Both sides must have the fix for Bug 18633374

 

1.1   unplug 插拔方式

 

show pdbs

create pluggable database PDBLHR 1212  admin user lhr identified by lhr CREATE_FILE_DEST = '/u01/app/oracle/oradata';

alter pluggable database PDBLHR 1212 open;

alter session set container= PDBLHR 1212;

create table xxt10 as select * from dual;

select name from v$datafile  where con_id=3 ;

 

conn / as sysdba

alter pluggable database PDBLHR 1212 close  immediate;

alter pluggable database PDBLHR 1212  unplug into '/tmp/ PDBLHR1212 .xml'; # 在执行完这句命令后,该 pdb 只能被删除而不能直接打开。

drop pluggable database PDBLHR1212   keep datafiles ;   -- 默认也是 keep datafiles

 

-- 目标库创建路径

mkdir -p /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

chown oracle.oinstall /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

 

-- 从源库拷贝数据文件和 xml 文件

scp /tmp/ PDBLHR1212 .xml oracle@192.168.59.52: /tmp/ PDBLHR1212 .xml

scp /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/* oracle@192.168.59.52: /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

 

 

-- 目标库执行

create pluggable database PDBLHR1212 2

using '/tmp/ PDBLHR1212 .xml '

nocopy tempfile reuse;

 

alter pluggable database PDBLHR1212 2  open;

 

show pdbs

SELECT to_char(time, 'YYYY-MM-DD HH24:MI:SS') time,

       NAME,

       CAUSE,

       TYPE,

       LINE,

       MESSAGE,

       STATUS,

       ACTION,

       CON_ID

  FROM PDB_PLUG_IN_VIOLATIONS

 order by time desc;

 

$ORACLE_HOME/bin/dbupgrade -c PDBLHR1212 2  # 如果是相同版本迁移,则不需要执行此命令

 

@?/apex/apxremov_nocdb.sql   # 移除 PDB 中的 APEX 组件

 

select name,con_id from v$datafile order by con_id;

ALTER DATABASE MOVE datafile 5 TO '+D ATA ';

校验:

select count(1) from CDB_tables where owner='HR';

 

Oracle APEX 12.1.0.2.0 中默认安装,而在 12.2.0.1.0 未默认安装,如果不进行 APEX 卸载,在 12.2.0.1.0 plug 12.1.0.2.0 版本的 pdb 将报如下 ORA-65346 错误:

ERROR at line 1:

ORA-65346: The PDB version is lower and components (APEX) are missing in CDB.

 

 - APEX mismatch: PDB has installed common APEX. CDB has not installed APEX.

 

解决:编辑 xml 文件 /tmp/ PDBLHR1212 .xml 删除以下行:

<APEX>4.2.5.00.08:1</APEX>

或者卸载 APEX

select COMP_ID, STATUS from DBA_REGISTRY where COMP_ID='APEX';

SQL>@?/apex/apxremov_nocdb.sql

12.1.0.2 需要跑脚本 apxremov_con.sql ,其它版本需要跑 apxremov_nocdb.sql apxremov_cdb.sql 进行卸载 APEX 组件。

 

1.2   DBMS_PDB.DESCRIBE 方式

-- 源库

create pluggable database PDBLHR3 admin user lhr identified by lhr CREATE_FILE_DEST = '/u01/app/oracle/oradata';

alter pluggable database PDBLHR3 open;

alter session set container=pdblhr3;

shutdown immediate

startup open read only

exec DBMS_PDB.DESCRIBE ('/tmp/orcl.xml');

select name from v$datafile   ;

 

 

-- 目标库创建路径

mkdir -p /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

chown oracle.oinstall /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

 

-- 从源库拷贝数据文件和 xml 文件

scp /tmp/ orcl.xml   oracle@192.168.59.52: /tmp/ orcl.xml

scp /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/* oracle@192.168.59.52: /u01/app/oracle/oradata/CDB1212/7C5288B7DE640179E053823BA8C05BD1/datafile/

 

 

--- 目标库

set serveroutput on

DECLARE

  l_result BOOLEAN;

BEGIN

  l_result := DBMS_PDB.check_plug_compatibility(pdb_descr_file => '/tmp/orcl.xml',

                                                pdb_name       => ' PDBLHR5 ');

  IF l_result THEN

    DBMS_OUTPUT.PUT_LINE(' Yes ');

  ELSE

    DBMS_OUTPUT.PUT_LINE(' No ');

  END IF;

END;

/

 

CREATE   PLUGGABLE DATABASE PDBLHR5

USING '/tmp/orcl.xml'

CREATE_FILE_DEST = '/u01/app/oracle/oradata';

 

alter   PLUGGABLE DATABASE PDBLHR5 open;

show pdbs

SELECT to_char(time, 'YYYY-MM-DD HH24:MI:SS') time,

       NAME,

       CAUSE,

       TYPE,

       LINE,

       MESSAGE,

       STATUS,

       ACTION,

       CON_ID

  FROM PDB_PLUG_IN_VIOLATIONS

 order by time desc;

 

$ORACLE_HOME/bin/dbupgrade -c PDBLHR1212 2  # 如果是相同版本迁移,则不需要执行此命令

 

@?/apex/apxremov_nocdb.sql   # 移除 PDB 中的 APEX 组件

 

select name,con_id from v$datafile order by con_id;

ALTER DATABASE MOVE datafile 5 TO '+D ATA ';

 

 

 

 




About Me

........................................................................................................................

● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除

● 本文在itpub( http://blog.itpub.net/26736162 )、博客园( http://www.cnblogs.com/lhrbest )和个人weixin公众号( xiaomaimiaolhr )上有同步更新

● 本文itpub地址: http://blog.itpub.net/26736162

● 本文博客园地址: http://www.cnblogs.com/lhrbest

● 本文pdf版、个人简介及小麦苗云盘地址: http://blog.itpub.net/26736162/viewspace-1624453/

● 数据库笔试面试题库及解答: http://blog.itpub.net/26736162/viewspace-2134706/

● DBA宝典今日头条号地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

........................................................................................................................

● QQ群号: 230161599 (满) 、618766405

● weixin群:可加我weixin,我拉大家进群,非诚勿扰

● 联系我请加QQ好友 646634621 ,注明添加缘由

● 于 2018-12-01 06:00 ~ 2018-12-31 24:00 在魔都完成

● 最新修改时间:2018-12-01 06:00 ~ 2018-12-31 24:00

● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解

● 版权所有,欢迎分享本文,转载请保留出处

........................................................................................................................

小麦苗的微店 https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

小麦苗出版的数据库类丛书 http://blog.itpub.net/26736162/viewspace-2142121/

小麦苗OCP、OCM、高可用网络班 http://blog.itpub.net/26736162/viewspace-2148098/

小麦苗腾讯课堂主页 https://lhr.ke.qq.com/

........................................................................................................................

使用 weixin客户端 扫描下面的二维码来关注小麦苗的weixin公众号( xiaomaimiaolhr )及QQ群(DBA宝典)、添加小麦苗weixin, 学习最实用的数据库技术。

........................................................................................................................

欢迎与我联系

 

 



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-2284343/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论
QQ:646634621| 网名:小麦苗| 微信公众号:xiaomaimiaolhr| 11g OCM| QQ群:618766405 微信群:私聊| 《数据库笔试面试宝典》作者| OCP、OCM、高可用(RAC+DG+OGG)网络班开讲啦,有需要的小伙伴可以私聊我。

注册时间:2012-09-23

  • 博文量
    1153
  • 访问量
    7092533