Excavate the soil from the top of the septic tank and the side of the tank that contains the sewer pipe inlet. Clear away all soil from around the cast iron pipe starting at the septic tank and extending the entire length of the damaged pipe section; this could simply be to the nearest pipe joint or may extend all the way to the house.
Pump the septic tank to remove all waste before removing the pipe. Hiring a professional septic cleaning service may be the best option because it has the equipment necessary to contain the waste material.
Cut through the cast iron pipe on the outer edges of the damaged section of pipe. Cut with a reciprocating saw with a carbide blade to achieve a clean cut. Leave approximately 1 foot of pipe stubbed out when cutting out the pipe at the septic tank or house foundation; this ensures sufficient space to install a coupling if you wish to replace the cast iron pipe.
Pound the deteriorated pipe with a hand sledgehammer to break it up and dislodge it from the septic tank. Alternatively, hold a scrap 2-by-4-inch board against the open end of the pipe and pound the board with the hammer to slowly back the pipe out of position; you may access the pipe from within the septic tank or from the exterior.