Operating System - OpenVMS
1832890 Members
2044 Online
110048 Solutions
New Discussion

Re: File Recovery and User Name

 
KiranSharma
Occasional Contributor

File Recovery and User Name

I am a beginer in open VMS.
I would like to know the command in open VMS to know the user who locked a file and also the command to restore a deleted file?
7 REPLIES 7
Ian Miller.
Honored Contributor

Re: File Recovery and User Name

who has a file locked?
See BLOCKING.EXE in
http://h71000.www7.hp.com/freeware/freeware60/rms_tools/

Undelete - can be difficult but the highly recommended DFU tool can sometimes do this.

http://www.digiater.nl/dfu.html
____________________
Purely Personal Opinion
KiranSharma
Occasional Contributor

Re: File Recovery and User Name

Some Body locked a file and i need to get the user who blocked.
Wim Van den Wyngaert
Honored Contributor

Re: File Recovery and User Name

On all nodes of the cluster (or on the node itself if not a cluster) :

$ show dev xxxx/files/out=x.lis
$ sea x.lis xxxx

where xxxx is the fully qualified name of the file.
You will see who has the file open (the PID).
With show prod /id=this_pid you will see what the process is.

Wim
Wim
Karl Rohwedder
Honored Contributor

Re: File Recovery and User Name

On the V8.0 freeware is a utility named FILES_INFO, which lists all processes that have a specific file open.

Here is the link:
http://h71000.www7.hp.com/freeware/freeware80/files_info/


regards Kalle
Jan van den Ende
Honored Contributor

Re: File Recovery and User Name

Kiran,

2 questions - 2 answers.

>>>
I would like to know the command in open VMS to know the user who locked a file
<<<

I usually use the help of PIPE
First, you need --some-- specification of the device that contains the file. If the file resides in a directory with a logical name, then that is fine; if you know the device, fine too.

$ pipe show device | search SYS$PIPE

Usually you gat a process ID (first on the line); then a
$ SHOW PROC/IDENT=
will show the process.
Sometimes you will get 8 zeroes.
That means the file is "opened by the system", which means it is a "known file", made so by use of the INSTALL utility..

>>>
also the command to restore a deleted file
<<<

If you mean "undelete"; then there is very little hope on multi-processing systems like VMS, because the space of the deleted file is made available to use by other processes, on a last-freed, first-used basis.

Of you really mean "restore", ie, get a file back from a backup tape:

$ BACKUP : /SELECT=
For convinience (but not for speed!!) the savesetname may be wildcarded to *.*

hope the helps,

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Hoff
Honored Contributor

Re: File Recovery and User Name

There are add-on tools which provide a Windows or Mac OS X UNDELETE -- a trashcan or recycle bin of some sort -- and these tools basically intercept the DCL command DELETE, and relocate the file aside. This isn't an entirely certain operation, as there are other ways to delete a file other than the DELETE command itself.

OpenVMS itself does not provide such a trashcan-like file-saving mechanism, and file deletion tends to be a fairly specific activity. DELETE deletes the file.

The analog technique commonly used within OpenVMS is the file version, where you have multiple copies of a file preserved. If you look at a typical directory, you will have some number of lower versions preserved, and you can go back through these and review or reload them as required. But if you use a wildcard version in your file DELETE, all versions are gone. PURGE gets rid of some or all the lower file versions, depending on the exact command.

On the level of a system manager, the usual approach involves regular disk BACKUP operations, and restoration of individual files or of a whole disk from the archives as required.

On a multi-user system, it can be fairly chancy to undelete a file, as the storage underneath the file and file header tends to be reused by other processes and system activities. There are tools around that try to do this and that can succeed, the difficulty here is in the block-level churn that can occur on a typical OpenVMS disk -- the undelete works best on a quiet system, or when you can take the disk offline immediately after the errant DELETE. When the disk blocks are reallocated and overwritten by something else, an undelete operation will not be able to recover that area of the original file.

It is also possible that the files involved can be set for erase-on-delete, and the file system will stomp on the blocks of any file marked as such, when the DELETE is issued. Barring off-line techniques targeting data remanence and media-level recovery, that data is gone.

Since you are asking about locked files, I'll point out another wrinkle: file locking means there is another application with that file open, either operating on the local node or from any node within the cluster. The application is active. File locks are automatically cleaned up when the application exits, or when the node crashes.

If you poke around inside various documentation, you will find a LOCKED keyword and an UNLOCK command. These are entirely and completely unrelated to file locks, and are an artifact of a far older file deaccess locking mechanism. There are no direct DCL commands for looking at the more modern file locks and at the distributed lock manager (DLM), though there are various mechanisms used to examine the lock-related structures. Take-home here is that the UNLOCK command or the f$file_attributes LOCKED argument are not associated with what most folks think of as a locked file. Those are related to deaccess locking, something which is seldom used on OpenVMS any more.

SHOW DEVICE/FILE is one approach, the SDA commands related to SHOW LOCK are another, there is the $getlki system service, and one of my all-time favorite techniques is with the DECamds (AMDS) locking display. DECamds and Availability Manager (AvailMan) are well worth installing (and preferably ahead of when you need them), and are licensed with current versions of OpenVMS Alpha, and with OpenVMS I64 EOE and MCOE configurations.

Stephen Hoffman
HoffmanLabs

Mobeen_1
Esteemed Contributor

Re: File Recovery and User Name

Kiran, i would suggest the following

$set def
$sh dev/file mm.txt
$ search mm.txt "filename"
$ show proc/id= (obtained from above step)

regards
Mobeen