Reputation: 29
This is the first time I interact with a database or with sqlplus, but I'm coursing a subject called Data Bases in my college and we were told to install sqlplus with no further assistance and "to type sqlplus
with the user SYS
and the password we choosed during the installation", so I followed the described procedure to install it in my Ubuntu 18.04 computer in the upvoted question here https://askubuntu.com/questions/159939/how-to-install-sqlplus and everything worked out fine, except that I wasn't asked to write a password, and when I tried the instruction my professor gave me (to type sqlplus with the user SYS) I get the error ORA-12162: TNS:net service name is incorrectly specified.
After a long time reading, I jumped into the conclusion that I should export my SID, and I exported the one described here: http://www.dba-oracle.com/t_ora_12162_tns_net_service_name.htm
ORACLE_HOME=/u01/oracle; export ORACLE_HOME
ORACLE_SID=asdb; export ORACLE_SID
but that didn't work either, and I read I should export my SIDE, which I tried to find by writing
sqlplus \nolog
SELECT instance FROM v$thread;
but then I get SP2-0640: Not connected, so I don't really get what I'm suppose to do when my professor asks us to type sqlplus (I think is to connect with my own database that I installed when I installed sqlplus, but I'm not sure) and why is not working.
When I exposed the whole problem to my professor he extended the assignment due time in one day, but just that.
Upvotes: 2
Views: 9307
Reputation: 7033
There are a couple of things wrong with this scenario:
sqlplus is only a client tool, not the database itself. Either your professor should have provided you with network access to a pre-configured database, along with instructions on how to configure the client tnsnames.ora and sqlnet.ora files, or they should have been more specific and told you to install Oracle Database locally on your system and not just sqlplus.
Oracle products are not supported on Ubuntu (no matter what anyone says about hacking the install to work). You must use Red Hat, Oracle Linux, or SuSE if you want to get expected results.
If you can get Oracle Database installed on a supported operating system, you will have the option to create your first database at the end of the install. Once that is done, your procedure to export ORACLE_HOME and ORACLE_SID is mostly correct. Exact values for ORACLE_HOME and ORACLE_SID should be set during the installation and database creation.
export ORACLE_HOME=/u01/oracle/product/db_1
export ORACLE_SID=orcl
sqlplus /nolog
SQL> connect sys as sysdba
OR
SQL> connect / as sysdba
Upvotes: 2