0

I have downloaded sqlplus instant client on mac and have sqlplus working. I need to login as system and connect hr schema or make a new schema. i'm having problems connecting.

user@togo ~ % export PATH=~/Downloads/instantclient_19_8:$PATH
user@togo ~ % sqlplus

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Jul 1 11:43:25 2022
Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Enter user-name: sqlplus /nolog
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: system
Enter password: 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


Enter user-name: sys as sysdba
Enter password: 
ERROR:
ORA-12162: TNS:net service name is incorrectly specified


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

If anyone could help me with this problem or guide me through the process of using sqlplus on Mac.

2
  • SQL*Plus is a client; do you have an existing database to connect to - and if so have you set up your tnsnames.ora file so you have a TNS alias to use during login, or at least have the details for a easy-connect connection string? Commented Jul 1, 2022 at 8:04
  • i'm trying to connect to hr schema which already exists on oracle database. Can you help me set up the tnsnames.ora? Commented Jul 1, 2022 at 9:23

2 Answers 2

1
  1. First you need to figure out on what host your database is running and what the service names are that you can use to connect to.
  2. Next create a tnsnames.ora using the info learned from 1 or use EZCONNECT to connect without tnsnames.ora
assume your dbserver is reachable as linux01
assume your database supports the service dbservice1
assume the listener on linux01 for dbservice1 is on port 1521

your EZCONNECT can be done

using sqlplus hr/bigsecretpassword@//linux01/dbservice01

or if your listener is on a different port (1527) you can specify that

using sqlplus hr/bigsecretpassword@//linux01:1527/dbservice01

Lots of error message are possible. If you get errors, don't forget to specify the exact message you get. (and how long it took before it came)

Sign up to request clarification or add additional context in comments.

Comments

0

I don't use Mac, but - generally speaking, database name (i.e. its alias) is specified along with username. Something like this on my MS Windows:

M:\>sqlplus

SQL*Plus: Release 18.0.0.0.0 - Production on Pet Srp 1 09:11:18 2022
Version 18.5.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Enter user-name: scott@orcl                --> this!
Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

Active code page: 1250

SQL>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.