Link to home
Start Free TrialLog in
Avatar of gbcbr
gbcbrFlag for Cyprus

asked on

Connection to Oracle 11 on Solaris 10

I install Oracle 11.2 on the Solaris server and I can connect locally via the port 1527, but remotely I can't see this port. Please advise.
Avatar of nognew
nognew
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi there!
 you need to configure your Oracle Listener to listen on external IP addresses. I believe by default it is only listening on locahost, or even not started at all.
To test it issue commands like:

lsnrctl status
lsnrctl stop
lsnrctl start



Cheers,
t.
do you have proper tns configuration on client machine. are you able to succesfully run tnsping <tns alias> command.

Also, if you have a firewall running, you need to open the port 1527 so that others can connect through it.
Avatar of gbcbr

ASKER

Yes, locally it's connected via 1527. But firewall running on CiscoASA, so server and client have no firewall between them. The question is how to open port 1527 for client?
If you asking about opening a port on a Firewall thats completely another question which should be placed in Network section. As for oracle you need to make sure your listener is running and lsnrctl.ora has the Alias set up to listen on IP:port you want to connect to.
Cheers,
t.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

What are you using to connect with?  SQL*Plus or some other app?
the tns entry will have port=1527 on your client, you do not need to open port 1527 on client, that has to be on server.
Avatar of gbcbr

ASKER

to slightwv: SQL Developer, but it asks default port 1521
to nognew :
# lsnrctl status
# lsnrctl not found
gbcbr,
 have you run the command on Server side? This is a server command, if you run it on Server and got that reply, that means your paths and perhaps environemnt variables are not set. Actually you nee dto be an Oracle user to run such commands.
Cheers,
t.
Avatar of gbcbr

ASKER

I run it from root
>>to slightwv: SQL Developer, but it asks default port 1521

I've not used sql developer a lot but if you are referring to the port when you click 'new connection' just type over the 1521 and use the correct port.
can you post the contents of byour tnsnames.ora file here? also, try using sqlplys user/pwd@tnsalias to connect and tell us what is the error?
Avatar of gbcbr

ASKER

to nognew: the same result under oracle user
to slightwv: if I change and connect, I didn't post. Problem that I can't see from my iMac 1527 port on server
Also, in sql developer, try to use connection type as TNS and choose alias from the drop down.
>>I can't see from my iMac 1527 port on server

I don't understand what you mean what you say you can't see the port.  Please explain this a little more.

>>can you post the contents of byour tnsnames.ora file here?

SQL Developer doesn't require a tnsnames.ora file.
Avatar of gbcbr

ASKER

MacOS has Network Utility which can scan any IP about opened ports. In my case I have this result:
Port Scanning host: 10.1.1.7

       Open TCP Port:       21                 ftp
       Open TCP Port:       22                 ssh
       Open TCP Port:       23                 telnet
       Open TCP Port:       25                 smtp
       Open TCP Port:       79                 finger
       Open TCP Port:       111                sunrpc
       Open TCP Port:       513                login
       Open TCP Port:       514                shell
       Open TCP Port:       587                submission
       Open TCP Port:       2049               nfsd
       Open TCP Port:       4045               npp

so 1527 doesn't visible
sql developer gives option to connect using different ways, one of that is TNS, where you can use your tns entry.
I think that is a better way for beginners, as there are less chances of mistake.
You won't see that port opened.  Unless explicitly told to not behave this way:  The way Oracle works is the listener accepts the connect request, opens a random high-level port then hands off the connection to that port and goes back to listening.

Also, the port 1527 need to be opened on server, not on client, I think @gbcbr is confusing client and server configurations as your server is on solaris, this port need on solaris machine.
Avatar of gbcbr

ASKER

This is tnsnames.ora file:
# This file contains the syntax information for
# the entries to be put in any tnsnames.ora file
# The entries in this file are need based.
# There are no defaults for entries in this file
# that Sqlnet/Net3 use that need to be overridden
#
# Typically you could have two tnsnames.ora files
# in the system, one that is set for the entire system
# and is called the system tnsnames.ora file, and a
# second file that is used by each user locally so that
# he can override the definitions dictated by the system
# tnsnames.ora file.

