How to administer PDB datafile
set container to corresponding pdb from root.
SQL> alter session set container=dx12p1;
Session altered.
SQL> alter database datafile '/oradisk/oradata/dx12c/dx12p1/user_01.dbf' autoextend off;
Database altered.
SQL> select file_name from cdb_data_files;
FILE_NAME
---------------------------------------------------------------------------------
/oradisk/oradata/dx12c/dx12p1/system_01.dbf
/oradisk/oradata/dx12c/dx12p1/sysaux_01.dbf
/oradisk/oradata/dx12c/dx12p1/user_02.dbf
/oradisk/oradata/dx12c/dx12p1/user_01.dbf
cdb_data_files will list all the datafiles of all pdbs if it is executing from cdb$root container.
SQL> alter session set container=cdb$root;
Session altered.
SQL> select con_id,file_name from cdb_data_files;
CON_ID FILE_NAME
---------- --------------------------------------------------------------------------------
4 /oradisk/oradata/dx12c/dx12p1/system_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/sysaux_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/user_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/user_02.dbf
1 /oradisk/oradata/dx12c/o1_mf_system_92z0hgg0_.dbf
1 /oradisk/oradata/dx12c/o1_mf_sysaux_92z0drb2_.dbf
1 /oradisk/oradata/dx12c/o1_mf_undotbs1_92z0l5j5_.dbf
1 /oradisk/oradata/dx12c/o1_mf_users_92z0l4c0_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_system_92z0mhgh_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_sysaux_92z0mhg3_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users02.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users01.dbf
2 /oradisk/oradata/dx12c/o1_mf_system_92z0mhgh_.dbf
2 /oradisk/oradata/dx12c/o1_mf_sysaux_92z0mhg3_.dbf
14 rows selected.
SQL> alter session set container=dx12p;
Session altered.
SQL> select con_id,file_name from cdb_data_files;
CON_ID FILE_NAME
---------- --------------------------------------------------------------------------------
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_system_92z0mhgh_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_sysaux_92z0mhg3_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users02.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users01.dbf
set container to corresponding pdb from root.
SQL> alter session set container=dx12p1;
Session altered.
SQL> alter database datafile '/oradisk/oradata/dx12c/dx12p1/user_01.dbf' autoextend off;
Database altered.
SQL> select file_name from cdb_data_files;
FILE_NAME
---------------------------------------------------------------------------------
/oradisk/oradata/dx12c/dx12p1/system_01.dbf
/oradisk/oradata/dx12c/dx12p1/sysaux_01.dbf
/oradisk/oradata/dx12c/dx12p1/user_02.dbf
/oradisk/oradata/dx12c/dx12p1/user_01.dbf
cdb_data_files will list all the datafiles of all pdbs if it is executing from cdb$root container.
SQL> alter session set container=cdb$root;
Session altered.
SQL> select con_id,file_name from cdb_data_files;
CON_ID FILE_NAME
---------- --------------------------------------------------------------------------------
4 /oradisk/oradata/dx12c/dx12p1/system_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/sysaux_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/user_01.dbf
4 /oradisk/oradata/dx12c/dx12p1/user_02.dbf
1 /oradisk/oradata/dx12c/o1_mf_system_92z0hgg0_.dbf
1 /oradisk/oradata/dx12c/o1_mf_sysaux_92z0drb2_.dbf
1 /oradisk/oradata/dx12c/o1_mf_undotbs1_92z0l5j5_.dbf
1 /oradisk/oradata/dx12c/o1_mf_users_92z0l4c0_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_system_92z0mhgh_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_sysaux_92z0mhg3_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users02.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users01.dbf
2 /oradisk/oradata/dx12c/o1_mf_system_92z0mhgh_.dbf
2 /oradisk/oradata/dx12c/o1_mf_sysaux_92z0mhg3_.dbf
14 rows selected.
SQL> alter session set container=dx12p;
Session altered.
SQL> select con_id,file_name from cdb_data_files;
CON_ID FILE_NAME
---------- --------------------------------------------------------------------------------
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_system_92z0mhgh_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_o1_mf_sysaux_92z0mhg3_.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users02.dbf
3 /oradisk/oradata/dx12c/dx12p/dx12p_users01.dbf
Thanks for sharing this blog. The content is beneficial and useful. Very informative post. Visit here to learn more about Data Warehousing companies and Data analytics Companies. I am impressed by the information that you have on this blog. Thanks once more for all the details.Visit here for Top Big Data Companies.
ReplyDelete