Connect to database with SQL*Plus: is TNSNAMES.ORA used?

Hi ,
we have a local database called DEV01 and a duplicate of this database in a datacenter. To be able to connect to both databases the TNSNAMES.ORA
on the local database server (not the one in the datacenter) has the following entries:
/* Entry for local database */
DEV01_local, DEV01_local.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = server01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID= DEV01)
/* Entry for database in datacenter */
DEV01,DEV01.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = server02)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = DEV01)
When I connect to the local database server I set the Oracle-environment as follows:
export ORACLE_SID=DEV01
export PATH=/opt/oracle/app/oracle/product/9.2.0/bin:$PATH
export ORACLE_HOME=/opt/oracle/app/oracle/product/9.2.0
Now I start SQL*Plus as follows:
oracle#> sqlplus user/user
SQL> select instance_name, host_name from v$instance;
INSTANCE_NAME    HOST_NAME
DEV01            server01
Since the SID is on both databases the same (DEV01) I really do not understand how Oracle decides to which database SQL*Plus connects to.
Is it a matter of the entries in the TNSNAMES.ORA?
But when I start SQL*Plus as follows:
oracle#> sqlplus user/user@DEV01_local
SQL> select instance_name, host_name from v$instance;
INSTANCE_NAME    HOST_NAME
DEV01            server01
or
oracle#> sqlplus user/user@DEV01
SQL> select instance_name, host_name from v$instance;
INSTANCE_NAME    HOST_NAME
DEV01            server02
everything is as expected.
Does anybody know which database gets chosen when just connect with "sqlplus user/user" (without @DEV01 or @DEV01_local)?
Any help will be appriciated!
Rgds
Jan

Both databases have the SID=DEV01.
The ORACLE_SID is set to DEV01 - but when connecting I end up at
oracle#> sqlplus user/user
SQL> select instance_name, host_name from v$instance;
INSTANCE_NAME    HOST_NAME
DEV01            server01
which is the database with the TNSNAMES.ORA entry "DEV01_local, DEV01_local.WORLD = ..."
In your case the one defined by ORACLE_SID environment variable => but which from both is it?

