How to access Oracle table using sqlplus


 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications How to access Oracle table using sqlplus
# 1  
Old 06-17-2008
How to access Oracle table using sqlplus

Hi,

I want to use sqlplus from server1

sqlplus usr1/pass1@dns1

and I want to connect to an Oracle database from a server2.

Unfortunately the database was created on the server1 and on server2.

So when I use the command just like that...it connects to the database from the server2.

Is there a way to connect to the database found on the server2?

thank you in advance for your answers
# 2  
Old 06-17-2008
Your request isn't clear. I've understood that you have two servers, server1 and server2. On both of them there's installed an Oracle Database Server.

Regardless of the server from which you are invoking sqlplus, the destination database is determined by the last part of the connect string, that is "@dns1".

This alias is translated into four pieces of information:
- Destination address of the remote server
- Destination port (default: 1521)
- Protocol (usually TCP)
- Service Name or SID of the remote database

Assuming you're using local naming method, all these informations are stored in a file called "tnsnames.ora", that by default resides in "$ORACLE_HOME/network/admin" of the server from which you are invoking sqlplus.

Look into it and search for the entry called "dns1": here you can verify which is the real destination db server you're connecting to.

If you need to connect to the other server, you need another entry in this file, pointing to the second destination server.
# 3  
Old 06-17-2008
I wasn't sure about my guess and I wanted another opinion. Thank you very much for your answer.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Truncate table $TABLE -- SQLPLUS

I want to truncate a table using sqlplus where the table name is in shell variable: I am using : sqlplus -s / <<end truncate table $TABLE end (2 Replies)
Discussion started by: IB_88
2 Replies

2. UNIX and Linux Applications

Help in copying table structure to another table with constraints in Oracle

hi, i need to copy one table with data into another table, right now am using create table table1 as select * from table2 i want the constraints of table1 to be copied to table2 also , can anyone give me some solution to copy the constraints also, now am using oracle 10.2.0.3.0... (1 Reply)
Discussion started by: senkerth
1 Replies

3. Shell Programming and Scripting

Connect to Oracle using sqlplus

I have logged into oracle using SQLPLUS. When I type any kind of query, there is only 1 answer - '2'. What is wrong with it? (1 Reply)
Discussion started by: Subhasis
1 Replies

4. Shell Programming and Scripting

Connecting to Oracle DB using sqlplus

Hi, I am very new to shell scripting and trying to write a simple shell script in which i am trying to achieve the following: 1. Connect to oracle database hosted on a different server 2. fire a query on the oracle db 3. store the output in a variable 4. use this variable for further logic... (26 Replies)
Discussion started by: shrutihardas
26 Replies

5. UNIX for Dummies Questions & Answers

Connecting to Oracle DB using sqlplus

Hi, I am very new to shell scripting and trying to write a simple shell script in which i am trying to achieve the following: 1. Connect to oracle database hosted on a different server 2. fire a query on the oracle db 3. store the output in a variable 4. use this variable for further logic... (1 Reply)
Discussion started by: shrutihardas
1 Replies

6. Shell Programming and Scripting

Formatting Oracle sqlplus output

a job extracts orcle data into unix as flat file. a single record breaks into two record in unix flat file. This is the case only for 6 records out of 60 lack records. (its not single record in two line. but its single record into record. ie., \n come into picture) can you tell me what... (6 Replies)
Discussion started by: Gopal_Engg
6 Replies

7. Shell Programming and Scripting

calling sqlplus, read table return etc

I have korn shell scripts. I want to pass a variable to a script which will execute a a sql script to read a table that contains env. variables. I want to read and then somehow export at unix level variables example for every row selected from the table build export command line field1... (5 Replies)
Discussion started by: TimHortons
5 Replies

8. Shell Programming and Scripting

Check the record count in table (table in oracle)

I have requirement: 1) Check the record count in table (table in oracle) 2) If records exists generate the file for existing records and wait for some time then Go to sleep mode and Again check the record count after 10 min.......... (Loop this process if record count >0). 3) Generate touch... (1 Reply)
Discussion started by: kamineni
1 Replies

9. Shell Programming and Scripting

Check the record count in table (table in oracle)

I have requirement: 1) Check the record count in table (table in oracle) 2) If records exists generate the file for existing records and wait for some time (Go to sleep mode) and Again check the record count after 10 min.......... (Loop this process if record count >0). 3) Generate touch... (1 Reply)
Discussion started by: kamineni
1 Replies
Login or Register to Ask a Question