This raises a few separate issues, not the least of which is – who owns the property on either side of the retaining wall and fence.
Below is an article that may prove useful
http://www.lawaccess.nsw.gov.au/Pages/representing/lawassist_fences/retaining_walls/home.aspx