Oracle 11g修改MEMORY_TARGET
默认情况下,Oracle 11g是使用AMM(Automatic Memory Management,自动内存管理)的。我们在安装数据库过程中,指定Oracle使用内存
默认情况下,Oracle 11g是使用AMM(Automatic Memory Management,自动内存管理)的。我们在安装数据库过程中,指定Oracle使用内存的百分比,这个取值就作为MEMORY_TARGET和MEMORY_MAX_TARGET的初始取值使用。如果这两个参数设置为非零取值,那么Oracle就是采用AMM管理策略的。
下面演示一下如何修改MEMORY_TARGET的值。
1.测试环境
我们在Oracle 11g中进行操作。
SQL>
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL>
2.查看MEMORY_TARGET和相关参数值
我们通过show parameter来查看初始化参数值,其他相关的参数包括MEMORY_MAX_TARGET、sga_max_size、sga_target、pga_aggregate_target等。
SQL>
SQL> show parameter memory
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 500M
memory_target big integer 400M
shared_memory_address integer 0
SQL>
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 500M
sga_target big integer 0
SQL>
SQL> show parameter pga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 0
SQL>
我们看到,数据库的MEMORY_MAX_TARGET为500M,MEMORY_TARGET为400M。
3.修改MEMORY_TARGET
我们通过alter system语句来修改MEMORY_TARGET,需要注意的是,MEMORY_TARGET是个动态参数,,而MEMORY_MAX_TARGET是个静态参数。
这样一来,当修改值MEMORY_MAX_TARGET时,我们必须首先修改MEMORY_MAX_TARGET参数值,重启数据库使静态参数生效后再去修改MEMORY_TARGET值,否则,数据库会报错。
3.1修改值我们尝试将MEMORY_TARGET参数值由400M修改为500M。
SQL>
SQL> alter system set memory_target=500m;
System altered.
SQL>
SQL>
SQL> show parameter memory
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 500M
memory_target big integer 500M
shared_memory_address integer 0
SQL>
3.2修改值>MEMORY_MAX_TARGET
我们尝试将MEMORY_TARGET参数值由500M修改为700M。由于修改值>MEMORY_MAX_TARGET,数据库会报错;我们必须首先修改MEMORY_MAX_TARGET参数值,重启数据库使静态参数生效后再去修改MEMORY_TARGET值。
SQL>
SQL> alter system set memory_target=600m;
alter system set memory_target=600m
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00837: Specified value of MEMORY_TARGET greater than MEMORY_MAX_TARGET
SQL>
SQL> alter system set memory_max_target=800m scope=spfile;
System altered.
SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 732352512 bytes
Fixed Size 1347456 bytes
Variable Size 603979904 bytes
Database Buffers 121634816 bytes
Redo Buffers 5390336 bytes
Database mounted.
Database opened.
SQL>
SQL> show parameter memory
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 700M
memory_target big integer 500M
shared_memory_address integer 0
SQL>
SQL> alter system set memory_target=600m;
System altered.
SQL> show parameter memory
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address integer 0
memory_max_target big integer 700M
memory_target big integer 600M
shared_memory_address integer 0
SQL>
SQL>
本文永久更新链接地址:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.
