convert nocdb to cdb using dbms_pdb

时间:2022-04-11 15:01:15

convert nocdb to cdb using dbms_pdb

本文介绍将nocdb转换为cdb

 

环境介绍:

ORACLE_HOME: /u01/app/oracle/product/12.1.0

TNS Listener port: 1521

Container databases:

SID: cdbtest(cdb)

SID: cdb2(nocdb)

 

在scott用户下增加测试数据(进行迁移后的验证)

SYS@cdb2> startup

ORACLE instance started.

 

Total System Global Area 438423552 bytes

Fixed Size 2289304 bytes

Variable Size 255852904 bytes

Database Buffers 176160768 bytes

Redo Buffers 4120576 bytes

Database mounted.

Database opened.

SYS@cdb2> conn scott/tiger

ERROR:

ORA-28000: the account is locked

 

 

Warning: You are no longer connected to ORACLE.

SYS@cdb2> alter user scott identified by tiger account unlock ;

SP2-0640: Not connected

SYS@cdb2> conn / as sysdba

Connected.

SYS@cdb2> alter user scott identified by tiger account unlock ;

 

User altered.

 

SYS@cdb2> conn scott/tiger

Connected.

SCOTT@cdb2> create table ziyoo (a int ,b varchar2(10)) ;

 

Table created.

 

SCOTT@cdb2> insert into ziyoo values (1,'1') ;

 

1 row created.

 

SCOTT@cdb2> commit ;

 

Commit complete.

设置cdb2为read only 模式

SCOTT@cdb2> conn / as sysdba

Connected.

SYS@cdb2> shutdown immediate ;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@cdb2> startup mount exclusive ;

ORACLE instance started.

 

Total System Global Area 438423552 bytes

Fixed Size 2289304 bytes

Variable Size 255852904 bytes

Database Buffers 176160768 bytes

Redo Buffers 4120576 bytes

Database mounted.

SYS@cdb2> alter database open read only ;

 

Database altered.

生成 manifest file并关闭cdb2

 

SYS@cdb2> exec dbms_pdb.describe(pdb_descr_file=>'/u01/app/oracle/oradata/noncdb/noncdb1.xml');

 

PL/SQL procedure successfully completed.

 

SYS@cdb2> shutdown immediate ;

Database closed.

Database dismounted.

exit

ORACLE instance shut down.

 

SYS@cdb2> Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

在cdbtest数据库创建pdb使用上面生成的 manifest file 文件

$export ORACLE_SID=cdbtest

$sqlplus / as sysdba

 

SQL*Plus: Release 12.1.0.1.0 Production on Tue Apr 15 21:43:00 2014

 

Copyright (c) 1982, 2013, Oracle. All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SYS@cdbtest> ed

Wrote file afiedt.buf

 

create pluggable database exnoncdb1

as clone

file_name_convert=('/u02/oradata/cdb2/','/u02/oradata/noncdb1/')

copy

/

 

Pluggable database created.

 

SYS@cdbtest> alter pluggable database exnoncdb1 open ;

 

Warning: PDB altered with errors.

 

SYS@cdbtest> alter pluggable database exnoncdb1 close ;

 

Pluggable database altered.

 

SYS@cdbtest> alter pluggable database exnoncdb1 open ;

 

Warning: PDB altered with errors.

 

SYS@cdbtest> select name ,con_id from v$active_services order by 1 ;

 

NAME CON_ID

---------------------------------------------------------------- ----------

SYS$BACKGROUND 1

SYS$USERS 1

cdbtest.oracle.com 1

cdbtestXDB 1

exnoncdb.oracle.com 6

exnoncdb1.oracle.com 7

pdb1.oracle.com 3

pdb3_his.oracle.com 4

pdb56.oracle.com 5

 

9 rows selected.

 

SYS@cdbtest> select con_id,dbid,name ,open_mode from v$pdbs ;

 

CON_ID DBID NAME OPEN_MODE

---------- ---------- ------------------------------ ----------

2 4087438519 PDB$SEED READ ONLY

3 3352592044 PDB1 READ WRITE

4 3960920495 PDB3_HIS READ WRITE

5 3170747834 PDB56 READ WRITE

6 1921111138 EXNONCDB MOUNTED

7 4022373748 EXNONCDB1 READ WRITE

 

6 rows selected.

 

转换pdb data dictionary (可选,生产环境建议做)

$sqlplus sys/password@localhost:1521/exnoncdb1.oracle.com as sysdba

 

SQL*Plus: Release 12.1.0.1.0 Production on Tue Apr 15 22:15:40 2014

 

Copyright (c) 1982, 2013, Oracle. All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

 

SYS@localhost:1521/exnoncdb1.oracle.com> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql

输出过程省略,执行需要较长时间。。。。

 

 

scoot用户验证数据:

SYS@localhost:1521/exnoncdb1.oracle.com> conn scott/tiger@localhost:1521/exnoncdb1.oracle.com

Connected.

SCOTT@localhost:1521/exnoncdb1.oracle.com> select * from tab ;

 

TNAME

--------------------------------------------------------------------------------

TABTYPE CLUSTERID

------- ----------

DEPT

TABLE

 

EMP

TABLE

 

BONUS

TABLE

 

SALGRADE

TABLE

 

ZIYOO

TABLE

 

 

5 rows selected.

 

SCOTT@localhost:1521/exnoncdb1.oracle.com> select * from ziyoo ;

 

A B

---------- ----------

1 1

 

1 row selected.

 

重置环境

 

