  X-ray vortices carrying tunable Orbital Angular Momentum (OAM) are an
emerging tool for X-ray characterization technology. However, in contrast to
the generation of vortex beams in the visible wavelength region, the generation
of X-ray vortices in a controlled manner has proved challenging. Here, we
overcome this challenge using an X-ray free-electron laser oscillator (XFELO),
which can produce intense coherent X-rays with switchable OAM. Using the
pinhole mirror in an XFELO, this scheme adjusts only the kinetic energy of the
electron beam to produce vortex beams that can be programmed to dynamically
change between different OAM modes without the need for additional optical
elements. With the nominal parameters of currently constructing 1 MHz
repetition rate facility (i.e. SHINE), the active formation of the OAM modes of
l = ${\pm}$1 and l = ${\pm}$2 and the rapid switching between them by detuning
the electron beam energy of the XFELO are numerically illustrated. The
real-time switching can be achieved within 200 ${\mu}$s, while the output pulse
energy can reach the 100 ${\mu}$J level.
