Cut pancetta into 1/3-inch dice, then cook in a deep 12-inch heavy skillet over moderate heat, stirring, until fat begins to render, 1 to 2 minutes. Add onion and cook, stirring occasionally, until onion is golden, about 10 minutes. Add wine and boil until reduced by half, 1 to 2 minutes.
Cook spaghetti in a 6 to 8-quart pot of boiling salted water until al dente. While pasta is cooking, whisk together eggs, Parmigiano-Reggiano, Pecorino Romano (1/3 cup), 1 teaspoon coarsely ground black pepper, and 1/4 teaspoon salt in a small bowl.
Drain spaghetti in a colander and add to onion mixture, then toss with tongs over moderate heat until coated. Remove from heat and add egg mixture, tossing to combine. Serve immediately.
Consumption of raw or undercooked eggs, shellfish and meat may increase the risk of foodborne illness.