ORACLE 11G自动内存管理

合集下载

Oracle 11g 的 自动内存管理

Oracle 11g 的 自动内存管理

Oracle 11g 的自动内存管理作者: Fenng | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址: /database/oracle_11g_amm.html这是我的Oracle 11g 系列的文章之一.Oracle 的9i/10g 中已经对内存管理逐步做了很大的简化,11g 则更进一步,引入了一个新的概念自动化内存管理(Automatic Memory Management,AMM) . 如果DBA 真的想偷懒的话,只需要设定两个参数就可以把烦心的事情都交给Oracle 折腾了(只要DBA 足够心宽)。

PGA 与SGA 一起搞定。

这两个参数分别是:MEMORY_TARGET--操作系统的角度上 Oracle 所能使用的最大内存值。

动态参数MEMORY_MAX_TARGET--MEMORY_TARGET所能设定的最大值。

非动态可调。

Tip: 如果使用的是pfile,设定了MEMORY_TARGET 而没有指定MEMORY_MAX_TARGET 的值,则实例启动后MEMORY_MAX_TARGET 的值与MEMORY_TARGET 相等。

如果pfile 中指定了MEMORY_MAX_TARGET 而没有指定MEMORY_TARGET ,实例启动后MEMORY_TARGET 为0 。

AMM 在后台会启动一个内存管理(Memory Manager, mman)进程。

因为AMM 的引入,Oracle 内存管理更加灵活多样。

组合出来有5 种内存管理形式.∙自动内存管理∙自动共享内存管理∙手工共享内存管理∙自动PGA 管理手动PGA 管理1) 自动内存管理默认安装的实例即是AMM 方式。

如下SQL> show parameters targetNAME TYPE VALUE------------------------------------ ----------------------------------------------------archive_lag_target integer 0db_flashback_retention_target integer 1440fast_start_io_target integer 0fast_start_mttr_target integer 0memory_max_target big integer 1216Mmemory_target big integer 1216Mpga_aggregate_target big integer 0sga_target big integer 0要注意到SGA_TARGET 和都为0 。

oracle11g自动内存管理(其三)

oracle11g自动内存管理(其三)

oracle 11g 自动内存管理(其三)ORACLE 11g自动内存管理:在oracle11g中,使用一个参数memory_target就能够实现SGA和PGA组件依据工作负荷进行自动内存分配。

oracle推荐使用自动内存管理简化内存分配。

oracle 11g依然支持手工内存分配:1:oracle 11g使用memory_target来支持内存自动分配。

2:使用sga_target和pga_target参数来设置SGA和PGA,数据库会在这两个组件中自我优化。

3:你也可以手工设置SGA中的各个组件。

比如db_cache_size,shared_pool_size等组件。

oracle 11g中新的内存初始化参数:有两个新的关键的内存初始化参数memory_target(这个参数设置分配给实例的内存数)和memory_max_size(这个参数是可选的,设置实例能够分配的最大内存,设置的是memory_target的上限值)。

memory_max_size参数是静态,然而memory_target是动态的。

因此你可以调整memory_target参数值的大小,但上限是memory_max_size。

对自动内存管理的配置有两种情况,在创建数据库时或者是创建数据库后。

1:在数据库创建期间设置自动内存管理:如果是手工建库,那么你只需要设置好如下类似初始化参数即可:memory_target = 1000mmemory_max_target = 1500m如果是采用DBCA创建数据库,如果是创建新库并且是高级安装,你能选择自动内存管理选项。

如果是选择基本安装,那么默认就是自动内存管理。

2:在数据库创建后:你可以在数据库创建后添加memory_max_target和memory_target.虽然memory_target是一个动态参数,但是当数据库运行时,你不能交换到自动内存管理。

Oracle数据库内存优化操作说明

Oracle数据库内存优化操作说明

千里之行,始于足下。

Oracle数据库内存优化操作说明Oracle数据库的内存优化操作主要包括以下几个方面:1. 调整SGA和PGA的大小:- SGA(System Global Area)是Oracle数据库实例使用的内存区域,包括数据库缓存、共享池等。

可以通过修改SGA_TARGET和SGA_MAX_SIZE等参数来调整SGA的大小。

- PGA(Program Global Area)是每个进程独自使用的内存区域,包括排序区、hash区等。

可以通过修改PGA_AGGREGATE_TARGET参数来调整PGA的大小。

2. 合理配置各个内存区域的大小:- 根据具体的数据库负载情况,可以调整SGA组件的大小,如缓冲区大小、共享池大小等,以提高数据库的性能。

- 合理配置PGA区域的大小,可以减少排序操作的磁盘访问,提高查询效率。

3. 使用自动内存管理 AMM(Automatic Memory Management):- AMM是Oracle 11g及以上版本中提供的内存管理特性,可以自动分配SGA和PGA的大小。

可以通过设置MEMORY_TARGET参数来启用AMM。

4. 使用自动PGA管理:- Oracle 12c及以上版本中提供了自动PGA管理特性,可以根据需要自动调整PGA的大小。

可以通过设置PGA_AGGREGATE_TARGET参数来启用自动PGA管理。

5. 合理配置数据库连接池:第1页/共2页锲而不舍,金石可镂。

- 如果数据库中有大量的并发连接,可以考虑启用连接池来管理连接,减少连接的开销,提高数据库的并发性能。

6. 合理配置数据库缓存:- Oracle数据库中有多个缓存区域,如数据缓存、共享池等,可以根据具体的负载情况,调整缓存的大小,以提高查询性能。

需要注意的是,内存优化操作可能会引起数据库的性能变化,因此在进行内存优化之前,最好先进行充分的测试和评估,以确保优化操作是必要且有效的。

修改Oracle 11g 内存

修改Oracle 11g 内存

修改Oracle 11g 内存分类:Oracle Database 2011-12-16 18:49 910人阅读评论(0) 收藏举报oracleintegersystemsqlbic/tswisdom/article/details/7078477[oracle@bi11g bin]$ ./sqlplus /nologSQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 1618:39:36 2011 Copyright (c) 1982, 2009, Oracle. All rights reserved.SQL> conn / as sysdbaConnected.SQL> show parameter memoryNAME TYPE VALUE------------------------------------ -----------------------------------------hi_shared_memory_address integer 0memory_max_target big integer 1584Mmemory_target big integer 1584Mshared_memory_address integer 0SQL> alter system set memory_target = 512M scope=spfile2 ;System altered.SQL> alter system set memory_max_target =1024Mscope=spfile2 ;System altered.SQL> show parameter memoryNAME TYPE VALUE------------------------------------ -----------------------------------------hi_shared_memory_address integer 0memory_max_target big integer 1584M memory_target big integer 1584Mshared_memory_address integer 0SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.SQL> startupORACLE instance started.Total System Global Area 1068937216 bytesFixed Size 2220200 bytesVariable Size 859836248 bytesDatabase Buffers 201326592 bytesRedo Buffers 5554176 bytesDatabase mounted.Database opened.SQL> show parameter memoryNAME TYPE VALUE------------------------------------ ----------------------------------------- hi_shared_memory_address integer 0 memory_max_target big integer 1Gmemory_target big integer 512Mshared_memory_address integer 0SQL>ORACLE 11G自动内存管理2012-04-11 21:04:48分类:Oracle/uid-25528717-id-3171158.htmlORACLE 11g 自动内存管理:在oracle 11g中,使用一个参数memory_target就能够实现SGA和PGA组件依据工作负荷进行自动内存分配。

Oracle Enterprise Linux下如何修改shm大小

