How to find the process that has a file open on unix?

Using the command it will show the processes that has the file open.

E.g:
$ fuser /u01/oradata/TEST/system01.dbf
/u01/oradata/TEST/system01.dbf: 2650128 2662644 2670618 2699278
$ ps -ef | egrep “2650128|2662644|2670618|2699278”
oracle 2650128 1 0 Jun 29 – 38:04 ora_mmon_TEST
oracle 2662644 1 0 Jun 29 – 64:44 ora_dbw0_TEST
oracle 2670618 1 0 Jun 29 – 16:36 ora_ckpt_TEST
oracle 2699278 1 0 Jun 29 – 15:02 ora_smon_TEST

One of the reason for using this would if one uses NFS to store datafiles you may find even though you drop the tablespace with the option to include datafiles it doesn’t free space as there may be oracle processes that still have handle open on the datafile as you will notice .nfs9999 file remaining in the directory where the datafile resides. So to free up space you may need to find the user sessions that have an handle open on the datafiles so by using fuser .nfs9999 you can find the process id and then map it back to the oracle session.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s