There are many reasons why we might need to get the file version of a particular code within Oracle. The main reason being that Oracle requires the file version of certain files within the Oracle instance when we a service request (SR) is opened in Oracle Support/Metalink.
Normally we tend to go directly to the file system and pull up the file to get the file version. We use commands like adident or strings or grep. Alternatively we can get the file versions from a seeded database table.
Note: The seeded table will only contain versions for seeded Oracle files. You can add custom files/objects to the tables, ad_files, ad_file_versions by using the seeded API, AD_FILE_UTIL. The procedures to be used in the API are load_file_info and load_file_version_info.
Database query to get file versions
SELECT adf.app_short_name, fap.basepath, adf.subdir, adf.filename, adv.file_version_id, adv.VERSION, adv.creation_date FROM ad_files adf, ad_file_versions adv, fnd_application fap WHERE adf.file_id = adv.file_id and fap.application_short_name = adf.app_short_name AND adf.filename IN ('qpprg.ldt', 'ARHBRGVS.pls', 'qaevents.xml', 'ExpensesAttachmentService.class', 'ZXXEUSL.rdf', 'AKDAPREG.fmb') ORDER BY adf.filename, adv.creation_date DESC
Execute the query in the database
Comparison of the file versions between the database table and the file system
Now we can compare the file version with the file in the file system. Let us take the file, ARHBRGVS.pls. The data returned for this file is,
Column name | Value |
APP_SHORT_NAME | AR |
BASEPATH | AR_TOP |
SUBDIR | patch/115/sql |
FILENAME | ARHBRGVS.pls |
These values tell us where to find the file on the server. Log in to Unix. Go the directory for this file, i.e. BASEPATH/SUBDIR/FILENAME. In this case it will be $BASEPATH/SUBDIR/FILENAME and it will translate to $AR_TOP/patch/115/sql/ARHBRGVS.pls.
Execute the following commands
$ cd $AR_TOP/patch/115/sql/
$ pwd
Now let us see if the file named, ARHBRGVS.pls, exists in this directory
$ ls -ltr ARHBRGVS.pls
So the file exists in the expected directory. Now let us check for the file version
$ strings ARHBRGVS.pls | grep Header
We get the version from the file and it is 120.6.12010000.2.
If you compare this value with the value in the table you will find that the value matches. Therefore getting the file version from the table is the same as getting it from the actual file itself. If we take the file version from the table, it will be easier for us. Also, we might not always have access to the file system to query for the file.
Forms
Let us try the fmb file.
Looking at the data the file, AKDAPREG.fmb, should be in $AK_TOP/forms/US. Actually the compiled version of the fmb file will reside in $AK_TOP/forms/US and the uncompiled version will be in $AU_TOP/forms/US.
$ ls $AK_TOP/forms/US/AKDAPREG*
Let’s check the file in $AU_TOP/forms/US
The uncompiled version resides here. Let’s check the version
$ strings $AU_TOP/forms/US/AKDAPREG.fmb | grep Header | grep AKDAPREG.fmb
You can see the version in the file matches the version in the database.
Reports
Let us check a rdf file
Reports do not have a compiled version. Hence the rdf file should reside in $ZX_TOP/reports/D
$ adident Header $ZX_TOP/reports/D/ZXXEUSL.rdf
The version we get is the same as the table.
XML file
Let’s check the XML file
The file location will be $QA_TOP/patch/115/import/D. Let us check now
$ grep Header $QA_TOP/patch/115/import/D/qaevents.xml
The version in the file matches with the version in the table.
Cheers!