[oracle@localhost admin]$ sqlplus
SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 7 16:58:58 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Enter user-name: /as sysdba
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> show con_id
CON_ID
------------------------------
1
SQL> select name,CON_ID from v$tablespace;
NAME CON_ID
------------------------------ ----------
SYSAUX 1
SYSTEM 1
UNDOTBS1 1
USERS 1
TEMP 1
SYSTEM 2
SYSAUX 2
TEMP 2
SYSTEM 3
SYSAUX 3
TEMP 3
NAME CON_ID
------------------------------ ----------
USERS 3
12 rows selected.
SQL> select T.name,T.con_id,C.name
from v$tablespace T,v$containers C
where C.con_id= T.con_id ; 2 3
NAME CON_ID NAME
------------------------------ ---------- ------------------------------
TEMP 1 CDB$ROOT
USERS 1 CDB$ROOT
UNDOTBS1 1 CDB$ROOT
SYSTEM 1 CDB$ROOT
SYSAUX 1 CDB$ROOT
TEMP 2 PDB$SEED
SYSAUX 2 PDB$SEED
SYSTEM 2 PDB$SEED
USERS 3 PDB1
TEMP 3 PDB1
SYSAUX 3 PDB1
NAME CON_ID NAME
------------------------------ ---------- ------------------------------
SYSTEM 3 PDB1
12 rows selected.
SQL> alter session set container=pdb1;
Session altered.
SQL> show con_id;
CON_ID
------------------------------
3
SQL> select con_id, name from v$containers;
CON_ID NAME
---------- ------------------------------
3 PDB1
SQL> show user;
USER is "SYS"
SQL> select FILE_NAME from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/CDB1/2D689955A3305006E055000000000001/datafile/o1_mf_sys
tem_cfs6gb0d_.dbf
/u01/app/oracle/oradata/CDB1/2D689955A3305006E055000000000001/datafile/o1_mf_sys
aux_cfs6gb0v_.dbf
/u01/app/oracle/oradata/CDB1/2D689955A3305006E055000000000001/datafile/o1_mf_use
rs_cfs6h1n7_.dbf
SQL> select T.name,T.con_id,C.name
from v$tablespace T,v$containers C
where C.con_id= T.con_id ; 2 3
NAME CON_ID NAME
------------------------------ ---------- ------------------------------
USERS 3 PDB1
TEMP 3 PDB1
SYSAUX 3 PDB1
SYSTEM 3 PDB1
SQL> create TABLESPACE test
DATAFILE '/u01/app/oracle/oradata/CDB1/2D689955A3305006E055000000000001/datafile/test.dbf' SIZE 10M
AUTOEXTEND ON NEXT 10M; 2 3
Tablespace created.
SQL> select T.name,T.con_id,C.name
from v$tablespace T,v$containers C
where C.con_id= T.con_id ; 2 3
NAME CON_ID NAME
------------------------------ ---------- ------------------------------
TEST 3 PDB1
USERS 3 PDB1
TEMP 3 PDB1
SYSAUX 3 PDB1
SYSTEM 3 PDB1
SQL> create user test
2 identified by test
3 default tablespace test
4 CONTAINER=CURRENT;
User created.
SQL> select username,DEFAULT_TABLESPACE as usr_T from dba_users where username='TEST';
USERNAME USR_T USR_T
-------------------------
TEST TEST TEST
SQL> grant connect,resource to test;
Grant succeeded.
SQL> conn test/test@pdb1
Connected.
SQL> create table test01(id number);
Table created.
SQL> insert into test01 values(1);
1 row created.
SQL> /
1 row created.
SQL> /
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test01;
ID
----------
1
1
1
SQL> set lines 200
SQL> select TABLE_NAME,TABLESPACE_NAME from user_tables where TABLE_NAME='TEST01';
TABLE_NAME TABLESPACE_NAME
---------------- ------------------------------
TEST01 TEST
SQL>
************END***************