# The entries in tnsnames.ora are an alternative to using
# the names server with the onames adapter.
# They are a collection of aliases for the addresses that
# the listener(s) is(are) listening for a database or
# several databases.

# The following is the general syntax for any entry in
# a tnsnames.ora file. There could be several such entries
# tailored to the user's needs.

<alias>= [ (DESCRIPTION_LIST =  # Optional depending on whether u have
                        # one or more descriptions
                        # If there is just one description, unnecessary ]
        (DESCRIPTION=
          [ (SDU=2048) ]      # Optional, defaults to 2048
                        # Can take values between 512 and 32K
          [ (ADDRESS_LIST=    # Optional depending on whether u have
                        # one or more addresses
                        # If there is just one address, unnecessary ]
            (ADDRESS=
            [ (COMMUNITY=<community_name>) ]
            (PROTOCOL=tcp)
            (HOST=<hostname>)
            (PORT=<portnumber (1521 is a standard port used)>)
            )
            [ (ADDRESS=
              (PROTOCOL=ipc)
              (KEY=<ipckey (PNPKEY is a standard key used)>)      
            )
            ]
            [ (ADDRESS=
              [ (COMMUNITY=<community_name>) ]
              (PROTOCOL=decnet)
              (NODE=<nodename>)
              (OBJECT=<objectname>)
            )
            ]
              ... # More addresses
          [ ) ] # Optional depending on whether ADDRESS_LIST is used or not
          [ (CONNECT_DATA=
            (SID=<oracle_sid>)
            [ (GLOBAL_NAME=<global_database_name>) ]
            )
          ]
          [ (SOURCE_ROUTE=yes) ]  
        )
        (DESCRIPTION=    
          [ (SDU=2048) ]      # Optional, defaults to 2048
                        # Can take values between 512 and 32K
          [ (ADDRESS_LIST= ]      # Optional depending on whether u have more
                        # than one address or not
                        # If there is just one address, unnecessary
            (ADDRESS
            [ (COMMUNITY=<community_name>) ]
            (PROTOCOL=tcp)
            (HOST=<hostname>)
            (PORT=<portnumber (1521 is a standard port used)>)
            )
            [ (ADDRESS=
              (PROTOCOL=ipc)
              (KEY=<ipckey (PNPKEY is a standard key used)>)
               )
            ]
            ...             # More addresses
          [ ) ]             # Optional depending on whether ADDRESS_LIST  
                        # is being used
          [ (CONNECT_DATA=
            (SID=<oracle_sid>)
            [ (GLOBAL_NAME=<global_database_name>) ]
            )
          ]
          [ (SOURCE_ROUTE=yes) ]
        )
        [ (CONNECT_DATA=
            (SID=<oracle_sid>)
            [ (GLOBAL_NAME=<global_database_name>) ]
          )
        ]
        ...   # More descriptions
      [ ) ]      # Optional depending on whether DESCRIPTION_LIST is used or not
That looks like the 'sample' one in the samples directory.

It's not necessary to configure this to work with sql developer and IMO confuses people new to Oracle.
Avatar of gbcbr

ASKER

but the main question: how I can open 1521 and 1527 on the Solaris server and connect to Oracle from client?
probably its already open, what makes you feel that the said port is NOT OPEN?
You don't open the port.   Oracle takes care of all that for you.

If you enter everything for the database server into the sql*Developer connection page, it will connect.

What error message are you getting?
Avatar of gbcbr

ASKER

The Network Adapter could not establish the connection
the same with 1521 and 1527
are you able to ping the server machine?
are the entries you are using are correct -hostname,port and SID/Service Name?
in your case the port is 1527, you should be able to atleast ping the hostname, and verify the service name.
From an above request: Log into the solaris machine as the oracle user and post the results of: lsnrctl status
Avatar of gbcbr

ASKER

$ lsnrctl status
ksh: lsnrctl:  not found
The oracle user should have the correct profile.  did you execute the oracle user profile?

but OK(replace SIDNAME with the correct oracle database sid):

export ORACLE_SID=SIDNAME
ORAENV_ASK=NO
. oraenv

the try again

you may need to set your environment, set the path to oracle_home\BIN, also set oracle_home env variable. after that run the above command again.
Avatar of gbcbr

ASKER

Generally I'm crazy now. I have OS and DB from the same developer Oracle and I have so much headache to connect each other!
Trust me, it's not that difficult once you understand how Oracle networking works.

You need certain things in certain places.  Once we understand where everything is on the database server, it should go much easier.
Avatar of gbcbr

ASKER

Thank you everybody for the help, I'm going to sleep now. We'll communicate tomorrow.
Have a nice day.
Avatar of gbcbr

ASKER

Ok, problem was in non proper installation of Oracle, today I reinstall Oracle with correct value of SWAP, maxshm and maxuprc and I can connect from Mac, but after rebooting Solaris it again unvisible.
System generate proper files listener.ora
tnsnames.ora and sqlnet.oraset
But when start connect to db I have message: The Network Adaptor could not establish the connection.
I'll post these files
Avatar of gbcbr

ASKER

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.7)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.7)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle
do you start you listner and oracle service after reboot? try this:
sqlplus / as sysdba
startup
exit
lsnrctl status
lsnrctl start
Avatar of gbcbr

