So yesterday I was fighting with importing cx_Oracle and it finally worked. However, I could not connect to the database. So I checked sqlplus to find out, whether I can connect to my Oracle database at all. I have tried both SYS and SYSTEM with the password I set during configuration as well as SCOTT/TIGER, but nothing helps and I get always the same error. This is what is printed:
[gruszczy@gruszczy-laptop matches]$ sqlplus
SQL*Plus: Release 11.2.0.2.0 Beta on Sat Jun 11 12:33:48 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter user-name: sys
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: system
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Enter user-name: scott
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Process ID: 0
Session ID: 0 Serial number: 0
Do you have any idea, what might not have been set? I have found information on Google, that I need to have no trailing slash in ORACLE_HOME and ORACLE_SID set. I have done both those things:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=XE
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
Is there anything that I have done wrong or do I have to set up something more?
EDIT
My tnsnames.ora:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gruszczy-laptop)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
EDIT
I tried doing suggested operations and got this:
$ sudo su - oracle
$ -bash-4.2$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Beta on Sat Jun 11 21:47:15 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00130: invalid listener address '(ADDRESS=(PROTOCOL=TCP)(HOST=gruszczy-laptop)(PORT=1521))'
SQL> Disconnected
-bash-4.2$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Beta on 11-JUN-2011 21:47:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gruszczy-laptop)(PORT=1521)))
This doesn't say me anything and I have no idea, how this all should be configured. I have never had to set this up before. Also usually before I try doing anything I start database with 'Start Database' application.