Can anyone tell me in detail,what is the difference between sqlplus sys/ as sysdba
and sqlplus sys@xe as sysdba
?For the records the database is installed on the same machine as the client.
-
One conn goes through the listener, the other doesn't and attaches directly.– PhilᵀᴹCommented Jan 30, 2013 at 19:51
2 Answers
sqlplus sys/ as sysdba
connects directly to the database without using networking (TNS. This type of connection is called a bequeath connection.
sqlplus sys@xe as sysdba
connects through the listener.
@xe
defines the database where you are connecting to. Since it in your case seems to be the same as without defining it specifically, it points the connection to this same database.
No difference in privileges etc.
So, in practice, there is no difference in the result in your case.
-
2Incorrect. @xe forces the connection through the listener. / as sysdba doesn't require a listener as it connects directly.– PhilᵀᴹCommented Jan 30, 2013 at 20:51
-
Since the connection ends up to same database with same privileges, I believe that making a quick jump at the listener is not that relevant for the asker. Commented Jan 30, 2013 at 21:02
-
It does make a difference. You can't connect to an idle instance through the listener. This is needed e.g. in order to startup or shutdown the instance.– user1822Commented Jan 30, 2013 at 22:49