Oracle Database 12c New Features

Showing posts with label PDB Seed. Show all posts
Showing posts with label PDB Seed. Show all posts

Create PDB from PDB$SEED (appropriate PDB directory)

This is an extension example from previous post of Create PDB from PDB$SEED
The objective is to convert the data files and temp files to pdb folder appropriately.

Previous example result is as follow

Check the data and temp files

SQL> alter session set container=pdb2;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB2

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdb$seed_system01.dbf
+DATA/pdb2/pdb$seed_sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdbseed_temp01.dbf


If you notice that system01.dbf and sysaux01.dbf are having suffix pdb$seed but temp01.dbf is having pdbseed (without $). We therefore need to convert both of them.

Following is the command to rectify my error (I am creating PDB3 from the beginning).

1. Create the folder to place the pdb datafiles, in this example I am using ASM, the procedure is the same if you are using non RAC (ordinary file system)

[oracle@ora12cn1 ~]$ su - grid
Password:
[grid@ora12cn1 ~]$ asmcmd
ASMCMD> cd +DATA
ASMCMD> mkdir pdb3
ASMCMD> cd pdb3
ASMCMD> pwd
+DATA/pdb3
ASMCMD> 
2. Connect to root, with sys as sysdba

[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 15:55:04 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

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

SQL> 

3. Identify the location of PDB$SEED datafiles.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select file_name from dba_data_files;

FILE_NAME
-------------------------------------------
+DATA/pdb$seed_system01.dbf
+DATA/pdb$seed_sysaux01.dbf


4.  Connect to root and issue the CREATE PLUGGABLE DATABASE command with following changed
     FILE_NAME_CONVERT = ('+DATA/pdb$seed_', '+DATA/pdb3/','+DATA/pdbseed_','+DATA/pdb3/')

SQL> conn / as sysdba

Connected.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE PLUGGABLE DATABASE pdb3
  2  ADMIN USER pdb3_admin IDENTIFIED BY oracle ROLES=(CONNECT)
  3  FILE_NAME_CONVERT=('+DATA/pdb$seed_', '+DATA/pdb3/','+DATA/pdbseed_','+DATA/pdb3/');

Pluggable database created.

SQL> alter session set container = PDB3;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB3

5. Check the result, it look better now

SQL> alter pluggable database pdb3 open;

Pluggable database altered.

SQL> alter session set container=pdb3;

Session altered.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb3/system01.dbf
+DATA/pdb3/sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb3/temp01.dbf


7. The service is automatically added

[oracle@ora12cn2 Desktop]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 01-DEC-2013 18:38:17
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn2, pid: 3475>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn2.localdomain)(PORT=50151))
Service "pdb2" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "pdb3" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

Create PDB from PDB$SEED (appropriate PDB directory)

This is an extension example from previous post of Create PDB from PDB$SEED
The objective is to convert the data files and temp files to pdb folder appropriately.

Previous example result is as follow

Check the data and temp files

SQL> alter session set container=pdb2;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB2

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdb$seed_system01.dbf
+DATA/pdb2/pdb$seed_sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdbseed_temp01.dbf


If you notice that system01.dbf and sysaux01.dbf are having suffix pdb$seed but temp01.dbf is having pdbseed (without $). We therefore need to convert both of them.

Following is the command to rectify my error (I am creating PDB3 from the beginning).

1. Create the folder to place the pdb datafiles, in this example I am using ASM, the procedure is the same if you are using non RAC (ordinary file system)

[oracle@ora12cn1 ~]$ su - grid
Password:
[grid@ora12cn1 ~]$ asmcmd
ASMCMD> cd +DATA
ASMCMD> mkdir pdb3
ASMCMD> cd pdb3
ASMCMD> pwd
+DATA/pdb3
ASMCMD> 
2. Connect to root, with sys as sysdba

[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 15:55:04 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

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

SQL> 

3. Identify the location of PDB$SEED datafiles.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select file_name from dba_data_files;

FILE_NAME
-------------------------------------------
+DATA/pdb$seed_system01.dbf
+DATA/pdb$seed_sysaux01.dbf


4.  Connect to root and issue the CREATE PLUGGABLE DATABASE command with following changed
     FILE_NAME_CONVERT = ('+DATA/pdb$seed_', '+DATA/pdb3/','+DATA/pdbseed_','+DATA/pdb3/')

SQL> conn / as sysdba

Connected.

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE PLUGGABLE DATABASE pdb3
  2  ADMIN USER pdb3_admin IDENTIFIED BY oracle ROLES=(CONNECT)
  3  FILE_NAME_CONVERT=('+DATA/pdb$seed_', '+DATA/pdb3/','+DATA/pdbseed_','+DATA/pdb3/');

Pluggable database created.

SQL> alter session set container = PDB3;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB3

5. Check the result, it look better now

SQL> alter pluggable database pdb3 open;

Pluggable database altered.

SQL> alter session set container=pdb3;

Session altered.

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb3/system01.dbf
+DATA/pdb3/sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb3/temp01.dbf


7. The service is automatically added

[oracle@ora12cn2 Desktop]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 01-DEC-2013 18:38:17
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn2, pid: 3475>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn2.localdomain)(PORT=50151))
Service "pdb2" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "pdb3" has 1 instance(s).
  Instance "ora12c2", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

