Oracle Corp. plans to acquire Sun Microsystems Inc. for $7.4 billion, picking up what might prove to be a software treasure trove that includes the popular MySQL open-source database as well as Java.