Oracle 12c: Criando um PDB via SQL*Plus

12c

Primeiramente, preciso encontrar onde fica o SEED, que estará no diretório onde foi criado o CDB.

[ricardo@Melquior ~]$ export ORACLE_SID=PROD
[ricardo@Melquior ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Apr 14 08:24:17 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> SELECT FILE_NAME FROM DBA_DATA_FILES;

FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/PROD/system01.dbf
/u01/app/oracle/oradata/PROD/sysaux01.dbf
/u01/app/oracle/oradata/PROD/undotbs01.dbf
/u01/app/oracle/oradata/PROD/users01.dbf

SQL> EXIT
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[ricardo@Melquior ~]$ ls -lh /u01/app/oracle/oradata/PROD
total 1,6G
-rw-r----- 1 ricardo ricardo  18M Abr 14 08:25 control01.ctl
drwxr-x--- 2 ricardo ricardo   91 Abr 14 08:14 pdbseed
-rw-r----- 1 ricardo ricardo  51M Abr 14 08:22 redo01.log
-rw-r----- 1 ricardo ricardo  51M Abr 14 08:22 redo02.log
-rw-r----- 1 ricardo ricardo  51M Abr 14 08:25 redo03.log
-rw-r----- 1 ricardo ricardo 571M Abr 14 08:23 sysaux01.dbf
-rw-r----- 1 ricardo ricardo 781M Abr 14 08:22 system01.dbf
-rw-r----- 1 ricardo ricardo  61M Abr 14 08:23 temp01.dbf
-rw-r----- 1 ricardo ricardo  91M Abr 14 08:23 undotbs01.dbf
-rw-r----- 1 ricardo ricardo 5,1M Abr 14 08:22 users01.dbf
[ricardo@Melquior ~]$ ls -lh /u01/app/oracle/oradata/PROD/pdbseed/
total 741M
-rw-r----- 1 ricardo ricardo  21M Abr 14 08:21 pdbseed_temp012015-04-14_08-14-50-AM.dbf
-rw-r----- 1 ricardo ricardo 491M Abr 14 08:21 sysaux01.dbf
-rw-r----- 1 ricardo ricardo 251M Abr 14 08:21 system01.dbf
[ricardo@Melquior ~]$

Agora posso criar um PDB, chamado DEV1, indicando um caminho para seus DATAFILEs.

[ricardo@Melquior ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Apr 14 08:25:49 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> CREATE PLUGGABLE DATABASE DEV1 ADMIN USER PDB_ASM IDENTIFIED BY Nerv2015
  2  FILE_NAME_CONVERT=('/u01/app/oracle/oradata/PROD/pdbseed/','/u01/app/oracle/oradata/PROD/DEV1/');

Pluggable database created.

SQL>

E para que ele possa ser utilizado, deve ser aberto em READ WRITE.

SQL> ALTER PLUGGABLE DATABASE DEV1 OPEN READ WRITE;

Pluggable database altered.

SQL>

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.