Create PDB from PDB$SEED

The creation of a new PDB from the seed is nearly instantaneous. The operation copies the
data files from the READ ONLY seed PDB to the target directory defined in the CREATE
PLUGGABLE DATABASE statement.

It creates tablespaces such as SYSTEM to store a full catalog including metadata pointing to
Oracle-supplied objects, SYSAUX for local auxiliary data.

It creates default schemas and common users that exist in seed PDB, SYS who continues to
have all superuser privileges and SYSTEM who can administer the PDB.
It creates a local user (the PDBA) granted a local PDB_DBA role. Until the PDB SYS user grants
privileges to the local PDB_DBA role, the new PDBA cannot perform any other operation than
connecting to the PDB.

A new default service is also created for the PDB.

1. Create the folder to place the pdb datafiles, in this example I am using ASM, the procedure is the same if you are using non RAC (ordinary file system)

[oracle@ora12cn1 ~]$ su - grid
Password:
[grid@ora12cn1 ~]$ asmcmd
ASMCMD> cd +DATA
ASMCMD> mkdir pdb2
ASMCMD> cd pdb2
ASMCMD> pwd
+DATA/pdb2
ASMCMD> 


2. Connect to root, with sys as sysdba

[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 15:55:04 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> 

3. Identify the location of PDB$SEED datafiles.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select file_name from dba_data_files;

FILE_NAME
-------------------------------------------
+DATA/pdb$seed_system01.dbf
+DATA/pdb$seed_sysaux01.dbf


4.  Connect to root and issue the CREATE PLUGGABLE DATABASE command

SQL> conn / as sysdba            
Connected.
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE PLUGGABLE DATABASE pdb2
  2  ADMIN USER pdb2_admin IDENTIFIED BY oracle ROLES=(CONNECT)
  3  FILE_NAME_CONVERT=('+DATA', '+DATA/pdb2');

Pluggable database created.

SQL> alter session set container = PDB2;

Session altered.
SQL> show con_name

CON_NAME
------------------------------
PDB2
5. The services is automatically created

[oracle@ora12cn1 oracle]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 25-NOV-2013 17:50:25
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn1, pid: 4003>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn1.localdomain)(PORT=52784))
Service "pdb1" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "pdb2" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

6. Now test open the database

SQL> alter pluggable database pdb2 open; 

Pluggable database altered.

SQL> select name, con_id, open_mode from v$pdbs; 

NAME            CON_ID OPEN_MODE
---------- ---------- ----------
PDB$SEED            2 READ ONLY
PDB1               3 MOUNTED
PDB2               4 READ WRITE


7. Check the data and temp files

SQL> alter session set container=pdb2;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB2

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdb$seed_system01.dbf
+DATA/pdb2/pdb$seed_sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdbseed_temp01.dbf


You may want to refer to modified Create PDB from PDB$SEED (appropriate PDB directory) post that explain appropriate PDB directory.

Create PDB from PDB$SEED

The creation of a new PDB from the seed is nearly instantaneous. The operation copies the
data files from the READ ONLY seed PDB to the target directory defined in the CREATE
PLUGGABLE DATABASE statement.

It creates tablespaces such as SYSTEM to store a full catalog including metadata pointing to
Oracle-supplied objects, SYSAUX for local auxiliary data.

It creates default schemas and common users that exist in seed PDB, SYS who continues to
have all superuser privileges and SYSTEM who can administer the PDB.
It creates a local user (the PDBA) granted a local PDB_DBA role. Until the PDB SYS user grants
privileges to the local PDB_DBA role, the new PDBA cannot perform any other operation than
connecting to the PDB.

A new default service is also created for the PDB.

1. Create the folder to place the pdb datafiles, in this example I am using ASM, the procedure is the same if you are using non RAC (ordinary file system)

[oracle@ora12cn1 ~]$ su - grid
Password:
[grid@ora12cn1 ~]$ asmcmd
ASMCMD> cd +DATA
ASMCMD> mkdir pdb2
ASMCMD> cd pdb2
ASMCMD> pwd
+DATA/pdb2
ASMCMD> 


2. Connect to root, with sys as sysdba