SCOTT@localhost:1521/exnoncdb1.oracle.com> conn / as sysdba

Connected.

SYS@cdbtest> alter pluggable database exnoncdb close immediate ;

 

Pluggable database altered.

 

SYS@cdbtest> drop pluggable database exnoncdb ;

 

Pluggable database dropped.

 

SYS@cdbtest> alter pluggable database exnoncdb1 close immediate ;

 

Pluggable database altered.

 

SYS@cdbtest> drop pluggable database exnoncdb1 including datafiles ;

 

Pluggable database dropped.

 

SYS@cdbtest> select name ,open_mode from v$pdbs ;

 

NAME OPEN_MODE

------------------------------ ----------

PDB$SEED READ ONLY

PDB1 READ WRITE

PDB3_HIS READ WRITE

PDB56 READ WRITE

 

4 rows selected.

convert nocdb to cdb using dbms_pdb的更多相关文章

  1. 探索Oracle之数据库升级七 11gR2 to 12c 升级完毕后插入PDB

    探索Oracle之数据库升级七 11gR2 to 12c 升级完毕后插入PDB 前言:        从Oracle 12c開始,引入了容器数据库的概念,能够实现数据库插拔操作,例如以下图: 如今我们 ...

  2. SQL Server系统视图sys.master_files不能正确显示数据库脱机状态

    最近发现在SQL Server数据库(目前测试过SQL Server 2008, 2012,2014,2016各个版本)中,即使数据库处于脱机(OFFLINE)状态,但是sys.master_file ...

  3. ORACLE 12C新特性——CDB与PDB

    Oracle 12C引入了CDB与PDB的新特性,在ORACLE 12C数据库引入的多租用户环境(Multitenant Environment)中,允许一个数据库容器(CDB)承载多个可插拔数据库( ...

  4. CDB中plug PDB

    CDB中plug PDB 先决条件: ·CDB要能够访问之前被unplugged 的pdb的xml文件.如果不能访问,需要使用dbms_pdb.recover创建一个xml文件 ·CDB要能够访问到该 ...

  5. CDB和PDB基本管理

    CDB和PDB基本管理 这篇文章主要介绍CDB和PDB的基本管理,资料来源oracle官方. 基本概念: Multitenant Environment:多租户环境 CDB(Container Dat ...

  6. 详谈Oracle12c新特点容器数据库&可插拔数据库(CDB&PDB)

    一般信息 数据字典 CDB_FILE$ DBA_PDBS PDB$SEED CDB_LOCAL_ADMINAUTH$ DBA_PDB_HISTORY PDB_HISTORY$ CDB_PDB_SAVE ...

  7. Oracle12c之 CDB数据库中数据字典架构

    数据字典就是元数据的集合,比如创建的表,列,约束,触发器等等这些都是元数据,需要保存到数据库中.除此之外,Oracle自身的一些数据库对象,如目录,PL/SQL代码等等这些都是元数据,都需要存放在数据 ...

  8. Upgrade a Non-CDB To a PDB on CDB

    .Stop the cluster database and start database on one node with read noly [oracle@raca1 admin]$ srvct ...

  9. Convert BSpline Curve to Arc Spline in OpenCASCADE

    Convert BSpline Curve to Arc Spline in OpenCASCADE eryar@163.com Abstract. The paper based on OpenCA ...

随机推荐

  1. unity3d游戏开发git环境配置

    http://dmayance.com/git-and-unity-projects/ 主要是将2进制的项目文件设置成文本模式,这样便于比较修改. 部署了一个gitignore,忽略了不需要同步的项目 ...

  2. mac mysql

    http://blog.neten.de/posts/2014/01/27/install-mysql-using-homebrew/

  3. Lintcode: Majority Number II

    Given an array of integers, the majority number is the number that occurs more than 1/3 of the size ...

  4. C++调试技巧

    编号:1010时间:2016年5月13日11:15:20功能:C++调试技巧http://www.cnblogs.com/lidabo/p/3631055.html

  5. [html5] (Notification) 桌面通知

    前几天要做一个桌面通知的功能,翻查以前做的笔记,发现webkitNotifications这个已经不能用了,baidu了下,基本都是介绍webkitNotifications的,后来在SOF上找到答案 ...

  6. bzoj3131

    这是一道很好也很烦的综合题…… 首先我们肯定要先把f(i)处理出来这是毫无疑问的 我们要求出数位乘积为now的个数,首先是空间上的问题 直接肯定会爆空间,不难发现 乘积的质因数只有2,3,5,7,并且 ...

  7. 【网络流#2】hdu 1533 - 最小费用最大流模板题

    最小费用最大流,即MCMF(Minimum Cost Maximum Flow)问题 嗯~第一次写费用流题... 这道就是费用流的模板题,找不到更裸的题了 建图:每个m(Man)作为源点,每个H(Ho ...

  8. 获取用户IP地址

    // <summary> /// 取得客户端真实IP.如果有代理则取第一个非内网地址 /// by flower.b /// </summary> public static ...

  9. powerdesigner的PDM模型name和comment相互复制替换

    在[Tools]-[Execute Commands]-[Edit/Run Script] 下.输入以下命令,这些命令也可以保存起来,扩展名为 vbs ,以便下次使用. 1.name的值复制到comm ...

  10. 如何读取R 的sumary()结果

    思路 step 1: sum = summary(model) step 2: sum有好多属性,直接根据属性名称引用($)即可, 如: + > sum$call 返回 model 使用的模型语 ...