查看Oracle数据文件和磁盘i/o情况

--查询当前用户使用了多少还原表空间

select d.username,c.name,b.writes

from v$transaction a,v$rollstat b,v$rollname c,v$session d

where d.taddr=a.addr

and a.xidusn=b.usn

and b.usn=c.usn

order by d.username;

对于DML事务繁忙的数据库,还原表空间数据文件应存放到单独的i/o位置;

---查看表空间的使用情况

SQL> col tablespace for a10

SQL> select ts.name tablespace,fs.phyrds "reads",fs.phywrts "writes",fs.phyblkrd ,fs.phyblkwrt,

2    fs.readtim "rtime",fs.writetim "wtime"

3   from v$tablespace  ts,v$datafile df,v$filestat fs

4  where ts.ts#=df.ts#

5    and df.file#=fs.file#;

TABLESPACE      reads     writes   PHYBLKRD  PHYBLKWRT      rtime      wtime

---------- ---------- ---------- ---------- ---------- ---------- ----------

USERS              19         15         19         15         11          0

UNDOTBS1        15844      20703      15844      46695      16266      10397

SYSAUX          60815      86883     167445     104202      52467      59148

SYSTEM          15948       5314      23326       7379      13508       5985

UNDOTBS2           19         15         19         15         15          0

TBS_USER_DATA       2056         15       2056         15       4477          0

6 rows selected.

SQL>

----查看临时表空间的使用情况

SQL> col name for a10

SQL> select ts.name,ts.phyrds "reads",ts.phywrts "writes",ts.phyblkrd,ts.phyblkwrt,ts.readtim "rtime",ts.writetim "wtime"

2   from v$tablespace ts,v$tempfile tf ,v$tempstat ts

3  where ts.ts#=tf.ts#

4    and tf.file#=ts.file#;

NAME            reads     writes   PHYBLKRD  PHYBLKWRT      rtime      wtime

---------- ---------- ---------- ---------- ---------- ---------- ----------

TEMP              121        173       3177       3177        439          4

SQL>

---查看数据文件的i/o分布情况

SQL> col name for a30

SQL> select name,phyrds,phywrts,readtim,writetim

2    from v$filestat a,v$datafile b

3   where a.file#=b.file#

4   order by readtim desc;

NAME                               PHYRDS    PHYWRTS    READTIM   WRITETIM

------------------------------ ---------- ---------- ---------- ----------

+DATA1/solgle_db/datafile/sysaux.      60507      84287      52025      58244

257.855682813

+DATA1/solgle_db/datafile/undotbs      15476      20070      15870      10139

1.258.855682813

+DATA1/solgle_db/datafile/system.      15948       5230      13508       5956

256.855682813

+DATA1/solgle_db/datafile/undotbs         19         15         15          0

2.264.855683309

+DATA1/solgle_db/datafile/users.2         19         15         11          0

59.855682813

5 rows selected.

SQL>

---查看当前磁盘i/o情况

[oracle@www.solgle.com bin]$ iostat 10 2

Linux 3.8.13-16.2.1.el6uek.x86_64 (www.solgle.com)        10/21/14        _x86_64_        (1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

10.99    0.00    4.21    3.91    0.00   80.89

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn

fd0               0.00         0.00         0.00         32          0

scd0              0.00         0.00         0.00        388          0

sda               8.73        19.48       256.87   19595146  258412610

dm-0             11.87        15.63       251.36   15720540  252874408

dm-1              1.17         3.84         5.51    3867737    5538184

sdb               5.85        62.59        21.05   62969895   21178848

sde               0.47         1.75        20.06    1765502   20181991

sdc               0.74        50.58        13.48   50883954   13557611

sdd               3.82       192.21        33.26  193372657   33459598

avg-cpu:  %user   %nice %system %iowait  %steal   %idle

29.34    0.00    5.05    0.99    0.00   64.62

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn

fd0               0.00         0.00         0.00          0          0

scd0              0.00         0.00         0.00          0          0

sda               9.78        14.07       768.35        128       6992

dm-0             15.71        14.07       768.35        128       6992

dm-1              0.00         0.00         0.00          0          0

sdb               5.71        47.91        21.32        436        194

sde               0.44         0.00         2.75          0         25

sdc               0.00         0.00         0.00          0          0

sdd               1.98        59.78         0.11        544          1

[oracle@www.solgle.com bin]$

点击阅读全文
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