Oracle Enterprise Linux下如何修改shm大小
531_0351ITPUB个人空间_u;b_}_Pe_L&o0q
_Zy z_T g_u~:T Q0再重新建库问题解决。
6b#J.z2L_F+}_&i0/dev/sda128G8.3G18G32% /ITPUB个人空间_G1W_m_N%K_A_c_Y3|
tmpfs506M154M352M31% /dev/shm
N^'S_f_}8G_~+{z0?_}0/dev/hdc3.2G3.2G0 100% /media/090531_0351ITPUB个人空间,J4Q1m_{_{_V
P
#p6j };xc0
-~8J v F\:^0Filesystem Size Used Avail Use% Mounted on
(c A2U_R j_D_h w#`0/dev/sda128G8.3G18G32% /ITPUB个人空间_P_R_J/m_B _ |_L_d/X_\
tmpfs1.0G154M871M16% /dev/shmITPUB个人空间_o_\_M&P7q4L
增大到了1G,然后重新mount即可生效。ITPUB个人空间'R+[)~&r'~0P
mount -o remount /dev/shmITPUB个人空间_V;J1|P_i9~_?
df -h在修改前后的结果对比
__)H_v$?)R"b_]:}3{8B0Filesystem Size Used Avail Use% Mounted on
Oracle Enterprise Linux
今天在Vmware下装了Oracle Enterprise Linux5之后,准备安装11g,建库的时候提示如果使用自动内存管理/dev/shm大小必须要403M,目前只有384M可用,请增大/dev/shm,以前没遇到这个问题过,查了下文档,发现/dev/shm就是个临时文件系统,修改/etc/fstab文件即可。ITPUB个人空间+g_~_\(K_[

oracle11g自动内存管理

oracle11g自动内存管理
内存结构管理主要涉及对SGA中的各种缓冲区进行最佳设置,使 实例对内存的利用率达到最高,从而提高数据库的性能。
用户进程
共享缓冲区 库缓冲区
SGA
数据缓冲区 日志缓冲区
服务器进程 PGA
数据字典
Java池
大池
PMON
SMON
DBWR
LGWR
CKPT
Others
参数文件 口令文件
数据文件
控制文件
重做日志 文件
MEMORY_MAX_TARGET : 这个参数定义了 MEMORY_TARGET最大可以达 到而不用重启实例的值,如果没 有设MEMORY_MAX_TARGET
大,也可以动态减小的。它不能超
值,默认和MEMORY_TARGET
过MEMORY_MAX_TARGET参数设 的值相等 置的大小 使用动态内存管理时,要让Oracle完全控制内存管理,SGA_TARGET和 PGA_AGGREGATE_TARGET这两个参数应该设置为0
归档日志文件
数据库
实例启动时分配
共享池
数据库高速缓存
重做日志缓存
大池(可选)
java池 (可选)
其它结构(例如锁,数据状态)
当server进程建立时分配
为每个连接到数据库的用户进程保留的内存空间 当一个进程创建的时候分配 当一个进程终止释放
9i
Oracle对内存的管理的 优化从未间断,从8i
10g
到12c不断地提出新的管理概念。每个本版都
11g
对内存管理进行了简化
8i->9i:PGA的自动管理
12c
9i->10g:SGA的自动管理 10g->11g:MEMORY(SGA+PGA)的自动管理

oracle11g关于内存的分配方案。

oracle11g关于内存的分配方案。

oracle11g关于内存的分配方案。

1,在32位的操作系统上,安装oracle的话,oracle最大能分配到的内存是1.7G。

这样的话,推荐最好使用64位的操作系统。

这样在物理内存足够大的情况下,oracle也能分配到无限制的足够大的内存。

2,在物理内存既定的情况下,如果服务器是只为oracle应用提供的服务器。

在创建数据库实例时,oracle的典型内存分布,默认总共给sga 和pga分配系统内存的40%,同时oracle建议自动内存管理。

此时,如果选择oracle的典型内存分布,同时不选择自动管理内存分布,那么sga : pga的内存比是3:1。

但是当sga的内存达到1536M之后,就不会再增加内存了,多出来的内存全都被增加到了pga的内存中去了。

(问题一:请问一下,如果是自动管理内存分布的话,sga和pga 也会出现这样的情况吗? sga达到1536m之后也不会继续增加吗?问题二:pga增多的话,排序等的性能会增加。

但是如果适当的增加sga,将表数据全都缓存到sga中的话,内存中的排序等性能同样会得到很大的提升。

为什么典型配置在sga增加到1536m之后就不再增加了呢?)3,定制数据库实例的内存时:pga,根据实际的情况,可以增加到足够大。

sga的共享池,日志缓冲池如果过大的话,会对性能产生较大的负面影响。

sga的java池,建议20msga的共享池,建议sga的22%sga的large池,建议sga的9.9%sga的缓冲区,可以设置到足够大。

(问题三,当创建数据库实例时,如果选择的是自动管理内存的话,这时的内存结构参数的值都是0。

如果只想要手动管理sga的一个缓冲区的话,是不是必然将重新手动设置sga的全部内存结构?包括重新设置sga本身的大小?)4,问题四:请问一下,如果手动设置的话,那sga和pga的内存比应该多少比较合适?以上只是个人的一些理解,有可能有错误的地方,希望大家能帮忙指出,最后将做出总结,将错误的地方改正。

Oracle_11g服务器配置和管理(详细正确版------自测)

Oracle_11g服务器配置和管理(详细正确版------自测)

安装Oracle前linux系统参数的配置检查下列包是否安装,如果未安装则要先安装。

# rpm -qa | grep make gcc glibc 等等binutils-2.17.50.0.6-2.el5compat-libstdc++-33-3.2.3-61elfutils-libelf-0.125-3.el5elfutils-libelf-devel-0.125glibc-2.5-12glibc-common-2.5-12glibc-devel-2.5-12gcc-4.1.1-52gcc-c++-4.1.1-52libaio-0.3.106libaio-devel-0.3.106libgcc-4.1.1-52libstdc++-4.1.1libstdc++-devel-4.1.1-52.e15make-3.81-1.1sysstat-7.0.0unixODBC-2.2.11unixODBC-devel-2.2.11在安装Oracle 11g前,先关闭系统防火墙,禁用selinux;需要手工更改系统的内核参数以及创建oracle用户和用户组,具体操作步骤如下所述。

(1)创建oracle用户和oinstall、dba用户组命令如下所示。

# /usr/sbin/groupadd oinstall //创建用户组oinstall# /usr/sbin/groupadd dba //创建用户组dba# /usr/sbin/useradd -m -g oinstall -G dba oracle //创建用户oracle# id oracle //查看用户oracle的属性uid=512(oracle) gid=1005(oinstall) groups=1005(oinstall),1006(dba)(2)设置oracle用户的口令,命令如下所示。

# passwd oracle //设置oracle用户的口令Changing password for user oracle.New UNIX password:BAD PASSWORD: it is too simplistic/systematicRetype new UNIX password:passwd: all authentication tokens updated successfully.//口令更改成功(3)创建Oracle的安装目录。

oracle 11g数据库参数及指标

oracle 11g数据库参数及指标

oracle 11g数据库参数及指标Oracle 11g数据库参数及指标Oracle 11g是一种功能强大的关系型数据库管理系统,通过合理设置数据库参数和监控关键指标,可以提高数据库的性能和稳定性。

在本文中,我们将讨论一些重要的Oracle 11g数据库参数及指标,并探讨它们的作用和优化方法。

数据库参数是控制数据库行为的设置,它们可以影响数据库的性能、安全性和可用性。

在Oracle 11g中,有许多重要的数据库参数需要重点关注。

其中,一些关键的参数包括SGA大小、PGA大小、日志文件大小、并行处理器数量等。

SGA(System Global Area)是Oracle数据库中的一个重要参数,它包含了数据库实例运行时所需要的共享内存结构。

通过适当调整SGA的大小,可以提高数据库的整体性能。

通常情况下,应根据实际需求和硬件配置来动态调整SGA的大小,以达到最佳性能。

PGA(Program Global Area)是每个数据库会话独立使用的内存区域,它包含了会话私有的内存结构。

合理设置PGA的大小可以有效控制数据库会话的内存消耗,避免内存不足导致的性能问题。

日志文件大小也是一个需要重点关注的参数。

日志文件用于记录数据库中的变更操作,对数据库恢复和故障恢复非常重要。

如果日志文件过小,可能会导致频繁的日志切换和性能下降;如果日志文件过大,可能会浪费存储空间。

因此,应根据数据库的写入速度和变更频率来合理设置日志文件大小。

除了数据库参数外,监控关键指标也是提高数据库性能的重要手段。

一些重要的数据库指标包括IOPS(每秒输入/输出操作数)、查询响应时间、锁定等待时间等。

IOPS是衡量存储性能的重要指标,它代表了存储系统每秒能够处理的输入/输出操作数量。

通过监控IOPS,可以了解存储系统的性能瓶颈,并采取相应的优化措施,提高数据库的读写性能。

查询响应时间是衡量数据库性能的重要指标之一,它代表了数据库处理查询请求所需的时间。

oracle 11g sga pga的设置原则 和方法

oracle 11g sga pga的设置原则 和方法

oracle 11g sga pga的设置原则和方法Oracle 11g中SGA(System Global Area)和PGA(Program Global Area)的设置原则和方法如下:1. SGA的设置原则:- 根据系统的内存大小和应用的需求,确定SGA的大小。

SGA主要包括Buffer Cache、Shared Pool、Large Pool、Java Pool等组件,需要根据数据库的访问模式和数据量大小来进行调整。

- 尽量使用自动内存管理(Automatic Memory Management,AMM)来管理SGA的大小和组件分配,这样可以更加灵活地管理内存资源。

2. SGA的设置方法:- 手动设置SGA大小:可以通过修改初始化参数文件(initSID.ora)的SGA相关参数来手动设置SGA的大小,如SGA_TARGET、SGA_MAX_SIZE等。

需要重启数据库以使设置生效。

- 使用AMM:在使用AMM的情况下,只需要设置SGA_TARGET参数为所需的SGA大小,Oracle会自动根据系统的内存大小和负载情况进行动态调整。

3. PGA的设置原则:- 根据应用的并发性和查询的复杂度,以及数据库服务器的硬件资源(CPU、内存)等因素来确定PGA的大小。

- PGA主要包括Sort Area、Hash Area、Bitmap Merge Area等组件,需要根据查询的需求和并发性来决定这些组件的大小。

4. PGA的设置方法:- 使用PGA_AGGREGATE_TARGET参数:PGA_AGGREGATE_TARGET参数用于指定PGA的目标大小,Oracle会根据这个目标值和实际的应用需求来动态分配PGA的大小。

- 手动设置PGA大小:可以通过设置PGA相关的初始化参数(如SORT_AREA_SIZE、HASH_AREA_SIZE等)来手动控制PGA的大小,需要重启数据库以使设置生效。

Oracle11g安装说明

Oracle11g安装说明

1Oracle11G安装配置说明1.1环境需求1.1.1硬件环境a)内存>1G, 命令:prtconf|moreb)Paging space物理内存在2-16GB之间,交换空间与物理内存大小相同物理内存大于16GB交换,交换空间设为物理内存的0.75倍命令:lsps –ac)检查是否是64位命令:/usr/bin/getconf HARDWARE_BITMODEBootinfo -kd)磁盘空间temp 空间>=1GBoracle 软件安装目录>=8GBe)操作系统runlevel为2命令:who –r1.1.2软件环境a)操作系统版本AIX 6,64bit及以上版本1.2安装Oracle 11g1.2.1安装前检查1.2.2安装Oracle 11g For AIX1.点击安装文件出现如下图所示界面。

