After Operation Barbarossa began, Oleynikov became chief of staff of the 27th Reserve Brigade, which joined the 2nd Red Banner Army of the Far Eastern Front at Svobodny, in late July 1941. In November, he was appointed chief of staff of the 116th Rifle Division of the Transbaikal Front, forming in Chita Oblast at Antipikha and Peschanka. In early February 1942 the division was railed to Kaluga, where it joined the 50th Army of the Western Front and fought in the Rzhev–Vyazma Offensive. From April to July 1942 it was in the army reserve in the area of Mosalsk, then fought in heavy offensive battles for the capture of Shakhovo and Pavlovo. In August 1942 division was relocated to the Stalingrad sector and fought in the Battle of Stalingrad, participating in continuous offensive battles as part of the 1st Guards and then the 24th and 66th Armies of the Stalingrad and Don Fronts. Then-Colonel Oleynikov became deputy division commander on 9 December and was appointed chief of the operations department of the staff of the 66th Army on 28 December. In January 1943 its troops fought in the liquidation of the Stalingrad pocket. After the end of the battle the army joined the group of forces under the command of Lieutenant General Kuzma Trubnikov then was withdrawn to the Reserve of the Supreme High Command (RVGK) in the Steppe Military District. The army was redesignated as the 5th Guards Army on 5 May, and during the month Oleynikov was appointed deputy chief of staff of the army for auxiliary command posts. With the army, he fought on the Voronezh and Steppe (from 20 October the 2nd Ukrainian) Fronts in the Battle of Kursk, the offensive battles at Oboyan and Prokhorovka, the capture of Left-bank Ukraine and the Battle of the Dnieper.