Thursday, December 11, 2008

Oracle System Help

The man pages of unix is the best place to know about every nook and corner of a command on unix, how about similar help on an Oracle server as well ?. There is a feature on any Oracle database which prints the basic information needed about a particular sqlplus command.

A system.help table which is not already present on a database, but which needs to be created by running a script from $ORACLE_HOME/sqlplus/admin/help directory. When the hlpbld.sql script along with the helpus.sql script as the command line argument is executed, it creates a table called HELP, usually this table needs to be created under the SYSTEM scehma. This means the hlpbld.sql script needs to be executed from the SYSTEM user as shown below.


SQL> conn system/manager
Connected.
SQL> !pwd
/export/oracle/home/product/10.2.0/sqlplus/admin/help


SQL> @hlpbld.sql "helpus.sql" --- This creates the help table and populates it

Now, the index of the help on sqlplus commands can be viewed with a "HELP INDEX" command from the sql prompt, which is one of the topics that HELP table offers.



Alternatively, "? INDEX", also prints the same output. All, this "HELP/?" command does is run a select query against the system.help table in the background
with the parameter that you pass in the where clause by equating it to the topic column.



SQL> set line 1000
SQL> col topic for a5
SQL> col seq for 999
SQL> select * from system.help where topic='INDEX';


SQL> ? RECOVER

SQL> HELP SHUTDOWN