My datafile was corrupted last week and I am trying to recover the db. Also, the last backup was a few years back. What can I do?
A backup a few years old is probably indicative of the need to revisit your backup and recovery strategy.
How was the backup taken? If the backup was a cold backup, then you can shutdown the database, restore all of the datafiles from the cold backup, and start it up. If you want to roll forward to a more current point in time, you will need all of the archived redo logs generated since that backup was taken. If you do not want to roll forward, or you cannot roll forward, then also replace the online redo logs and the control files from the backup before you attempt to start the database. In this case, the changes since the backup will be lost.
If the backup was a hot backup, then you'll need the archived redo logs that go with it. This way, you can resolve any inconsistencies in the datafiles while that backup was being performed. Replace the database datafiles, and restore the archived redo logs. Then STARTUP MOUNT the database and issue RECOVER DATABASE UNTIL CANCEL. Once you have applied the last archived redo log that you have, issue ALTER DATABASE OPEN RESETLOGS.