Operating System - HP-UX
1745866 Members
4518 Online
108723 Solutions
New Discussion юеВ

Re: Free space does not free after rm

 
SOLVED
Go to solution
Clifton Bonello
Occasional Contributor

Free space does not free after rm

I am running Oracle 10g on HP UX 11.23. I have an Itanium server.

I have a process which runs every 15 mins and this backs up the Oracle Archive redo logs and then removes them from the filesystem using rm command.

The problem is that altghough the files get deleted, the free space on the partition does not free up. This is happening because there is still some process that is using the files. The only way by which I could free up that space is by shutdown and restart of the Oracle database.

Unfortunately shutting down and restart of the database is not a good option for me.

Is there any other way how I can force to free the space after the rm command without actually killing the process using it (which in this case is an Oracle database)?
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: Free space does not free after rm

Shalom,

if process 8838 has an open file handle on the file /tmp/shmuelbagel.dat and that file contains 55 Mb, rm will not free the space until the process with the file handle is closed.

fuser -cu /tmp
Will show all open file handles and process id owners on the /tmp filesysem

fuer -cuk /tmp
will kill them all. If you are lucky you won't crash your box.

Use -cuk with care.

Better to identify and kill the processes one at a time.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Mel Burslan
Honored Contributor

Re: Free space does not free after rm

By deleting a file which is being held open by a process, you are not freeing the disk space. The archive logs for oracle should only have a limited size and when one reaches to that size, it needs to be closed and a new one should be created. Then you should be able to backup the closed file(s) and delete them after backing them up.

If your archive logs keep getting bigger to no end, it is not right and your dba should deal with the issue. Or if another process is holding them open for whatever reason other than what they are intended to be used for, they need to stop doing that. Otherwise you will never see that freed up space and the file you deleted will actually be corrupt, if you take the backup while it was open.
________________________________
UNIX because I majored in cryptology...
smatador
Honored Contributor

Re: Free space does not free after rm

Hi,
I think if you do an lsof of the fs, you could get the process and when you identify them, you could perhaps kill them. Some oracle process can be kill without problem, but for other oracle process, you should shutdown the database.
let identify them first.
Hope it helps
Solution

Re: Free space does not free after rm

Clifton,

Whilst all the advice so far provided is reasonably accurate, I would add that Oracle *only* keeps archive log files opening whislt it is writing to them, so there should never be more than one archive log file open at any one time. SO if you are seeing this problem for more than one file per iteration of your process, then there is some other sort of problem...

Your script (I'm assuming its a script now), should always leave the latest archive log file in place and only delete the rest, and for belt and braces you should run fuser on the file before doing a backup or rm to confirm the file is not open (backing up an archive log whilst Oracle has it open will result in a corrupt backup that your DBA can't restore from.

Maybe you could share your script with us - might make it easier to pin down the problem.

As an alternative you should talk to your DBA about using RMAN to handle this process - it knows which logs to backup and which to leave, and it can delete the files also - it also makes it easier for DBAs to track where archive logs have gone.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Clifton Bonello
Occasional Contributor

Re: Free space does not free after rm

Hi,

Thanks to everyone for your replies. Duncan, your point is very valid for me because I am deleting all the files without actually taking care if any file is yet open.

I will be enhancing my script to delete all the files except the last one. I will see if this solves my problem.

Thanks again

Re: Free space does not free after rm

Clifton,

Remember to compile your list of files to be deleted *when the script is first called*, rather than after the backup has run - this is cos if the backup runs for long enough a few more archive logs could get created whilst you are running it - if they're not in the backup, you shouldn't delete them.

HTH

Duncan

I am an HPE Employee
Accept or Kudo