Use the dbms_pdb package for Migration. dbms_pdb is newly added to 12c, which is used for Migration convenience. You can use descdbms_pdb to view the specific parameters. Migrate Non-CDB database
Use the dbms_pdb package for Migration. dbms_pdb is newly added to 12c, which is used for Migration convenience. You can use desc dbms_pdb to view the specific parameters. Migrate Non-CDB database
Go to non-CDB Database
View the location of the data file
[Oracle @ shuang ~] $ Sqlplus/as sysdba
SQL * Plus: Release 12.1.0.1.0 Production on Wed Feb 26 13:17:45 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 1060585472 bytes
Fixed Size 2296472 bytes
Variable Size 704644456 bytes
Database Buffers 348127232 bytes
Redo Buffers 5517312 bytes
SQL> select name from v $ datafile;
NAME
--------------------------------------------------------------------------------
/U01/app/oracle/oradata/SHUANG/datafile/o1_mf_system_9jckkfwg _. dbf
/U01/app/oracle/oradata/SHUANG/datafile/o1_mf_sysaux_9jckdvs6 _. dbf
/U01/app/oracle/oradata/SHUANG/datafile/o1_mf_undotbs1_9jckpbno _. dbf
/U01/app/oracle/oradata/SHUANG/datafile/o1_mf_users_9jckp97s _. dbf
Check whether the database is a Non-CDB database.
SQL> select name, cdb from v $ database;
NAME CDB
------------
SHUANG NO
Create Test Users and tables
SQL> conn a/
Connected.
SQL> select count (*) from;
COUNT (*)
----------
1024
Use the dbms_pdb package for Migration. dbms_pdb is newly added to 12c, which is used for Migration convenience. You can use desc dbms_pdb to view the specific parameters.
To migrate a Non-CDB database to a CDB database, you must first set the Non-CDB database as a read-only database before further operations.
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
[Oracle @ shuang ~] $ Sqlplus/as sysdba
SQL * Plus: Release 12.1.0.1.0 Production on Wed Feb 26 13:17:45 2014
Copyright (c) 1982,201 3, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1060585472 bytes
Fixed Size 2296472 bytes
Variable Size 704644456 bytes
Database Buffers 348127232 bytes
Redo Buffers 5517312 bytes
Database mounted
SQL> alter database open read only;
Database altered.
SQL> exec dbms_pdb.describe (PDB_DESCR_FILE => '/u01/app/oracle/oradata/SHUANG/datafile/shuang12c. xml ');
PL/SQL procedure successfully completed.
SQL> host ls-l/u01/app/oracle/oradata/SHUANG/datafile/shuang12c. xml
-Rw-r -- 1 oracle oinstall 4123 February 26 12:50/u01/app/oracle/oradata/SHUANG/datafile/shuang12c. xml
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
Run PLUG in CDB to insert the Non-CDB into CDB, specify the COPY parameter, and COPY the file to the corresponding directory of CDB. If the file has been copied to a specific directory, you can specify the NOCOPY option so that you do not need to copy it again.
Go to the CDB database.
SQL> create pluggable database shuang using '/u01/app/oracle/oradata/SHUANG/datafile/shuang12c. xml' copy;
PL/SQL procedure successfully completed.
SQL> select name, open_mode from v $ pdbs;
NAME OPEN_MODE
----------------------------------------
PDB $ SEED READ ONLY
PDBORCL MOUNTED
SHUANG READ WRITE
SQL> alter session set container = shuang;
Session altered.
SQL> select count (*) from a.;
COUNT (*)
----------
1024