Wednesday, September 2, 2015

Multitenant : Configure Instance Parameters and Modify Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)

Multitenant : Configure Instance Parameters and Modify Container Databases (CDB) and Pluggable Databases (PDB) in Oracle Database 12c Release 1 (12.1)

Configure Instance Parameters in a CDB (ALTER SYSTEM)
Configure Instance Parameters in a PDB (ALTER SYSTEM)
Modify a CDB (ALTER DATABASE)
Modify a PDB (ALTER PLUGGABLE DATABASE)

Configure Instance Parameters in a CDB (ALTER SYSTEM)

ALTER SYSTEM SET parameter_name=value;
ALTER SYSTEM SET parameter_name=value CONTAINER=CURRENT;
ALTER SYSTEM SET parameter_name=value CONTAINER=ALL;


In addition to the default action, an initialization parameter change from the root container can target all containers using the following syntax.

ALTER SYSTEM SET parameter_name=value CONTAINER=ALL;


Configure Instance Parameters in a PDB (ALTER SYSTEM)


COLUMN name FORMAT A35
COLUMN value FORMAT A35

SELECT name, value
FROM   v$system_parameter
WHERE  ispdb_modifiable = 'TRUE'
ORDER BY name;



To make a local PDB change, make sure you are either connected directly to a privileged use in the PDB, or to a privileged common user, who has their container pointing to the PDB in question. As mentioned previously, if the CONTAINER clause is not mentioned, the current container is assumed, so the following ALTER SYSTEM commands are functionally equivalent.

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER = pdb1;

ALTER SYSTEM SET parameter_name=value;
ALTER SYSTEM SET parameter_name=value CONTAINER=CURRENT;



Modify a CDB (ALTER DATABASE)
Modify a PDB (ALTER PLUGGABLE DATABASE)

to target the PDB you must either connect directly to a privileged user using a service pointing to the PDB, or connect to the root container and switch to the PDB container. Some of the possible PDB modifications are shown below.
CONN / AS SYSDBA
ALTER SESSION SET CONTAINER = pdb1;






-- Default edition for PDB.
ALTER PLUGGABLE DATABASE DEFAULT EDITION = ora$base;

-- Default tablespace type for PDB.
ALTER PLUGGABLE DATABASE SET DEFAULT BIGFILE TABLESPACE;
ALTER PLUGGABLE DATABASE SET DEFAULT SMALLFILE TABLESPACE;

-- Default tablespaces for PDB.
ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE users;
ALTER PLUGGABLE DATABASE DEFAULT TEMPORARY TABLESPACE temp;

-- Change the global name. This will change the container name and the
-- name of the default service registered with the listener.
ALTER PLUGGABLE DATABASE OPEN RESTRICTED FORCE;
ALTER PLUGGABLE DATABASE RENAME GLOBAL_NAME TO pdb1a.localdomain;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN;

-- Time zone for PDB.
ALTER PLUGGABLE DATABASE SET TIME_ZONE='GMT';

-- Make datafiles in the PDB offline/online and make storage changes.
ALTER PLUGGABLE DATABASE DATAFILE '/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf' OFFLINE;
ALTER PLUGGABLE DATABASE DATAFILE '/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf' ONLINE;

ALTER PLUGGABLE DATABASE DATAFILE '/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf'
  RESIZE 1G AUTOEXTEND ON NEXT 1M;

-- Supplemental logging for PDB.
ALTER PLUGGABLE DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER PLUGGABLE DATABASE DROP SUPPLEMENTAL LOG DATA;




-- Limit the total storage of the the PDB (datafile and local temp files).
ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE 5G);

-- Limit the amount of temp space used in the shared temp files.
ALTER PLUGGABLE DATABASE STORAGE (MAX_SHARED_TEMP_SIZE 2G);

-- Combine the two.
ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE 5G MAX_SHARED_TEMP_SIZE 2G);

-- Remove the limits.
ALTER PLUGGABLE DATABASE STORAGE UNLIMITED;




No comments:

Post a Comment