配置CDB 的實例參數和普通實例一樣,通過ALTER SYSTEM 即可設置初始化參數,一些數據庫的配置可以使用ALTERDATABASE 命令。
連接上rootcontainer之後,可以使用alter system命令來修改,默認僅對root container有效,也就是當前的container。 下面2個命令作用相同:
ALTER SYSTEM SET parameter_name=value;
ALTER SYSTEM SET parameter_name=valueCONTAINER=CURRENT;
如果想讓修改對所有的container有效,使用如下語法:
ALTER SYSTEM SET parameter_name=valueCONTAINER=ALL;
在root container中用all進行修改,那麼所有的PDB都會繼承這些參數,除非在PDB 中在單獨修改這個參數。
如果在rootcontainer中設置CONTAINER=ALL,那麼PDB的參數也會繼承之前的值,但可以通過ALTER SYSTEM在PDB container中修改。 注意這裡能進行修改的前提是要這個參數支持,可以使用如下命令查看:
column name format a35 column value format a35 select name, value from v$system_parameter WHERE ispdb_modifiable = 'TRUE' order by name;
--我這裡有174個參數,可以在PDB中修改:
SQL> select count(1) fromv$system_parameter where ispdb_modifiable='TRUE'; COUNT(1) ---------- 174
修改步驟方式如下:
CONN / AS SYSDBA ALTER SESSION SET CONTAINER = pdb1; ALTER SYSTEM SET parameter_name=value; ALTER SYSTEM SET parameter_name=valueCONTAINER=CURRENT;
ALTER DATABASE 命令和non-CDB 數據庫是一樣的,一些命令可以影響CDB 和所有的PDB,有些僅對root container 有效,具體的使用可以參考官網。
http://docs.oracle.com/cd/E16655_01/server.121/e17636/cdb_admin.htm#ADMIN13633
可以指定特定的PDB之後,在使用ALTERPLUGGABLE DATABASE 命令修改PDB的信息,當然為了向後兼容性,ALTER DATABASE 命令也能完成大部分的修改工作。
具體修改操作如下:
CONN / AS SYSDBA ALTER SESSION SET CONTAINER = pdb1; -- Default edition forPDB. ALTER PLUGGABLE DATABASE DEFAULT EDITION =ora$base; -- Default tablespacetype for PDB. ALTER PLUGGABLE DATABASE SET DEFAULTBIGFILE TABLESPACE; ALTER PLUGGABLE DATABASE SET DEFAULTSMALLFILE TABLESPACE; -- Default tablespacesfor PDB. ALTER PLUGGABLE DATABASE DEFAULT TABLESPACEusers; ALTER PLUGGABLE DATABASE DEFAULT TEMPORARYTABLESPACE temp; -- Change the globalname. This will change the container name and the -- name of the defaultservice registered with the listener. ALTER PLUGGABLE DATABASE OPEN RESTRICTEDFORCE; ALTER PLUGGABLE DATABASE RENAME GLOBAL_NAMETO pdb1a.localdomain; ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE; ALTER PLUGGABLE DATABASE OPEN; -- Time zone for PDB. ALTER PLUGGABLE DATABASE SETTIME_ZONE='GMT'; -- Make datafiles in thePDB 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 loggingfor PDB. ALTER PLUGGABLE DATABASE ADD SUPPLEMENTALLOG DATA; ALTER PLUGGABLE DATABASE DROP SUPPLEMENTALLOG DATA; In addition there is amechanism to control the maximum size of the PDB and the amount of the sharedtemp space it can use. -- Limit the totalstorage of the the PDB (datafile and local temp files). ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE5G); -- Limit the amount oftemp space used in the shared temp files. ALTER PLUGGABLE DATABASE STORAGE(MAX_SHARED_TEMP_SIZE 2G); -- Combine the two. ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE5G MAX_SHARED_TEMP_SIZE 2G); -- Remove the limits. ALTER PLUGGABLE DATABASE STORAGE UNLIMITED;