Reputation: 1
I've seen a lot of tutorials already and I can't figure it out. Database connection is ok (checked on SQL PLUS) Listener ok. But I'm still getting this error: enter image description here
Another thing, they say is to check the file tnsnames.ora, but that's odd because this file is inside a folder called sample (it shouldn't be, right?) enter image description here
I need to install Oracle for a course. I'm begginer on this (sorry if my explanation is not perfect). I hope someone can help me. Thanks!
Upvotes: 0
Views: 4833
Reputation: 1
Check the working of services: OracleOraDB21Home1TNSListener, OracleServiceXE
Upvotes: 0
Reputation: 11591
First we should see if your database is running OK. So do
Start => cmd => sqlplus / as sysdba
If your database is installed correctly and running you'll see:
C:\>sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Wed Nov 10 12:28:07 2021
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL>
You can type "exit" to get out of SQL Plus. If not even that works, then something has probably gone wrong with the install in which case I'll refer you to the video at the end of this answer as a walk-through of the entire process.
Assuming your database is running, the next thing is check that the listener (which lets you connect to the database from elsewhere, eg SQL Developer) is running and configured OK. A common issue is it might be listening on the wrong IP address based on the host information it found on the PC.
If you run
Start => cmd => lsnrctl status
you will be told if your listener is up and running and what IP address is it listening on
C:\>lsnrctl status
LSNRCTL for 64-bit Windows: Version 21.0.0.0.0 - Production on 10-NOV-2021 12:30:48
Copyright (c) 1991, 2021, Oracle. All rights reserved.
...
...
Listener Parameter File C:\oracle\product\21c\homes\OraDB21Home1\network\admin\listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxx.xxx.xxx.xxx)(PORT=1521)))
...
...
That is the IP address you would need to enter in SQL Developer. Alternatively, you could edit the listener.ora (as per the path in the output above) and change the HOST= to HOST=localhost. The process for this is:
lsnrctl stop
edit the listener.ora file to change to localhost
stop the listener either via Services or running (via cmd as Adminstrator)
lsnrctl start
Then lsnrctl status should something like
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
and then you should be good to go.
Note that for Express Edition, the default service name is XEPDB1 rather than using a SID of XE. If you get an error that you can't connect to XEPDB1, it might be that the pluggable database is not open. With your SQL Plus you can check that as well with:
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
------------------------------ ----------
PDB$SEED READ ONLY
XEPDB1 MOUNTED
SQL> alter pluggable database XEPDB1 open;
Pluggable database altered.
SQL> alter pluggable database all save state;
Pluggable database altered.
If it shows MOUNTED, the last two commands will open it and make sure it is opened automatically next time you reboot your PC.
If you get totally stuck, you can start from scratch following the video from the Windows XE team
Upvotes: 4