[oracle@ora12cn1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Nov 25 15:55:04 2013
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> 

3. Identify the location of PDB$SEED datafiles.

SQL> alter session set container=PDB$SEED;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB$SEED

SQL> select file_name from dba_data_files;

FILE_NAME
-------------------------------------------
+DATA/pdb$seed_system01.dbf
+DATA/pdb$seed_sysaux01.dbf


4.  Connect to root and issue the CREATE PLUGGABLE DATABASE command

SQL> conn / as sysdba            
Connected.
SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> CREATE PLUGGABLE DATABASE pdb2
  2  ADMIN USER pdb2_admin IDENTIFIED BY oracle ROLES=(CONNECT)
  3  FILE_NAME_CONVERT=('+DATA', '+DATA/pdb2');

Pluggable database created.

SQL> alter session set container = PDB2;

Session altered.
SQL> show con_name

CON_NAME
------------------------------
PDB2
5. The services is automatically created

[oracle@ora12cn1 oracle]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 25-NOV-2013 17:50:25
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn1, pid: 4003>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn1.localdomain)(PORT=52784))
Service "pdb1" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "pdb2" has 1 instance(s).
  Instance "ora12c1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
The command completed successfully

6. Now test open the database

SQL> alter pluggable database pdb2 open; 

Pluggable database altered.

SQL> select name, con_id, open_mode from v$pdbs; 

NAME            CON_ID OPEN_MODE
---------- ---------- ----------
PDB$SEED            2 READ ONLY
PDB1               3 MOUNTED
PDB2               4 READ WRITE


7. Check the data and temp files

SQL> alter session set container=pdb2;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDB2

SQL> select file_name from dba_data_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdb$seed_system01.dbf
+DATA/pdb2/pdb$seed_sysaux01.dbf

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/pdb2/pdbseed_temp01.dbf


You may want to refer to modified Create PDB from PDB$SEED (appropriate PDB directory) post that explain appropriate PDB directory.

Explore Oracle 12c Services In RAC

To check the services via Oracle Listener

[oracle@ora12cn1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 21-NOV-2013 22:23:08
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                21-NOV-2013 14:25:29
Uptime                    0 days 7 hr. 57 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ora12cn1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.101)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.111)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ora12cn1.localdomain)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0/db_1/admin/ora12c/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "ora12c" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
Service "quote" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
The command completed successfully

Make sure that the listener is started, if not started start the listener. To view detail services use services parameter

[oracle@ora12cn1 admin]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 21-NOV-2013 22:24:29
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:3 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn1, pid: 3844>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn1.localdomain)(PORT=21683))
Service "quote" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:3 refused:0 state:ready
         LOCAL SERVER
The command completed successfully



To list the services automatically created for each container.


SQL> SELECT name, con_id FROM v$services;
NAME               CON_ID
-------------------- ----------
quote                       3
ora12cXDB                    1
ora12c                      1
SYS$BACKGROUND                1
SYS$USERS                    1


Note: There we will never have PDB$SEED service because, we never can connect to the PDB SEED, in this example case I only have 1 PDB namely QUOTE.

SQL> col pdb_name form a20
SQL> select pdb_id, pdb_name from cdb_pdbs;
PDB_ID     PDB_NAME
---------- --------------------
2 PDB$SEED
       3 QUOTE

Explore Oracle 12c Services In RAC

To check the services via Oracle Listener

[oracle@ora12cn1 admin]$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 21-NOV-2013 22:23:08
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date                21-NOV-2013 14:25:29
Uptime                    0 days 7 hr. 57 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/ora12cn1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.101)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.111)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=ora12cn1.localdomain)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/product/12.1.0/db_1/admin/ora12c/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "ora12c" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
Service "quote" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
The command completed successfully

Make sure that the listener is started, if not started start the listener. To view detail services use services parameter

[oracle@ora12cn1 admin]$ lsnrctl services
LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 21-NOV-2013 22:24:29
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:0 refused:0 state:ready
         LOCAL SERVER
Service "ora12c" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:3 refused:0 state:ready
         LOCAL SERVER
Service "ora12cXDB" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:0 max:1022 state:ready
         DISPATCHER <machine: ora12cn1, pid: 3844>
         (ADDRESS=(PROTOCOL=tcp)(HOST=ora12cn1.localdomain)(PORT=21683))
Service "quote" has 1 instance(s).
  Instance "ora12c_1", status READY, has 1 handler(s) for this service...
    Handler(s):
      "DEDICATED" established:3 refused:0 state:ready
         LOCAL SERVER
The command completed successfully



To list the services automatically created for each container.


SQL> SELECT name, con_id FROM v$services;
NAME               CON_ID
-------------------- ----------
quote                       3
ora12cXDB                    1
ora12c                      1
SYS$BACKGROUND                1
SYS$USERS                    1


Note: There we will never have PDB$SEED service because, we never can connect to the PDB SEED, in this example case I only have 1 PDB namely QUOTE.

SQL> col pdb_name form a20
SQL> select pdb_id, pdb_name from cdb_pdbs;
PDB_ID     PDB_NAME
---------- --------------------
2 PDB$SEED
       3 QUOTE