The exemption is claimed by designating the property on your tax return for the sale year, and the Canada Revenue Agency can request records showing it was actually your home rather than a rental for the years being claimed.
If any stretch of ownership was a rental or a home office deduction changed its use, that period may not qualify for the full exemption, and working out the split is exactly the kind of math a lawyer or accountant handles alongside the usual $800 to $1,500 closing file.
Long ownership tends to mean a bigger number is at stake, which makes confirming the exemption calculation worth the extra step rather than assuming it applies automatically. Get your hand-reviewed valuation from Joel Dyck.