Pluggable database administration:-
Open all pluggable databases:
Connect to container database using oraenv
$. oraenv=DB_Name
$sqlplus "/as sysdba"
SQL> alter pluggable database all open;
Get pluggable database status:
SQL> select con_id, dbid, name, open_mode from v$pdbs;
Switch to Puggable database from container :
SQL> alter session set container = <Puggable_DB>;
Get status of Pluggable database
SELECT v.name, v.open_mode, NVL(v.restricted, 'n/a') "RESTRICTED", d.status
FROM v$pdbs v, dba_pdbs d WHERE v.guid = d.guid ORDER BY v.create_scn;
Get file location for pluggable database:
SQL>select file_name from dba_data_files;
Create table space for pluggable datatbase:
SQL> alter session set container=<Pluggable_DB>;
Session altered.
SQL> CREATE TABLESPACE TB_Name LOGGING DATAFILE '/<Path>/<File_Name>.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 8192K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
Set new tablespace as default to pluggaable database.
SQL> ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE <TB_Name>;
Rename pluggable database
SQL>alter pluggable database <Pluggable_DB> close immediate;
SQL>alter pluggable database <Pluggable_DB> open restricted;
SQL>select name, open_mode from v$pdbs;
SQL>alter pluggable database <Pluggable_DB> rename global_name to <New_Name>;
SQL>alter pluggable database <New_Name> close immediate;
SQL>alter pluggable database <New_Name> open;
Move pluggable database file from one directory to another
SQL>alter database move datafile '<Current_Location>/system01.dbf' to '<New_Location>/system01.dbf';
Open all pluggable databases:
Connect to container database using oraenv
$. oraenv=DB_Name
$sqlplus "/as sysdba"
SQL> alter pluggable database all open;
Get pluggable database status:
SQL> select con_id, dbid, name, open_mode from v$pdbs;
Switch to Puggable database from container :
SQL> alter session set container = <Puggable_DB>;
Get status of Pluggable database
SELECT v.name, v.open_mode, NVL(v.restricted, 'n/a') "RESTRICTED", d.status
FROM v$pdbs v, dba_pdbs d WHERE v.guid = d.guid ORDER BY v.create_scn;
Get file location for pluggable database:
SQL>select file_name from dba_data_files;
Create table space for pluggable datatbase:
SQL> alter session set container=<Pluggable_DB>;
Session altered.
SQL> CREATE TABLESPACE TB_Name LOGGING DATAFILE '/<Path>/<File_Name>.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 8192K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
Set new tablespace as default to pluggaable database.
SQL> ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE <TB_Name>;
Rename pluggable database
SQL>alter pluggable database <Pluggable_DB> close immediate;
SQL>alter pluggable database <Pluggable_DB> open restricted;
SQL>select name, open_mode from v$pdbs;
SQL>alter pluggable database <Pluggable_DB> rename global_name to <New_Name>;
SQL>alter pluggable database <New_Name> close immediate;
SQL>alter pluggable database <New_Name> open;
Move pluggable database file from one directory to another
SQL>alter database move datafile '<Current_Location>/system01.dbf' to '<New_Location>/system01.dbf';
Comments
Post a Comment