This project is read-only.

Unable to login at the second username and password in Oracle database

Aug 15, 2013 at 3:39 PM
Hello guys,

I need your help on my project, I used renci ssh.net to connect to an oracle database (AIX) for data backup using "exp" command. I used C# .net code. I am stuck on logging in the second username and password after executing the "exp" command. This is my code:

string serverIP = "192.xxx.xx.xx";
        PasswordConnectionInfo connectionInfo = new PasswordConnectionInfo(serverIP, "username", "password");

        using (var client = new SshClient(connectionInfo))
        {
            client.Connect();

            if (client.IsConnected)
            {
                using (var shellStream = client.CreateShellStream("dumb", 80, 24, 800, 600, 1024))
                {
                    string reply = String.Empty;
                    var rep = shellStream.Expect("$");

                    shellStream.WriteLine("cd /Orarecovery");
                    rep = shellStream.Expect(new Regex(@"[$#]")); 
                    shellStream.WriteLine("exp");
                    rep = shellStream.Expect("Username:");
                    shellStream.WriteLine("system"); // 2nd username
                    //richTextOutput.Text = rep;  // to be displayed at the form
                    MessageBox.Show(rep);
                 }
            }
            client.Disconnect();
        }

The output on this is like this:

Export: Release 10.2.0.4.0 - Production on Thu Aug 15 22:24:47 2013

Copyright (c) 1982, 2007, Oracle. All rights reserved.


Username:

Password:

** it seems that it will not write the username and password

Hope you can help me..Thank you