These words often have the same meaning, but they are used differently.
All comes before the definite article: All the time
Whole comes after the definite article: The whole time
All comes before a possessive adjective: All my life
Whole comes after a possessive adjective: My whole life
Whole can only be used after a definite article: The whole country (not 'Whole country')
They have different meanings:
All exams were affected. = Every exam was affected.
Whole exams were affected. = This doesn't mean that every exam was affected, but that some were affected completely.
We generally use all. We can say 'the whole of the' before an uncountable noun.