1.unplug

To unplug a PDB, you first close it and then generate an XML manifest file. The XML file contains information about the names and the full paths of the tablespaces, as well as data files of the unplugged PDB. The information will be used by the plugging operation.

In this section, you unplug two PDBs to plug them with different methods.

Use SQL*Plus to close the PDBs before they can
be unplugged. Note: The pdb2 database may not have been opened, so you
may receive an error that the PDB is already closed.

. oraenv

[enter cdb1 at the prompt]

1. 操作步骤如下:(预先检查cdb 和plug pdb 兼容性,发现一旦不兼容,plug pdb 只能以受限制模式打开)

source

exec dbms_pdb.describe (‘PDB1_Unplug.xml’, ‘PtestDEV’);
 
  --localtion is D:\appOra12c\Administrator\product\12.1.0\dbhome_1\database
 
  
step 2:

target

set serveroutput on
 
 begin
  if dbms_pdb.check_plug_compatibility('C:\app\software\PDB1_Unplug.xml','PtestDEV') then
    dbms_output.put_line('no violations found');
  else
    dbms_output.put_line('violations found');
  end if;
end;

create table pdb_plug_back as select * from  pdb_plug_in_violations;
delete from  pdb_plug_in_violations;

set linesize 999
set pagesize 999
SELECT name,type, message, action
  FROM pdb_plug_in_violations
 --make no row feedback or check mos

2.begin work

sqlplus / as sysdba

alter pluggable database pdb1 close
immediate;

alter pluggable database pdb2 close
immediate;

Unplug the closed PDB and then specify the path and name of the XML
file.

alter pluggable database pdb1 unplug
into '/u01/app/oracle/oradata/pdb1.xml';

alter pluggable database pdb2 unplug
into '/u01/app/oracle/oradata/pdb2.xml';

Drop the closed PDB and keep the data files.

drop pluggable database pdb1 keep
datafiles;

drop pluggable database pdb2 keep
datafiles;

Verify the status of the unplugged PDB.

select pdb_name, status from cdb_pdbs
where pdb_name in ('PDB1', 'PDB2');

[you should see no rows]

exit

The unplugging operation makes changes in the
PDB data files to record that the PDB was properly and
successfully unplugged. Because the PDB is still part of the CDB, you
can back it up in Oracle Recovery Manager (Oracle RMAN). This backup provides a convenient
way to archive the unplugged PDB. After backing it up,
you then remove it from the CDB catalog. But, of course, you
must preserve the data files for the subsequent plugging
operation.

2.plug to same cdb or another cdb

n this section, you plug the unplugged PDB into another CDB by using different methods.

Checking the Compatibility of the Unplugged PDB with the Host CDB

Before starting the plugging operation, make sure
that the to-be-plugged-in PDB is compatible with the new host CDB.
Execution of the PL/SQL block raises an error if it is not compatible.

Execute the following PL/SQL block:

. oraenv

[enter cdb2 at the prompt]

sqlplus / as sysdba

[if cdb2 is not started up,
start it up now.]

set serveroutput on

DECLARE
   compatible BOOLEAN := FALSE;
BEGIN  
   compatible :=
DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
       
pdb_descr_file =>
'/u01/app/oracle/oradata/pdb1.xml');
   if compatible then
     
