One of my shell script, I'm using shell variable to substitute parameter value to a oracle related command "tnsping". without substitution same value is working fine. see below example.
Below is the result is expected with command:
> tnsping "(ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))"
TNS Ping Utility for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 01-NOV-2012 19:28:42
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Attempting to contact (ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))
OK (0 msec)
my shell variable have below value
> echo $p
"(ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))"
When I'm executing tnsping command with same variable, I'm not getting same result:
> tnsping $p
TNS Ping Utility for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 01-NOV-2012 19:28:25
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/oracle/product/11.2/network/admin/sqlnet.ora
TNS-03505: Failed to resolve name
Can you please tell me how to correct this or if I'm wrong somewhere.
Below is the result is expected with command:
> tnsping "(ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))"
TNS Ping Utility for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 01-NOV-2012 19:28:42
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Attempting to contact (ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))
OK (0 msec)
my shell variable have below value
> echo $p
"(ADDRESS = (PROTOCOL = TCP)(HOST = uedcb031)(PORT = 1521))"
When I'm executing tnsping command with same variable, I'm not getting same result:
> tnsping $p
TNS Ping Utility for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 01-NOV-2012 19:28:25
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
/oracle/product/11.2/network/admin/sqlnet.ora
TNS-03505: Failed to resolve name
Can you please tell me how to correct this or if I'm wrong somewhere.