Question: The user needs to know when was the last time spfile was created or modified on a Linux server. How this can be found out?
Use the below approach to get the creation time of spfile.
1. Find the inode of the file using the ‘ls -i‘ command:
$ ls -i spfile[SID].ora 3950836 spfile[SID].ora
Here 3950836 is the inode number of the spfile.
2. Find the root/parent filesystem that our file resides in.
$ cd $ORACLE_HOME/dbs $ df -h . Filesystem Size Used Avail Use% Mounted on /dev/mapper 96G 86G 4.9G 95% /
3. Use the debugfs command to find the creation time of the file. Run the command using root user or sudo if the oracle user has the privileges.
# debugfs -R 'stat [inode]' [FIlesystem from above]
For Example :
# debugfs -R 'stat <3950836>' /dev/mapper
debugfs 1.43-WIP (20-Jun-2013)
Inode: 3950836 Type: regular Mode: 0640 Flags: 0x80000
Generation: 679845444 Version: 0x00000000:00000001
User: 8000 Group: 8000 Size: 3584
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x5c5cd3c4:1bf05f78 -- Fri Feb 8 00:56:36 2019
atime: 0x5c5e00b1:e1953d14 -- Fri Feb 8 22:20:33 2019
mtime: 0x5c5cd3c4:1bf05f78 -- Fri Feb 8 00:56:36 2019
crtime: 0x5c5cb6f3:895fa1d0 -- Thu Feb 7 22:53:39 2019
Size of extra inode fields: 28
EXTENTS:
(0):10470261
As shown in the output above the creation time of the spfile is “Thu Feb 7 22:53:39 2019”. Similarly, you can get the modification time of the spfile from the “mtime” line just above it.