Ndba

ndba.egloos.com

포토로그 마이가든



close_wait 인 프로세스 확인하기 SYSTEM

lsof | grep (port number)

공유하기 버튼

 

[펌] [vmo] maxperm, minperm 개념 UNIX

[출처] http://hacmp.egloos.com/1164979


AIX에서 Memory 관리를 위해 일반적으로 사용하는 명령을 보겠습니다.
AIX 4.3.3  AIX 5.1 : /usr/samples/kernel/vmtune(vmtune64  64bit인 경우)
AIX 5.2 및 AIX 5.3 : vmo 명령 사용. (32 또는 64bit 공용이며, 위의 vmtune과 달리 Reboot 시에도 설정 값이 Default로 돌아가지 않도록 설정 가능.)
 
 
nmaxperm  Persistent Memory 영역의 최대 한계를 %로 나타낸 것이 아니라 일반적으로 File Cache 영역이 사용할 수 있는 영역 범위까지를 지정하는 것입니다.(Soft Limit)
 
nminperm  마찬가지로 Persistent Memory 영역의 최소 사용 영역이 아니라 최소 보장 영역이라 할 수 있습니다. Computational 영역이 높은 사용률을 보이더라도 File Cache 영역에 대한 요청 또한 많아지면 이 정도는 보장을 하겠다는 내용으로 이해하시면 됩니다.
 
nnumperm  실제 File Cache 영역이 사용하는 영역을 vmtune, vmo 등을 통해 확인할 수 있습니다. 이 값을 사용자가 설정하는 값이 아니라 시스템이 사용 중인 File Cache 영역을 계산하여 보여주는 값입니다.
 
nmaxclient  NFS와 같은 서비스를 통한 File Cache 영역을 지정하고 있습니다. 일반적으로 maxperm과 같은 수치를 Default로 설정합니다.
 
nstrict_maxperm  말 그대로 Strict 합니다. 아주 엄격히 maxperm을 적용하기 때문에 이 때의 maxperm 값은 File Cache의 최대 한계를 나타낸다고 볼 수 있습니다. 이것을 설정하는 이유는 Computational 실 메모리 영역을 보장하고자 하는 것입니다. 만약 maxperm=20%에 stirict_maxperm=1을 주게 되면, File Cache 영역이 실 메모리 영역의 20%를 넘지 못하기 때문에 Computational 영역이 실 메모리의 80%를 자유롭게 사용할 수 있습니다.

공유하기 버튼

 

GDB Debugger 사용 팁 리눅스

출처 : http://bebop.emstone.com/2008/12/23/gdb-debugger-사용-팁/


GDB Debugger 사용 팁

자주 사용하는 GDB 명령어

run command-line-arguments : 디버깅할 프로그램을 시작합니다. 실행 시 명령어 라인 인자를 전달할 수 있습니다.

break place : breakpoint를 설정합니다.

delete N : N 에 해당하는 breakpoint를 제거합니다. (N은 info breakpoints 명령을 통해서 확인할 수 있습니다.)

help command : GDB 명령어에 대한 설명을 제공합니다.

step : 프로그램의 현재 라인을 실행하고 다음 라인에서 정지합니다. 현재 라인이 함수인 경우 함수의 시작위치에서 정지하게 됩니다.

next : 프로그램의 현재 라인을 실행합니다. 현재 라인이 함수인 경우 함수를 실행하고 다음 라인에서 정지하게 됩니다.

finish : 현재 실행된 함수의 끝에 도달할 때까지 next 명령을 실행합니다.

continue : breakpoint를 만나거나, 프로그램이 정지될 때까지 프로그램을 실행합니다.

print E : 실행 중인 함수에서 사용하는 변수값을 화면에 표시할 때 사용합니다. E는 C언어에서 사용하는 표현식입니다.

quit : GDB를 종료합니다.

Breakpoint 사용하기

breakpoint를 설정하는 명령어는 break 입니다. break 명령어는 다음과 같이 사용할 수 있습니다.

현재 소스 파일에서 19번째 라인에 breakpoint를 걸고 싶은 경우
(gdb) b 17

현재 소스 파일에서 main 함수에 breakpoint를 걸고 싶은 경우
(gdb) b main

gui.c 파일에서 17번째 라인에 breakpoint를 걸고 싶은 경우
(gdb) b gui.c:17

gui.c 파일에서 gui_init () 함수에 breakpoint를 걸고 싶은 경우
(gdb) b gui.c:gui_init

breakpoint를 한번만 걸고 제거하고 싶은 경우에는 tbreak 명령을 이용합니다.

breakpoint에 대한 정보를 보고 싶은 경우에는 info breakpoints 명령을 이용합니다.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x0805c53a in main_restart_idle at main.c:17
2 breakpoint keep y 0x0805b199 in main at main.c:1139

breakpoint를 사용하고 싶지 않을 경우에는 disable 명령어를 사용합니다.
(gdb) disable 2

breakpoints를 사용하고 싶은 경우에는 enable 명령어를 사용합니다.
(gdb) enable 2

