driving relay from uno

and the same code and wiring is working fine when I am using power adapter but not on battery power supply.

Well, it could be an inadequate battery (somebody asked what type of battery you were using and you failed to reply), or some difference in wiring between the two two setups.