2.直接点击下一步选择跳过软件更新选项点击下一步3.选择仅安装数据库软件选项,点击下一步如下图所示:4.选择单实例数据库安装选项,点击下一步。

如下图所示:5.出现请选择运行产品时所使用的语言,选择简体中文和英文。

如下图所示:6.点击下一步出现如下图所示的界面7.选择安装数据的版本,在此选择企业版点击下一步出现如下图所示的界面8.选择产品安装文件的目录,在此我们选择/u01/app/oralnventory,选择oralnventory组名为oinstall。

点击下一步如下图所示:9.选择数据库管理员(OSDBA)组为dba,数据库操作者组为dba,点击下一步如下图所示:10.正在检查执行的先决条件,检查完成后出现如下所示的操作界面,如下图所示11.点击下一步,显示了数据库Oracle11g的安装概要。

如下图所示:12.点击安装按钮正式开始安装Oracle11g数据库,如下图所示:13.出现如下窗口14.点击确定按钮出现下面如图所示的界面15.在欢迎使用配置Oracle数据库界面,点击下一步出现如下图所示的界面16.选择创建数据库选择,点击下一步,如下图所示17.选择一般用途或数据处理选项,点击下一步18.选择配置Enterprise Manager 选项和配置Database Control以进行本地管理,点击下一步,如下图所示:19.选择监听程序配置选项,点击下一步20.选择添加选项,点击下一步,如下图所示:21.输入监听程序的名称为LISTENER,点击下一步如下图所示:22.选择要用的协议TCP,点击下一步如下图所示:23.选择使用的标准端口号1521选项,点击下一步,如下图所示:24.在是否配置另一个监听程序,选择否选项,点击下一步,如下图所示:25.输入管理员口令,点击下一步。

oracle实例的内存(SGA和PGA)进行调整,优化数据库性能

oracle实例的内存(SGA和PGA)进行调整,优化数据库性能
-----当前分配PGA的总大小,这个值有可能大于PGA,如果PGA设置太小.这个值接近select sum(pga_used_mem) from v$process.
total PGA allocated 52124672 bytes
-----这个值等于参数PGA_AGGREGATE_TARGET的值,如果此值为0,表示禁用了PGA自动管理。
aggregate PGA auto target 75220992 bytes
-----表示PGA还能提供多少内存给自动运行模式,通常这个值接近pga_aggregate_target-total pga inuse.
global memory bound 20971520 bytes
-----工作区执行的最大值,如果这个值小于பைடு நூலகம்M,马上增加PGA大小
total PGA inuse 30167040 bytes
PGA memory freed back to OS 0 bytes
total PGA used for auto workareas 8891392 bytes
maximum PGA used for auto workareas 22263808 bytes
total PGA used for manual workareas 0 bytes ---为0自动管理
maximum PGA used for manual workareas 0 bytes ---为0自动管理
over allocation count 0
select 1 from tab2 where a.col3 = b.col3
)
where ....

Oracle11gR2数据库新特性新

Oracle11gR2数据库新特性新
类似LOB,但性能更快,功能更 强
透明加密、压缩、deduplication 保持了数据库的安全性、可靠性
和扩展性 LOB 接口的超集,方便从传统
LOB迁移
好处
一个安全模型 一个数据视图 单点数据管理 高性能
Lob字段压缩测试(照片数据)
测试评估 结论:
通过对lob字段存储为 securefile,并进行high级压缩, 由原来的26.2M变为现在的 25.4M,有一定的压缩比例,但 不明显。 存储空间评测
测试评估 结论:
通过对数据块进行压缩,现在数 据库 dfk_gaxz.t_ALERT_M_DETAIL 表 由33M变为8M,执行时间:20S, 效果理想;数据库表 DFK_GAXZ.BADPERSON_M_DET AIL由2024M变为1275M,空间节省 45%。 存储空间评测
对表进行压缩之后,表占用的存 储空间比原先缩小40%以上,效果相 当明显。 性能评测
–优化的磁盘布局 –联机添加/删除/重新平衡磁盘 –集成的镜像
只读快照
–文件系统多达64 个时间点空 间有效副本
Oracle 数据库11g 第2 版
其他ASM 增强
改善的管理
ASM 安装和配置助手 (ASMCA)
功能完备的ASMCMD ASM 文件访问控制 ASM 磁盘组重命名 数据文件到磁盘映射
RAC数据库的ADDM
▪ 确定集群性能问题 ▪ 定位问题
• 全局资源,如 IO和锁 • 高负载SQL和热数据块 • 内存内部争用 • 网络延时 • 实例间相应时间偏差
在EM中运行ADDM
数据卫士(Data Guard)技术革新
Active Data Guard
physical standby在redo apply同 时,支持只读查询

