十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
这篇文章主要介绍“Oracle 12c nocdb怎么转换成cdb”,在日常操作中,相信很多人在Oracle 12c nocdb怎么转换成cdb问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Oracle 12c nocdb怎么转换成cdb”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
创新互联是专业的坊子网站建设公司,坊子接单;提供网站建设、做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行坊子网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
Oracle 12c nocdb转换成cdb
环境说明:
OS:Oracle Linux Server release 6.3
DB:Oracle 12.2.0.1.0
DBName:dapuchai
场景:
Oracle 11.2.0.4.0升级到Oracle 12.2.0.1.0,默认是no-cdb模式,升级后根据需要将no-cdb转换成cdb里,即将之前的11.2.0.4.0数据完全迁移到PDB(Creating a PDB Using a Non-CDB);
实施方案:
一:连接non-CDB(dapuchai),生成XML格式数据库描述文件
二:DBCA新建cdb数据库(cjcdb)
三:Plug in the non-CDB (cjcpdb)
四:执行noncdb_to_pdb.sql
五:验证数据
参考:https://docs.oracle.com/database/121/ADMIN/cdb_plug.htm#ADMIN13598
一:连接non-CDB(dapuchai),生成XML格式数据库描述文件
Connect to the non-CDB, and run the DBMS_PDB.DESCRIBE
procedure to construct an XML file that describes the non-CDB.
[root@cjc ~]# ps -ef|grep pmon
oracle 2677 1 0 22:35 ? 00:00:00 ora_pmon_dapuchai
root 3057 2634 0 22:37 pts/1 00:00:00 grep pmon
SQL> select name,cdb from v$database;
NAME CDB
--------- ---
DAPUCHAI NO
SQL> show pdbs
SQL> show con_id
CON_ID
------------------------------
0
SQL> shutdown immediate
---只读方式打开dapuchai数据库
SQL> startup open read only;
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------- -------------------- ---
DAPUCHAI READ ONLY NO
---生成xml格式的数据库描述文件
SQL> BEGIN
DBMS_PDB.DESCRIBE(pdb_descr_file => '/home/oracle/20200113.xml');
END; 2 3
4 /
PL/SQL procedure successfully completed.
二:DBCA新建cdb数据库(cjcdb)
[oracle@cjc ~]$ dbca
三:Plug in the non-CDB (cjcpdb)
[oracle@cjc oracle12]$ ps -ef|grep pmon
oracle 3106 1 0 22:38 ? 00:00:00 ora_pmon_dapuchai
oracle 4326 1 0 23:05 ? 00:00:00 ora_pmon_cjcdb
oracle 5651 3249 0 23:16 pts/1 00:00:00 grep pmon
[oracle@cjc ~]$ export ORACLE_SID=cjcdb
[oracle@cjc ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 13 23:18:52 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------- -------------------- ---
CJCDB READ WRITE YES
[oracle@cjc oradata]$ mkdir cjcpdb
[oracle@cjc oradata]$ cd cjcpdb/
[oracle@cjc cjcpdb]$ pwd
/u01/app/oracle12/oradata/cjcpdb
SQL> select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle12/oradata/cjcdb/users01.dbf
/u01/app/oracle12/oradata/cjcdb/undotbs01.dbf
/u01/app/oracle12/oradata/cjcdb/system01.dbf
/u01/app/oracle12/oradata/cjcdb/sysaux01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/system01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/sysaux01.dbf
/u01/app/oracle12/oradata/cjcdb/pdbseed/undotbs01.dbf
7 rows selected.
SQL> create pluggable database cjcpdb using '/home/oracle/20200113.xml' copy FILE_NAME_CONVERT = ('/u01/app/oracle/oradata/dapuchai/', '/u01/app/oracle12/oradata/cjcpdb/');
Pluggable database created.
---数据文件迁移完成
[oracle@cjc cjcpdb]$ pwd
/u01/app/oracle12/oradata/cjcpdb
[oracle@cjc cjcpdb]$ ll -rth
total 2.5G
-rw-r----- 1 oracle oinstall 58M Jan 13 23:26 temp01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 ogg_temtbs01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 ogg_tbs01.dbf
-rw-r----- 1 oracle oinstall 11M Jan 13 23:26 cjc_tbs01a.dbf
-rw-r----- 1 oracle oinstall 16M Jan 13 23:26 users01.dbf
-rw-r----- 1 oracle oinstall 446M Jan 13 23:26 undotbs01.dbf
-rw-r----- 1 oracle oinstall 1.2G Jan 13 23:26 system01.dbf
-rw-r----- 1 oracle oinstall 881M Jan 13 23:26 sysaux01.dbf
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CJCPDB MOUNTED
四:执行noncdb_to_pdb.sql
虚拟机内存只分配4G,并且是机械硬盘,脚本执行了1小时;
切换到PDB并执行脚本
SQL> alter session set container=cjcpdb;
SQL> @?/rdbms/admin/noncdb_to_pdb.sql
......
......
......
---启动pdb
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 CJCPDB MOUNTED
SQL> alter pluggable database cjcpdb open;
Pluggable database altered.
告警日志查看pdb启动过程;
五:验证数据
[oracle@cjc ~]$ cd /u01/app/oracle12/product/12.2.0.1/db_1/network/admin/
[oracle@cjc admin]$ vi tnsnames.ora
......
CJCPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = cjc)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = CJCPDB)
)
)
---修改环境变量,指定cdb实例
[oracle@cjc ~]$ vi .bash_profile
......
#export ORACLE_SID=dapuchai
export ORACLE_SID=cjcdb
......
[oracle@cjc ~]$ source .bash_profile
---关掉no-cdb
到此,关于“Oracle 12c nocdb怎么转换成cdb”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!