Australia have hung on to take the second Ashes test to a draw.