Oracle自动存储管理管理员指南 11g Release 2 (11.2)说明书

Oracle自动存储管理管理员指南 11g Release 2 (11.2)说明书

Oracle® Automatic Storage Management Administrator's Guide11g Release 2 (11.2)E16102-05August 2010Oracle Automatic Storage Management Administrator's Guide, 11g Release 2 (11.2)E16102-05Copyright © 2007, 2010, Oracle and/or its affiliates. All rights reserved.Contributing Authors: Jerry Abraham, Prasad Bagal, Mark Bauer, Eric Belden, Bill Bridge, Chan Chan, Xiaobin Chen, Hanlin Chien, Jonathan Creighton, Steve Fogel, Dave Friedman, Barb Glover, Fred Glover, Allan Graves, Shie-rei Huang, Rekha Iyer, Diane Lebel, Rich Long, Colin McGregor, Gregory Mengel, Harendra Mishra, Valarie Moore, Nitin Munjal, Darshan Nagarajappa, Harish Nandyala, Bob Nelson, Balaji Pagadala, Satish Panchumarthy, Soma Prasad, Kathy Rich, Harshavardhan Sabbineni, Francisco Sanchez, Santhosh Selvaraj, Ara Shakian, Duane Smith, Joshua Smith, Malai Stalin, Amar Subba, Yaser Suleiman, Elisabeth Thibault, Michael Timpanaro-Perrotta, Samarjeet Tomar, Brian Tsao, Nitin Vengurlekar, P Venkatraman, Anton Verhulst, Radek Vingralek, Ron Weiss, Ric Werme, Rajiv Wickremesinghe, Jim A. Williams, Sivakumar Yarlagadda, Song Ye, Krishnan Yegnashankaran, Hector Yuen, Jon ZollaThis software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.This software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.ContentsPreface (xxiii)Audience (xxiii)Documentation Accessibility (xxiii)Related Documents (xxiv)Conventions (xxiv)What's New in Oracle Automatic Storage Management? (xxv)Oracle Automatic Storage Management 11g Release 2 (11.2.0.2) New Features (xxv)Oracle Automatic Storage Management 11g Release 2 (11.2.0.1) New Features (xxvii)Oracle Automatic Storage Management 11g Release 1 (11.1) New Features (xxx)1 Introduction to Oracle Automatic Storage ManagementOverview of Oracle Automatic Storage Management...................................................................... 1-1 Understanding Oracle ASM Concepts................................................................................................. 1-2 About Oracle ASM Instances........................................................................................................... 1-2 About Oracle ASM Disk Groups..................................................................................................... 1-5 About Mirroring and Failure Groups............................................................................................. 1-5 About Oracle ASM Disks.................................................................................................................. 1-6 Allocation Units ......................................................................................................................... 1-7 About Oracle ASM Files.................................................................................................................... 1-7 Extents.......................................................................................................................................... 1-7Oracle ASM Striping................................................................................................................... 1-8File Templates...........................................................................................................................1-10 Understanding Oracle ASM Disk Group Administration............................................................1-10 About Discovering Disks...............................................................................................................1-10 About Mounting and Dismounting Disk Groups......................................................................1-11 About Adding and Dropping Disks.............................................................................................1-11 About Online Storage Reconfigurations and Dynamic Rebalancing......................................1-11 2 Considerations for Oracle ASM StorageStorage Resources for Disk Groups...................................................................................................... 2-1 Oracle ASM and Multipathing.............................................................................................................. 2-3 Recommendations for Storage Preparation........................................................................................ 2-4iii3 Administering Oracle ASM InstancesOperating with Different Releases of Oracle ASM and Database Instances Simultaneously. 3-1 Configuring Initialization Parameters for Oracle ASM Instances................................................. 3-2 Initialization Parameter Files for an Oracle ASM Instance.......................................................... 3-3 Backing Up, Copying, and Moving an Oracle ASM Initialization Parameter File................... 3-4 Setting Oracle ASM Initialization Parameters............................................................................... 3-5 Automatic Memory Management for Oracle ASM............................................................... 3-5 Oracle ASM Parameter Setting Recommendations....................................................................... 3-6 ASM_DISKGROUPS................................................................................................................... 3-7ASM_DISKSTRING.................................................................................................................... 3-7ASM_POWER_LIMIT................................................................................................................ 3-8ASM_PREFERRED_READ_FAILURE_GROUPS.................................................................. 3-9DB_CACHE_SIZE....................................................................................................................... 3-9DIAGNOSTIC_DEST...............................................................................................................3-10INSTANCE_TYPE....................................................................................................................3-10LARGE_POOL_SIZE...............................................................................................................3-10PROCESSES..............................................................................................................................3-10REMOTE_LOGIN_PASSWORDFILE...................................................................................3-11SHARED_POOL_SIZE............................................................................................................3-11 Setting Database Initialization Parameters for Use with Oracle ASM....................................3-11 Managing Oracle ASM Instances.......................................................................................................3-12 Administering Oracle ASM Instances with Server Control Utility.........................................3-12 Using Oracle Restart.......................................................................................................................3-13 Starting Up an Oracle ASM Instance............................................................................................3-13 About Mounting Disk Groups at Startup.............................................................................3-15About Restricted Mode...........................................................................................................3-15 Shutting Down an Oracle ASM Instance.....................................................................................3-16 Upgrading an Oracle ASM Instance with Oracle Universal Installer.....................................3-17 Downgrading an Oracle ASM Instance.......................................................................................3-19 Out of Place Upgrades....................................................................................................................3-22 Configuring Oracle Grid Infrastructure with the Configuration Wizard...............................3-22 Active Session History Sampling for Oracle ASM.....................................................................3-22 Using Oracle ASM Rolling Upgrade.................................................................................................3-22 Patching Oracle ASM Instances in Oracle RAC Environments...................................................3-23 Authentication for Accessing Oracle ASM Instances....................................................................3-23 About Privileges for Oracle ASM.................................................................................................3-24 Using One Operating System Group for Oracle ASM Users............................................3-24Using Separate Operating System Groups for Oracle ASM Users...................................3-25The SYSASM Privilege for Administering Oracle ASM....................................................3-26The SYSDBA Privilege for Managing Oracle ASM Components.....................................3-27 Creating Users with the SYSASM Privilege................................................................................3-27 Operating System Authentication for Oracle ASM ...................................................................3-28 Password File Authentication for Oracle ASM ..........................................................................3-28 Migrating a Database to Use Oracle ASM........................................................................................3-29 Using Oracle Enterprise Manager to Migrate Databases to Oracle ASM...............................3-29 Using Oracle Recovery Manager to Migrate Databases to Oracle ASM.................................3-29 Best Practices White Papers on Migrating to Oracle ASM........................................................3-29 iv4 Administering Oracle ASM Disk GroupsDisk Group Attributes............................................................................................................................ 4-2 Creating Disk Groups............................................................................................................................. 4-3 Using the CREATE DISKGROUP SQL Statement........................................................................ 4-3 Example: Creating a Disk Group..................................................................................................... 4-5 Creating Disk Groups for a New Oracle Installation.................................................................... 4-6 Specifying the Allocation Unit Size................................................................................................. 4-7 Specifying the Sector Size for Drives............................................................................................... 4-8 Oracle Cluster Registry and Voting Files in Oracle ASM Disk Groups..................................4-10 Altering Disk Groups...........................................................................................................................4-11 Managing Volumes in a Disk Group............................................................................................4-12 Adding Disks to a Disk Group......................................................................................................4-13 Adding Disks to a Disk Group with SQL Statements........................................................4-13 Dropping Disks from Disk Groups..............................................................................................4-14 Intelligent Data Placement.............................................................................................................4-15 Resizing Disks in Disk Groups......................................................................................................4-16 Undropping Disks in Disk Groups...............................................................................................4-17 Manually Rebalancing Disk Groups............................................................................................4-17 Tuning Rebalance Operations.......................................................................................................4-18 Oracle ASM Disk Discovery ..............................................................................................................4-19 How A Disk is Discovered.............................................................................................................4-19 Disk Discovery Rules......................................................................................................................4-20 Improving Disk Discovery Time...................................................................................................4-21 Managing Capacity in Disk Groups..................................................................................................4-21 Negative Values of USABLE_FILE_MB.......................................................................................4-23 Oracle ASM Mirroring and Disk Group Redundancy..................................................................4-23 Mirroring, Redundancy, and Failure Group Options...............................................................4-23 Oracle ASM Failure Groups...................................................................................................4-25How Oracle ASM Manages Disk Failures............................................................................4-25Guidelines for Using Failure Groups....................................................................................4-25Failure Group Frequently Asked Questions........................................................................4-26 Oracle ASM Recovery from Read and Write I/O Errors..........................................................4-26 Oracle ASM Fast Mirror Resync...................................................................................................4-27 Preferred Read Failure Groups.....................................................................................................4-29 Configuring and Administering Preferred Read Failure Groups....................................4-30 Performance and Scalability Considerations for Disk Groups....................................................4-31 Determining the Number of Disk Groups...................................................................................4-31 Performance Characteristics When Grouping Disks.................................................................4-31 Oracle ASM Storage Limits...........................................................................................................4-31 Disk Group Compatibility..................................................................................................................4-32 Overview of Disk Group Compatibility......................................................................................4-32 Disk Group Compatibility Attributes..........................................................................................4-33 COMPATIBLE.ASM................................................................................................................4-33COMPATIBLE.RDBMS...........................................................................................................4-34COMPATIBLE.ADVM............................................................................................................4-34 Setting Disk Group Compatibility Attributes.............................................................................4-34 Valid Combinations of Compatibility Attribute Settings..................................................4-35vUsing CREATE DISKGROUP with Compatibility Attributes..........................................4-36Using ALTER DISKGROUP with Compatibility Attributes.............................................4-36Viewing Compatibility Attribute Settings...........................................................................4-36Features Enabled By Disk Group Compatibility Attribute Settings................................4-37Reverting Disk Group Compatibility....................................................................................4-37 Considerations When Setting Disk Group Compatibility in Replicated Environments......4-38 Managing Oracle ASM File Access Control for Disk Groups......................................................4-39 About Oracle ASM File Access Control.......................................................................................4-40 Using SQL Statements to Set Disk Group Attributes for Oracle ASM File Access Control.4-41 Using SQL Statements to Manage Oracle ASM File Access Control.......................................4-42 Mounting and Dismounting Disk Groups......................................................................................4-43 Mounting Disk Groups Using the FORCE Option.....................................................................4-44 Checking the Internal Consistency of Disk Group Metadata......................................................4-45 Dropping Disk Groups........................................................................................................................4-45 Renaming Disks Groups......................................................................................................................4-46 5Introduction to Oracle ACFSOverview of Oracle ACFS...................................................................................................................... 5-1 Understanding Oracle ACFS Concepts................................................................................................ 5-4 About Oracle ACFS............................................................................................................................ 5-4 About Oracle ACFS and Oracle Database Homes........................................................................ 5-5 About Oracle ASM Dynamic Volume Manager............................................................................ 5-6 About the Oracle ACFS Driver Model............................................................................................ 5-6 About the Oracle ACFS Mount Model and Namespace.............................................................. 5-7 About the Oracle ACFS Mount Registry........................................................................................ 5-7 About Oracle ACFS Snapshots......................................................................................................... 5-8 About Oracle ACFS and Backup and Restore................................................................................ 5-8 About Oracle ACFS Integration with Oracle ASM....................................................................... 5-9 Understanding Oracle ACFS Administration.................................................................................... 5-9 Oracle ACFS and File Access and Administration Security........................................................ 5-9 Oracle ACFS and Grid Infrastructure Installation.....................................................................5-10 Oracle ACFS and Grid Infrastructure Configuration................................................................5-10 Clusterware Resources and Oracle ACFS Administration.......................................................5-10 Oracle ACFS and Dismount or Shutdown Operations.............................................................5-11 Oracle ACFS Security.....................................................................................................................5-12 Oracle ACFS Encryption................................................................................................................5-14 Oracle ACFS Replication................................................................................................................5-16 Oracle ACFS Tagging.....................................................................................................................5-18 Overview of Oracle ASM Dynamic Volume Manager..................................................................5-18 6Using Views to Display InformationViews Containing Oracle ASM Disk Group Information............................................................... 6-1 Viewing Oracle ASM File Access Control Information................................................................ 6-4 Viewing Disk Region Information................................................................................................... 6-5 Views Containing Oracle ACFS Information..................................................................................... 6-6 vi7 Administering Oracle ASM Files, Directories, and TemplatesWhat Types of Files Does Oracle ASM Support?.............................................................................. 7-1 About Oracle ASM Filenames............................................................................................................... 7-2 Single File Creation Form................................................................................................................. 7-3 Multiple File Creation Form............................................................................................................. 7-4 Fully Qualified File Name Form...................................................................................................... 7-4 Alias Oracle ASM Filename Forms................................................................................................. 7-5 Creating a Tablespace in Oracle ASM: Using a Data File with an Alias Name................. 7-6 Alias Oracle ASM Filename with Template Form........................................................................ 7-6 Incomplete Oracle ASM Filename Form........................................................................................ 7-7 Incomplete Oracle ASM Filename with Template Form.............................................................. 7-7 Creating and Referencing Oracle ASM Files in the Database........................................................ 7-7 Creating Oracle ASM Files Using a Default File Location for Disk Group Specification....... 7-8 Using Oracle ASM Filenames in SQL Statements......................................................................... 7-9 Managing Alias Names for Oracle ASM Filenames......................................................................... 7-9 Adding an Alias Name for an Oracle ASM Filename...............................................................7-10 Renaming an Alias Name for an Oracle ASM Filename...........................................................7-10 Dropping an Alias Name for an Oracle ASM Filename............................................................7-10 Dropping Files and Associated Aliases from a Disk Group.....................................................7-10 Managing Disk Group Directories....................................................................................................7-11 Creating a New Directory..............................................................................................................7-11 Renaming a Directory.....................................................................................................................7-12 Dropping a Directory.....................................................................................................................7-12 Accessing Oracle ASM Files with the XML DB Virtual Folder...................................................7-12 Inside /sys/asm..............................................................................................................................7-13 Using DBMS_FILE Transfer Utility for Oracle ASM.....................................................................7-14 Managing Disk Group Templates......................................................................................................7-15 Template Attributes........................................................................................................................7-15 Adding Templates to a Disk Group.............................................................................................7-17 Modifying a Disk Group Template..............................................................................................7-17 Dropping Templates from a Disk Group....................................................................................7-18 Creating Tablespaces in Oracle ASM: Specifying Attributes with Templates.......................7-18 8 Performing Oracle ASM Data Migration with RMANOverview of Oracle ASM Data Migration.......................................................................................... 8-1 Purpose of Oracle ASM Data Migration......................................................................................... 8-1 Basic Concepts of Oracle ASM Data Migration............................................................................. 8-2 Basics Steps of Data Migration to Oracle ASM Using RMAN.................................................... 8-2 Preparing to Migrate the Database to Oracle ASM Using RMAN................................................. 8-3 Migrating the Database to Oracle ASM Using RMAN.................................................................... 8-5 Migrating a Database from Oracle ASM to Alternative Storage.................................................... 8-9 Moving Data Files Between Oracle ASM Disk Groups Using RMAN......................................... 8-9 9 Administering Oracle ASM with Oracle Enterprise ManagerOracle Automatic Storage Management Home Page........................................................................ 9-1 Accessing the Oracle ASM Home Page in Single-Instance Oracle Databases ......................... 9-2vii。

