Technical here…there are a million ways to accomplish what you want, but if you are just looking to get a good working copy of your live environment for testing purposes with the least amount of steps, then I’d just replace your TEST environment with a LIVE copy.
FIRST, it sounds like Test/Live have become out of sync, this is bad practice, but easily fixed with this method. You should never have fields added directly into live without first putting them into test and actually testing them. There are probably no real issues with your current environment, but it should be fixed because your table/field IDs could become out of sync and cause many other issues. You should fix your DEV too.
SECOND, to restore the copy of PROD:
Stop your TEST aos, restore a copy of your LIVE database over your TEST database. Verify the permissions for the AOS user are correct after the restore in SQL. If you have a user called AXProd and one called AXTest…make sure AXTest is the owner of the DB and remove AXProd from the restored DB or else your AOS will not start. If the AOS does not start, check the windows event log for details.
Then just copy your entire LIVE application directory over to the TEST application directory and just replace/delete the TEST one. The directory is typically C:\Program Files\Microsoft Dynamics AX\50\Application\Appl[InstanceName] and make sure the folder name is the same. You should technically do this with the LIVE aos stopped, but it should be ok. Application files are flushed at midnight or something.
You should be able to just start the AOS now. You will need to tweak/reconfigure somethings though. Admin>Setup>Server Config is the first thing I do and make sure the TEST AOS is setup as a batch or else you will not have a batch machine. You should delete the LIVE AOS line from here too.
You can sync/compile for good measure if you want, but it isn’t required since what you’re copying is already compiled and sync’d.
If you have any automated emails or automated system processes, you should realize that this is a copy of live, so depending on your customizations, there may be some considerations. For example, we have our live system sending customers emails automatically…if we restore to a test system, the customers might now get automated emails twice, one from live and one from test.
EDIT: This is for AX 2009, I just noticed you said AX 4.0. The only difference is the batch setup…the rest is the same.
Feel free to ask any more questions.