Skip to main content
added 33 characters in body
Source Link
Jenifer
  • 387
  • 3
  • 15

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME  > sqlplus MyUsername/PASSWORD@SID**MyPassword@MyHostname:1521/MyServiceName

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

   > sqlplus MyUsername/MyPassword@MyHostname:1521/MyServiceName

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

deleted 3 characters in body
Source Link
Jenifer
  • 387
  • 3
  • 15

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus -S testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

I have also tried the below syntax:

schema_version=$(sqlplus -S ''"$username'"/'"$password'"@'"$TNS_entry'"' @schema.sql) echo "Schema_number: $schema_version";

But I am not sure what to use for TNS_entry and schema.sql

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus -S testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

I have also tried the below syntax:

schema_version=$(sqlplus -S ''"$username'"/'"$password'"@'"$TNS_entry'"' @schema.sql) echo "Schema_number: $schema_version";

But I am not sure what to use for TNS_entry and schema.sql

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

added 144 characters in body
Source Link
Jenifer
  • 387
  • 3
  • 15

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus -S testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

I have also tried the below syntax:

schema_version=$(sqlplus -S ''"$username'"/'"$password'"@'"$TNS_entry'"' @schema.sql) echo "Schema_number: $schema_version";

But I am not sure what to use for TNS_entry and schema.sql

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus -S testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

Trying to connect to ORACLE SQLPLUS using unix shell script. But it is getting failed.. Looks like the script in line 3 is incorrect as I am passing username, password and SID

#!/bin/sh
cd /dev/shrd/alt/test1/stest/ptest
V1=`sqlplus -S testuser/passwd@testSID <<EOF
SELECT count(*) FROM test_table WHERE region='Aus';
EXIT;
EOF`
if [ -z "$V1" ]; then
  echo "No rows returned"
  exit 0
else
  echo $V1
fi

I got an error stating -ORA-12162: TNS:net service name is incorrectly specified when I added - sqlplus $username/$password in the script.

I have also tried the below syntax:

schema_version=$(sqlplus -S ''"$username'"/'"$password'"@'"$TNS_entry'"' @schema.sql) echo "Schema_number: $schema_version";

But I am not sure what to use for TNS_entry and schema.sql

Can anyone please confirm if the below syntax is valid and I can add it in shell script?

**sqlplus USERNAME/PASSWORD@SID**

Kindly guide me if I'm missing something (like Hostname, Port Number,TNS_entry or something else).

Thanks in advance :)

added 144 characters in body
Source Link
Jenifer
  • 387
  • 3
  • 15
Loading
Source Link
Jenifer
  • 387
  • 3
  • 15
Loading