My sqlplus command doesnt finish , it wait on password line,it dont give me error.
This code doesnt problem when i open new cmd window and paste this code ! everything is ok, but i cant run on c# using process();
My sqlplus command text:
Set ORACLE_SID=prod
Set ORACLE_HOME=C:\oracle\product\10.2.0\db_1
sqlplus -s
sys as sysdba
password
shutdown immediate
startup mount
recover standby database until cancel;
cancel
alter database open read only;
exit;
exit;
I try this :
C:\cmd.cmd
*********************************************
Set ORACLE_SID=prod
Set ORACLE_HOME=C:\oracle\product\10.2.0\db_1
sqlplus -s
sys as sysdba
manager
select * from dual;
exit;
*********************************************
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = @"C:\cmd.cmd";
startInfo.RedirectStandardInput = true;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
process = Process.Start(startInfo);
//output
string BatProcessResult = process.StandardOutput.ReadToEnd();
Output:
D:\AppPath\bin\Debug>Set ORACLE_SID=prod
D:\AppPath\bin\Debug>Set ORACLE_HOME=C:\oracle\product\10.2.0\db_1
D:\AppPath\bin\Debug>sqlplus -s
D:\AppPath\bin\Debug>sys as sysdba;
sqlplus -s "sys@wherever/password as sysdba". The double quotes are needed because of the spaces.username/pw@dborusername@db/pw.