首页 > 代码库 > Oracle 12c 多租户配置和修改 CDB 和 PDB 参数

Oracle 12c 多租户配置和修改 CDB 和 PDB 参数

1. 配置CDB 实例参数,影响CDB与所有 PDB
为CDB配置例程参数相对于对于非CDB的数据库是变化不太。ALTER SYSTEM命令用于设置初始化参数,与使用ALTER DATABASE命令修改一些数据库配置。
ALTER SYSTEM SET parameter_name=value CONTAINER=ALL;
说明:使用CONTAINER=ALL后,cdb与pdbs这个参数相同。pdbs可以在本地设置同一参数为不同值,将覆盖CONTAINER=ALL设定的值。

2. 修改 CDB 
ALTER DATABASE 命令和non-CDB 数据库是一样的,但是有些可以影响CDB 和所有的PDB,有些仅对 cdb 有效,具体看官网吧!

3. 配置PDB 实例参数
如果在cdb中设置CONTAINER=ALL,那么PDB的参数也会继承之前的值,但可以通过ALTER SYSTEM在PDB container中修改 PDB local parameter,将覆盖(优先)从CDB继承的参数。 
3.1 查看pdbs支持修改的参数
show con_name;
col value for a30;
col name for a35;
select name, value from   v$system_parameter WHERE  ispdb_modifiable = ‘TRUE‘ order by name;
3.2 修改 PDB 实例参数
alter system set parameter_name=value; ->等价于 ALTER SYSTEM SET parameter_name=value CONTAINER=CURRENT;

4.修改PDB 
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;

Oracle 12c 多租户配置和修改 CDB 和 PDB 参数