Wednesday 28 April 2010

MEMORY_TARGET not supported on this system

MEMORY_TARGET not supported on this system 
Oracle9i introduced pga_aggregate_target, you can adjust the PGA automatically; Oracle10 introduction sga_target, can automatically adjust to the SGA. Oracle11g then the two parts are integrated, the introduction of memory_target, can automatically adjust all of the memory, which is newly introduced automatic memory management features. 
SQL> alter system set memory_target = 200m scope = spfile; 

System altered. 

SQL> alter system set memory_target = 200m scope = spfile; 

System altered. 

SQL> alter system set sga_target = 0 scope = spfile; 

System altered. 

SQL> alter system set pga_aggregate_target = 0 scope = spfile; 

System altered. 

SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 

SQL> startup 
ORACLE instance started. 

Total System Global Area 209235968 bytes 
Fixed Size 1298920 bytes 
Variable Size 150998552 bytes 
Database Buffers 54525952 bytes 
Redo Buffers 2412544 bytes 
Database mounted. 
Database opened. 

Set memory_target parameters, in fact Oracle will automatically set and adjust the two double-underscore at the beginning of the implicit parameter to the allocation of SGA and PGA memory, which, and Oracle10g is automatically set sga_target are assigned db_cache_size and shared_pool_size mechanism is the same as 
SQL> select a.ksppinm name, b.ksppstvl value 
2 from x $ ksppi a, x $ ksppcv b 
3 where a.indx = b.indx 
4 and (a.ksppinm like '% sga_target%' 
5 or a.ksppinm like '% pga_aggregate_target%'); 

NAME VALUE 
---------------------------------------- ---------- -------------------- 
sga_target 0 
__sga_target 125829120 
pga_aggregate_target 0 
__pga_aggregate_target 79691776 

If memory_max_target / memory_target set too large, may result in instance not start, reported that ORA-00845 error 
SQL> alter system set memory_max_target = 300m scope = spfile; 

System altered. 

SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL> startup 
ORA-00845: MEMORY_TARGET not supported on this system 

This error is a bit misleading, in fact does not mean that the platform does not support the version of AMM features, but more than the system set up memory_max_target set share memory (/ dev / shm) only. In Oracle11g for linux seems to use a new mechanism to manage the shared memory segment, rather than the traditional sys v shm had. The alert.ora can be found in a more accurate description of the error 

Starting ORACLE instance (normal) 
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the / dev / shm file system to be mounted for at least 314572800 bytes. / Dev / shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is 209715200 and used is 0 bytes. 
memory_target needs larger / dev / shm 

Therefore, this error there are two solutions. The first is to reduce the natural memory_max_target / memory_target. The second is to increase the / dev / shm 
[root @ localhost ~] # df-k / dev / shm 
Filesystem 1K-blocks Used Available Use% Mounted on 
shmfs 204800 0 204800 0% / dev / shm 

[root @ localhost ~] # umount / dev / shm 
[root @ localhost ~] # mount-t tmpfs shmfs-o size = 300m / dev / shm 

[root @ localhost ~] # df-k / dev / shm 
Filesystem 1K-blocks Used Available Use% Mounted on 
shmfs 358400 0 358400 0% / dev / shm 

[root @ localhost trace] # ls-l / dev / shm 
total 0 

Increase / dev / shm and re-start the instance 
SQL> startup 
ORACLE instance started. 

Total System Global Area 313860096 bytes 
Fixed Size 1299624 bytes 
Variable Size 255855448 bytes 
Database Buffers 50331648 bytes 
Redo Buffers 6373376 bytes 
Database mounted. 
Database opened. 

Let's look at / dev / shm the contents of the 
[root @ localhost trace] # df-k / dev / shm 
Filesystem 1K-blocks Used Available Use% Mounted on 
shmfs 307200 122792 184408 40% / dev / shm 
[root @ localhost trace] # ls-l / dev / shm 
total 122792 
-rw-r ----- 1 oracle oinstall 4194304 Sep 10 21:15 ora_ning_1179659_0 
-rw-r ----- 1 oracle oinstall 4194304 Sep 10 21:15 ora_ning_1179659_1 
-rw-r ----- 1 oracle oinstall 0 Sep 10 21:15 ora_ning_1179659_10 
-rw-r ----- 1 oracle oinstall 0 Sep 10 21:15 ora_ning_1179659_11
-rw-r ----- 1 oracle oinstall 0 Sep 10 21:15 ora_ning_1179659_12 
-rw-r ----- 1 oracle oinstall 0 Sep 10 21:15 ora_ning_1179659_13 
...... 

Attached: / dev / shm to use: 

Using tmpfs speed up your linux server uses virtual disks to store squid cache files and php the seesion. Fast and a lot of Oh! 

By default the system will load the / dev / shm, it is the so-called tmpfs, Some say that with the ramdisk (virtual disk), but not the same. The same as the virtual disk, tmpfs can use your RAM, but it can also use your swap partition to store. And the traditional virtual disk is a block device, and the need for a sort of command mkfs can really use it, tmpfs is a file system, rather than a block device; you just install it, it can use. 

tmpfs has the following advantages: 
1. Dynamic file system size, 
2. tmpfs Another major advantage is its lightning speed. Because a typical tmpfs file system will be fully reside in RAM, the read and write could be almost instantaneous. 
3. tmpfs data not be retained after you restart, because virtual memory is volatile in nature. It is necessary to do some scripting to do, such as loading, binding operations. 

Well talk about a number of major principles, we are tired of looking at it, I still talk about the application of it:) 

First in the / dev / shm to build a tmp folder, and then with the actual / tmp binding 

mkdir / dev / shm / tmp 
chmod 1777 / dev / shm / tmp 
mount - bind / dev / shm / tmp / tmp 

1. Squid cache directory settings 

vi / etc / squid / squid.conf 

Modified to 
cache_dir ufs / tmp 256 16 256 
The first one here, 256 that the use 256M memory, I think http://www.linuxaid.com.cn/articles/4/4 / 441672019.shtml where the method does not use the ramdisk as the direct use of tmpfs, at least every time you start do not mkfs , you can also dynamically change the size. This time, / tmp is actually the / dev / shm / tmp 

Then restart about service, ok, now all of the squid cache files are saved inside inverted tmpfs file system, and soon oh. 

2. For php performance optimization 

For a visit to a large quantity of apache + php website may tmp will be under a lot of temporary files, such as seesion or some cache file, then you can save it to a tmpfs file. 

Save seesion method is very simple as long as a modified php.ini on the list, as I have already / dev / stm / tmp and / tmp binding, it is not rewritten are also OK, as php program generated cache file, it will only change their own php program has:) 

As for the tmpfs other applications, I think we may be inspired by this article will.

No comments: