By appointing Léo Apotheker as its new chief executive and adding former Oracle president Ray Lane to its board, Hewlett-Packard is taking aim at Oracle as its No. 1 threat.

Oracle recently hired Mark Hurd, who resigned under pressure from HP because of an ethics scandal. Larry Ellison, chief executive of Oracle, not only defended Hurd’s reputation but brought him aboard as co-president. Oracle has been focused on enterprise software in the past, but it bought server maker Sun Microsystems and entered the hardware business.

HP, meanwhile, has shifted more of its focus into the high-margin software business. By hiring Apotheker, the former CEO of software giant SAP, you can expect that software will be an even bigger part of HP’s business. And by adding Lane, who is currently managing partner at Kleiner Perkins Caufield & Byers and who worked previously under Ellison as president, HP will have the expertise to target Oracle better. Lane will also serve as non-executive chairman.

This is what it looks like on the surface, at least. HP and Oracle will compete head to head in software and hardware, but HP also has to square off against Dell and Lenovo in computers and against IBM in servers and services. HP also has to worry about Apple. Oracle and HP are also close partners. It reminds me of the snake with two heads that is trying to bite itself.

It’s too bad that HP’s top insiders — Ann Livermore, Vyomesh Joshi and Todd Bradley — won’t get a shot at running at HP. I felt that after two CEOs hired from outside HP, the company was ready for someone who understood it better. Such a choice would have been popular among HP’s 300,000 employees. (Our own poll showed that 84 percent of readers thought HP should hire an insider as CEO). But Apotheker is a veteran of the big company environment. Looking at this from above, it looks like the person who made the biggest impact on the HP board’s decision in hiring Apotheker was Oracle’s Larry Ellison, whose hiring of Hurd pushed HP to play defense.