when I user sqlplus name@orcl
to connect to oracle,after enter password,
I just get that:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
then, I enter username and password, and connect success
How to resolve it?
other information:
1. instance
2. tnsnames.ora
3. listener.ora
You don't connect to a "database" as such, you talk to a "listener" which ultimately hands off your request to the database.
So in your case, your database understands a service called "orcl", but until it sends that fact to the listener ("Hey, if someone asks for 'orcl' then I am your guy), then the listener is unaware of that, and you'll get the error you saw.
So the challenge here is working out the database did not communicate with the listener. You can try:
From the database:
SQL> alter system register
then check 'lsnrctl status' again - see if orcl is the in the list of offered services.
If that doesn't work, then you can set the 'local_listener' parameter to explicitly tell the database which listener you want it to liaise with. Then you would do 'alter system register' again, and once again, check 'lsnrctl status' to see services.
If after all that, it still doesn't work, you can explicitly configure the listener itself the details about the service 'orcl', but if you end up there, then its likely you have some sort of fundamental configuration issue we'd need to explore more.