To disable OSPFv2 on a device, use the no router ospf command:
device# configure terminal
device(config)# no router ospf
The following example disables OSPFv2 on a device.
device# configure terminal device(config)# no router ospf