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. SQL Server 和 Oracle 以及 MySQL 有哪些区别?

    SQL,在这里我理解成SQL Server.三者是目前市场占有率最高(依安装量而非收入)的关系数据库,而且很有代表性.排行第四的DB2(属IBM公司),与Oracle的定位和架构非常相似,就不赘述了. ...

  2. java.lang.NoSuchMethodError: javaxservlet.http.HttpServletRequest.isAsyncStarted()Z

    鸣谢网址:http://stackoverflow.com/questions/25940571/java-lang-nosuchmethoderror-javaxservlet-http-https ...

  3. IntelliJ IDEA14 安装

    一.官网下载 IntelliJ IDEA的官网:https://www.jetbrains.com/idea/ 进入选择Get IntelliJ IDEA Now ,进入下载页:https://www ...

  4. Javascript和ECMAScript二三事

    来自<javascript高级程序设计 第三版:作者Nicholas C. Zakas>的学习笔记(一) Javascript是一种专为与网页交互而设计的脚本语言,由下列三个不同部分组成: ...

  5. Scrum中的User Story

    我们通常用User Story来描述Backlog里的各个Backlog项,User Story是从用户的角度对系统的某个功能模块所作的简短描述.一个User Story描述了项目中的一个小功能,以及 ...

  6. WPF性能优化经验总结

    WPF性能优化一.Rendering Tier 1. 根据硬件配置的不同,WPF采用不同的Rendering Tier做渲染.下列情况请特别注意,因为在这些情况下,即使是处于Rendering Tie ...

  7. How to Cope with Deadlocks

    http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html How to Cope with Deadlocks This section ...

  8. 创业公司Playcafe关门大吉 创始人总结10大失败教训

    导读:互联网电视游戏网站PlayCafe的创始人马克·高登森(Mark Goldenson)日前撰文,总结了自己创业失败的十个教训.以下为文章主要内容: 一年半前,我与公司联合创始人戴维·奈格(Dev ...

  9. MVC 的HTTP请求

    MVC 的HTTP请求过程(以IIS为例) 通过Browser发过请求给IIS(get/post) IIS得到请求后,再把请求转给aspnet_iisapi.dll处理,通过asp.net的一些框架的 ...

  10. 去除windows的Shift+Space 全角半角切换

    windows7下的输入法,有一个“全/半角切换”的快捷方式“Shift+Space”,我们可以通过以下方式查看到: “开始”->“控制面板”->“区域和语言”->“键盘和语言”-& ...