Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » Oracle 12c+

如何修改PDB的初始化参数

本文介绍如何在12c数据库中修改PDB初始化参数。

12c初始化参数的特点

A. 和之前版本一样,一个CDB只有一个spfile,PDB参数存在数据库内部表中PDB_SPFILE$
B. PDB会继承CDB的初始化参数,如果你没有改变这个参数在PDB中值
C. 我们可以通过alert system参数我们可以设置PDB基本的参数,可修改参数可以通过下面的语句查询
   select name from v$system_parameter where ispdb_modifiable='TRUE' order by name;


当然并不是所有的参数都可以修改的,比如
SQL> alter system set sga_max_size=400M scope=spfile;
alter system set sga_max_size=400M scope=spfile
*
ERROR at line 1:
ORA-65040: operation not allowed from within a pluggable database
SQL>

如何确定哪些参数可以在session级别和system级别修改,哪些可以直接修改,哪些需要重启数据库才能修改

如果isses_modifiable为FALSE,说明这个参数不能在session级别修改,如何为TRUE,说明这个参数可以在session级别修改
如果issys_modifiable为FALSE,说明这个参数需要重启后才能生效,如果为immediate,说明这个参数可以立即修改,说明这个是动态参数

SQL> select name, isses_modifiable session_mod, issys_modifiable system_mod from v$parameter where name='sga_target';

NAME                                     SESSI SYSTEM_MO
---------------------------------------- ----- ---------
sga_target                               FALSE IMMEDIATE

SQL> select name, isses_modifiable session_mod, issys_modifiable system_mod from v$parameter where name='sga_max_size';

NAME                                     SESSI SYSTEM_MO
---------------------------------------- ----- ---------
sga_max_size                             FALSE FALSE

SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     TRUE
sga_max_size                         big integer 760M
sga_target                           big integer 0
unified_audit_sga_queue_size         integer     1048576
SQL> alter system set sga_target=400M;
System altered.
SQL> show parameter sga
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     TRUE
sga_max_size                         big integer 760M
sga_target                           big integer 400M
unified_audit_sga_queue_size         integer     1048576
SQL> alter system set sga_max_size=800M;
alter system set sga_max_size=800M
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified

SQL>

如何确定哪些隐含参数可以在session级别和system级别修改,可以通过下面的语句查询
SELECT a.ksppinm "Parameter",
       b.ksppstvl "Session Value",
       c.ksppstvl "Instance Value",
       decode(bitand(a.ksppiflg/256,1),1,'TRUE','FALSE') IS_SESSION_MODIFIABLE,
       decode(bitand(a.ksppiflg/65536,3),1,'IMMEDIATE',2,'DEFERRED',3,'IMMEDIATE','FALSE') IS_SYSTEM_MODIFIABLE
FROM   x$ksppi a,
       x$ksppcv b,
       x$ksppsv c
WHERE  a.indx = b.indx
AND    a.indx = c.indx
AND    a.ksppinm LIKE '/_%' escape '/'
/


SELECT a.ksppinm "Parameter",
decode(bitand(ksppiflg/524288,1),1,'TRUE','FALSE') ISPDB_MODIFIABLE
FROM x$ksppi a
WHERE a.ksppinm LIKE '%&1%'
/

如何修改RAC中PDB参数?
连接到所需要修改的PDB,然后修改pdb的初始化参数,指定sid即可(ps -ef|grep pmon)
alter session set container = pdb11;
alter system set open_cursors=150 scope=spfile sid='pgold1';
alter system set open_cursors=250 scope=spfile sid='pgold2';

如何修改Standby中初始化参数?
由于PDB的初始化参数存在数据库的内部表中(PDB_SPFILE$),Stanady不能打开为read-write。Oracle推出了解决方案,即加上DB_UNIQUE_NAME
ALTER SESSION SET CONTAINER = pdb11;
alter system set open_cursors=200 scope=spfile db_unique_name='CDB_STBY';
alter system set open_cursors=200 scope=spfile db_unique_name='CDB_STBY' sid='pgold_sb1';
alter system set open_cursors=250 scope=spfile db_unique_name='CDB_STBY' sid='pgold_sb2';
注意:这里的SID是指备库的SID

如果想更改所有的PDB初始化参数,可以指定CONTAINER = ALL
ALTER SYSTEM SET OPEN_CURSORS = 200 CONTAINER = ALL;

Reference

http://docs.oracle.com/database/121/ADMIN/cdb_admin.htm

http://docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60000


关键词:spfile 12c 

相关文章

关于max_string_size
在Oracle数据库19c中使用JSON
保障业务连续性的神器
Oracle事务卫士(Transaction Guard)和应用连续性(Application Continuity)
容器数据库(CDB)和可插拔数据库(PDB)概述
How to generate AWR on PDB and ADG(12.2 afterwards)
在12c上使用wm_concat
Exadata with database 12.2
如何在oracle 12c中正确的应用补丁?
在OEL6.8上安装12.2 RAC
Oracle Database 12.2 Hands-On Lab
How to create single physical standby for RAC
Top