ASKER

it doesn't start, maybe we need some path
# lsnrctrl status
lsnrctrl: not found
# su - oracle
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
$ lsnrctrl status
ksh: lsnrctrl:  not found
$
Try the env setup I mentioned in http:#a33719083.
Avatar of gbcbr

ASKER

I put all path to .profile, but still can't find lsnrctl
So i found it manually and run, but it shows too much errors:

# /u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 21-SEP-2010 18:23:59

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Message 850 not found; No message file for product=network, facility=NL
LSNRCTL> start
Message 1070 not found; No message file for product=network, facility=TNSTNS-12545: Message 12545 not found; No message file for product=network, facility=TNS
 TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
  TNS-00515: Message 515 not found; No message file for product=network, facility=TNS
   Solaris Error: 2: No such file or directory
LSNRCTL>
>>I put all path to .profile, but still can't find lsnrctl

Then the PATH you added is wrong.

You need to have ORACLE_HOME set as well.  

What we really need to see is the 'status' not the 'start' (unless the listener isn't running).
Avatar of gbcbr

ASKER

LSNRCTL> status
Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS
 TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
  TNS-00511: Message 511 not found; No message file for product=network, facility=TNS
   Solaris Error: 146: Connection refused
Did you set up ORACLE_HOME and have the proper PATH before you ran the status?
Avatar of gbcbr

ASKER

#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident      "@(#)local.profile      1.10      01/06/23 SMI"
stty istrip
umask 022
DISPLAY=:0.0
export DISPLAY
PATH=/usr/bin:/usr/ucb:/etc:/usr/openwin/bin:.
export PATH
TMP=/tmp
TMPDIR=/tmp
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=orcl
ORACLE_OWNER=oracle
export ORACLE_HOME ORACLE_BASE ORACLE_SID ORACLE_OWNER
ADR_BASE_LISTENER=/u01/app/oracle
export ADR_BASE_LISTENER
The PATH isn't set up property:

export PATH=$ORACLE_HOME/bin:/usr/bin:/usr/ucb:/etc:/usr/openwin/bin:.
Avatar of gbcbr

ASKER

I don't understand why they are not the same

#
# Copyright (c) 2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# ident      "@(#)local.profile      1.10      01/06/23 SMI"
stty istrip
umask 022
DISPLAY=:0.0
export DISPLAY
PATH=$ORACLE_HOME/bin:/usr/bin:/usr/ucb:/etc:/usr/openwin/bin:.
export PATH
TMP=/tmp
TMPDIR=/tmp
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=orcl
ORACLE_OWNER=oracle
export ORACLE_HOME ORACLE_BASE ORACLE_SID ORACLE_OWNER
ADR_BASE_LISTENER=/u01/app/oracle
export ADR_BASE_LISTENER

# su - oracle
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
$ env
_=/bin/env
LANG=C
HZ=
PATH=/bin:/usr/bin:/usr/ucb:/etc:/usr/openwin/bin:.
ORACLE_BASE=/u01/app/oracle
LOGNAME=oracle
MAIL=/var/mail/oracle
ORACLE_SID=orcl
ORACLE_OWNER=oracle
DISPLAY=:0.0
SHELL=/bin/ksh
ADR_BASE_LISTENER=/u01/app/oracle
HOME=/export/home/oracle
TERM=xterm
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
PWD=/export/home/oracle
TZ=EET
$
>>I don't understand why they are not the same

Different users have different profiles.  Why do you think they should be the same?

You really can't add $ORACLE_HOME to the PATH before you set it.  Move the PATH statement below the ORACLE_HOME statement.
Avatar of gbcbr

ASKER

these are .profile and env from one user - oracle
>>these are .profile and env from one user - oracle

The first looks like it is from 'root', then you did a 'su - oracle' which executes oracle's profile.
OH, are you saying the first is actually oracle's .profile and not root's or /etc/profile?
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gbcbr

ASKER

PATH=/u01/app/oracle/product/11.2.0/dbhome_1/bin:/usr/bin:/usr/ucb:/etc:/usr/ope.......
Thank you very much!
It starts work!

LSNRCTL> start
Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/unknown/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                21-SEP-2010 19:13:16
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/unknown/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                21-SEP-2010 19:13:16
Uptime                    0 days 0 hr. 0 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/unknown/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> $
>>  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))


The listener.ora file is telling it to use port 1521.  Where are you getting the original port 1527?
Avatar of gbcbr

ASKER

I don't now. For me it's little bit confusing, because when I was connect locally it shows 1527, but remotely 1521. Maybe for local and remote connections Oracle use different ports?
>>Maybe for local and remote connections Oracle use different ports?

Nope.  add the ip address 10.1.1.7 and 1521 in sqldeveloper connection fields and see if you can connect.
Avatar of gbcbr

ASKER

No connection, message error ORA-12505, TNS:listener does not currntly know of SID given in connect description.
For me this is strange - in lsnrctl window only listener.ora, but no tnsnames.ora
But all information about SID in tns file

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=orcl)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                21-SEP-2010 20:27:26
Uptime                    0 days 0 hr. 0 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/unknown/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=orcl)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL>
sorry I missed that the first time:
The database hasn't registered with the listener yet.  Is the database up and running?
Avatar of gbcbr

ASKER

I've reinstall system completely, so I don't want any local work on DB. I plan to connect to Oracle from iMac with SQL Developer. But at the moment I have problem to connect to DB to SQLD.
It looks very strange, because SID_NAME wrote directly in tnsnames.ora
The listener status doesn't show it is listening for a database.   The database should register with the listener on startup.

The status should shoe something like (assuming your database is called ORCL):
Service "ORCL" has 1 instance(s).
Avatar of gbcbr

ASKER

this I  understand, but why it can't see db?
Avatar of gbcbr

ASKER

So, if listener doesn't see orcl db, we can't see this db from remote?
Avatar of gbcbr

ASKER

I'm crazy, it looks like we try to develop new OS&DB not just install two products from one developer
>>this I  understand, but why it can't see db?

Is the database up and running?  
What is the instance name?

Starting in 10g you no longer need to add instances to the listener.ora file.  The instance is suppose to automatically register with the listener.  

You can manually add an entry in the listener.ora file:
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL)
      (ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = dev1ora)
    )
  )


>>So, if listener doesn't see orcl db, we can't see this db from remote?

Correct.  It's the listeners job to accept the connect request and connect you to the database.  If the listener isn't listening for that database, it can't connect you.

>>it looks like we try to develop new OS&DB not just install two products from one developer

I don't understnad this comment.
Avatar of gbcbr

ASKER

Last comment means that too much time and efforts for very simple installation which has to take one hour job.
Finally I solve problem with your big help. I didn't change anything in listener.ora, I just go with DBCA create new DB sample and connect to it in 1 second, but orcl DB still unavailable, something was wrong in structure.
Again thanks a lot for your great help to understand how it works.

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=orcl)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                22-SEP-2010 08:04:03
Uptime                    0 days 2 hr. 28 min. 51 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/unknown/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=orcl)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.1.1.7)(PORT=1521)))
Services Summary...
Service "sample" has 1 instance(s).
  Instance "sample", status READY, has 1 handler(s) for this service...
Service "sampleXDB" has 1 instance(s).
  Instance "sample", status READY, has 1 handler(s) for this service...
The command completed successfully
check in net configuration orcl DB is added in the services tab.

to open net manager
$ORACLE_HOME/bin netmgr
if it is not added add the service in it.