Need to execute Oracle relocation command in shell script

Hello,

I need to execute below command in shell script

srvctl relocate service -d $database -s $service -i $avail  -t $pref -f 
and also need to get the errors ,if any,in another file.

What's the right way to execute such commands in shell script?

Best regards,
Vishal

It'll depend on which output stream the errors appear on, but speaking generally, you can capture the output and/or errors as follows:

#!/bin/sh
srvctl relocate service -d $database -s $service -i $avail  -t $pref -f > outputfile.txt 2> errorfile.txt"
1 Like