-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec_sql.1
More file actions
151 lines (151 loc) · 4.28 KB
/
Copy pathexec_sql.1
File metadata and controls
151 lines (151 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.TH "oradba\-exec\-sql" "1" "13/12/2013" "User commands" "User commands"
.SH "NAME"
oradba\-exec\-sql \- Execute a SQL-query or a SQL-file in Oracle databases\.
.SH "SYNOPSIS"
.HP
\fBoradba\-exec\-sql\fR [\fI\-\-database DB\fR] [\fI\-\-user DB_USER\fR] [\fI\-\-password PWD\fR]
[\fI\-\-log\-dir LOGDIR\fR] [\fI\-\-log\-name LOGNAME\fR] [\fI\-\-log\-mode LOGMODE\fR]
\fI"SQL\-query|SQL\-file"\fR [\fIArg1 Arg2 \.\.\.\fR]
.SH "DESCRIPTION"
\fBoradba\-exec\-sql\fR should be used to execute a SQL\-query or SQL\-file in Oracle databases\. \fBoradba\-exec\-sql\fR commonly used in \fBcron\fR(8) tasks\.
.PP
It can setup all \fBoradba\-exec\-sql\fR options in configuration file \fI/etc/oradba/oradba\-exec\-sql.conf\fR\.
.PP
\fBoradba\-exec\-sql\fR simplifies common actions while execute SQL\-query:
.PP
.RS
* connect to the target database;
.br
* safety storage database passwords in \fBOracle Password Repository\fR;
.br
* centarlized storage and rotation log\-file of executing SQL\-queries\.
.RE
.SH "OPTIONS"
.SS "Mandatory arguments"
.TP
\fB\-u\fR, \fB\-\-user\fR DB_USER
Database user to conect to\. This option should be present either in configuration file or in command line\.
.SS "Optional arguments"
.TP
\fB\-p\fR, \fB\-\-password\fR DB_PWD
Database password to connect to. Database passwords keeps in password repository \- \fBOracle Password Repository\fR, which mantains with \fBopr\fR(8) utility\.
.TP
\fB\-b\fR, \fB\-\-database\fR DB
TNSAlias of target database\. Default is \fIlocal\fR\.
.TP
\fB\-l\fR, \fB\-\-log\-name\fR LOGNAME
Name of log\-file\. Default is autogenerate\. Logfiles created in LOGDIR.
.TP
\fB\-r\fR, \fB\-\-log\-dir\fR LOGDIR
Directory to keep logfiles\. Default is \fI/var/log/oradba/exec\-sql\fR\.
.TP
\fB\-o\fR, \fB\-\-log\-mode\fR LOGMODE
Select logger mode (default \fIauto\fR):
.RS
.IP
runit \- svlogd from \fBRunIt\fR;
.br
dtools \- multilog from \fBDaemonTools\fR;
.br
syslog \- logger for \fBSysLog\fR;
.br
file \- plain logfile with \fBLogRotate\fR rotation\.
.RE
.IP
Logger mode detects automatically or can be setted in configuration file or as command line option\.
.HP
\fBSQL\-query\fR \- SQL\-query to execute in a target database
.HP
\fBSQL\-script\fR \- SQL\-file to execute in a target database
.IP
[Arg1 Arg2 \.\.\.] \- optional argumants for SQL\-file
.SH "CONFIGURATION"
.PP
Configuration paramaters stored in file \fI/etc/oradba/oradba\-exec\-sql.conf\fR\.
.TP
\fBDB\fR
Target database\.
.TP
\fBDB_USER\fR
Database user to connect to.
.TP
\fBNLS_LANG\fR
Oracle NLS parameters\.
.TP
\fBLOG_FILE\fR
Name of Log\-file to write output and error streams\.
.TP
\fBLOG_MODE\fR
Logger mode\.
.TP
\fBLOG_DIR\fR
Logdir to keep log\-files\.
.TP
\fBOLD_LOG_KEEP_DAYS\fR
Keep old log\-files in days\.
.SH "ENVIRONMENTS"
.TP
\fBORACLE_HOME\fR
Oracle home\.
.TP
\fBDB_APPINFO\fR
Session identifier in database\.
.TP
\fBDB\fR
TNSAlias of database to connect to\.
.TP
\fBDB_USER\fR
Database user to connect to\.
.TP
\fBDB_PWD\fR
Database password to connect to\.
.TP
\fBOPR\fR
Excutables to access to Oracle Password Repository\.
.TP
\fBSQLPLUS_FORMAT\fR
User's file to format Oracle SQLPlus output\.
.TP
\fBLOG_DIR\fR
Base directory for logfiles\.
.SH "EXAMPLES"
.SS "Execute SQL in cron"
.IP
*/5 * * * * /usr/bin/oradba\-exec\-sql "select 1 from dual"
.RS
.IP
Logname is generated as select_1_from_dual
.RE
.IP
*/5 * * * * /usr/bin/oradba\-exec\-sql \-\-user TEST \-\-log\-name my\-log "select 1 from dual;"
.RS
.IP
Logname my\-log
.RE
.SS "Execute in command line"
.IP
/usr/bin/oradba\-exec\-sql \-\-user test \-\-password test \-\-database TEST \-\-log\-dir /tmp \-\-log\-name test \-\-log\-mode file "select 1 from dual"
.IP
Result will output in file /tmp/test\.
.SH "AUTHOR"
.PP
Kryazhevskikh Sergey, <soliverr@gmail.com>
.SH "FILES"
.TP
\fI/etc/oradba/oradba\-exec\-sql.conf\fR
Configuration parameters for \fBoradba\-exec\-sql\fR\.
.TP
\fI/etc/oradba/sqlfunctions.def\fR
Oracle SQLPlus defines to format output\.
.TP
\fI/var/log/oradba/exec\-sql/oradba\-exec\-sql.log\fR
Main log\-file to keep history of executed command\.
.TP
\fI/var/log/rias/oradba\-exec\-sql\fR
Directory to keep log\-files\. It can be redefined by \-\-log\-dir command line argument or into configuration file.
.SH "BUGS"
.PP
Erros should be reported through ITS \fBhttp://sourceforge.net/oracledba\fR\.
.SH "SEE ALSO"
.PP
\fBopr\fR(8)