search
HomeDatabaseMysql TutorialOracle scope设置初始化参数即时生效

一、测试需求背景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

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool