I have some vague recollections of Oracle databases needing a bit of fiddling when you reboot for the first time after installing the database. However, you haven't given us enough information to work on. To start with:
sqlplus / as sysdba
from within the VM?listener.log
file (in %ORACLE_HOME%\network\log
) since the last reboot?EDIT: I've now been able to come up with a scenario which generates the same error message you got. It looks to me like the database you're attempting to connect to has not been started up. The example I present below uses Oracle XE on Linux, but I don't think this makes a significant difference.
First, let us confirm that the database is shut down:
$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 17 18:16:43 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance.
It's the text Connected to an idle instance
that tells us that the database is shut down.
Using sqlplus / as sysdba
connects us to the database as SYS without needing a password, but it only works on the same machine as the database itself. In your case, you'd need to run this inside the virtual machine. SYS has permission to start up and shut down the database, and to connect to it when it is shut down, but normal users don't have these permissions.
Now let us disconnect and try reconnecting as a normal user, one that does not have permission to startup/shutdown the database nor connect to it when it is down:
SQL> exit Disconnected $ sqlplus -L "user/pw@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)))" SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 17 18:16:47 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. ERROR: ORA-12505: TNS:listener does not currently know of SID given in connect descriptor SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
That's the error message you've been getting.
Now, let's start the database up:
$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 17 18:17:00 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 805306368 bytes Fixed Size 1261444 bytes Variable Size 209715324 bytes Database Buffers 591396864 bytes Redo Buffers 2932736 bytes Database mounted. Database opened. SQL> exit Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
Now that the database is up, let's attempt to log in as a normal user:
$ sqlplus -L "user/pw@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)))" SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 17 18:17:11 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL>
We're in.
I hadn't seen an ORA-12505 error before because I don't normally connect to an Oracle database by entering the entire connection string on the command line. This is likely to be similar to how you are attempting to connect to the database. Usually, I either connect to a local database, or connect to a remote database by using a TNS name (these are listed in the tnsnames.ora file, in %ORACLE_HOME%\network\admin
). In both of these cases you get a different error message if you attempt to connect to a database that has been shut down.
If the above doesn't help you (in particular, if the database has already been started, or you get errors starting up the database), please let us know.
EDIT 2: it seems the problems you were having were indeed because the database hadn't been started. It also appears that your database isn't configured to start up when the service starts. It is possible to get the database to start up when the service is started, and to shut down when the service is stopped. To do this, use the Oracle Administration Assistant for Windows, see here.