登录  /  注册

Oracle scope设置初始化参数即时生效

php中文网
发布: 2016-06-07 17:31:03
原创
1235人浏览过

一、测试需求背景1、有没有问我初始化参数修改之后是否可以立即生效,立即做了一个测试,结论是,可以。 2、linux系统下,Oracle

一、测试需求背景
1、有没有问我初始化参数修改之后是否可以立即生效,立即做了一个测试,结论是,可以。

2、linux系统下,Oracle数据块默认8K,能支持的数据文件最大32G,想使用64G的就需要修改初始化参数  db_16k_cache_size

3、顺便复习总结了一下表空间相关基础概念:

1)同一个数据库内可以设置不同block大小,来设置不同大小的数据文件,有时候业务有这个需求。

2)同一个表空间只能使用同一种block

3)spfile启动的数据库,可以使用scope=both使得参数立即在内存中生效,但是要注意前提,pfile启动的库不行。

二、测试过程

SQL> show parameter block

NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_block_buffers                    integer    0
db_block_checking                    string      FALSE
db_block_checksum                    string      TYPICAL
db_block_size                        integer    8192
db_file_multiblock_read_count        integer    128


SQL> show parameter db_16k


NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size                    big integer 0


SQL> alter system set db_16k_cache_size=34603008  scope=spfile;


System altered.


SQL>
SQL>
SQL> commit;


Commit complete.


SQL>
SQL> alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G;
alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G
*
ERROR at line 1:
ORA-01144: File size (5242880 blocks) exceeds maximum of 4194303 blocks

 

SQL> alter system set db_16k_cache_size=34603008  scope=both;


System altered.

 

SQL> alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G blocksize 16k;
alter tablespace users add datafile '/oracle/oradata/user02.dbf' size 40G blocksize 16k
                                                                          *
ERROR at line 1:
ORA-00933: SQL command not properly ended

 

SQL> create tablespace aaa datafile '/oracle/oradata/aa.dbf' size 40G blocksize 16k;

Tablespace created.


SQL> SQL> SQL> host du -sh /oracle/oradata/aa.dbf

41G    /oracle/oradata/aa.dbf

三、scope参数详解

SCOPE = SPFILE
 The change is applied in the server parameter file only. The effect is as follows:
■ For dynamic parameters, the change is effective at the next startup and is persistent.
■ For static parameters, the behavior. is the same as for dynamic parameters. This is the only SCOPE specification allowed for static parameters.
(此更改写入初始化参数文件,更改将在下次启动时生效。动态参数与静态参数都一样可以。也是静态参数唯一可以使用的方式。)
 必须是spfile启动的数据库才可以啊。不然报错
SCOPE = MEMORY
The change is applied in memory only. The effect is as follows:
■ For dynamic parameters, the effect is immediate, but it is not persistent because the server parameter file is not updated.
■ For static parameters, this specification is not allowed.
(只在内存上修改,立即生效,但重启后将不再生效,因为并没有写入到初始化参数文件。只适用于动态参数,静态参数则不允许。)
用于不是spfile启动的数据库上面。下次启动如果用spfile,就失效了。

SCOPE = BOTH
The change is applied in both the server parameter file and memory. The effect is as follows:
■ For dynamic parameters, the effect is immediate and persistent.
■ For static parameters, this specification is not allowed.
(既写入到初始化参数文件,也在内存上修改,,立即生效。同样也只适用于动态参数,静态参数则不允许。)
 必须是spfile启动的数据库才可以啊。不然报错

相关阅读:

Oracle scope/sid/deferred/reset 总结说明 

linux

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
关于CSS思维导图的课件在哪? 课件
凡人来自于2024-04-16 10:10:18
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号