DBMS_OUTPUT.PUT_LINE('Is pluggable PDB1 compatible?
YES');
   else DBMS_OUTPUT.PUT_LINE('Is pluggable
PDB1 compatible? NO');
   end if;
END;
/

DECLARE
   compatible BOOLEAN := FALSE;
BEGIN   
   compatible :=
DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
       
pdb_descr_file =>
'/u01/app/oracle/oradata/pdb2.xml');
   if compatible then
     
DBMS_OUTPUT.PUT_LINE('Is pluggable PDB2 compatible?
YES');
   else DBMS_OUTPUT.PUT_LINE('Is pluggable
PDB2 compatible? NO');
   end if;
END;
/

Plugging the Unplugged PDB: NOCOPY
Method

Use the data files of the unplugged PDB
to plug the PDB into another CDB without any copy.

create pluggable database
pdb_plug_nocopy using
'/u01/app/oracle/oradata/pdb1.xml'
NOCOPY
TEMPFILE REUSE;

This operation lasts a few seconds. The
original data files of the unplugged PDB now belong to the new
plugged-in PDB in the new host CDB. A file with the same name as the
temp file specified in the XML file exists in the target location.
Therefore, the TEMPFILE_REUSE clause is required.

Verify the status and open mode of the plugged PDB.
Proceed to the next section, "Opening the Plugged PDB,"
to finalize the plugging operation.

select pdb_name, status from
cdb_pdbs where pdb_name='PDB_PLUG_NOCOPY';

select open_mode from v$pdbs
where name='PDB_PLUG_NOCOPY';

List the data files of the plugged PDB.

select name from v$datafile
where con_id=3;

exit

Plugging the Unplugged PDB: COPY
Method

Create and define a destination
for the new data files, plug the unplugged PDB into the CDB, and then
copy the data files of the unplugged PDB.

mkdir
/u01/app/oracle/oradata/cdb2/pdb_plug_copy

sqlplus / as sysdba

Use the data files of the unplugged PDB
to plug the PDB into the CDB and copy the data files to
a new location.

create pluggable database
pdb_plug_copy using '/u01/app/oracle/oradata/pdb2.xml'

COPY
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb2','/u01/app/oracle/oradata/cdb2/pdb_plug_copy');

Verify the status and open mode of the plugged PDB.
Proceed to the next section, "Opening the Plugged PDB,"
to finalize the plugging operation.

select pdb_name, status from
cdb_pdbs where pdb_name='PDB_PLUG_COPY';

select open_mode from v$pdbs
where name='PDB_PLUG_COPY';

List the data files of the plugged PDB.

select name from v$datafile
where con_id=4;

exit

Plugging the Unplugged PDB: AS CLONE
MOVE Method

Create and define a destination for the new data files, use the data files of the unplugged PDB to plug the PDB into another CDB, and then move the data files to another location.

mkdir /u01/app/oracle/oradata/cdb2/pdb_plug_move

sqlplus / as sysdba

Plug the PDB into the CDB and move the
data files to a new location.

create pluggable database
pdb_plug_move using '/u01/app/oracle/oradata/pdb2.xml'

MOVE
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb2','/u01/app/oracle/oradata/cdb2/pdb_plug_move');

An error message is returned because of the non-uniqueness of the GUID. This is a good example of
using the AS CLONE clause.

create pluggable database
pdb_plug_move
AS CLONE using '/u01/app/oracle/oradata/pdb2.xml'
MOVE
FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb2','/u01/app/oracle/oradata/cdb2/pdb_plug_move');

Verify the status and open mode of the plugged PDB.
Proceed to the next section, "Opening the Plugged PDB,"
to finalize the plugging operation.

select pdb_name, status from
cdb_pdbs where pdb_name='PDB_PLUG_MOVE';

select open_mode from v$pdbs
where name='PDB_PLUG_MOVE';

List the data files of the plugged PDB.

select name from v$datafile
where con_id=5;

 
 

3.seting

Open and check the availability of the plugged PDB.

Open the plugged-in PDBs.

alter pluggable database
pdb_plug_nocopy open;

alter pluggable database
pdb_plug_copy open;

alter pluggable database
pdb_plug_move open;

Connect to the plugged-in PDBs and verify the container
name that you are connected to.

connect
sys/oracle@localhost:1521/pdb_plug_nocopy AS SYSDBA

show con_name

connect
sys/oracle@localhost:1521/pdb_plug_copy AS SYSDBA

show con_name

connect
sys/oracle@localhost:1521/pdb_plug_move AS SYSDBA

show con_name

exit

####sample:

source: 12.1.0.2.160419 cdb + 2pdb

target   12.1.0.2.161019 cdb + 0pdb

目标 迁移souce a pdb to target

step 1:

#####################

select con_id,name, OPEN_MODE from v$pdbs;
alter pluggable database PtestDEV close immediate;
alter pluggable database PtestDEV open;
alter pluggable database PtestDEV close immediate;

(the step unplug need 15 minutes)
alter pluggable database PtestDEV unplug into 'c:\app\oracle\DEV.xml';
drop pluggable database PtestDEV keep datafiles;
select pdb_name, status from cdb_pdbs where pdb_name in ('PtestDEV');
exit

@the source host and target host datafile location should be same. (it will avoid omf and file covert issue)
@the source host and target host datafile opatch version should be same. (it will avoid omf and file covert issue)

step2:

####

set serveroutput on

DECLARE
   compatible BOOLEAN := FALSE;
BEGIN   
   compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(
        pdb_descr_file => 'C:\app\software\dev.xml');
   if compatible then
      DBMS_OUTPUT.PUT_LINE('Is pluggable ptestdev compatible? YES');
   else DBMS_OUTPUT.PUT_LINE('Is pluggable ptestdev compatible? NO');
   end if;
END;
/

NO                               -even if it is no, we can go ahead
PL/SQL 过程已成功完成。

step 3:
create pluggable database ptestdev using 'C:\app\software\dev.xml' NOCOPY TEMPFILE REUSE;

select pdb_name, status from cdb_pdbs where pdb_name='PDB_PLUG_NOCOPY';
select open_mode from v$pdbs where name='PDB_PLUG_NOCOPY';
select con_id,name, OPEN_MODE from v$pdbs;

issue 1: (sugest not use zip method to move data from souce to target ,using it is orinal file)

create pluggable database ptestdev using
ORA-27070: 异步读取/写入失败

SQL> create pluggable database ptestdev using 'C:\app\software\dev.xml' NOCOPY TEMPFILE REUSE;
create pluggable database ptestdev using 'C:\app\software\dev.xml' NOCOPY TEMPFI
LE REUSE
*
第 1 行出现错误:
ORA-01119: 创建数据库文件
'D:\ORA12CDATA\ORADATA\testUAT12C\A645A206A1E24A79BB8B3C9DA55D36AD\DATAFILE\O1_M

F_SYSTEM_DBWZ3L9R_.DBF' 时出错
ORA-27070: 异步读取/写入失败
OSD-04008: WriteFile() ??? ???д????
O/S-Error: (OS 5) ???????

###solution:
http://www.dba-oracle.com/t_os_error_os5_access_denied.htm

1.give window user oracle with administrator privileges
2.restart windows oracle service
 
 I would change your OracleService<SID> to logon explicitly as an Oracle user with admin privileges. In the ControlPanel services:

Right click on service

Select 'properties'

Select 'logon'

Change the default user ID to an Oracle user with Windows administrator privileges

http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/12c/r1/pdb/pdb_unplug_plug/pdb_unplug_plug.html?cid=6768&ssid=106107405091384

Plugging an Unplugged Pluggable Database的更多相关文章

  1. Plugging an Unplugged Pluggable Database issue 3

    Multitenant Unplug/Plug Best Practices (文档 ID 1935365.1) 1.source 从0419 升级到1019 ,但是datapatch 没有回退041 ...

  2. Plugging an Unplugged Pluggable Database issue 2

    因为原库和目标库版本不一制,出现各种问题,强烈建议保持2个版本一致 http://www.cndba.cn/dave/article/220 Log 提示查看PDB_PLUG_IN_VIOLATION ...

  3. ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged

    SQL> drop pluggable database pdb2; drop pluggable database pdb2 * ERROR at line : ORA-: cannot ke ...

  4. oracle12c新特点之可插拔数据库(Pluggable Database,PDB)

    1.    12c PDB新特点的优势 1)    可以把多个PDB集成进一个平台. 2)    可以快速提供一个新的PDB或一个已有PDB的克隆. 3)    通过拔插技术,可以快速把存在的数据库重 ...

  5. Oracle Database 12c 新特性 - Pluggable Database

    在Oracle Database 12c中,可组装式数据库 - Pluggable Database为云计算而生.在12c以前,Oracle数据库是通过Schema来进行用户模式隔离的,现在,可组装式 ...

  6. Oracle 12c: RMAN restore/recover pluggable database

    查看数据库状态 运行在归档模式,可拔插数据库name=pdborcl SQL> archive log list; Database log mode Archive Mode Automati ...

  7. Oracle 12C pluggable database自启动

    实验环境创建了两个PDB,本实验实现在开启数据库时,实现pluggable database PDB2自启动: 原始环境: SQL> shu immediateDatabase closed.D ...

  8. Clone a Pluggable Database – 12c Edition

    1. 1.Tnsnames when connecting to either Container or Pluggable instance The tnsnames.ora should be c ...

  9. Multitenant best Practice clone pdb seed and Clone a Pluggable Database – 12c Edition

    1. 1.Tnsnames when connecting to either Container or Pluggable instance The tnsnames.ora should be c ...

