- 论坛徽章:
- 0
|
这里有另外一个需求,我们有一个脚本TBS_usage.sh,这个脚本接受两个参数,第一个是db实例名,第二个是表空间名
这脚本用于获得指定的表空间有那些文件系统,然后显示文件系统的利用率. 但这里文件系统利用率是显示所有的(太多了,不方便看),我只要显示列出表空间的文件系统利用率
nuh302:UPP1:/ora/admin#./TBS_usage.sh UPP1 SYSTEM USERS
TABLESPACE_NAME FILE_NAME AUT USERMB MAXMB
-------------------- ------------------------------------------------------------ --- ---------- ----------
SYSTEM /ora/data/da010/UPP1system_01.dbf NO 1749.875 0
USERS /ora/data/da009/UPP1users_01.dbf NO 4095.5 0
/ora/data/da009/UPP1users_03.dbf NO 799.5 0
/ora/data/da010/UPP1users_02.dbf NO 4095.5 0
/ora/data/da011/UPP1users_05.dbf NO 499.5 0
/ora/data/da011/UPP1users_06.dbf NO 511.5 0
/ora/data/da013/UPP1users_07.dbf NO 499.5 0
/ora/data/da014/UPP1users_04.dbf NO 999.5 0
Mounted on kbytes used aloc avail %used
/ 1048576 237032 0 805848 22%
/stand 298928 149088 0 119944 49%
/var 6291456 3903728 0 2370952 62%
/var/opt/controlm 114688 59321 0 51910 51%
/usr 5242880 3783024 0 1448472 72%
/tmp 720896 147440 0 569656 20%
/ora/product/v920 4620288 2915295 0 1598635 63%
/ora/product/emagent10g 3178496 1534120 0 1542388 48%
/ora/data/rd002 70680576 34820920 0 35579568 49%
/ora/data/rd001 70680576 34830552 0 35570008 49%
/ora/data/da016 268435456 57128 0 266281632 0%
/ora/data/da015 268435456 52486016 0 214262344 19%
/ora/data/da014 268435456 226156016 0 41949184 84%
/ora/data/da013 268435456 232441384 0 35712928 86%
/ora/data/da012 268435456 229167568 0 38961168 85%
/ora/data/da011 268435456 226971592 10240000 30899984 88%
/ora/data/da010 335544320 285855384 0 49300800 85%
/ora/data/da009 335544320 283611568 0 51527088 84%
/ora/data/da008 335544320 281123224 0 53995992 83%
/ora/data/da007 335544320 285530384 0 49623264 85%
/ora/data/da006 335544320 281022488 0 54095944 83%
/ora/data/da005 335544320 285664672 0 49490008 85%
/ora/data/da004 335544320 294769856 0 40455976 87%
/ora/data/da003 335544320 284604184 0 50542224 84%
/ora/data/da002 335544320 291890168 0 43313168 86%
/ora/data/da001 335544320 276670952 0 58413480 82%
/ora/archive 883490816 75110984 0 802076320 8%
/ora/admin 622592 443360 0 171109 71%
/opt 5242880 3426344 0 1803056 65%
/opt/controlm2.2.4 2162688 1445051 0 676184 66%
/mnt 64569344 2727384 0 61358880 4%
/home 1032192 806240 0 224408 78%
/apps1 16384 1110 0 14326 6%
/apps 1024000000 811823928 0 210634000 79%
/apps/stats 6701056 5242721 0 1367277 78%
/apps/archdata 75776000 23105600 0 52258928 30%
/apps/sharpedge/prod/arc2tape 189278096 0 0 189278096 0%
/oradata/sharpedge/arch 184875600 23894152 0 160981448 12%
/oradata/sharpedge/undo 177957640 51400368 0 126557272 28%
/oradata/sharpedge/temp 161351936 34794664 0 126557272 21%
/oradata/sharpedge/redo2 11545704 2056096 0 9489608 17%
/oradata/sharpedge/redo1 11569872 2080264 0 9489608 17%
/oradata/sharpedge/index 918522344 669400600 0 249121744 72%
/oradata/sharpedge/spfile 1565939432 495021112 0 1070918320 31%
/oradata/sharpedge/data 2147483647 1589076536 0 1070918320 73%
在这里需要把写一些代码把表空单里的文件系统变成 '1p;\#/ora/data/da009/#p;\#/ora/data/da010/#p;\#/ora/data/da011/#p;\#/ora/data/da013/#p;\#/ora/data/da014/#p
然后 sed -n '1p;\#/ora/data/da009/#p;\#/ora/data/da010/#p;\#/ora/data/da011/#p;\#/ora/data/da013/#p;\#/ora/data/da014/#p'
这个代码如何写啊? |
|