Similar Messages

  • Able to connect to database from SQL plus but not from Oracle SQL developer

    Hi
    I have two database editions in my system Oracle XE and Oracle EE. I am able to connect to EE database through SQL plus but not through SQL developer.Please tell me how to do it.
    All settings are good.I am able to connect to the database before installing XE.I need both for my work(different projects).
    And the default listener started is XE's.Please tell me how to change the default one to EE or tell me how to connect through SQL developer??
    Regards
    Harsha

    I Solved it.
    I copied the text from listener.ora for EE
    and added it in the other one.
    It works after restart.

  • When connecting to database in SQL* plus giving Error

    hi,
    I am using Oracle 10g. My problem is when i connecting to database in Server through SQL * Plus giving the Error:
    ORA-12514: TNS:listerner does not currently know of service requested in connect descriptor.
    Why this is happening i don't know. I created listener also. But no use. How to solve this can any tell me pls... ! .
    Thank u...!

    hi,
    Thank u bang for u r reply. It is not working sir. I added the listener as follows:
    # listener.ora Network Configuration File: D:\oracle10g\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = HA14)(PORT = 1521))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle10g)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    (SID_DESC =
    (GLOBAL_DBNAME = OVSL06)
    (ORACLE_HOME = D:\oracle10g)
    (SID_NAME = OVSL06)
    I typed the following commands in command prompts
    C:\>lsnrctl
    LSNRCTL for 32-bit Windows: Version 10.1.0.2.0 - Production on 30-MAY-2007 16:29
    :14
    Copyright (c) 1991, 2004, Oracle. All rights reserved.
    Welcome to LSNRCTL, type "help" for information.
    LSNRCTL> stop
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    The command completed successfully
    LSNRCTL> start
    Starting tnslsnr: please wait...
    TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Production
    System parameter file is D:\oracle10g\network\admin\listener.ora
    Log messages written to D:\oracle10g\network\log\listener.log
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=HA14)(PORT=1521)))
    STATUS of the LISTENER
    Alias LISTENER
    Version TNSLSNR for 32-bit Windows: Version 10.1.0.2.0 - Produ
    ction
    Start Date 30-MAY-2007 16:29:28
    Uptime 0 days 0 hr. 0 min. 2 sec
    Trace Level off
    Security ON: Local OS Authentication
    SNMP OFF
    Listener Parameter File D:\oracle10g\network\admin\listener.ora
    Listener Log File D:\oracle10g\network\log\listener.log
    Listening Endpoints Summary...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HA14)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROCipc)))
    Services Summary...
    Service "PLSExtProc" has 1 instance(s).
    Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfully
    same error is getting as i am getting previously. Tell me solution pls....!
    Thank u...!

  • Connecting oracle database with sql*net via VIP on Ace

    Is there any way to get oracle Database traffic working only via the ACE Blade instead of using a firewall to do packet inspection.
    The case is we have application servers in a DMZ wich should connect via a VIP to a Oracle database on port 1521.
    Normally oracle negotiates the tcp ports wich it will use and a normal firewall will do an inspect and opens up the dynamic channel.
    However on the Ace there is still no Inspect for Sql*net.
    Everthing on routing and connection level works fine tnspings telnet to 1521 works fine. Only when using the application stack the dynamic ports needs to be used.
    In our design a firewall in between this node's is at this moment impossible.
    Any Ideas or examples how to solve this...

    ORA-27140: attach to post/wait facility failedThis is to do with filesystem permissions on $ORALCE_HOME/bin
    Login as the 'oracle' account (or the account with which oracle binaries are installed.
    goto $ORACLE_HOME/bin
    chmod 6751 account_used_to_install

  • Downloading and installing Oracle (with sql plus) on Windows 7 Professional

    Hi,
    I got a new laptop which has Windows 7 Professional (64 bit). I intend to download Oracle 10g and would like to install bothe the database and the sql plus in this system.
    I would appreciate if somebody could provide me a link to the appropriate database (with sql plus installation capability). Also if available the installation guide.
    Thanks in advance.

    Hello,
    Windows 7 Professional (64 bit). I intend to download Oracle 10g and would like to install bothe the database and the sql plusOracle *10g* is not certified on Windows *7*, except with the latest patchset *10.2.0.5*, and its Premium Support ended on the *31st of July 2010*.
    You should download Oracle *11.2* which is certified on Windows *7 - 64 bit*.
    You'll find the Documentation and Download tabs on the link below:
    http://www.oracle.com/technetwork/database/enterprise-edition/overview/index.html
    About SQLPlus, it's delivered with Oracle Server and, in *11g*, you can still use it from a DOS box. If you intend to have a Graphical Tool, you should use Oracle SQL Developer instead:
    http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
    Hope this help.
    Best regards,
    Jean-Valentin

  • To connect oracle database with ms access database

    i want to connect oracle database with ms access database
    i have follow the following steps
    1. create ms access database.
    2. create system dsn.
    3. make change in listener.ora.
    4. make change in hs folder.
    5.change the tnsname.ora.
    6. lsnrctl stop and lsnrct start.
    7. create database link in oracle sql*plus.
    8.select the table of ms access
    but i have return the foloowing error.
    ORA-12154: TNS:could not resolve the connect identifier specified
    using window 2000, oracle 10g

    Have a look on ths thread, may it helps ...
    Re: copy access data into oracle with form builder 9i

  • Learning PL/SQL with SQL plus

    I'm looking to teach myself PL/SQL with SQL Plus, it's a works pc so I can not use any other software than SQL plus.
    When starting SQL plus I'm asked for a username, password and host string.
    I'm taking it the host string is the db I want to connect to and obviously supply the username and password for level of access?
    Also what I ideally need is a sample db on my local machine to connect to with SQL plus to learn that way.
    Can anyone point me in the right direction please. Any help is greatly appreciated.

    Use the net8 configuration assistant preferably as it'll get the syntax correct.
    Otherwise you copy the sample one up one folder and edit that.
    Connection information (SID, Server/IP, port number) you'll have to get off your DBA.
    The name at the start of a tnsnames entry is the name that you want to reference the database as, so you can call it FRED if you like.
    e.g.
    FRED =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS =
            (PROTOCOL = TCP)
            (HOST = <server name or ip address>)
            (PORT = <port>) -- usually 1521 but can differ if more than one instance on the server
        (CONNECT_DATA =
          (SID = <database SID>) -- the name of the database on the server.
      )Once that's set up you can then log onto the database in the following way:
    sqlplus <user>/<password>@fred
    What happens is that the TNS Listener service (that should be running on your PC) will look up "fred" in the tnsnames.ora file and then use the information from that to make the connection to the server on the correct port and connect you to the actual database on there.
    After that.... it's up to you.
    :)

  • Error: connecting to db with SQL Developer

    Hi,
    I have just done a test disaster recovery (complete restore and recovery) of my database. I have successfully restored and recovered my database and managed to open the database , though with a few warnings shown below
    RMAN> alter database open resetlogs;
    database opened
    RMAN-06900: WARNING: unable to generate V$RMAN_STATUS or V$RMAN_OUTPUT row
    RMAN-06901: WARNING: disabling update of the V$RMAN_STATUS and V$RMAN_OUTPUT row
    s
    ORACLE error from target database:
    ORA-06553: PLS-801: internal error [56319]
    When I try to use sql developer to access the database. I end up getting the following error:
    ORA-06544: PL/SQL:internal error, arguments: [56319], [], [], [], [], [], [], []
    ORA-06553: PLS-801: internal error [56319]
    06544. 00000 - "PL/SQL: internal error, arguments: [%s], [%s], [%s], [%s], [%s], [%s], [%s], [%s]"
    *Cause: A pl/SQL internal error occurred.
    *Action: Report as a bug; the first argument is the internal error number.
    vendor code 6544
    This has been the first time I performed full recovery.
    I am using sqldeveloper 1.1 and running oracle 10g R2
    I was wondering if anybody has come across this problem before
    Any help would be appreciated

    Sorry, I meant that "restore database" and "recover database" commands both completed successfully without errors<br><br>
    I had a try connecting with sql *plus, which I get <br><br>
    ORA-06553:PLS-801 internal error.<br><br>
    <i>HOWEVER</i>, I still get connected, and can run queries against the tables<br><br>
    You'd get better response from the Recovery Manager forum...<br>Sorry you are right,

  • I have problem to connect oracle DB with SQL developer

    I try connect to my oracle db with oracle SQL developer and received that message:
    http://ioj.com/v/camkp
    (pictures 1 and 2)
    if i try connect with sql plus, all well.
    command : select userenv('LANGUAGE') from dual; result: Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> select userenv('LANGUAGE') from dual;
    *USERENV('LANGUAGE')
    RUSSIAN_RUSSIA.CL8MSWIN1251*
    in SQL DEVELOPER: (picture 3)
    check\uncheck "Skip NLS Settings", nothing changed.
    what the issue is?

    Then apparently it's still not getting the OS settings right; try to add these to \sqldeveloper\bin\sqldeveloper.conf (maybe region is enough):
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=US
    AddVMOption -Duser.region=USHope that helps,
    K.

  • Not able to connect Oracle DBXE from sql*plus client

    Hi,
    I have installed Oracle 10gXE from oracle site. i have updated the tnsnames.ora also
    but when i try to connect the db through sql*plus client, i am redirected to .net debugger.
    Pls help me in this,
    Thanks in advance.
    -- Raja

    Hello,
    Can you clarify what you are trying to connect from? If it's B1 ( one ) then post to the [B1 forum|http://forums.sdn.sap.com/index.jspa#44].
    Otherwise need more info on the product you are using?
    Typically the Oracle Path must be in the PATH statement as well it requires the correct platform ( 32 or 64 ) bit client installed.
    Most BOE/CR products are 32 bit so you need to install the 32 bit client.
    Don

  • Uable to connect to database with new connection

    we are not able to connect to DB using SQL DEVELOPER with new connection,exiting connects works fine and sql plus works fine as well.
    anybody has any information u.
    Thanks
    RK

    Thank you very much for reply.
    Sql developer version: 1.5.1; oracle db is 10.2g.
    existing connections we are connected thru SQL Developer itself before couple days back. if you close and try to reconnect it is just kept running runinng.
    our connections use SID,port no, host name, we are not using the Tns.
    Thanks in advance
    RK

  • Create new MySQL Database with SQL

    I have a simple question, :-)
    how can I create a new MySQL Database with SQL - (JDBC)
    can you show me a code example?
    tank you ...

    okay ... but how do I use the URL ??? that's the problem
    I tried this:
    Connection con   = null;
            Vector vct       = new Vector();
            try{
                String drv = "org.gjt.mm.mysql.Driver";
                String url = "jdbc:mysql://111.222.333.444:3306";
                String name = "myname";
                String pass = "mypass";
                Class.forName(drv);
                con = DriverManager.getConnection(url,name,pass);
                String statement = "CREATE DATABASE TestDB_Don1";
                Statement stm = con.createStatement();
                stm.execute(statement);
                stm.close();
                con.close();                         
            catch(Exception e){ e.printStackTrace(); }but it doesen't work ............. what is wrong ?

  • How to connect external database(Ex:SQL Server/Tivoli)  from ABAP Webdynpro

    Hi,
    Any one have idea how to connect external database like SQL Server/Tivoli to access tables from WebDynPro ABAP.
    Please point to me some links if you have
    Thanks
    Praveen

    Hi,
    Please check out this link -
    FETCH DATA FROM ORACLE DATABASE USING Web Dynpro
    Regards,
    Lekha.

  • Backspace with SQL*Plus

    Hi,
    when I use backspace on my keyboard with SQL*Plus or svrmrgl,
    the symbol ^h is comming on my screen.
    But I want delete the character before the cursor.
    Any idea ???
    Thanks
    null

    Pardon my ignorance, but what's the significance of the N'<string>' construction? That's not one I'm familar with.
    Justin

  • Hi guys Pls tell me a way to connect db4 database with jsp and which driver

    hi guys
    Pls tell me a way to connect db4 database with jsp and
    also tell me which driver i have to use
    also tell me how to connect with excel sheets

    take a look at the follwing links. There, you'll find all what you need :
    DB4:
    http://www.oracle.com/database/berkeley-db/je/index.html
    http://www.oracle.com/technology/products/berkeley-db/je/index.html
    http://www.oracle.com/database/berkeley-db/db/index.html
    http://www.oracle.com/database/docs/berkeley-db-je-datasheet.pdf
    Excel:
    http://64.18.163.122/rgagnon/javadetails/java-0516.html
    Hope That Helps

Maybe you are looking for

  • Using if statement in cursor problem

    Hi, I am getting problem in cursor in plsql. i'e     DECLARE     CURSOR curRec IS           if condition then                select query1;           else                select query2;           end if;       c1rec curRec%ROWTYPE; Pls.. help.

  • Reporting tab is not shown in the console

    hi everyone the reporting tab is not shown in the service manager console, the topology i am using is 2 servers [one for DW and the other for management server] both servers have their SQL server installed on each one, could you please tell me how i

  • FBL1N - Cheque information display required

    Hi Gurus, While displaying Vendor Line item display, i need to know the cheque information for payment made against an invoice. I currently do it by selecting the line item and clicking the icon for displaying chq info (cntrlshiftF7), and get the chq

  • Query SQL bulit-in account information

    Dear Expert, Is there any known script to query the sql account (bulit-in) information? espcially for creation date, last logon date, etc? Thanks so much.

  • Web Service Testing Problem

    Hi All,         I create a new customize web service for service confirmation through Web UI in CRM7.0 .I activate the service in Productive mode .After that 2 new button is coming (WSDL and Test Page) in same page.when i click on WSDL button ,i got