practice6-Database Configuration and I/O Issues
ÀÛ¼ºÀÚ °ü¸®ÀÚ ÀÛ¼º½Ã°£ 2003-08-13 10:16:33
 

1. system/manager·Î login ÇÑ ÈÄ Database ¿¡ ´ëÇÑ ¹°¸®Àû ±¸Á¶¸¦ È®ÀÎÇÑ´Ù.

$ sqlplus system/manager

SQL> select name from v$datafile
union
select member from v$logfile
union
select name from v$controlfile
union
select value from v$parameter
where (name like 'log_archive_dest%'
and name not like 'log_archive_dest_state%')
or name in ('log_archive_dest','log_archive_duplext_dest') ;

NAME
----------------------------------------------------------------------
----------
/home/human/LABS/users01.dbf
/home/human/oradata/HUMAN/control01.ctl
/home/human/oradata/HUMAN/control02.ctl
/home/human/oradata/HUMAN/control03.ctl
/home/human/oradata/HUMAN/cwmlite01.dbf
/home/human/oradata/HUMAN/drsys01.dbf
/home/human/oradata/HUMAN/example01.dbf
/home/human/oradata/HUMAN/indx01.dbf
/home/human/oradata/HUMAN/isaya01.dbf
/home/human/oradata/HUMAN/log02b.rdo
/home/human/oradata/HUMAN/odm01.dbf

NAME
----------------------------------------------------------------------
----------
/home/human/oradata/HUMAN/query01.dbf
/home/human/oradata/HUMAN/redo01.log
/home/human/oradata/HUMAN/redo01b.rdo
/home/human/oradata/HUMAN/redo02.log
/home/human/oradata/HUMAN/sh_tbs01.dbf
/home/human/oradata/HUMAN/system01.dbf
/home/human/oradata/HUMAN/tools01.dbf
/home/human/oradata/HUMAN/undotbs01.dbf
/home/human/oradata/HUMAN/xdb01.dbf
/home/human/oradata/nanune01.dbf
location=/home/human/arch/log

2. database ÀÇ ¹°¸®Àû file¿¡ ´ëÇÑ I/O ¸¦ È®ÀÎÇÑ´Ù.

SQL> col name format a38
SQL> select phyrds,phywrts,d.name
  2  from v$datafile d,v$filestat f
  3  where d.file# = f.file#;

    PHYRDS    PHYWRTS NAME
---------- ---------- --------------------------------------
      3570        265 /home/human/oradata/HUMAN/system01.dbf
        49      1169 /home/human/oradata/HUMAN/undotbs01.db
                      f

        3          1 /home/human/oradata/HUMAN/cwmlite01.db
                      f

        3          1 /home/human/oradata/HUMAN/drsys01.dbf
        3          1 /home/human/oradata/HUMAN/example01.db
                      f


    PHYRDS    PHYWRTS NAME
---------- ---------- --------------------------------------
        3          1 /home/human/oradata/HUMAN/indx01.dbf
        3          1 /home/human/oradata/HUMAN/odm01.dbf
      601        353 /home/human/oradata/HUMAN/tools01.dbf
        17        10 /home/human/LABS/users01.dbf
        3          1 /home/human/oradata/HUMAN/xdb01.dbf
        3          1 /home/human/oradata/nanune01.dbf
        3          1 /home/human/oradata/HUMAN/isaya01.dbf
        3          1 /home/human/oradata/HUMAN/query01.dbf
      2214        452 /home/human/oradata/HUMAN/sh_tbs01.dbf

3. V$SYSTEM_EVENT performance view ¸¦ queryÇÏ¿© Redo log file ¿¡ ´ëÇÑ Wait°¡ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù.

SQL> col event format a30
SQL>
SQL> select event,total_waits,time_waited, average_wait
  2  from v$system_event
  3  where event='log file sync'
  4  or event = 'log file parallel write';

EVENT                          TOTAL_WAITS TIME_WAITED AVERAGE_WAIT
------------------------------ ----------- ----------- ------------
log file parallel write              7619          7            0
log file sync                          42          71            2

log file sync¿¡ ´ëÇÑ wait event´Â online redo log ³ª unbatched commit À» ÀúÀåÇÏ°í Àִ  diskÀÇ I/O¼Óµµ°¡ slowÀÓÀ» ÀǹÌÇÑ´Ù.
log file parallel write´Â º°·Î À¯¿ëÇÏÁö ¾Ê´Ù.

SQL> exit

4. perfstat/perfstat·Î loginÇÏ¿© STATSPACK¸¦ »ç¿ëÇØ º¸ÀÚ

$ sqlplus /nolog

SQL> @LABS/ptw9i/snap.sql

SQL> exit

$ sqlplus hr/hr

SQL> !cat $HOME/LABS/ptw9i/lab04_10.sql
variable n number;
begin
for i in 1..40
loop
select count(*) into :n from hr.temp_emps;
end loop;
end;
/