Oracle 11g 下的自动内存管理(AMM)

Oracle 11g 下的自动内存管理(AMM)

Oracle 11g R1下的自动内存管理(AMM)Oracle在简化内存管理方面过去几年做了巨大的努力,从Oracle 9i通过PGA_AGGREGATE_TARGET参数实现PGA自动管理开始,Oracle 10g通过SGA_TARGET 参数实现了SGA的自动管理,Oracle 11g更是惊人地实现了数据库所有内存块的全自动化管理,它使得动态管理SGA和PGA成为现实。

写本文时,自动内存管理(AMM)已经在主流平台上得到支持,包括Linux,Windows,Solaris,HP-UX,AIX。

AMM参数自动内存管理是用两个初始化参数进行配置的:MEMORY_TARGET:动态控制SGA和PGA时,Oracle总共可以使用的共享内存大小,这个参数是动态的,因此提供给Oracle的内存总量是可以动态增大,也可以动态减小的。

它不能超过MEMORY_MAX_TARGET参数设置的大小。

默认值是0。

MEMORY_MAX_TARGET:这个参数定义了MEMORY_TARGET最大可以达到而不用重启实例的值,如果没有设置MEMORY_MAX_TARGET值,默认等于MEMORY_TARGET的值。

使用动态内存管理时,SGA_TARGET和PGA_AGGREGATE_TARGET代表它们各自内存区域的最小设置,要让Oracle完全控制内存管理,这两个参数应该设置为0。

