Thermus thermophilus bacteriophage P23-45 encodes a giant 5,002-residue tail tape measure protein (TMP) that defines the length of its extraordinarily long 800 nm tail. We found that the N-terminal portion of P23-45 TMP is an unusual RNA polymerase (RNAP) homologous to cellular and viral two-barrel RNAPs. The TMP-fused virion RNAP transcribes pre-early phage genes, including a gene that encodes another, non-virion RNAP, that transcribes early and some middle phage genes. We determined the crystal structures of both P23-45 RNAPs. The non-virion RNAP has a crab claw-like architecture similar to previously reported two-barrel RNAPs. The virion RNAP adopts a unique flat structure without a clamp, which likely reflects the requirement for its extrusion through the narrow channel in the phage tail for delivery into the cell. Structure and sequence comparisons of the P23-45 RNAPs with other phage and cellular RNAPs suggest that, despite the extensive functional differences, the two P23-45 RNAPs originate from an ancient gene duplication in an ancestral phage. Our findings demonstrate remarkable adaptability of two-barrel RNAPs that can be attained within a single virus species.