SQL> @LABS/ptw9i/lab04_10.sql

SQL> exit

$ sqlplus /nolog

SQL> @LABS/ptw9i/snap.sql

SQL> @LABS/ptw9i/spreport.sql
Enter value for begin_snap: 16
Enter value for end_snap: 17

SQL> exit

$ vi sp_16_17.lst
^LTablespace IO Stats for DB: HUMAN  Instance: HUMAN  Snaps: 16 -17
->ordered by IOs (Reads + Writes) desc

Tablespace
------------------------------
                Av      Av    Av                    Av        Buffer Av Buf
        Reads Reads/s Rd(ms) Blks/Rd      Writes Writes/s      Waits Wt(ms)
-------------- ------- ------ ------- ------------ -------- ---------- ------
TOOLS
          167      1    4.3    1.0          15        0          0    0.0
SYSTEM
            11      0    0.0    2.5            3        0          0    0.0
UNDOTBS1
            4      0    0.0    1.0            6        0          0    0.0
          -------------------------------------------------------------

Production DBÀÇ °æ¿ì Disk¸¦ ÁÖÀÇ ±í°Ô monitorÇؼ­ ¸ðµç device°£¿¡ workload°¡ ºÐ»ê µÉ ¼ö ÀÖµµ·Ï ÇØ¾ß ÇÑ´Ù.
¸¸ÀÏ Æ¯Á¤ datafile¿¡ ´ëÇؼ­´Â ´Ù¸¥ °Íµé°ú ±¸º°µÇ¾î I/O°¡ µÎµå·¯Áö°Ô ³ªÅ¸³­´Ù¸é I/OÀÇ ¾çÀ» ÁÙÀÏ ¼ö ÀÖ´Â ¹æ¹ýÀ» ã¾Æ¾ß ÇÑ´Ù.
¿¹¸¦ µé¾î Full table scansÀÇ È½¼ö°¡ ¸¹´Ù¸é Index »ç¿ëÀ» °í·ÁÇØ º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù.
¸¸ÀÏ ÀÌÈÄ¿¡µµ ¿©ÀüÈ÷ ¹®Á¦°¡ ¹ß»ýµÇ°í ÀÖ´Ù¸é, ÀÌ¿ëµµ°¡ ³·Àº device¿¡ ±× datafileÀ» À̵¿ ½ÃÅ°´Â °Íµµ °í·ÁÇØ º¼ ¼ö ÀÖ´Ù.

5. system/manager·Î loginÇÏ¿© LOG_CHECKPOINT_TO_ALERT = TRUE ·Î ¼³Á¤ÇÏ¿© Checkpoint ¿¡ ´ëÇÑ Á¤º¸¸¦ alert log¿¡ ³²±â°í È®ÀÎ

$ sqlplus system/manager

SQL> alter system set log_checkpoints_to_alert = true;

SQL> exit

- sh/sh ·Î login ÇÏ¿© database¿¡ ´ëÇÑ workload¸¦ À¯¹ßÇÑ´Ù.

$ sqlplus /nolog

SQL> !cat $HOME/LABS/ptw9i/lab06_06.sql
connect system/manager
alter system set log_checkpoint_timeout = 30;
connect sh/sh
update sales
set amount_sold = amount_sold * 1.5
where cust_id > 150000;
rollback;
connect system/manager
alter system set log_checkpoint_timeout = 300000;
connect sh/sh

SQL> @LABS/ptw9i/lab06_06.sql

SQL> exit

Wed Aug 13 10:06:14 2003
Beginning log switch checkpoint up to RBA [0x4.2.10], SCN: 0x0000.001e5429
Thread 1 advanced to log sequence 4
  Current log# 1 seq# 4 mem# 0: /home/human/oradata/HUMAN/redo01.log
  Current log# 1 seq# 4 mem# 1: /home/human/oradata/HUMAN/redo01b.rdo
Wed Aug 13 10:06:14 2003
ARC0: Evaluating archive  log 2 thread 1 sequence 3
ARC0: Beginning to archive log 2 thread 1 sequence 3
Creating archive destination LOG_ARCHIVE_DEST_1: '/home/human/arch/log/3.ARC'
Wed Aug 13 10:06:16 2003
Completed checkpoint up to RBA [0x4.2.10], SCN: 0x0000.001e5429
Wed Aug 13 10:06:24 2003
ARC0: Completed archiving  log 2 thread 1 sequence 3
Wed Aug 13 10:06:32 2003
ALTER SYSTEM SET log_checkpoint_timeout=300000 SCOPE=MEMORY;

À§ µÎ ½Ã°£ Â÷°¡ checkpoint intervalÀÌ´Ù.


¸ñ·Ï | ÀÔ·Â | ¼öÁ¤ | ´äº¯ | »èÁ¦