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.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31480688/viewspace-2649370/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31480688/viewspace-2649370/