Rosales, 34, was batting .234 with four home runs and 27 RBIs in 71 games with Oakland this season. He started 36 of 38 games at shortstop from April 15 to May 28 following the injury to Marcus Semien but started just 19 of 56 games since then.
Rosales returned to Oakland as a free agent prior to the season and hit .226 with 19 homers and 82 RBIs in 268 games over five seasons with the A's. He is a .228 career hitter with 44 homers and 168 RBIs in 606 games in 10 seasons in the majors.
Mejia, 22, began the season at Class A Kane County of the Midwest League and was 1-1 with a 6.08 ERA in 18 relief appearances before being transferred to Hillsboro of the short-season Class Northwest League, where he made three relief appearances. He is 13-14 with a 4.67 ERA in 79 games (23 starts) in five seasons in the minors.