Shortcuts for Running SQL Commands and Scripts
For more information about the individual SQL scripts relevant to administration and to troubleshooting or performance tuning, see Tools.
After logging in to a console window and invoking:
source /opt/lce/tools/source-for-psql-shortcuts.sh
A reminder banner will appear:
USAGE of the enabled shortcuts:
psqlc "<a SQL command>"
psqlf <path to script with SQL commands> [<arg1> [<arg2> [...]]]
psqli
Invokes interactive prompt. Note that you can also invoke SQL scripts
from within the interactive prompt, like so: \i <path to script>
; you will then be prompted for script args.
psqlf
You can use the psqlf
shortcut to run the various SQL scripts packaged with Log Correlation Engine that are found under /opt/lce/tools/pg-helper-sql/
.
Here is an example of running a SQL script that takes no arguments:
psqlf pg-helper-sql/recent-alerts-24hours.sql
And here is an example of running a SQL script that takes an argument:
psqlf pg-helper-sql/disk-usage-one-silo.sql 0
To quickly locate and run a script:
-
Log in to Log Correlation Engine via the command line interface (CLI).
-
Type
psqlf
followed by a space. -
Type the first few letters of the name of the script you want to run. For example, to run wal-activity.sql, you can type wa.
-
Press Tab.
psqlf automatically completes the name of the script.
-
To run the script, press Enter.
Log Correlation Engine runs the selected script.