DB2 V9.1 Linux Script
Hi Please can someone assist with a OFFLINE BACKUP script in linux.
I am running RH4 db2 V9.1 and SAP NW7.
I would like to :
1> STOP SAP
2> START DB MANAGER
3> BACKUP DB OFFLINE
4> STARTSAP.
I am able to do the above on the command line but the problem is i would like to script it and run in cron at 2am.
Any assistance will be appreciated.
Hussen
Hi Hussen,
One thing you have to ensure for this method is that after the stopsap, that all connection to the database are stopped. If you have any left-over connection outside of SAP (db2bp process from a CLP connection), offline backup will complain.
So, if you are sure it's safe to close all the connections at 2:00 am, you can add:
db2 force applications all
<wait for a while e.g. 2 minutes>
before the offline backup to make sure all connections are gone.
Regards,
-Beck
Similar Messages
-
How to avoid creation of ^M in linux scripts
Hi All
How to avoid creation of ^M in linux scripts
RegardsIf you keep your scripts on linux, there will be no ^M's.
If you use FTP, set transfer type to ASCII. (ascii command)
If you have scripts that show ^M's, you can get rid of them using vi(m) command:
1,$s/ <CTRL>v <CTRL>m //
(where <CTRL>-v means holding the CTRL button and pressing the "v" button, same for "m")
!! Please mind that, whilst it doesn't give any errors most of the time, it can give very strange and unexpected errors in certain cases.
It did give errors on linux+oracle 9 listener (!!!) -
Linux script for PGP encryption
Hello,
We are trying to do PGP encryption by giving the OS command in the File adapter. Can somebody provide me the exact linux script that we should use to do PGP encryption?
Note: We have XI-3.0 on LINUX.
Promise points for helpful answers.
Regards,
Raji.Hi Rajashree
PGP Encryption is used to support the transmission of sensitive data to / from third party systems via XI.
Adapter modules are developed to encrypt the file using PGP.
We had a similar requirement where we used PGP encryption.The module was developed using Cryptix OpenPGP which is a Java implementation of the OpenPGP standard.When the module is called in the adapter, it uses the PGP key provided by the party that will receive the encrypted message. This module should be called prior to calling the Sap adapter
Logic Flow/Processing:
1.Read the XML payload and message for getting the needed data.
2.Read the key to be used in the encryption and log the key to be used and the beginning of the encryption.
3.Call the PGP encryption and compression method.
4.Log whether encryption has been successful.
5.Set as payload the message content encrypted, and the principal data.
6.If any error occurs, logs an exception in PGP adapter module and the error reason.
7.Return the message.
Go through This links
Is there any FTP API available from SAP?
Send Text file to FTP in binary mode with PGP encryption
http://www.webmethods.com/meta/default/folder/0000007429
Converting IDOC to XML
XI implementation
http://www1.webmethods.com/PDF/webMethods_for_SAP-wp.pdf
Current versions found at http://www.cryptix.org and http://www.bouncycastle.org.
http://www.bouncycastle.org/documentation.html
If you want to use the unix script on windows then you need cygwin. Take the shell executable and cygwin.dll and copy them to another machine and try out.
Else you write an .exe or a batch file where you will give your PGP command to encrypt and decrypt and execute it from the OS level in your adapter. Check my answer in this thread:
Re: PGP Encription
Might be useful.
PGP Encription
Re: PGP Encription
\Re: triggering encryption script with XI
Pls rewards if useful -
Run Linux script with Runtime.exec
Hi there!
I want to run some Linux script files out of a Java application.
I'm currently using a code like this:
Runtime rt = Runtime.getRuntime();
Process p=rt.exec("//home//scriptFile1");But this isn't working. Although I'm getting no exeption, the file isn't executed.
It looks like he's doing something, but he's definitly not processing the file.
I think the problem is probably, that in scriptFile1, I call some other script files (which call itself some other script files).
E.g. like this:
scriptFile1:
scriptFile2
binary1
binary2
scriptFile3Any ideas?
Thank you!Hi! I now get at least some error messages, when I call the script file:
knoppix@Knoppix:~/Desktop$ java Main
start
ERROR>/media/hda5/scripts/startds_2: line 1: stop: command not found
ERROR>/media/hda5/scripts/startds_2: line 3: dspp_2: command not found
ERROR>/media/hda5/scripts/startds_2: line 5: killcan: command not found
ERROR>/media/hda5/scripts/startds_2: line 7: canpdemsimeit: command not found
ERROR>/media/hda5/scripts/startds_2: line 9: demsimeit: command not found
ERROR>/media/hda5/scripts/startds_2: line 11: guidemsimeit: command not found
ERROR>/media/hda5/scripts/startds_2: line 13: MCAbrowser: command not found
ExitValue: 0These "lost" commands are all located in the same directory as the script I call, so I wonder why.
I could adjust every command by adding in front of it the absolute path in the script file. That would work. But maybe I can pass in some other way the directory, in which he should search for the commands. That would save me a lot of work...
I will RTFM but if anyone has currently an idea: please post...
THX -
Runtime exec to run linux scripts
Hi,
I have been having trouble running a simple linux script from within my java program. So far, this is the command line i am passing to the exec() method:
String[] commandArray = {"/bin/sh", "-c", "sh",
"/home/charles/java/ideaProjects/Condor/linuxScripts/LinuxSubmit.sh",
"TwoMinTest.cmd"};
Process proc = rt.exec(commandArray);
The last paramater, "TwoMinTest.cmd" is a varibale that is passed to the script. The command works fine from a linux terminal window but from the java program the process just hangs with no out put from the script (the script does an echo "hello" first). Both the error and input streams obtained from the process do not output anything. If i instert a deliberate mistake into the command the error stream outputs it fine. Any idea why it hangs?
thanks, CharlesI've fixed it for anyone who's interested, this is what i did:
String[] commandArray = {"/bin/sh", "-c", "sh"};
Process proc = rt.exec(commandArray);
OutputStream out = proc.getOutputStream();
PrintWriter p = new PrintWriter(out);
p.println("sh /home/charles/java/ideaProjects/Condor/linuxScripts/LinuxSubmit.sh " +
"TwoMinTest.cmd");
p.flush();
and it flew like a bird.
charles -
How do I get additional parameters into a Linux Script / PowerShell Discovery?
Hi all,
I'm trying to do a Linux Shell / PowerShell discovery as described in
http://operatingquadrant.com/2013/07/30/unixlinux-mp-authoring-discovering-and-monitoring-failover-clusters/ but for the
complex logic I need the GUID of the target object and the GUID of the discovery itself ($MPElement$ and $Target/Id$) as additional arguments to either of the scripts.
I tried to insert them into the "ScriptArguments" tag - but they don't show up in either of the scripts.
I tried to edit the code in VSAE, but it complains: "Could not find schema information for the element 'Scheduler'."
I added the (SCSM) "Management Pack Schema Version 1.1 XSD" as described in the blog
VSAE - Could not find schema information, but this also does not help.
Any ideas?
Thanks, Holger
Holger alias "Marvin", the InternetSmurf, Munich, Germany // Where can I edit / remove this signature line? Please do not say "in your profile" - I searched all the profiles I found ...Hi Bob or Vladimir,
here comes the code - I shortened it, I hope, everything necessary is contained:
<TypeDefinitions>
<ModuleTypes>
<DataSourceModuleType ID="MyMP.Linux.XYZ.ServerDiscoveryDataSource" Accessibility="Internal" Batching="false">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.Discovery.MapperSchema</SchemaType>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="Interval" type="xsd:integer" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="TargetSystem" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="ShellCommand" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="ScriptArguments" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="Timeout" type="xsd:integer" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="UserName" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="Password" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="PSScriptName" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="PSScriptBody" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="FilterExpression" type="ExpressionType" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="ClassId" type="xsd:string" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
<xsd:element name="InstanceSettings" type="SettingsType" minOccurs="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Interval" Selector="$Config/Interval$" ParameterType="int" />
<OverrideableParameter ID="Timeout" Selector="$Config/Timeout$" ParameterType="int" />
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/Interval$</Interval>
<SyncTime />
</SimpleReccuringSchedule>
<ExcludeDates />
</Scheduler>
</DataSource>
<ProbeAction ID="InvokeProbe" TypeID="Unix.Authoring.ShellCommand.PropertyBag.ProbeAction">
<TargetSystem>$Config/TargetSystem$</TargetSystem>
<ShellCommand>$Config/ShellCommand$</ShellCommand>
<ScriptArguments>$Config/ScriptArguments$</ScriptArguments>
<Timeout>$Config/Timeout$</Timeout>
<UserName>$Config/UserName$</UserName>
<Password>$Config/Password$</Password>
<PSScriptName>$Config/PSScriptName$</PSScriptName>
<PSScriptBody>$Config/PSScriptBody$</PSScriptBody>
</ProbeAction>
<ConditionDetection ID="Filter" TypeID="System!System.ExpressionFilter">
<Expression>$Config/FilterExpression$</Expression>
</ConditionDetection>
<ConditionDetection ID="Mapper" TypeID="System!System.Discovery.ClassSnapshotDataMapper">
<ClassId>$Config/ClassId$</ClassId>
<InstanceSettings>$Config/InstanceSettings$</InstanceSettings>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="Mapper">
<Node ID="Filter">
<Node ID="InvokeProbe">
<Node ID="Scheduler" />
</Node>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>
</ModuleTypes>
</TypeDefinitions>
<!-- ********** Monitoring ********** -->
<Monitoring>
<Discoveries>
<!-- ***** XYZ Linux Server Discovery ***** -->
<Discovery ID="MyMP.Linux.XYZ.ServerDiscoveryRule" Enabled="true" Target="Unix!Microsoft.Unix.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="MyMP.Linux.XYZ.Server">
<Property TypeID="MyMP.Linux.Server" PropertyID="NetworkName" />
<Property TypeID="MyMP.Linux.Server" PropertyID="Manufacturer" />
<Property TypeID="MyMP.Linux.Server" PropertyID="Model" />
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="MyMP.Linux.XYZ.ServerDiscoveryDataSource">
<Interval>600</Interval>
<TargetSystem>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$</TargetSystem>
<ShellCommand>
<![CDATA[
logfile="/tmp/scom.ServerDiscovery.log"
echo "--------------------------------------" >> $logfile
echo `date` >> $logfile
echo Arguments: $* >> $logfile
echo Arguments: .$1. .$2. .$3. .$4. .$5. >> $logfile
export returnstring=""
export systemmanufacturer=`dmidecode -s system-manufacturer | sed -e 's/^ *//' -e 's/ *$//'`
echo "systemmanufacturer=$systemmanufacturer" >> $logfile
returnstring="$returnstring#systemmanufacturer=$systemmanufacturer"
export systemproductname=`dmidecode -s system-product-name | sed -e 's/^ *//' -e 's/ *$//'`
echo "systemproductname=$systemproductname" >> $logfile
returnstring="$returnstring#systemproductname=$systemproductname"
echo "Done." >> $logfile
echo "--------------------------------------" >> $logfile
echo "$returnstring" >> $logfile
echo "======================================" >> $logfile
echo "$returnstring"
#echo "ServerDiscovery=Done"
]]></ShellCommand>
<ScriptArguments>$MPElement$ $Target/Id$ $Target/Property[Type="Unix!Microsoft.Unix.Computer"]/NetworkName$ $MPElement$ $Target/Id$</ScriptArguments>
<Timeout>300</Timeout>
<UserName>$RunAs[Name="Unix!Microsoft.Unix.PrivilegedAccount"]/UserName$</UserName>
<Password>$RunAs[Name="Unix!Microsoft.Unix.PrivilegedAccount"]/Password$</Password>
<PSScriptName>ServerDiscovery.ps1</PSScriptName>
<PSScriptBody>
<![CDATA[
# Copyright (C) MyCompany 2014
# ServerDiscovery.ps1
# Summary:
# Discover XYZ Linux Server.
Param (
[string]$StdOut,
[string]$StdErr,
[string]$ReturnCode,
[string]$param4,
[string]$param5
$LogFile = "C:\scom\ServerDiscovery.log"
$SplitChar = "#"
function Main
Param (
[string]$StdOut,
[string]$StdErr,
[string]$ReturnCode,
[string]$param4,
[string]$param5
DebugOut "-------------------------------------------------"
DebugOut "Starting ServerDiscovery.ps1"
DebugOut "$(Get-Date -Format F)"
DebugOut "1 StdOut: $StdOut"
DebugOut "2 StdErr: $StdErr"
DebugOut "3 ReturnCode: $ReturnCode"
DebugOut "4 param4: $param4"
DebugOut "5 param5: $param5"
if ($ReturnCode -eq "0")
$serverProperties = $StdOut.split($SplitChar)
foreach ($obj in $serverProperties)
if ($obj -ne $null)
$property = $obj.split("=")[0]
$value = $obj.split("=")[1]
switch ($property)
"sourceid" { $SourceId = $value }
"managedentityid" { $ManagedEntityId = $value }
"hostname" { $PrincipalName = $value
$TargetComputer = $value }
"systemmanufacturer" { $Manufacturer = $value }
"systemproductname" { $ModelName = $value }
default { DebugOut "unknown Property/Value-Pair: $obj" }
DebugOut "PrincipalName: [$PrincipalName]"
DebugOut "TargetComputer: [$TargetComputer]"
DebugOut "Manufacturer: [$Manufacturer]"
DebugOut "ModelName: [$ModelName]"
$oAPI = New-Object -ComObject "MOM.ScriptAPI"
$oDiscoveryData = $oAPI.CreateDiscoveryData($SourceType, "{$SourceId}", "{$ManagedEntityId}")
$oInst = $oDiscoveryData.CreateClassInstance("$MPElement[Name='MyMP.Linux.XYZ.XYZServer']$")
$oInst.AddProperty("$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$", $PrincipalName)
$oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $TargetComputer)
$oInst.AddProperty("$MPElement[Name='MyMP.Linux.Server']/NetworkName$", $TargetComputer)
$oInst.AddProperty("$MPElement[Name='MyMP.Linux.Server']/Model$", $ModelName)
$oInst.AddProperty("$MPElement[Name='MyMP.Linux.Server']/Manufacturer$", $Manufacturer)
#*** Send the data to OpsMgr
DebugOut "***** Return oDiscoveryData to OM; Normal exit *****"
$oAPI.Return($oDiscoveryData) # Submit the data
DebugOut ""
DebugOut "***** Normal end of script. *****"
Exit 0
else
DebugOut "No SourceId, no DiscoveryData ..."
DebugOut "***** Bad ReturnCode $ReturnCode. End of script. *****"
Exit $ReturnCode
} # End of Main
function DebugOut([string]$Text, [int]$dbg)
Write-Host $Text
echo $Text >> $LogFile
Main $StdOut $StdErr $ReturnCode $param4 $param5
]]></PSScriptBody>
<FilterExpression />
<ClassId>$MPElement[Name="MyMP.Linux.Server"]$</ClassId>
<InstanceSettings>
<Settings>
<Setting>
<Name>$MPElement[Name='Unix!Microsoft.Unix.Computer']/PrincipalName$</Name>
<Value>$Target/Property[Type="Unix!Microsoft.Unix.Computer"]/PrincipalName$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name='MyMP.Linux.Server']/NetworkName$</Name>
<Value>$Data/Property[@Name='NetworkName']$</Value>
</Setting>
<Setting>
<Name>$MPElement[Name='System!System.Entity']/DisplayName$</Name>
<Value>NetworkName: $Data/Property[@Name='NetworkName']$</Value>
</Setting>
</Settings>
</InstanceSettings>
</DataSource>
</Discovery>
</Discoveries>
</Monitoring>
Thanks, Holger.
Holger alias InternetSmurf, Munich, Germany -
Manual Standby on Standard Edition 10g for Linux (Scripts)
Hello,
I would like to know if someone has the SCRIPTS for a manual configuration of standby on standard Edition 10g for Linux Red Hat 3.0.
Or some documentation on how can I implement it.
Thank you very much
Best Regards
GisselThis link is for 9i but I think it can be helpful for you:
https://metalink.oracle.com/metalink/plsql/f?p=130:14:725414295789388455::::p14_database_id,p14_docid,p14_show_header,p14_show_help,p14_black_frame,p14_font:NOT,216212.1,1,1,1,helvetica#anchor3
Best Regards
Krystian Zieja / mob -
Linux script - disable ZEN-Partition
we have found out that we start with the zupdate.sig for activating some
new jobs. But what we need is a 2-3 line script to disable the zen-
partition and activate the windows-partition.
Beat[email protected] wrote:
> we have found out that we start with the zupdate.sig for activating some
> new jobs. But what we need is a 2-3 line script to disable the zen-
> partition and activate the windows-partition.
puhh.. I would have to dig into this myself.. normaly the lilo.s script
takes care of this.. does this help?
If you have already compiled drivers or have linux.2 please put them on
http://forge.novell.com/modules/xfmo...ect/?zfdimgdrv
Live BootCd and USB Disk from Mike Charles
http://forge.novell.com/modules/xfmod/project/?imagingx
eZie http://forge.novell.com/modules/xfmod/project/?ezie
Marcus Breiden
If you are asked to email me information please change -- to - in my e-mail
address.
The content of this mail is my private and personal opinion.
http://www.edu-magic.net -
RMAN exit problem from linux script..
Hi all
I am using 11.1.6.0 on linux centos ..below is the rman script (name is rmanbackup.sh) .
rman target / <<- EOF
sql 'alter system archive log current';
run {
backup current controlfile;
exit
EOF
echo "script complete for rman backup"
mkdir /home/oracle/backup_dir
cp /home/oracle/backup_dir /home/oracle/backup_dir1
when i execute this, rman exit from script without executing the last 3 operating system commands .
any help in this regard.As Mseberg said, Please try to mark you questions as answered, here is the answer:
add *#!/bin/ksh* in your script ; also cp -r not cp
[oracle@wissem ~]$ cat rmanbackup.sh
#!/bin/ksh
rman target / <<- EOF
sql 'alter system archive log current';
run {
backup current controlfile;
exit
EOF
echo "script complete for rman backup"
mkdir /home/oracle/backup_dir
cp -r /home/oracle/backup_dir /home/oracle/backup_dir1
[oracle@wissem ~]$ ./rmanbackup.sh
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Aug 28 17:00:11 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORAWISSE (DBID=3964208472)
RMAN>
using target database control file instead of recovery catalog
sql statement: alter system archive log current
RMAN> 2> 3>
Starting backup at 28-AUG-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=149 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 28-AUG-11
channel ORA_DISK_1: finished piece 1 at 28-AUG-11
piece handle=/home/oracle/app/oracle/flash_recovery_area/ORAWISSE/backupset/2011_08_28/o1_mf_ncnnf_TAG20110828T170014_75np001q_.bkp tag=TAG20110828T170014 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 28-AUG-11
RMAN>
Recovery Manager complete.
script complete for rman backup
[oracle@wissem ~]$ ls -rtl /home/oracle/backup_dir
total 0
[oracle@wissem ~]$ ls -rtl /home/oracle/backup_dir1/
total 4
drwxr-xr-x 2 oracle oinstall 4096 Aug 28 17:00 backup_dir
[oracle@wissem ~]$ ls -rtl /home/oracle/backup_dir1/backup_dir/
total 0
[oracle@wissem ~]$ -
Suppose to package all necessary *.class in example.jar in following way,
bin.start.class
business.bus.class
and the class file that contain main is bin.start.class.
There is no problem to run following under linux shell prompt. java VM is under PATH searching path. i.e.
$java -classpath example.jar bin.start
However, there is some problem to run a script which contains 'java -classpath example.jar bin.start' under linux shell prompt.
May I have any clue to identify this problem?
Thanks in advance.For case 1: Does any case work? When I see "[un]able to locate the main method" then I think that that the class was found but that the main method is not declared properly.
Of course, main must be declared with exactly these keywords:
static public void main( String arg[]) {
...For case 2: you still have some kind of classpath problem.
If your script really has the line
java -classpath example.jar bin.start
then I still think your current working directory at the time that this line is run not that same directory as where the jar file is.
If you have JAVA_HOME defined, you might want to try:
pwd
$JAVA_HOME/bin/java -classpath example.jar bin.start
Another suggestion: If your $PATH variable is long, try to shorten it to a short list of directories. You can test with just /bin:/usr/bin .
Also, is your shell Bash or C-shell? Is your script Bourne shell (/bin/sh) or Bourne? -
Runtime.getRuntime().exec problem with linux script.
Hello,
I try to start a script under Linux RedHat 9. This script must just create another file.
I work with JDK 1.4.1_02b06.
If I use the next command
process = Runtime.getRuntime().exec("/temp/myScript.sh");
This is not working. I script file is existing otherwise I receive an error. I don't understand why the script is not executed!
I have check some other posts in this forum but I cannot find the solution.
Thanks in advance for your help.
Alain.Try running it with sh: Runtime.getRuntime().exec("sh /temp/myScript.sh");
-
SQLPLUS Help with a Linux Script
I am receiving an SQLPLUS error of 155.
Apparently my SQL code is being truncated (I believe).
I originally had all of this code on separate lines to make it readable. Unfortunately for that try I also received a return code of 155.
I copied this SQL from my SQL DEVELOPER where this SQL works properly.
Can anybody make any suggestions?
BTW, I am newbie to both Linux Shell Scripts, SQL, and SQLPLUS.
Here is the log from the run of the script:
SQL*Plus: Release 11.2.0.2.0 Production on Fri May 4 17:49:38 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> SQL> Connected.
SQL> SQL> SQL> SELECT to_char(c.update_date, 'FMMonth, YYYY') 'Shipment Update Date'||'|'||b.SHIPMENT_GID 'Shipment Number'||'|'||count (distinct (b.SHIPMENT_GID)) 'No of Shipments'||'|'||count(distinct(a.i_transaction_no)) 'Auctions per Shipment'||'|'||count(*) 'No. of Carriers Notified'||'|'||sum (case when a.responding_gl_user_gid is null then 0 else 1 end) 'No of Bidders'||'|'||min (numtodsinterval((b.expected_response - b.insert_date),'day')) 'Duration of Auction'||'|'||min (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for first bid'||'|'||max (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for last bid'||'|'||numtodsinterval((max(a.update_date) - min(a.update_date)),'day') 'Elapse time of bidding'||'|'||numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day') 'Lead Time of Auction to P/U'||'|'||(max(a.bid_amount) - min(a.bid_amount)) 'High Bid- Low Bid Diff' from tender_collab_servprov a, tender_collaboration b, shipment c where a.i_transaction_no = b.i_transaction_no and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A') and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid') and b.shipment_gid = c.shipment_gid AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1) group by c.update_date, b.SHIPMENT_GID order by c.update_date, b.shipment_GID
ERROR at line 1:
ORA-00923: FROM keyword not found where expected
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Here is the Linux Shell script:
/bin/sh
LOGFILE="$(date +"%Y-%m-%d %H") Oracle REPORT LOG.TXT"
FILENAME="$(date +"%Y-%m-%d") PROD Unfinished Spot Bids.CSV"
echo "File Name for the spool is:" "$FILENAME"
#spool "$FILENAME"
sqlplus /nolog <<EOF >$LOGFILE
whenever sqlerror exit sql.sqlcode
connect glog_read/parker@OTMDEV
spool PROD_Unfinished.CSV
set linesize 32000 trimspool on pagesize 3000
SELECT to_char(c.update_date, 'FMMonth, YYYY') 'Shipment Update Date'||'|'||b.SHIPMENT_GID 'Shipment Number'||'|'||count (distinct (b.SHIPMENT_GID)) 'No of Shipments'||'|'||count(distinct(a.i_transaction_no)) 'Auctions per Shipment'||'|'||count(*) 'No. of Carriers Notified'||'|'||sum (case when a.responding_gl_user_gid is null then 0 else 1 end) 'No of Bidders'||'|'||min (numtodsinterval((b.expected_response - b.insert_date),'day')) 'Duration of Auction'||'|'||min (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for first bid'||'|'||max (numtodsinterval((a.update_date - a.transaction_time),'day')) 'Elapse time for last bid'||'|'||numtodsinterval((max(a.update_date) - min(a.update_date)),'day') 'Elapse time of bidding'||'|'||numtodsinterval((max(b.shipment_time) - max(c.insert_date)),'day') 'Lead Time of Auction to P/U'||'|'||(max(a.bid_amount) - min(a.bid_amount)) 'High Bid- Low Bid Diff' from tender_collab_servprov a, tender_collaboration b, shipment c where a.i_transaction_no = b.i_transaction_no and b.shipment_gid not in (select sqa.shipment_gid from tender_collaboration sqa, tender_collab_servprov sqb where sqa.i_transaction_no = sqb.i_transaction_no and sqb.acceptance_code = 'A') and a.i_transaction_no in (select i_transaction_no from tender_collaboration where tender_type = 'Spot Bid') and b.shipment_gid = c.shipment_gid AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE,-2), 'MM-DD-YYYY')),'MM-DD-YYYY')) + 1) group by c.update_date, b.SHIPMENT_GID order by c.update_date, b.shipment_GID;
spool off
EOF
RV=$?
echo "The return code fronm the sqlplus was:" "$RV"Looks the SELECT clause have missing pipes. See corrected one below :
The shell script format has alread been given above.
SELECT TO_CHAR(c.update_date, 'FMMonth, YYYY') || 'Shipment Update Date' || '|' ||
b.shipment_gid || 'Shipment Number' || '|' ||
COUNT(DISTINCT(b.shipment_gid)) || 'No of Shipments' || '|' ||
COUNT(DISTINCT(a.i_transaction_no)) || 'Auctions per Shipment' || '|' ||
COUNT(*) || 'No. of Carriers Notified' || '|' ||
SUM(CASE WHEN a.responding_gl_user_gid IS NULL THEN 0 ELSE 1 END) || 'No of Bidders' || '|' ||
MIN(numtodsinterval((b.expected_response - b.insert_date), 'day')) || 'Duration of Auction' || '|' ||
MIN(numtodsinterval((a.update_date - a.transaction_time), 'day')) || 'Elapse time for first bid' || '|' ||
MAX(numtodsinterval((a.update_date - a.transaction_time), 'day')) || 'Elapse time for last bid' || '|' ||
numtodsinterval((MAX(a.update_date) - MIN(a.update_date)), 'day') || 'Elapse time of bidding' || '|' ||
numtodsinterval((MAX(b.shipment_time) - MAX(c.insert_date)), 'day') || 'Lead Time of Auction to P/U' || '|' ||
(MAX(a.bid_amount) - MIN(a.bid_amount)) || 'High Bid- Low Bid Diff'
FROM tender_collab_servprov a,
tender_collaboration b,
shipment c
WHERE a.i_transaction_no = b.i_transaction_no
AND b.shipment_gid NOT IN ( SELECT sqa.shipment_gid
FROM tender_collaboration sqa,
tender_collab_servprov sqb
WHERE sqa.i_transaction_no = sqb.i_transaction_no
AND sqb.acceptance_code = 'A')
AND a.i_transaction_no IN (SELECT i_transaction_no
FROM tender_collaboration
WHERE tender_type = 'Spot Bid')
AND b.shipment_gid = c.shipment_gid
AND c.update_date >= trunc(last_day(to_date((to_char(add_months(SYSDATE, -2),'MM-DD-YYYY')),'MM-DD-YYYY')) + 1)
GROUP BY c.update_date, b.shipment_gid
ORDER BY c.update_date, b.shipment_gid
{code} -
How to create an executable File (Linux-Script) in Java
Hello,
I'm creating a script file in my Java Application.
This script should be executed by hand on my linux system. Therefor the execute flag must be set. But how can I set this flag without executing the "chmod"-command?
Is there any possiblility to do this?
Thanks,
ArminI don't think there is. But you can use Runtime.exec() to execute a chmod command.
-
How to run linux scripts remotely
hi,
My java program has to log in to linux os remotely with userid/pwd and it has to run some shell scripts there. How can i do this?Check out the following:
http://jakarta.apache.org/commons/net/ -
Executing/Triggering Linux script from Oracle 9i.
Hi All,
I am new to oracle and need help.
i want to execute a script in linux which should be triggered from oracle 9i.
Is it possible to do?
and if yes please help me out how to do?
Please let me know if any other information is needed..!!!Hi,
Welcome to the forum!
If you have a script called my_file.sql, and it is located on c:\oracle_stuff, then, from the SQL*Plus "SQL> " prompt, you can say
@c:\oracle_stuff\my_scriptor
@c:\oracle_stuff\my_script.sqlto run the script (that is, to execute every line in the file as if you were typing it).
The suffix ".sql" is the default, so you don't have to say it.
If you had a none-standard suffix, then you would have to specify it.
For example, if your file was called another_file.txt:@c:\oracle_stuff\another_file.txt
Maybe you are looking for
-
When Double-Clicking In CSS Panel missing in Dreamweaver CC 2014
Hello, Please help me. I not have this option in Edit > Prefrences > CSS Styles > "When Double-Clicking In CSS Panel" in Dreamweaver CC 2014. How to show it I use windows 8.1
-
Can't open folders I moved from previous computer.
I just upgraded my Mac Pro's 320GB HD with a 1TB. I moved over my Documents and Music folder and saved them on an extra HD. After I reformatted the computer, I tried to open those folders from the extra HD and they will not open. They have a circle w
-
How do I found out my passcode if it says it is wrong?
-
My Sony Playstation won't read games or DVDs that are inserted into it?
I have tried most of the remedies you see on the net but none have worked, can I take my playstation to a Sony Store near by or do I have to send the game out to be fixed?
-
NTDETECT FAILED boot up error??
Every support tech I talk with has no idea what this error is and tells me my only option is to do a clean install. Can anyone offer any help or advice. Thanks