ORACLE  SGA  的分配 SGA=((db_block_buffers * block size)+(shared_pool_size+large_pool_size+log_buffers)+1MBORACLE 8.1.X 版本SGA=((db_block_buffers * block size)+(shared_pool_size+large_pool_size+java_pool_size+log_buffers)+1MB理论上SGA可占OS系统物理内存的1/2——1/3,我们可以根据需求调整我推荐SGA=0.45*(OS RAM)假设服务器运行ORACLE 8.1.X 版本, OS系统内存为2G MEM, db_block_size 是8192 bytes, 
除了运行ORACLE数据库外, 没有其它的应用程序或服务器软件.这样SGA合计约为921M ( 0.45*2048M ), 设shared_pool_size 300M (300*1024*1024 bytes)设database buffer cache 570M (72960*8192 bytes) initorasid.ora文件里具体各参数如下:shared_pool_size = 314572800
# 300 Mdb_block_buffers = 72960
# 570 Mlog_buffer = 524288
# 512k (128K*CPU个数)large_pool_size = 31457280
# 30 Mjava_pool_size = 20971520
# 20 Msort_area_size = 524288
# 512k (65k--2M)sort_area_retained_size = 524288
# MTS 时 sort_area_retained_size = sort_area_sizeSUN Solaris里/etc/system文件里的几个参数同样跟内存分配有关ORACLE安装时缺省的设置: 建议修改的设置: 
set shmsys:shminfo_shmmax=4294967295 
set shmsys:shminfo_shmmin=1 
set shmsys:shminfo_shmmni=100 
set shmsys:shminfo_shmseg=15 
set semsys:seminfo_semmns=200 
set semsys:seminfo_semmni=70 
set ulimit=3000000  
set semsys:seminfo_semmni=315
set semsys:seminfo_semmsl=300
set semsys:seminfo_semmns=630
set semsys:seminfo_semopm=315
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmni=315
set shmsys:shminfo_shmseg=10
set shmsys:shminfo_shmmin=1 其中这些参数的含义shmmax - 共享内存段,建议设大点, 达到最大SGA
shmmin - 最小的共享内存段.
shmmni - 共享内存标志符的数量.
shmseg - 一个进程可分配的最大内存段数.
shmall - 最大可允许的内存数,比SGA还要大.
semmns - 信号灯,跟ORACLE的PROCESS数有关.
semmsl - 一个信号灯中最大的信号灯数.

解决方案 »

  1.   

    SGA是在哪里设置?我的init*.ora里好像没这一项。除了sga,其他的还有什么常规的优化么?
      

  2.   

    就是通过init.ora文件中的参数来设置,
    语句的效率也很重要
      

  3.   

    怎么我的参数的改动都是在spfileora1.ora里,而不是initora1.ora里?(sid=ora1),我改initoral.ora好像没有用
      

  4.   

    你用的是9I吧,可以用两中方法使你的参数修改生效
    1.alter system
    Using ALTER SYSTEM to Change Initialization Parameter Values
    The ALTER SYSTEM statement allows you to set, change, or delete (restore to default value) initialization parameter values. When the ALTER SYSTEM statement is used to alter a parameter setting in a traditional initialization parameter file, the change affects only the current instance, since there is no mechanism for automatically updating initialization parameters on disk. They must be manually updated in order to be passed to a future instance. Using a server parameter file overcomes this limitation.Setting or Changing Initialization Parameter Values
    Use the SET clause of the ALTER SYSTEM statement to set or change initialization parameter values. Additionally, the SCOPE clause specifies the scope of a change as described in the following table:SCOPE Clause Description 
    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. 
     
    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. 
     
    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. 2.用create pfile 命令从initoral.ora文件生成新的spfile
    CREATE SPFILE='/u01/oracle/dbs/test_spfile.ora'
           FROM PFILE='/u01/oracle/dbs/test_init.ora';
     
      

  5.   

    我用图形工具改动了processes参数,发现是在文件spfileora1.ora里做了记录,而initora1.ora里却无任何改动?oracle启动时到底是从哪个文件里取得参数?