1

I have recorded a script using Oracle 2 Tier protocol in LoadRunner 12.00. Here's a small snippet of the code where the script fails:

    lrd_init(&InitInfo, DBTypeVersion);
    lrd_initialize_db(LRD_DBTYPE_ORACLE, 1, 0);
    lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
    lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
    lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
    lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
    lrd_server_attach(OraSrv3, "xyz.abc.com", 24, 0, 0);

The error occurs at the lrd_server_attach line:

Action.c(24): Server Handle has not been allocated (NULL)
Action.c(24): server_attach: ERROR, return-code=LRDE2090 

I have updated the tsnames.ora file with the proper connection statement. What could be causing this error? Where should I start looking? Please help.

Aayush Pathak
  • 159
  • 11

1 Answers1

1

OK, Let's look at the example code for lrd_server_attach() and then your code

First, the example

lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
lrd_handle_alloc_ora(OraEnv1, SERVER, &OraSrv1, 0);  // See OraSrv1 here
lrd_handle_alloc_ora(OraEnv1, SVCCTX, &OraSvc1, 0);
lrd_handle_alloc_ora(OraEnv1, SESSION, &OraSes1, 0);
lrd_server_attach(OraSrv1, "rman", -1, 0, 0);        // See OraSrv1 here

Now, your code

lrd_init(&InitInfo, DBTypeVersion);
lrd_initialize_db(LRD_DBTYPE_ORACLE, 1, 0);
lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);   // See OraSrv1 here
lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
lrd_server_attach(OraSrv3, "xyz.abc.com", 24, 0, 0);   // See OraSrv3 here

To me it appears you have a handle label of OraSrv3 which has not been allocated. Your third parameter is also a bit henky, as it is usually the length of the second parameter, but here it is longer.

James Pulley
  • 5,606
  • 1
  • 14
  • 14