One issue with the sed solutions posted up to now: all output from your sqlplus command will be logged with the same time (the time the command was invoked).
This little function should log the time each line in output, which you may find much more usefull in debugging those slow SQL statements:
Edit - Another thing to be aware of is the return status of your sqlplus command will be lost (replaced with that of sed or logoutput), so ensure you don't rely on $? in the script following the sqlplus call
Last edited by Chubler_XL; 11-23-2010 at 11:31 PM..
Reason: Added warning about return status
Hi,
I am using a query like below in my shell script :
{
{
echo "set echo off"
echo "set head off"
echo "whenever sqlerror exit -1;
select NUMBER ||','||
FNAME ||','||
LOC ||','||
... (2 Replies)
HELLO,
I am using such a command to write oracle sqlplus query result to text file:
sqlplus -S xxx/xxx@xxxxxxx @\tmp\2.sql>\tmp\123.txt
Is it possible to script that:
If command succesfull write in \tmp\log.txt:
timestamp and "succeded"
and create 123.txt with results
else
If error... (2 Replies)
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
UNIX Gods,
I'll be running this script from CRON. I need to log the status of each of the six sqlplus calls into a file when this job is kicked off. Any suggestions?
Thanks in advance.
#!/bin/ksh
export USAGE="USAGE: `basename $0` -e <DBUSER> <DBPASSWD> <TNSNAME>"
if ; then
... (2 Replies)
On psql
select titolo,lingua from titolo where titolo ~* 'brivid';
titolo | lingua
------- + ------
Brivido | 1
On Sqlplus/gqsql
SQL> select titolo,genere,anno,lingua from titolo where titolo like '%rivid%';
TITOLO... (6 Replies)
Hi Guys,
I am using set -x in my script to track the flow of the script.
But if i want to write the output of the set -x into a log file, how do i do it?
Thanks,
Ajay (3 Replies)
Hi,
facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there.
ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Hi
I am trying to write output to a file in columns
I have file in the follwoing:
# cat file
abc
def
#
I am trying to write next output as like
# cat file
abc 123
def 345
#
:mad: (6 Replies)
HI
I am trying to grep 3 characters from hostname and append a character at the end.
I tried as in the following:
root@abag3:~# hostname | cut -c1-3
hyu
Now I am trying to append "g" at the end of this output as in the following.
root@abag3:~# hostname | cut -c1-3 | sed -s... (4 Replies)
Hello,
I am having problem while redirecting output to a file where as on console output is proper.
for dir in */; do printf "%s, " "$dir"; ls -m "$dir"; echo; done > output.txt
Output of above command is coming in single line but when i am redirecting output to a file, single line i... (10 Replies)
Discussion started by: Manoj Rajput
10 Replies
LEARN ABOUT DEBIAN
cback-span
cback-span(1) Kenneth J. Pronovici cback-span(1)NAME
cback-span - Span staged data among multiple discs
SYNOPSIS
cback-span [switches]
DESCRIPTION
This is the Cedar Backup span tool. It is intended for use by people who back up more data than can fit on a single disc. It allows a
user to split (span) staged data between more than one disc. It can't be a Cedar Backup extension in the usual sense because it requires
user input when switching media.
Generally, one can run the cback-span command with no arguments. This will start it using the default configuration file, the default log
file, etc. You only need to use the switches if you need to change the default behavior.
This command takes most of its configuration from the Cedar Backup configuration file, specifically the store section. Then, more informa-
tion is gathered from the user interactively while the command is running.
SWITCHES -h, --help
Display usage/help listing.
-V, --version
Display version information.
-b, --verbose
Print verbose output to the screen as well writing to the logfile. When this option is enabled, most information that would normally
be written to the logfile will also be written to the screen.
-c, --config
Specify the path to an alternate configuration file. The default configuration file is /etc/cback.conf.
-l, --logfile
Specify the path to an alternate logfile. The default logfile file is /var/log/cback.log.
-o, --owner
Specify the ownership of the logfile, in the form user:group. The default ownership is root:adm, to match the Debian standard for
most logfiles. This value will only be used when creating a new logfile. If the logfile already exists when the cback script is
executed, it will retain its existing ownership and mode. Only user and group names may be used, not numeric uid and gid values.
-m, --mode
Specify the permissions for the logfile, using the numeric mode as in chmod(1). The default mode is 640 (-rw-r-----). This value
will only be used when creating a new logfile. If the logfile already exists when the cback script is executed, it will retain its
existing ownership and mode.
-O, --output
Record some sub-command output to the logfile. When this option is enabled, all output from system commands will be logged. This
might be useful for debugging or just for reference. Cedar Backup uses system commands mostly for dealing with the CD recorder and
its media.
-d, --debug
Write debugging information to the logfile. This option produces a high volume of output, and would generally only be needed when
debugging a problem. This option implies the --output option, as well.
-s, --stack
Dump a Python stack trace instead of swallowing exceptions. This forces Cedar Backup to dump the entire Python stack trace associ-
ated with an error, rather than just progating last message it received back up to the user interface. Under some circumstances,
this is useful information to include along with a bug report.
RETURN VALUES
This command returns 0 (zero) upon normal completion, and six other error codes related to particular errors.
1 The Python interpreter version is < 2.5.
2 Error processing command-line arguments.
3 Error configuring logging.
4 Error parsing indicated configuration file.
5 Backup was interrupted with a CTRL-C or similar.
6 Other error during processing.
NOTES
Cedar Backup itself is designed to run as root, since otherwise it's difficult to back up system directories or write the CD or DVD device.
However, this command can be run safely as any user that has read access to the Cedar Backup staging directories and write access to the CD
or DVD device.
SEE ALSO cback(1)FILES
/etc/cback.conf - Default configuration file
/var/log/cback.log - Default log file
BUGS
Report bugs to <support@cedar-solutions.com>.
AUTHOR
Written by Kenneth J. Pronovici <pronovic@ieee.org>.
COPYRIGHT
Copyright (c) 2007,2010 Kenneth J. Pronovici.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
Cedar Backup July 2010 cback-span(1)