随机推荐

  1. Andriod Atom x86模拟器启动报错。

    用Inter Atom模式的Android模拟器启动报一下错误: Starting emulator for AVD 'new' emulator: ERROR: x86 emulation curr ...

  2. python day- 5 字典(dic)的 增删改查 及 操作方法

    字典(dic) 1.定义及格式 用{ }大括号括起来的,由key:value 来保存数据的就是 字典(dic) eg:dic = {"及时雨" : "宋江" , ...

  3. JAVA中Stack和Heap的区别

    http://m.blog.csdn.net/wl_ldy/article/details/5935528

  4. 利用CoreTelephony获取用户当前网络状态(判断2G,3G,4G)

    前言: 在项目开发当中,往往需要利用网络.而用户的网络环境也需要我们开发者去注意,根据不同的网络状态作相应的优化,以提升用户体验. 但通常我们只会判断用户是在WIFI还是移动数据,而实际上,移动数据也 ...

  5. Java类加载器(ClassLoader)

    类加载的机制的层次结构 每个编写的”.java”拓展名类文件都存储着需要执行的程序逻辑,这些”.java”文件经过Java编译器编译成拓展名为”.class”的文件,”.class”文件中保存着Jav ...

  6. 常用bluetooth协议

    HFP: HFP(Hands-free Profile),让蓝牙设备可以控制电话,如接听.挂断.拒接.语音拨号等,拒接.语音拨号要视蓝牙耳机及电话是否支持. HSP: HSP 描述了 Bluetoot ...

  7. codeforces 448B. Suffix Structures 解题报告

    题目链接:http://codeforces.com/problemset/problem/448/B 题目意思:给出两种操作automaton:可以删除字符串中任意一个字符: array:交换字符串 ...

  8. 「LuoguP2170」 选学霸(01背包

    Description 老师想从N名学生中选M人当学霸,但有K对人实力相当,如果实力相当的人中,一部分被选上,另一部分没有,同学们就会抗议.所以老师想请你帮他求出他该选多少学霸,才能既不让同学们抗议, ...

  9. GridFS大文件的添加、获取、查看、删除

    GridFS是一种在MongoDB中存储大二进制文件的机制,使用GridFS的原因有以下几种: 存储巨大的文件,比如视频.高清图片等. 利用GridFS可以简化需求. GridFS会直接利用已经建立的 ...

  10. cocos2d-js使用plist执行自身动作

    首先需要将精灵动作帧动画图片使用TexturePacker创建plist,创建好后,将生成的plist和png图片(所有帧动画图片集成的一张大图): 百牛信息技术bainiu.ltd整理发布于博客园 ...