Wednesday, May 24, 2006

Commands To Monitor NFS

Commands for monitoring NFS performance.

$ netstat -s -p tcp

$ nfsstat -c

$ nfsstat -m
/u001 from nas002:/client9_u001 (Addr 10.1.22.201)
Flags: vers=3,proto=tcp,auth=unix,hard,intr,link,symlink,devs,rsize=32768,wsize=32768,retrans=5
All: srtt= 0 ( 0ms), dev= 0 ( 0ms), cur= 0 ( 0ms)

/apps from nas002:/client9_apps (Addr 10.1.22.201)
Flags: vers=3,proto=tcp,auth=unix,hard,intr,link,symlink,devs,rsize=32768,wsize=32768,retrans=5
All: srtt= 0 ( 0ms), dev= 0 ( 0ms), cur= 0 ( 0ms)

$ rpcinfo
program version netid address service owner
100000 4 ticots client9.rpc rpcbind superuser
100000 3 ticots client9.rpc rpcbind superuser
100000 4 ticotsord client9.rpc rpcbind superuser
100000 3 ticotsord client9.rpc rpcbind superuser
100000 4 ticlts client9.rpc rpcbind superuser
100000 3 ticlts client9.rpc rpcbind superuser
100000 4 tcp 0.0.0.0.0.111 rpcbind superuser
100000 3 tcp 0.0.0.0.0.111 rpcbind superuser
100000 2 tcp 0.0.0.0.0.111 rpcbind superuser
100000 4 udp 0.0.0.0.0.111 rpcbind superuser
100000 3 udp 0.0.0.0.0.111 rpcbind superuser
100000 2 udp 0.0.0.0.0.111 rpcbind superuser
100024 1 tcp 0.0.0.0.192.0 status superuser
100024 1 udp 0.0.0.0.192.1 status superuser
100021 1 tcp 0.0.0.0.192.1 nlockmgr superuser
100021 1 udp 0.0.0.0.192.2 nlockmgr superuser
100021 3 tcp 0.0.0.0.192.2 nlockmgr superuser
100021 3 udp 0.0.0.0.192.3 nlockmgr superuser
100021 4 tcp 0.0.0.0.192.3 nlockmgr superuser
100021 4 udp 0.0.0.0.192.4 nlockmgr superuser
100020 1 udp 0.0.0.0.15.205 llockmgr superuser
100020 1 tcp 0.0.0.0.15.205 llockmgr superuser
100021 2 tcp 0.0.0.0.192.4 nlockmgr superuser
805306352 1 tcp 0.0.0.0.2.151 - superuser



Not NFS specific:
$ netstat -i
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
lo0 4136 loopback localhost 74916346 0 74916352 0 0
lan902 1500 10.1.22.0 client9nas 625727357 0 628752686 0 0
lan901 1500 10.1.18.0 client9afe 835324548 0 538488630 0 0
lan900 1500 10.1.20.0 client9adm 12442786 0 17658172 0 0

Sunday, May 21, 2006

Extract Index DDL

When restoring tables with export/import, it is common to disable any constraints, drop any non-primary key index, and disable any trigger. After the import simply enable constraints, enable triggers, and rebuild any index.

A quick way to get the index DDL is by using the export dump file. Run the dump file through import with the "indexfile" option.
imp file=export.dmp indexfile=index.sql fromuser=theSchemaOwner

File "index.sql" will be created. The tables will be in the file and commented out.

I learned this from Tom's web site.

Tuesday, May 16, 2006

Quickly Generate Oracle Object Grants

This quickly generates an Oracle SQL script that can be called to grant privileges to a user or role. Extend for other object types.

select 'grant execute on ' || object_name || ' to &&userOrRole;' || ' -- ' || object_type
from dba_objects where owner='&&OWNER' and object_type in ('PACKAGE', 'PROCEDURE')
union all
select 'grant select, insert, update, delete on ' || object_name || ' to &&userOrRole;' || ' -- ' ||
object_type
from dba_objects where owner='&&OWNER' and object_type in ('TABLE', 'VIEW')
/