1830410 Members
2566 Online
110002 Solutions
New Discussion

remsh problem

 
sheevm
Regular Advisor

remsh problem

We are running 11.0/sept 2003 patch level. on L2000 box.

remsh is having problem to connect to the ORACLE database when we use remsh in "c" program.

remsh works fine if we use shall script to connect to the database. Command line also works fine.

ORACLE and HP passing bucks onto each other.

Can anyone has any tips or hint?

C program is using oracle "C" libraries.

We have applied latest remsh patch. Is it remsh problem?

We are testing ORACLE 9i upgrade.

be good and do good
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: remsh problem

If you can't define the problem better, I'm afraid no one can help you. Are you using remsh inside a system() function? Is it inside a popen()? I suspect all of your problems arise from the fact that stdin, stdout, and/or stderr are not associated with a tty device.

I can't imagine why you would be using remsh for this when Pro/C is made to do exactly this with much greater power and flexibility.

If it ain't broke, I can fix that.
sheevm
Regular Advisor

Re: remsh problem

Hi!

The reason I cannot define the problem properly is I am not a "C" programmer. Anyway we are using the PRO/C program to connect to the database which is failing. Oracle sent us a sample program for the test purpose it does not work. This PRO/C program usese the "remsh" to connect to the remote host. Here is the sample program oracle sent to connect to the database remotely which does not work.
---------------------------------------
#include
#include
#include


/* Declare variables. No declare section is
needed if MODE=ORACLE. */


#include
#define UNAME_LEN 20
#define PWD_LEN 40

VARCHAR username[UNAME_LEN]; /* VARCHAR is an Oracle-supplied struct */
varchar password[PWD_LEN]; /* varchar can be in lower case also. */
/* Declare error handling function. */
void sql_error(msg)
char *msg;
{
char err_msg[128];
size_t buf_len, msg_len;

EXEC SQL WHENEVER SQLERROR CONTINUE;

printf("\n%s\n", msg);
buf_len = sizeof (err_msg);
sqlglm(err_msg, &buf_len, &msg_len);
printf("%.*s\n", msg_len, err_msg);

EXEC SQL ROLLBACK RELEASE;
exit(EXIT_FAILURE);
}

void main(int argc, char *argv[])
{
char db_user[32] , db_passwd[32] , ic_server[32] ;
char temp_char[32];
int v_emp;
char *user = argv[2] ;
char *passwd = argv[3] ;
char *server = argv[1];
FILE *fp;
strcpy(db_user , user );
strcpy(db_passwd , passwd );
strcpy(ic_server , "DEVL" );


if ((fp=fopen("/home/batch/devbin/test.ora", "w"))==NULL)
{
printf("Exiting program. Log file open failure\n");
exit(-1);
}

fb_setenv(ic_server, fp);

/* Connect to ORACLE--
* Copy the username into the VARCHAR.
*/
strncpy((char *) username.arr, "PRODDBO", UNAME_LEN);

/* Set the length component of the VARCHAR. */
username.len =
(unsigned short) strlen((char *) username.arr);

/* Copy the password. */
strncpy((char *) password.arr, "devldbo" , PWD_LEN);
password.len =
(unsigned short) strlen((char *) password.arr);
/* Register sql_error() as the error handler. */
EXEC SQL WHENEVER SQLERROR DO fb_sql_error("ORACLE error--\n", fp);

/* Connect to ORACLE. Program will call sql_error()
* if an error occurs when connecting to the default database.
*/
fprintf(fp, "Connected to Oracle using -%s-%s-%s-\n", db_user, db_passwd, ic_server);
fprintf(fp, "Before Connect ...\n");
fprintf(fp, "EXEC SQL CONNECT %s IDENTIFIED BY %s USING %s\n", username.arr, password.arr, ic_server) ;
fflush(fp);

EXEC SQL CONNECT :username IDENTIFIED BY :password USING :ic_server;

fprintf(fp, "Connected to Oracle using %s %s %s\n", db_user, db_passwd, ic_server);
/* Disconnect from ORACLE. */
EXEC SQL COMMIT WORK RELEASE;

fclose(fp);
exit(EXIT_FAILURE);
}
be good and do good
A. Clay Stephenson
Acclaimed Contributor

Re: remsh problem

There is no remsh in this thing! This is ProC. I assume that you have run the code through the ProC compiler and linked it. The first thing that I would check is the constants you have defined for the connection.

In any event, this is not a "remsh" problem.
If it ain't broke, I can fix that.
RAC_1
Honored Contributor

Re: remsh problem

I did not find any remsh worh in that program. I am not into C, but there was no remsh word in program.

Anil
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor

Re: remsh problem

It would help if you posted the contents of /home/batch/devbin/test.ora after executing the compiled and linked program.
If it ain't broke, I can fix that.
Sathish C
Frequent Advisor

Re: remsh problem

Hi
Please post the error message while you run this program then we can suggest solutions . Also pls check if you have installed Oralce 9i pathc number 3065127 .Pls see the atached file for the details of the patch . Check your trace file of the oracle if it had reported ORA-7445 error message . These all things are related HP- compiler problem for any compiler invoked oracle activities .

Thanx
Some cause happiness wherever they go; others, whenever they go
sheevm
Regular Advisor

Re: remsh problem


This what HP found after running "tusc" utility on the sample PRO/C program.
----------------------------------------


As shown by the information below, when the program is executed through remsh, the program is receiving a fb_sql_err.


22765] write(1, "i n f b _ s e t e n v \n".., 141) = 141
[22765] write(4, " f b _ s q l _ e r r o r : ".., 79) = 79
[22765] exit(1) .......................................... WIFEXITED(1)
[22764] waitpid(-1, WIFEXITED(1), WUNTRACED) ............. = 22765
[22764] sigvec(SIGCLD, 0x77ff0b90, 0x77ff0ba0) ........... = 0
[22764] sigprocmask(SIG_SETMASK, 0x77ff0b98, 0x77ff0bb8) . = 0
[22764] sigprocmask(SIG_SETMASK, 0x77ff0bb8, 0x77ff0b98) . = 0
[22764] exit(1) .......................................... WIFEXITED(1)
[22763] select(8, 0x781e45ac, NULL, NULL, NULL) .......... = 1
[22763] Received signal 18, SIGCLD, in read(), [caught], no siginfo


Per our conversation, this is about the time that the program /users/batch/work/nsk1 is trying to connect to local host through remsh. According to meta-link(Oracle) the tnslistner needs to be configured to support local loop back. As shown by the
data below, it appears that you need to have local host configured in the TNS listener.



SNST UKIM02.UK.ORACLE.COM
UKIM02 138.3.33.102
UKMVS1 138.3.33.102
LOOPBACK 127.0.0.1
lOCALHOST 127.0.0.1
We don't seem to be using a host file at all.
In DNRSLCxx we have:
UK.ORACLE.COM.
ORACLE.COM
.

You should contact Oracle to help setup the TNS Listener.

be good and do good