breakpoint를 설정한 지점에서 무시하고 특정 횟수만큼 지나가고 싶은 경우에는 ignore 명령어를 사용합니다.
(gdb) ignore 1 2

ignore 명령어의 첫번째 인자는 breakpoint 번호, 두번째 인자는 무시하고 지나갈 횟수를 나타냅니다.

breakpoint를 제거하고 싶은 경우에는 delete 명령어를 사용합니다.
(gdb) delete 1

Watchpoint 사용하기

변수에 값이 써지는 것을 확인하고 싶은 경우 watch 명령어를 사용합니다.
(gdb) watch x

값이 변경될 경우 다음과 같은 결과를 화면에서 볼 수 있습니다.
Old value = -10291281
New value = 20
main (argc=1, argv=0xbfd8c2e4) at main.c:1176
1176 x = 20

변수에 있는 값이 다른 변수로 읽히는 것을 확인하고 싶은 경우 rwatch 명령어를 사용합니다.
(gdb) rwatch

읽기 / 쓰기를 확인하고 싶은 경우에는 awatch 명령어를 이용합니다.

설정한 watchpoint 정보를 보고 싶을 경우 info breakpoints 명령을 사용합니다.

watchpoint를 사용하고 싶지 않을 경우 breakpoint에서 사용한 disable 명령어를 사용합니다.

Call Stack 사용하기

함수가 호출된 순서를 보고 싶은 경우 backtrace 명령을 사용합니다.

현재 함수의 프레임에서 다른 함수의 프레임으로 이동하고 싶은 경우 frame 명령어를 사용합니다.
(gdb) frame 4

frame 명령어의 첫번째 인자는 이동하고 싶은 stack frame 번호를 나타냅니다.

현재 frame의 정보를 보고 싶은 경우에는 info frame 명령어를 이용합니다.
현재 frame의 지역 변수의 값을 보고 싶은 경우 info locals, 함수가 받은 파라미터 정보를 보고 싶은 경우 info args명령어를 이용합니다.

이미 실행 중인 프로그램 디버깅하기

실행 중인 프로세스를 디버깅하고 싶은 경우 attach 명령어를 이용할 수 있습니다.
(gdb) attach 1182

attach 명령어의 첫번째 인자는 process-id 입니다.

공유하기 버튼

 

[펌] how to trace an Oracle Error Oracle

http://oracle.erkansaka.org/2011/09/how-to-trace-oracle-error.html

How to Trace an Oracle Error

In order to trace an oracle error ORA-XXXX, first login database using a privileged account and enable trace:

alter system set events 'XXXX trace name errorstack level 1';

(XXXX is the oracle error number not beginning with zero. You may set trace level up to 3 for more detailed trace)

After trace enabled if ORA-XXXX occurs, you can find a trace file generated in trace (dump) directory.

In order to disable trace:

alter system set events 'XXXX trace name errorstack off';

Generated trace file is more like a memory dump then an error stack. So you may not find what you are looking for...easily...

공유하기 버튼

 

AMM in 11g release 1 Oracle

