Using oracle easy connect does it really connect to the remote DB

oraclesqlplus

I tried connecting to remote host db using :

 sqlplus abc/abc@hostname1:1000/ABC

And tried printing

!hostname

it still shows me local hostname from which I am running and not HOSTNAME1.

So if I want statistics or run a script on that remote host .. Would it not do that..
i.e. Do I actually get data from remote host?

Is it bcoz !hostname is not a linux command and not a DB command?

Best Answer

The answer is very simple. The ! prefix in sqlplus executes the following text as a command in the local shell.

In your case it's executing the Unix hostname command locally.

Query v$instance to check the name of the machine you're connected to.

There are ways to execute local Unix commands via the database, but it's seen as a huge security hole, so I won't document them here.

ssh (assuming Unix) into the database host instead.