oracle12cnon-cdb升级成cdb模式
oracle 12c non-cdb升级成cdb模式
创新互联公司是一家专注网站建设、网络营销策划、小程序开发、电子商务建设、网络推广、移动互联开发、研究、服务为一体的技术型公司。公司成立十年以来,已经为近千家围栏护栏各业的企业公司提供互联网服务。现在,服务的近千家客户与我们一路同行,见证我们的成长;未来,我们一起分享成功的喜悦。
相同主机下,有一个non-cdb数据库,再创建一个cdb的实例。
SQL> select name,cdb from v$database;
NAME CDB
--------------------------- ---------
EID NO
1 row selected.
关闭数据库并以read only模式打开
16:50:58 SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
16:51:39 SQL> startup open read only;
ORACLE instance started.
Total System Global Area 1426063360 bytes
Fixed Size 8620704 bytes
Variable Size 486540640 bytes
Database Buffers 922746880 bytes
Redo Buffers 8155136 bytes
Database mounted.
Database opened.
SQL> select name,open_mode,cdb from v$database;
NAME OPEN_MODE CDB
--------------------------- ------------------------------------------------------------ ---------
EID READ ONLY NO
1 row selected.
生成xml格式的数据库描述文件
SQL> BEGIN
2 DBMS_PDB.DESCRIBE(pdb_descr_file => '/home/oracle/EID.xml');
3 END;
4 /
PL/SQL procedure successfully completed.
关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
连接到cdb数据库
SQL> CREATE PLUGGABLE DATABASE mpdb01 USING '/home/oracle/EID.xml'
2 COPY
3 FILE_NAME_CONVERT = ('/u02/app/oracle/oradata/EID/', '/u02/app/oracle/oradata/mcdb/mpdb01/');
Pluggable database created.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 MPDB01 MOUNTED
SQL> alter session set container=MPDB01;
Session altered.
执行如下命令。注意该命令会清空shared pool,所以生产环境要注意。
sql> @$ORACLE_HOME/rdbms/admin/noncdb_to_pdb.sql
SQL> alter pluggable database MPDB01 open;
Pluggable database altered.
文章标题:oracle12cnon-cdb升级成cdb模式
文章源于:http://myzitong.com/article/igdgdc.html