[resource:http://www.oracle-base.com/articles/11g/AutomaticMemoryManagement_11gR1.php]

Automatic Memory Management (AMM) in Oracle Database 11g Release 1

Oracle have made great strides in simplifying memory management over the last few versions of the database. Oracle 9i automated PGA management by introducingPGA_AGGREGATE_TARGET parameter. Oracle 10g continued this trend by automating SGA management using the SGA_TARGET parameter. Oracle 11g takes this one step further by allowing you to allocate one chunk of memory, which Oracle uses to dynamically manage both the SGA and PGA.

At the time of writing, Automatic Memory Management (AMM) is only supported on the major platforms (Linux, Solaris, Windows, HP-UX, AIX).

AMM Parameters

Automatic memory management is configured using two new initialization parameters:

  • MEMORY_TARGET: The amount of shared memory available for Oracle to use when dynamically controlling the SGA and PGA. This parameter is dynamic, so the total amount of memory available to Oracle can be increased or decreased, provided it does not exceed the MEMORY_MAX_TARGET limit. The default value is "0".
  • MEMORY_MAX_TARGET: This defines the maximum size the MEMORY_TARGET can be increased to without an instance restart. If the MEMORY_MAX_TARGET is not specified, it defaults to MEMORY_TARGETsetting.

When using automatic memory management, the SGA_TARGET and PGA_AGGREGATE_TARGET act as minimum size settings for their respective memory areas. To allow Oracle to take full control of the memory management, these parameters should be set to zero.

If you are using UNIX/Linux, before you consider using AMM you should check the current size of your shared memory file system. On Linux you do this by issuing the following command.

# df -k /dev/shmFilesystem           1K-blocks      Used Available Use% Mounted ontmpfs                  1029884    350916    678968  35% /dev/shm#

The shared memory file system should be big enough to accommodate the MEMORY_TARGET and MEMORY_MAX_TARGET values, or Oracle will throw the following error.

ORA-00845: MEMORY_TARGET not supported on this system

To adjust the shared memory file system size issue the following commands, specifying the required size of shared memory.

# umount tmpfs# mount -t tmpfs shmfs -o size=1200m /dev/shm

Make the setting permanent by amending the "tmpfs" setting of the "/etc/fstab" file to look like this.

tmpfs                   /dev/shm                tmpfs   size=1200m      0 0

AMM Configuration

The Database Configuration Assistant (DBCA) allows you to configure automatic memory management during database creation.

Automatic Memory Management

When creating the database manually, simply set the appropriate MEMORY_TARGET and MEMORY_MAX_TARGET initialization parameters before creating the database.

Enabling automatic memory management on a system that didn't previously use it is a simple task. Assuming you want to use a similar amount of memory to your current settings you will need to use the following calculation.

MEMORY_TARGET = SGA_TARGET + GREATEST(PGA_AGGREGATE_TARGET, "maximum PGA allocated")

The following queries show you how to display the relevant information and how to combine it in a single statement to calculate the required value.

-- Individual values.COLUMN name FORMAT A30COLUMN value FORMAT A10SELECT name, valueFROM   v$parameterWHERE  name IN ('pga_aggregate_target', 'sga_target')UNIONSELECT 'maximum PGA allocated' AS name, TO_CHAR(value) AS valueFROM   v$pgastatWHERE  name = 'maximum PGA allocated';-- Calculate MEMORY_TARGETSELECT sga.value + GREATEST(pga.value, max_pga.value) AS memory_targetFROM (SELECT TO_NUMBER(value) AS value FROM v$parameter WHERE name = 'sga_target') sga,     (SELECT TO_NUMBER(value) AS value FROM v$parameter WHERE name = 'pga_aggregate_target') pga,     (SELECT value FROM v$pgastat WHERE name = 'maximum PGA allocated') max_pga;

Assuming our required setting was 5G, we might issue the following statements.

CONN / AS SYSDBA-- Set the static parameter. Leave some room for possible future growth without restart.ALTER SYSTEM SET MEMORY_MAX_TARGET=6G SCOPE=SPFILE;-- Set the dynamic parameters. Assuming Oracle has full control.ALTER SYSTEM SET MEMORY_TARGET=5G SCOPE=SPFILE;ALTER SYSTEM SET PGA_AGGREGATE_TARGET=0 SCOPE=SPFILE;ALTER SYSTEM SET SGA_TARGET=0 SCOPE=SPFILE;-- Restart instance.SHUTDOWN IMMEDIATE;STARTUP;

Once the database is restarted the MEMORY_TARGET parameter can be amended as required without an instance restart.

ALTER SYSTEM SET MEMORY_TARGET=4G SCOPE=SPFILE;

AMM Tuning

In addition to the existing memory management V$ views, Oracle 11g includes four new V$ views to support automatic memory management:

The amount of memory allocated to each dynamic component is displayed using the V$MEMORY_DYNAMIC_COMPONENTS view.

COLUMN component FORMAT A30SELECT  component, current_size, min_size, max_sizeFROM    v$memory_dynamic_componentsWHERE   current_size != 0;COMPONENT                      CURRENT_SIZE   MIN_SIZE   MAX_SIZE------------------------------ ------------ ---------- ----------shared pool                       197132288  192937984  197132288large pool                          4194304    4194304    4194304java pool                          41943040   41943040   41943040SGA Target                        318767104  285212672  318767104DEFAULT buffer cache               71303168   41943040   75497472PGA Target                        104857600  104857600  1384120326 rows selected.SQL>

The V$MEMORY_CURRENT_RESIZE_OPS and V$MEMORY_RESIZE_OPS views provide information on current and previous component resize operations.

The V$MEMORY_TARGET_ADVICE view provides information to help tune the MEMORY_TARGET parameter. It displays a range of possible MEMORY_TARGET settings, as factors of the current setting, and estimates the potential DB Time to complete the current workload based on these memory sizes.

SELECT * FROM v$memory_target_advice ORDER BY memory_size;MEMORY_SIZE MEMORY_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR    VERSION----------- ------------------ ------------ ------------------- ----------        303                .75         3068              1.0038          2        404                  1         3056                   1          2        505               1.25         3056                   1          2        606                1.5         3056                   1          2        707               1.75         3056                   1          2        808                  2         3056                   1          26 rows selected.SQL>

Enterprise Manager includes the memory management configuration and advisor functionality in the "Memory Advisors" screen (Advisor Central > Memory Advisors).

Memory Advisors

Clicking the "Advice" button displays the "Memory Size Advice" screen, which contains a graphical representation of the information from the V$MEMORY_TARGET_ADVICE view.

Memory Size Advice

Considerations Before Using AMM

When you have large SGA sizes you can get considerable benefits from using HugePages. Automatic Memory Management and HugePages on Linux are not compatible, which means AMM is probably not a sensible option for any large systems. Instead, Automatic Shared Memory Management and Automatic PGA Management should be used as they are compatible with HugePages.

Even so, AMM is the default for all ASM instances and should be left that way. From a database perspective, it still may be relevant for smaller, less important databases.

For more information see:

Hope this helps. Regards Tim...

Back to the Top.

공유하기 버튼

 

1 2 3 4 5 6 7 8 9 10 다음