3932695
3932695

Reputation: 87

Remotely performing actions on another computer via batch file

I have these statements in a batch file, which need to be modified to execute on another computer on the network:

oradim -new -sid %ORACLE_SID% -intpwd %pass% -startmode M
D:
cd D:\oracle\product\10.2.0\db_1\database
echo control_files = (d:\oracle\databases\%ORACLE_SID%\control01.ora, d:\oracle\databases\%ORACLE_SID%\control02.ora, d:\oracle\databases\%oracle_SID%\control03.ora) > init%ORACLE_SID%.ora
echo undo_management = auto >> init%ORACLE_SID%.ora
echo db_name = %ORACLE_SID% >> init%ORACLE_SID%.ora
echo db_block_size = 8192 >> init%ORACLE_SID%.ora

I have previously used:

net use \\%ip% %pass%/USER:%user%
sc \\%ip% stop %serviceName%

...to stop services on another computer. But I am not sure how that knowledge can be applied in this case.

Assistance would be appreciated, thank you in advance.

Upvotes: 1

Views: 2082

Answers (1)

shf301
shf301

Reputation: 31394

You can use the PsExec tool from the PsTools collection to remotely run any command on a remote computer that you have access to.

You would use it like below to run commands from a specific batch file name fileName.

psexec \\%ip% -u %user% -p %pass% fileName

Upvotes: 1

Related Questions