He heard the Prophet ﷺ address Umar one time as he was saying, "By my father, by my father." The Prophet ﷺ said, "Allah forbids you from swearing by your fathers."Umar said, "By Allah, I never swore by them after that, neither speaking on my own nor quoting another."
أخبرنا عبيد الله بن سعيد وقتيبة بن سعيد واللفظ له قالا حدثنا سفيان عن الزهري
أنه سمع النبي ﷺ عمر مرة وهو يقول وأبي وأبي فقال إن الله ينهاكم أن تحلفوا بآبائكم فوالله ما حلفت بها بعد ذاكرا ولا آثرا
Bukhari recorded it in the Book of Oaths and Vows, chapter "Do not swear by your fathers," hadith no. 6647, as a suspended narration (mualaqan), and Muslim recorded it in the Book of Oaths, chapter on the prohibition of swearing by other than Allah, hadith no. 1646, from the hadith of Sufyan bin Uyayna with this same chain. It is also found in Kubra, hadith no. 4707.