Oracle 12c 多租戶配置和修改 CDB 和 PDB 引數

張衝andy發表於2017-05-06
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;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31383567/viewspace-2138595/,如需轉載,請註明出處,否則將追究法律責任。

相關文章