AMM配置在数据库创建过程中,数据库配置助手(DBCA)允许你配置自动内存管理在手动创建数据库时,只需要在创建数据库之前设置合适的MEMORY_TARGET和MEMORY_MAX_TARGET初始化参数。

在一个系统上启用自动内存管理其实很简单,不需要事先做太多的事情,可以使用下面的计算公式来计算:下面的查询语句向你展示有关的信息,以及如何计算出需要的值:假设我们需要的设置是5G,那么我们可以执行下面的语句:当数据库重启后,MEMORY_TARGET参数就可以在不重启实例的情况下随意改变大小了。

oracle 11g Automatic Storage Manager 自动存储管理

oracle  11g Automatic Storage Manager  自动存储管理

Automatic Storage Manager (ASM) Enhancements in Oracle Database 11g Release 1This article provides an overview of the main Automatic Storage Manager (ASM) enhancements in Oracle Database 11g Release 1, including:∙Oracle Database Storage Administrator's Guide∙New Disk Group Compatibility Attributes∙Fast Mirror Resync∙Rolling Upgrade∙SYSASM Privilege and OSASM OS Group∙Scalability and Performance Enhancements∙New ASMCMD Commands and Options∙Preferred Read Failure Groups∙Fast Rebalance∙Miscellaneous Disk Group Maintenance EnhancementsRelated articles.∙Automatic Storage Management (ASM) in Oracle Database 10g∙ASM using ASMLib and Raw Devices∙Using NFS with ASMOracle Database Storage Administrator's GuideThe documentation for this release now includes a Oracle Database Storage Administrator's Guide for the first time.New Disk Group Compatibility AttributesOracle 11g ASM includes two new compatibility attributes that determine the version of the ASM and database software that can use specific disk groups:∙COMPATIBLE.ASM - The minimum version of the ASM software that can access the disk group. In 11g, the default setting is 10.1.∙COMPATIBLE.RDBMS - The minimum COMPATIBLE database initialization parameter setting for any database instance that uses the disk group.In 11g, the default setting is 10.1.The compatibility versions of a disk group can only be increased, not decreased. If you have increased the version by mistake, you will need to create a new disk group.The disk group compatibility attributes can be set during disk group creation by adding the ATTRIBUTE clause to the CREATE DISKGROUP command.CREATE DISKGROUP data DISK '/dev/raw/*'ATTRIBUTE 'compatible.asm' = '11.1';CREATE DISKGROUP data DISK '/dev/raw/*'ATTRIBUTE 'compatible.rdbms' = '11.1', 'compatible.asm' = '11.1';The disk group compatibility attributes for existing disk groups can be altered using the SET ATTRIBUTE clause to the ALTER DISKGROUP command.ALTER DISKGROUP data SET ATTRIBUTE 'compatible.asm' = '11.1';ALTER DISKGROUP data SET ATTRIBUTE 'compatible.rdbms' = '11.1';The current compatibility settings are available from the V$ASM_DISKGROUP and V$ASM_ATTRIBUTE views.COLUMN name FORMAT A10COLUMN compatibility FORMAT A20COLUMN database_compatibility FORMAT A20SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;GROUP_NUMBER NAME COMPATIBILITY DATABASE_COMPATIBILI------------ ---------- -------------------- --------------------1 DATA 11.1.0.0.0 11.1.0.0.01 row selected.SQL>COLUMN name FORMAT A20COLUMN value FORMAT A20SELECT group_number, name, value FROM v$asm_attribute ORDER BYgroup_number, name;GROUP_NUMBER NAME VALUE------------ -------------------- --------------------1 au_size 10485761 compatible.asm 11.1.0.0.01 compatible.rdbms 11.11 disk_repair_time 3.6h4 rows selected.SQL>Fast Mirror ResyncDuring transient disk failures within a failure group, ASM keeps track of the changed extents that need to be applied to the offline disk. Once the disk is available, only the changed extents are written to resynchronize the disk, rather than overwriting the contents of the entire disk. This can speed up the resynchronization process considerably.Fast mirror resync is only available when the disk groups compatibility attributes are set to 11.1 or higher.ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'compatible.asm' = '11.1'; ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'compatible.rdbms' = '11.1;ASM drops disks if they remain offline for more than 3.6 hours. The disk groups default time limit is altered by changing the DISK_REPAIR_TIME parameter with a unit of minutes (M or m) or hours (H or h).-- Set using the hours unit of time.ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '4.5h';-- Set using the minutes unit of time.ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '300m'; The DROP AFTER clause of the ALTER DISKGROUP command is used to override the disk group default DISK_REPAIR_TIME.-- Use the default DISK_REPAIR_TIME for the diskgroup.ALTER DISKGROUP disk_group_1 OFFLINE DISK D1_0001;-- Override the default DISK_REPAIR_TIME.ALTER DISKGROUP disk_group_1 OFFLINE DISK D1_0001 DROP AFTER 30m;If a disk goes offline during a rolling upgrade, the timer is not started until after the rolling upgrade is complete.Rolling UpgradeClustered ASM instances for 11g onwards can be upgraded using a rolling upgrade. The ASM cluster is placed in rolling upgrade mode by issuing the following command from one of the nodes.ALTER SYSTEM START ROLLING MIGRATION TO 11.2.0.0.0;Once the cluster is in rolling upgrade mode each node in turn can be shutdown, upgraded and started. The cluster runs in a mixed version environment until the upgrade is complete. In this state, the cluster is limited to the following operations:∙Mount and dismount of the disk groups.∙Open, close, resize, and delete of database files.∙Access to local fixed views and fixed packages.The current status of the ASM cluster can be determined using the following query.SELECT SYS_CONTEXT('sys_cluster_properties', 'cluster_state') FROM dual;Once the last node is upgraded, the rolling upgrade is stopped by issuing the following command, which checks all ASM instances are at the appropriate version, turns off rolling upgrade mode and restarts any pending rebalance operations.ALTER SYSTEM STOP ROLLING MIGRATION;Restrictions and miscellaneous points about the rolling upgrade process include:∙The Oracle clusterware must be fully patched before an ASM rolling upgrade is started.∙Rolling upgrades are only available from 11g onwards, so this method is not suitable for 10g to 11g upgrades.∙This method can be used to rollback to the previous version if the rolling upgrade fails before completion.∙If the upgrade fails, any rebalancing operations must complete before a new upgrade can be attempted.∙New instances joining the cluster during a rolling upgrade are automatically placed in rolling upgrade mode.If all instances in a cluster are stopped during a rolling upgrade, once the instances restart they will no longer be in rolling upgrade mode. The upgrade must be initiated as if it were a new process.SYSASM Privilege and OSASM OS GroupThe introduction of ASM moved the management of storage away from system adminstrators and into the DBA territory. Unfortunately this isn't how every company operates. As a result, some system administrators were required to have access to privileged users to handle disk storage. Oracle addresses this issue with the introduction of the SYSASM privilege and the OSASM operating system group, which provide two mechanisms to enable the separation of storage and database administration duties.Users can be created in the ASM instance in a similar manner to database users. Granting these users the SYSASM privilege allows them to connect to the ASM instance and perform administration tasks. First, connect to the ASM instance.$ export ORACLE_SID=+ASM$ sqlplus / as sysasmNext, create a new user in the ASM instance and grant it the SYSASM privilege. The user is now able to connect using SYSASM.SQL> CREATE USER asm_user_1 IDENTIFIED by asm_password;User created.SQL> GRANT SYSASM TO asm_user_1;Grant succeeded.SQL> CONN asm_user_1/asm_password AS SYSASMConnected.SQL>Alternatively, assigning an operating system user to the OSASM group (asmadmin) allows then to connect as SYSASM using OS authentication. The following example creates a new OS user assigned to the OSASM group (asmadmin), which is immediately able to connect using SYSASM.# useradd tim_hall -G asmadmin# su - tim_hall$ export ORACLE_SID=+ASM$ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1$ $ORACLE_HOME/bin/sqlplus / as sysasmSQL*Plus: Release 11.1.0.6.0 - Production on Fri Aug 8 16:48:37 2008Copyright (c) 1982, 2007, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL>Scalability and Performance EnhancementsASM files are stored in a disk group as a collection of extents. In Oracle 10g each extent mapped directly to one allocation unit (AU), but in Oracle 11g an extent can be made up of one or more allocation units. As files get larger, the extent size can grow to reduce the size of the extent map describing the file, thus saving memory.When the disk group compatibility attributes are set to 11.1 or higher, the extent size will automatically grow as the file grows. The first 20,000 extents match the allocation unit size (1*AU). The next 20,000 extents are made up of 8 allocation units (8*AU). Beyond that point, the extent size becomes 64 allocation units (64*AU).In addition to the automatic expansion of the extent sizes, Oracle 11g also allows control over the allocation unit size using the ATTRIBUTE clause in the CREATE DISKGROUP statement, with values ranging from 1M to 64M.CREATE DISKGROUP disk_group_2EXTERNAL REDUNDANCYDISK '/dev/sde1'ATRRIBUTE 'au_size' = '32M';The combination of expanding extent sizes and larger allocation units should result in increased I/O performance for very large databases.New ASMCMD Commands and OptionsThe ASM command line utility includes several new commands. The followingexample output assumes you have already started the utility using the "-p"option.$ asmcmd -pASMCMD [+] >The usage notes for each command is available by issuing the "help<command>" command from within the asmcmd utility, so I will avoiddisplaying all this information here.The lsdsk command lists information about ASM disks from theV$ASM_DISK_STAT and V$ASM_DISK views. The summary usage is shown below.lsdsk [-ksptcgHI] [-d <diskgroup_name>] [pattern]An example of the output from the basic command and the "-k" option areshown below.ASMCMD [+] > lsdskPath/dev/sdc1/dev/sdd1/dev/sde1ASMCMD [+] > lsdsk -d data -kTotal_MB Free_MB OS_MB Name Failgroup Library Label UDIDProduct Redund Path8189 6961 8189 DATA_0000 DATA_0000 System UNKNOWN /dev/sdc18189 6961 8189 DATA_0001 DATA_0001 System UNKNOWN /dev/sdd18189 6950 8189 DATA_0002 DATA_0002 System UNKNOWN /dev/sde1ASMCMD [+] >The cp command allows files to be copied between ASM and local or remote destinations. The summary usage is shown below.cp [-ifr] <[@connect_identifier:]src> <[@connect_identifier:]tgt>The following example copies the current USERS datafile from ASM to thelocal file system.ASMCMD [+] > cp +DATA/db11g/datafile/users.273.661514191 /tmp/users.dbf source +DATA/db11g/datafile/users.273.661514191target /tmp/users.dbfcopying file(s)...file, /tmp/users.dbf, copy committed.ASMCMD [+] >There seems to be some concern that the cp command doesn't work for control files (here).The md_backup command makes a copy of the metadata for one or more disk groups. The summary usage is shown below.md_backup [-b location_of_backup] [-g dgname [-g dgname …]]An example of the command is shown below. The resulting file contains all the metadata needed to recreate the ASM setup.ASMCMD [+] > md_backup -b /tmp/backup.txt -g dataDisk group to be backed up: DATAASMCMD [+] >The md_restore command allows you to restore a disk group from the metadata created by the md_backup command. It also allows a certain amount of manipulation of the final disk groups during the restore. The summary usage is shown below.md_restore -b <backup_file> [-li][-t (full)|nodg|newdg] [-f <sql_script_file>][-g '<diskgroup_name>,<diskgroup_name>,...'][-o'<old_diskgroup_name>:<new_diskgroup_name>,...']A straight restore of the backup shown previously is shown below.ASMCMD [+] > md_restore -b /tmp/backup.txt -t full -g dataThe remap command repairs a range of physical blocks on disk. The contents of each block is not validated, so only blocks exhibiting read errors are repaired. The summary usage is shown below.remap <disk group name> <disk name> <block range>An example of the command is show below.ASMCMD [+] > remap data data_0001 5000-5999For detailed usage information see the ASMCDM Command Reference. Preferred Read Failure GroupsIn Oracle 10g, ASM always reads the primary copy of the mirrored extent set. This isn't a problem when both nodes and both failure groups are all located in the same site, but it can be inefficient for extended clusters, causing needless network traffic. Oracle 11g allows each node to define a preferred failure group, allowing nodes in extended clusters to access local failure groups in preference to remote ones.To configure preferred read failure groups the disk group compatibility attributes must be set to 11.1 or higher. Once the compatibility options are correct, the ASM_PREFERRED_READ_FAILURE_GROUPS parameter is set to the preferred failure groups for each node.SELECT name, failgroup FROM v$asm_disk;NAME FAILGROUP------------------------------ ------------------------------DATA_0000 DATA_0000DATA_0001 DATA_0001DATA_0002 DATA_00023 rows selected.SQL>ALTER SYSTEM SET ASM_PREFERRED_READ_FAILURE_GROUPS = 'data.data_0000', 'data.data_0001', 'data.data_0002';Fast RebalanceThe "ALTER DISKGROUP ... MOUNT" statement allows disk groups to be mounted in restricted mode.SQL> SELECT name FROM v$asm_diskgroup;NAME------------------------------DATASQL> ALTER DISKGROUP data DISMOUNT;Diskgroup altered.SQL> ALTER DISKGROUP data MOUNT RESTRICTED;Diskgroup altered.SQL> ALTER DISKGROUP data DISMOUNT;Diskgroup altered.SQL> ALTER DISKGROUP data MOUNT;Diskgroup altered.SQL>In a RAC environment, a disk group mounted in RESTRICTED mode can only be accessed by a single instance. The restricted disk group is not available to any ASM clients, even on the node where it is mounted.Using RESTRICTED mode improves the performance of rebalance operations in a RAC environment as it elimitates the need for lock and unlock extent map messaging that occurs between ASM instances. Once the rebalance operation is complete, the disk group should be dismounted then mounted in NORMAL mode (the default).Miscellaneous Disk Group Maintenance Enhancements∙The CREATE DISKGROUP and ALTER DISKGROUP commands include a new ATTRIBUTE clause (compatible, disk_repair_time, au_size).∙The CHECK clause of the ALTER DISKGROUP command has been simplified so there are only two options, NOREPAIR and REPAIR, available, with NOREPAIR as the default. Summarized errors are displayed, with full error messages writen to the alert log.∙ALTER DISKGROUP data CHECK; -- Like NOREPAIR∙ALTER DISKGROUP data CHECK NOREPAIR;ALTER DISKGROUP data CHECK REPAIR;∙Disk groups can now be mounted in restricted mode, which can improve performance of some maintenance tasks.∙The ALTER DISKGOUP command now includes ONLINE and OFFLINE clauses so disks can be taken offline for repair before being brought back online.∙-- Individual disks.∙ALTER DISKGROUP data OFFLINE DISK 'disk_0000', 'disk_0001';∙ALTER DISKGROUP data ONLINE DISK 'disk_0000', 'disk_0001';∙∙-- Failure groups.∙ALTER DISKGROUP data OFFLINE DISKS IN FAILGROUP 'fg_0000';∙ALTER DISKGROUP data ONLINE DISKS IN FAILGROUP 'fg_0000';∙∙-- Bring online all disks in disk group.ALTER DISKGROUP data ONLINE ALL;∙Disk groups that can't be mounted by ASM can now be dropped using the FORCE keyword of the DROP DISKGROUP command.DROP DISKGROUP data FORCE;。

oracle 11g memory参数

oracle 11g memory参数

oracle 11g memory参数Oracle 11g中的内存参数一、背景介绍在Oracle数据库管理中,内存参数是非常重要的配置项之一。

通过调整合适的内存参数,可以提高数据库的性能和响应速度。

本文将介绍Oracle 11g中的一些常用的内存参数及其作用。

二、SGA_TARGET参数SGA(System Global Area)是Oracle数据库实例中的关键内存区域,用于存储数据缓冲区、共享池、重做缓冲区等。

SGA_TARGET参数用于指定SGA的大小,它决定了数据库能够使用的内存总量。

通过增加SGA_TARGET的值,可以提高数据缓存的命中率,从而提高查询性能。

三、PGA_AGGREGATE_TARGET参数PGA(Program Global Area)是Oracle数据库实例中用于执行SQL 语句的内存区域。

PGA_AGGREGATE_TARGET参数用于指定PGA的大小,它决定了数据库能够同时执行的SQL语句数量。

通过增加PGA_AGGREGATE_TARGET的值,可以提高并发查询的能力,从而提高系统的吞吐量。

四、SHARED_POOL_SIZE参数共享池是SGA中的一个重要组成部分,用于存储共享SQL和PL/SQL代码的执行计划、游标等信息。

SHARED_POOL_SIZE参数用于指定共享池的大小,它决定了数据库能够缓存的SQL和PL/SQL 代码的数量。

通过增加SHARED_POOL_SIZE的值,可以提高SQL语句的重用率,从而降低系统的响应时间。

五、BUFFER_POOL_KEEP和BUFFER_POOL_RECYCLE参数Oracle数据库中的数据缓冲区分为KEEP缓冲区和RECYCLE缓冲区。

BUFFER_POOL_KEEP参数用于指定KEEP缓冲区的大小,它用于缓存经常被访问的数据块。

BUFFER_POOL_RECYCLE参数用于指定RECYCLE缓冲区的大小,它用于缓存不常被访问的数据块。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ORACLE 11G自动内存管理
ORACLE 11g 自动内存管理:
在oracle 11g中,使用一个参数memory_target就能够实现SGA和PGA组件依据工作负荷进行自动内存分配。oracle推荐使用自动内存管理简化内存分配。
oracle 11g依然支持手工内存分配:
1:oracle 11g使用memory_target来支持内存自动分配。
memory_max_size参数是静态,然而memory_target是动态的。因此你可以调整memory_target参数值的大小,但上限是memory_max_size。
对自动内存管理的配置有两种情况,在创建数据库时或者是创建数据库后。
1:在数据库创建期间设置自动内存管理:如果是手工建库,那么你只需要设置好如下类似初始化参数即可:
在有些场合,如果你使用自动内存管理给实例分配内存,可能会遇到下列错误,比如linux上:
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
这是因为/dev/shm没有设置正确的值,确保这个值至少等于sga_max_size参数值。
2:使用sga_target和pga_target参数来设置SGA和PGA,数据库会在这两个组件中自我优化。
3:你也可以手工设置SGA中的各个组件。比如db_cache_size,shared_pool_size等组件。
oracle 11g中新的内存初始化参数:
有两个新的关键的内存初始化参数memory_target(这个参数设置分配给实例的内存数)和memory_max_size(这个参数是可选的,设置实例能够分配的最大内存,设置的是memory_target的上限值)。
/dev/sda1 99M 14M 81M 15% /boot
none 2.0G 702M 1.4G 35% /dev/shm
ቤተ መጻሕፍቲ ባይዱ可以看到该值为2G。
可以通过/etc/fstab来更改该值:
默认情况下该文件相关内容如下:
memory_target = 1000m
memory_max_target = 1500m
如果是采用DBCA创建数据库,如果是创建新库并且是高级安装,你能选择自动内存管理选项。如果是选择基本安装,那么默认就是自动内存管理。
2:在数据库创建后:你可以在数据库创建后添加memory_max_target和memory_target.虽然memory_target是一个动态参数,但是当数据库运行时,你不能交换到自动内存管理。必须重启数据库将参数应用到实例启动过程才行。
6: 如果仅设置了 MEMORY_MAX_TARGET,则使用文本初始化文件进行手动设置时,MEMORY_TARGET 默认为 0。SGA 和 PGA 的自动优化行为默认情况下与 10g R2 中的相同。
7:如果 SGA_MAX_SIZE 不是用户设置的,则在用户设置了 MEMORY_MAX_TARGET 的情况下,系统会在内部将其设置为 MEMORY_MAX_TARGET(与用户是否设置SGA_TARGET 无关)。
[oracle@node1 dbs]$ cat /etc/fstab |grep shm
none /dev/shm tmpfs defaults 0 0
可以将该值修改为如下:
none /dev/shm tmpfs defaults,size=2G 0 0
2:如果设置了 SGA_TARGET 但未设置PGA_AGGREGATE_TARGET,则仍会自动优化这两个参数。PGA_AGGREGATE_TARGET 将初始化为以下值:(MEMORY_TARGET -SGA_TARGET)。
3:如果设置了 PGA_AGGREGATE_TARGET 但未设置 SGA_TARGET,则仍会自动优化这两个参数。SGA_TARGET 将初始化为值 min(MEMORY_TARGET -PGA_AGGREGATE_TARGET, SGA_MAX_SIZE(如果用户已设置)),系统将自动优化子组件。
4:如果未设置任何参数,则无需最小值或默认值即可自动优化这两个参数。有这样一个策略:在初始化过程中,将服务器的总内存按固定比率分配给SGA 和 PGA。该策略将在启动时分配 60% 的内存给SGA,40% 的内存给 PGA。如果未设置 MEMORY_TARGET,或者将其显式设置为 0(11g 中的默认值为 0):
[oracle@node1 dbs]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
14G 9.4G 3.2G 75% /
5:如果设置了 SGA_TARGET,则系统仅自动优化 SGA 的子组件大小。PGA 的自动优化与是否显式设置 PAG 无关。但是,不会自动优化整个SGA (SGA_TARGET) 和 PGA (PGA_AGGREGATE_TARGET),即 SGA 和PGA 不会自动增长或收缩。如果既未设置SGA_TARGET,又未设置 PGA_AGGREGATE_TARGET,则遵从当前的策略:自动优化PGA,但不自动优化SGA;必须显式设置部分子组件的参数(对于SGA_TARGET)。
实现自动内存管理,有下列原则:
MEMORY_TARGET 设置为非零值时:
1:如果设置了SGA_TARGET 和 PGA_AGGREGATE_TARGET,则会分别将它们当作 SGA大小和 PGA 大小的最小 值。MEMORY_TARGET 可以将 SGA_TARGET + PGA_AGGREGATE_TARGET 的值作为 MEMORY_MAX_SIZE。
然后重启系统即可解决问题。
相关文档
最新文档