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.
CodePudding user response:
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>
CodePudding user response:
- 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.
- 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)