Oracle SQL*Plus HOST command

Moderator: NorbertKrupa

Post Reply
User avatar
Josh
Intermediate
Intermediate
Posts: 106
Joined: Thu Jan 26, 2012 9:38 pm

Oracle SQL*Plus HOST command

Post by Josh » Fri Apr 03, 2015 11:29 am

Hi,

In Oracle SQL*Plus there is a HOST command that can be used to display the operating system prompt. From there I can enter operating system commands which do not effect my SQL*Plus session which stays connected to the DB. There doesn't seem to be a HOST command in vsql. Anyone know if there is a work around?
Thank you!
Joshua

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: Oracle SQL*Plus HOST command

Post by JimKnicely » Fri Apr 03, 2015 11:41 am

Hi,

In vsql you can use the \! meta-command all by itself to temporarily leave vsql.

The example below will show you that the vsql session is unaffected:

Code: Select all

dbadmin=> create table t (c int);
CREATE TABLE

dbadmin=> insert into t values (1);
 OUTPUT
--------
      1
(1 row)

dbadmin=> select current_session(), * from t;
         current_session          | c
----------------------------------+---
 vertica01.avnet.com-6565:0x7b2a5 | 1
(1 row)
I did not commit the data.

In vsql use the meta-command \! to leave vsql, and then type "exit" at the OS prompt to get back into vsql:

Code: Select all

dbadmin=> \!
[dbadmin@vertica01 ~]$ exit
exit
Back in vsql, the session id remains the same and the T table still has the uncommitted data:

Code: Select all

dbadmin=> select current_session(), * from t;
         current_session          | c
----------------------------------+---
 vertica01.avnet.com-6565:0x7b2a5 | 1
(1 row)

dbadmin=> rollback;
ROLLBACK
dbadmin=> select * from t;
 c
---
(0 rows)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

User avatar
Josh
Intermediate
Intermediate
Posts: 106
Joined: Thu Jan 26, 2012 9:38 pm

Re: Oracle SQL*Plus HOST command

Post by Josh » Fri Apr 03, 2015 2:16 pm

Thanks, Jim!!! Great example, too.
Thank you!
Joshua

Post Reply

Return to “vSQL”