SQL*Plus: Release 12.2.0.1.0 Production on Sun Jul 16 23:05:02 2017
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 con_name;
CON_NAME
------------------------------
CDB$ROOT
SQL> create pluggable database cdb1 admin user cdb1 identified by cdb1;
create pluggable database cdb1 admin user cdb1 identified by cdb1
*
ERROR at line 1:
ORA-65016: FILE_NAME_CONVERT must be specified
SQL> create pluggable database cdb1 admin user cdb1 identified by cdb1 file_name_convert=
2
SQL>
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
pdb:/data/pdb/datafile@oracle>oerr ora 65016
65016, 00000, "FILE_NAME_CONVERT must be specified"
// *Cause: Data files, and possibly other files, needed to be copied as a
// part of creating a pluggable database. However, Oracle Managed
// Files (OMF) was not enabled, PDB_FILE_NAME_CONVERT was not defined,
// and there was a failure to specify the FILE_NAME_CONVERT clause.
// *Action: Enable OMF or define PDB_FILE_NAME_CONVERT system parameter before
// issuing CREATE PLUGGABLE DATABASE statement, or specify
// FILE_NAME_CONVERT clause as a part of the statement.
//
如果未指定db_create_file_dest 参数则需要手动在CREATE PLUGGABLE DATABASE时指定FILE_NAME_CONVERT,例如:
SQL> create pluggable database cdb1 admin user cdb1 identified by cdb1 file_name_convert=('/u01/app/oracle/oradata/pdb/pdbseed','/data/pdb/cdb/cdb1');
Pluggable database created.
也可以使用参数db_create_file_dest
SQL> alter system set db_create_file_dest='/data/pdb/cdb/cdb1';创建成功后查看
SQL> select con_id,name,open_mode,restricted from v$pdbs order by 1;
CON_ID NAME OPEN_MODE RES
---------- -------------------------------------------------------------------------------------------------------------------------------- ---------- ---
2 PDB$SEED READ ONLY NO
3 CDB1 MOUNTED
SQL>
打开cdb--指定PDB 数据库:
SQL> alter session set container=cdb1;
Session altered.
SQL> startup
Pluggable Database opened.
SQL>
查看状态
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
3 CDB1 READ WRITE NO
SQL>