0

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?

1 Answer 1

2

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.

1
  • Is there a way to run this command on the remote host through sqlplus? Commented Jun 25, 2014 at 23:58

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.