A conservative-backed plan to repeal the bulk of ObamaCare and give lawmakers a two-year window to replace the struggling health law failed on a Senate vote Wednesday, in the latest setback for the repeal push.

The vote was 55-45 against the amendment, with seven Republicans opposing. The chamber’s 46 Democrats and two independent senators all voted against the measure.

The so-called “straight repeal” amendment, offered by Kentucky GOP Sen. Rand Paul, would have given senators two years to come up with a replacement. The measure failed on the heels of another sweeping ObamaCare overhaul amendment stalling overnight.

The votes highlight the difficulty Republican senators are having trying to hammer out an actual replacement plan, even after advancing a core bill to debate in a dramatic vote on Tuesday.

The straight repeal was essentially identical to the one that the GOP-controlled Congress sent in 2015 to then-President Barack Obama, who immediately vetoed the bill.

Senate Republicans drafted their first repeal measure of this session several months ago. But Senate Majority Leader Mitch McConnell at first was unable to get enough support to even hold a vote.

However, McConnell on Tuesday managed to garner enough backing to open debate for this bill, with the expectation that lawmakers would be able to vote on a slew of amendments. The successful test vote was helped in no small part by the dramatic arrival of Sen. John McCain, who voted to start debate upon returning to Capitol Hill for the first time since being diagnosed last week with brain cancer.

The amendment process, though, has been rocky.

Senators on Tuesday night blocked a wide-ranging proposal by Republicans to repeal much of ObamaCare and replace it with a more restrictive plan.

In Wednesday's vote, Republican Sens. Susan Collins of Maine; Shelley Moore Capito of West Virginia; John McCain of Arizona; Rob Portman of Ohio; Lamar Alexander of Tennessee; Lisa Murkowski of Alaska and Dean Heller of Nevada voted in opposition.

With members divided, Republicans may now move to attempt to pass what’s being referred to as “skinny” repeal. That plan repeals just a few elements of ObamaCare, like the individual and employer mandate and the taxes on medical device makers.

During a rally in Ohio on Tuesday night, President Trump issued a warning to Republicans who were on the fence about repealing ObamaCare.

“Any senator who votes against repeal and replace is telling America that they are fine with the ObamaCare nightmare, and I predict they’ll have a lot of problems,” the president said.

Fox News' Chad Pergram contributed to this report.