Batch script to monitor tbs
Hi guys.
On windows machine, I do have cron jobs that monitor tablespace usage and when a tbs reaches a machine, an alert is sent.
Now, I do have other dbs runing on windows and would like to do the same.
The problem is that am not use to windows and dont know how to do it! can any one help me automate this sql script??
select name, kbytes, used, free, pct_used
from (
select (select decode(extent_management,'LOCAL','*','') from dba_tablespaces
where tablespace_name =
b.tablespace_name) || nvl(b.tablespace_name,
nvl(a.tablespace_name,'UNKOWN')) name,
kbytes_alloc kbytes,
kbytes_alloc-nvl(kbytes_free,0) used,
nvl(kbytes_free,0) free,
((kbytes_alloc-nvl(kbytes_free,0))/
kbytes_alloc)*100 pct_used,
nvl(largest,0) largest,
nvl(kbytes_max,kbytes_alloc) Max_Size,
decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used
from ( select sum(bytes)/1024 Kbytes_free,
max(bytes)/1024 largest,
tablespace_name
from sys.dba_free_space
group by tablespace_name ) a,
( select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_data_files
group by tablespace_name
union all
select sum(bytes)/1024 Kbytes_alloc,
sum(maxbytes)/1024 Kbytes_max,
tablespace_name
from sys.dba_temp_files
group by tablespace_name )b
where a.tablespace_name (+) = b.tablespace_name
order by 1
Eric has exactly the right idea. To monitor database performance or statistics or other database metrics in a cross-platform manner (that works the same across Windows, Linux, Solaris etc). You should definitely be using dbms_scheduler in 10g or up or dbms_job in 9i or below.
There are several examples in these forums of how to use these. You can use utl_smtp for sending e-mail notifications.
If you want help on using dbms_scheduler, there is a dedicated Scheduler forum here :
Scheduler
-Ravi
Similar Messages
-
Hi,
I have to check the zip files created before 14 days by using Batch script.
Any conditional statement needed ?
Thanks,
JituBut this script is failing if the files are not present in the same folder.
So I am thinking to loop the statement to check if files are not there exit from the loop.
The script does not fail - it reports that no files are found. You can detect this like so:
if %ErrorLevel% NEQ 0 echo "There are no zip files!"
There is no loop in your script that you can exit from. -
[Resolved][ODQ] Error Running Exported Batch Script Outside of ODI
Dear ODI experts,
I have Installed 10.1.3.4.0 ---> selected "Oracle Data Integrator, Oracle Data Profiling, Oracle Data Quality 10.1.3.4.0" ---> Complete (1012MB)
- follow all steps of "Design a Name and Address Cleansing Project" section in Sample Tutorial
- in "Oracle DQ User Interface", right click Projects->Quality->customer master[1]
- select "Run" from the context menu
- the background tasks completed 100% properly
- export the project as a Batch Script
- make changes to config.txt, runProjectN.cmd, and *.stx files following as specified in the Sample Tutorial document
- at step 13-f, got the following errors by executing runProjectN.cmd
Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e7_us_globrtr_p2.dat>. errno = 2; N
o such file or directory Occurred in Transformer - (cl_open).
I did a full search in ODI folders and couldn't find "e7_us_globrtr_p2.dat".
I tried both export with data and export w/o data with proper change to specify input file path, and got the same error.
Appreciate any suggestions and/or hints help me further debug of fix this issue.
Regards,
Roy
The following is a complete message echo of runProjectN.cmd
===========================================================================
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>runproject1.cmd
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_PROJECT=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_CONFIG=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts\config.txt
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_SETTINGS=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>set TS_DATA=D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data
D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\scripts>cd /D D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tranfrmr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e5_tranfrmr_p1.stx
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call globrtr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e6_globrtr_p2.stx
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tranfrmr D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e9_tranfrmr_p3.stx
Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e7_us_globrtr_p2.dat>. errno = 2; N
o such file or directory Occurred in Transformer - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call cusparse D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e10_cusparse_p4.stx
Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e9_us_tranfrmr_p3.dat>. errno = 2;
No such file or directory Occurred in Customer Data Parser - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tsqsort D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e11_srtforpm_p5.stx
Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e10_us_cusparse_p4.dat>. errno = 2;
No such file or directory Occurred in tsqsort - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call uspmatch D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e12_pmatch_p6.stx
Wed Nov 28 17:18:37 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e11_us_srtforpm_p5.dat>. errno = 2;
No such file or directory Occurred in CGeoIO::initGIO - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call winkey D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e13_winkey_p7.stx
Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e12_us_pmatch_p6.dat>. errno = 2; N
o such file or directory Occurred in CWKD::initWKD - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call tsqsort D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e14_srtforrl_p8.stx
Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e13_us_winkey_p7.dat>. errno = 2; N
o such file or directory Occurred in tsqsort - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call rellink D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e15_rellink_p9.stx
Wed Nov 28 17:18:38 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e14_us_srtforrl_p8.dat>. errno = 2;
No such file or directory Occurred in CMatcher::InitMatcher - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call common D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e16_common_p10.stx
Wed Nov 28 17:18:39 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e15_us_rellink_p9.dat>. errno = 2;
No such file or directory Occurred in Create Common - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>call datarec D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\settings\e17_datarec_p11.stx
Wed Nov 28 17:18:39 2007 - 03503E ERROR: Can't open file: <D:\Bin\Oracle\ODIDQ10134\demo\oracledq\projects\oracledq\project1\data/e16_us_common_p10.dat>. errno = 2;
No such file or directory Occurred in CReCons::initRC - (cl_open).
D:\Bin\Oracle\ODIDQ10134\oracledq\quality_server\tsq11r0s\Software\bin>
===========================================================================
Solution:
Needs to modify "e9_tranfrmr_p3.stx" to point to "e6_nomatch_globrtr_p2_us.dat".Seems to be the DRM service went down, try running the batch after stopping & restarting the service.
-
LOG FILE for batch scripting in MAXL
Hello,
I just wanted to know how to create a LOG FILE for batch scripting.
essmsh E:\Batch\Apps\TOG_DET\Scripts\unload_App.msh
copy e:\batch\apps\tog_det\loadfile\gldetail.otl e:\hyperion\analyticservices\app\tog_det\gldetail /Y
essmsh E:\Batch\Apps\TOG_DET\Scripts\Build_Hier_Data.msh
REM
ECHO OFF
ECHO Loading GL actuals into WFS \ Combined......
E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
Drop object d:\NDM\Data\StampFiles\STAMPLOADBKUP.csv of type outline force;
Alter object d:\NDM\Data\StampFiles\STAMPLOAD_cwoo.csv of type outline rename to d:\NDM\Data\StampFiles\STAMPLOADBKUP.CSV;
SET LogFile=E:\Batch\Apps\TOG_DET\Logs.log
This file does not generate log file can any help me what might be the problem? Even though some of the steps above are not correct it should generate me log file atleast. I need syntax or whatever it is to generate Log file.
Regards
SomaI wanted to have a logfile of the following batch script regardless of whether the script is running or not.
essmsh E:\Batch\Apps\TOG_DET\Scripts\unload_App.msh
copy e:\batch\apps\tog_det\loadfile\gldetail.otl e:\hyperion\analyticservices\app\tog_det\gldetail /Y
essmsh E:\Batch\Apps\TOG_DET\Scripts\Build_Hier_Data.msh
REM
ECHO OFF
ECHO Loading GL actuals into WFS \ Combined......
E:\HYPERION\common\Perl\5.8.3\bin\MSWin32-x86-multi-thread\PERL.EXE E:\Batch\Apps\WFS.COMBINED\AMLOAD\WFSUATAMLOAD.PLX
Drop object d:\NDM\Data\StampFiles\STAMPLOADBKUP.csv of type outline force;
Alter object d:\NDM\Data\StampFiles\STAMPLOAD_cwoo.csv of type outline rename to d:\NDM\Data\StampFiles\STAMPLOADBKUP.CSV;
What I really want is I need a log file of the above batch script, how the above scripts are running. I do not care whether they are giving me positive results but I need to know what is happening in logfile. HOw will the log file be generated.
Regards
SOma -
Find and replace string in a file using batch script
I am writing a batch script to replace " ", with " ". The below code works but it prefixes each line with the line number and :.
It is the last part of the line that I am trying to replace.
E.g.
" ","BALANCE_SHEET ","ASSETS ","03","LEVEL_2 ",Asset Accounts," ",
To be replaced as
" ","BALANCE_SHEET ","ASSETS ","03","LEVEL_2 ",Asset Accounts," "
Code:
@echo off &setlocal
set "search=" ","
set "replace=" ""
set "textfile=Build_Accounts_Plan_Source.txt"
set "newfile=Build_Accounts_Plan_Source_new.txt"
(for /f "delims=" %%i in ('findstr /n "^" "%textfile%"') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
echo(!line!
endlocal
))>"%newfile%"
type "%newfile%"
Output:
3:" ","BALANCE_SHEET ","ASSETS ","03","LEVEL_2 ",Asset Accounts," "
Regards,
Ragav.Did you retype the code or did you use copy/paste? Retyping is not a good idea.
You can do this to find the cause of the problem:
Run the modified code below.
Use notepad.exe to open the file TempVBS.vbs in your %temp% folder.
Mark & copy the code, then paste it into your reply.
@echo off
set "textfile=Build_Accounts_Plan_Source.txt"
set "newfile=Build_Accounts_Plan_Source_new.txt"
set Scr="%temp%\TempVBS.vbs"
( echo Set oFSO = CreateObject("Scripting.FileSystemObject"^)
echo Set oInput = oFSO.OpenTextFile(WScript.Arguments(0^), 1^)
echo sData = Replace(oInput.ReadAll, "," ^& VbCrLf, VbCrLf^)
echo Set oOutput = oFSO.CreateTextFile(WScript.Arguments(1^), True^)
echo oOutput.Write sData
echo oInput.Close
echo oOutput.Close) > %Scr%
cscript //nologo %Scr% %textfile% %newfile% -
TSQL Script to monitor SQL Server transactional and snapshot replication
Hi Team,
Could you please let me know do you have any TSQL script to monitor replication(Transactional, Snapshot) with current status ? I have tried below script but it giving error. could you please have a look at the below script or do you have any other new TSQL
script to monitor the replication status ?
"Msg 8164, Level 16, State 1, Procedure sp_MSload_tmp_replication_status, Line 80
An INSERT EXEC statement cannot be nested."
DECLARE @srvname VARCHAR(100)
DECLARE @pub_db VARCHAR(100)
DECLARE @pubname VARCHAR(100)
CREATE TABLE #replmonitor(status INT NULL,warning INT NULL,subscriber sysname NULL,subscriber_db sysname NULL,publisher_db sysname NULL,
publication sysname NULL,publication_type INT NULL,subtype INT NULL,latency INT NULL,latencythreshold INT NULL,agentnotrunning INT NULL,
agentnotrunningthreshold INT NULL,timetoexpiration INT NULL,expirationthreshold INT NULL,last_distsync DATETIME,
distribution_agentname sysname NULL,mergeagentname sysname NULL,mergesubscriptionfriendlyname sysname NULL,mergeagentlocation sysname NULL,
mergeconnectiontype INT NULL,mergePerformance INT NULL,mergerunspeed FLOAT,mergerunduration INT NULL,monitorranking INT NULL,
distributionagentjobid BINARY(16),mergeagentjobid BINARY(16),distributionagentid INT NULL,distributionagentprofileid INT NULL,
mergeagentid INT NULL,mergeagentprofileid INT NULL,logreaderagentname VARCHAR(100),publisher varchar(100))
DECLARE replmonitor CURSOR FOR
SELECT b.srvname,a.publisher_db,a.publication
FROM distribution.dbo.MSpublications a, master.dbo.sysservers b
WHERE a.publisher_id=b.srvid
OPEN replmonitor
FETCH NEXT FROM replmonitor INTO @srvname,@pub_db,@pubname
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO #replmonitor
EXEC distribution.dbo.sp_replmonitorhelpsubscription @publisher = @srvname
, @publisher_db = @pub_db
, @publication = @pubname
, @publication_type = 0
FETCH NEXT FROM replmonitor INTO @srvname,@pub_db,@pubname
END
CLOSE replmonitor
DEALLOCATE replmonitor
SELECT publication,publisher_db,subscriber,subscriber_db,
CASE publication_type WHEN 0 THEN 'Transactional publication'
WHEN 1 THEN 'Snapshot publication'
WHEN 2 THEN 'Merge publication'
ELSE 'Not Known' END,
CASE subtype WHEN 0 THEN 'Push'
WHEN 1 THEN 'Pull'
WHEN 2 THEN 'Anonymous'
ELSE 'Not Known' END,
CASE status WHEN 1 THEN 'Started'
WHEN 2 THEN 'Succeeded'
WHEN 3 THEN 'In progress'
WHEN 4 THEN 'Idle'
WHEN 5 THEN 'Retrying'
WHEN 6 THEN 'Failed'
ELSE 'Not Known' END,
CASE warning WHEN 0 THEN 'No Issues in Replication' ELSE 'Check Replication' END,
latency, latencythreshold,
'LatencyStatus'= CASE WHEN (latency > latencythreshold) THEN 'High Latency'
ELSE 'No Latency' END,
distribution_agentname,'DistributorStatus'= CASE WHEN (DATEDIFF(hh,last_distsync,GETDATE())>1) THEN 'Distributor has not executed more than n hour'
ELSE 'Distributor running fine' END
FROM #replmonitor
--DROP TABLE #replmonitor
Rajeev RINSERT INTO #replmonitor
Hi Rajeev,
Could you please use the following query and check if it is successful?
INSERT INTO #replmonitor
SELECT a.*
FROM OPENROWSET
('SQLNCLI', 'Server=DBServer;Trusted_Connection=yes;',
'SET FMTONLY OFF; exec distribution..sp_replmonitorhelpsubscription
@publisher = DBServer,
@publication_type = 0,
@publication=MyPublication') AS a;
There is a similar thread for your reference.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/634090bf-915e-4d97-b71a-58cf47d62a8a/msg-8164-level-16-state-1-procedure-spmsloadtmpreplicationstatus-line-80?forum=sqlreplication
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support -
Batch script to open multiple excel and doc files
Hi Everyone,
Could anybody please provide a batch script to open multiple excel and doc files at a time.
Appreciate ur quick response.
Regards,You have several scripting choices within Windows. At a basic level you've got "batch files" - which run a series of command interpreter commands, and have a file extension of .BAT or .CMD. If you just wanted to open a list of Word documents, then assuming that the path to Word is correct (something like this below) you could list these in a file with a .BAT extension and run this (e.g. double click on it):
"C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File1.DOC"
"C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File2.DOC"
"C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File3.DOC"
"C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File1.XLS"
"C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File2.XLS"
Another script language is VBScript, which was the example I gave. VBScript is available on most Windows platforms and can be run from a command prompt or within Windows. If you save the text I gave you above to a file with a .VBS extension you can double-click to run it (Windows) or open a command prompt and type CSCRIPT MyVBScript.VBS (assuming that's the name of the your .VBS file).
Other script languages are available to achieve the same thing, including Powershell, however you'd need to have Powershell available on your PC. -
How to call a batch script from DI?
Hi All,
I'm new to DI/DS and would like to know is there a way to call a batch sciprt (.bat file) in DI?
What I try to do is,
1.call a batch script to move source files from a file server to the source folder before kicking off the data flow
2. once the data flow is completed, call a batch script to move the processed source files to the achive folder.
In other ETL tool like informatica it can be done via the command task, is there something similar in DI?
Any help would be appreciated.
Regards
BLThanks Suneer.
Just want to clarify, when I create the script task in the work flow, should I put the path of my batch file or the batch script itself in?
e.g., my batch script is movefile.bat under folder C:\Script,
and the command is: move /Y "C:\Input\*.*". "C:\Archive\".
in the script task, should I put
exec('cmd', 'C:\Script\movefile.bat')
or
exec('cmd', 'move /Y "C:\Input\*.*". "C:\Archive\".')
Thanks again for your help
Regards,
BL -
Batch Script to display last modified file from multiple directories
Hello,
I am trying to find the name of the latest file or the last modified file from a set of given directories.
I approached the problem by breaking it into two parts: a. read all the directories from a .txt file and display the names of those directories and files under those directories. b. Find the latest file present in any given directory and
Upto this point all worked well, but when I am trying to combine both these batch scripts, I am unable to get the desired result.
I am using BATCH SCRIPT only to complete this.
My tried script is as below:
a. TO SEE ALL THE DIRECTORIES SPECIFIED IN "path_123.txt" FILE
for /f "delims=" %%i in ('type "C:\Users\sonkar\Desktop\path_123.txt" ') do (set locall=%%i
echo %locall%
echo %%i
b. TO FIND THE LATEST FILE PRESENT IN THE DIRECTORY
set BUILDDROP="E:\"
for /f "tokens=*" %%a in ('dir /A:-D /B /O:-D %BUILDDROP%') do set NEWEST=%%a&& goto :next
:next
echo %NEWEST%
But when combining both is not working at all.
Any help is appreciated.Since batch files lack the ability to do date arithmetic you are pushing them well beyond their limits. Either VBScript of PowerShell could handle this type of task. Here is a VBScript solution. You must save the code in a .vbs file, then modify it to suit
your exact needs.
'Find the most recent file in a collection of folders
'11 Sep 2014 FNL
Dim dDate, dDate_, sFile, sFile_
Set oFSO = CreateObject("Scripting.Filesystemobject")
Set oList = ofso.OpenTextFile("C:\Users\sonkar\Desktop\path_123.txt", 1)
aList = Split(olist.ReadAll, vbCrLf)
oList.close
dDate = cdate("01/01/2000")
For Each sFolder In aList
dDate_ = cdate("01/01/2000")
ProcessFolder(sFolder)
If dDate_ > dDate Then
dDate = dDate_
sFile = sFile_
End If
Next
WScript.Echo "Most recent file: """ & sFile & """"
WScript.Echo "File date: " &dDate
Sub ProcessFolder(sFldr)
If LTrim(sFldr) = "" Then Exit Sub
WScript.Echo "Processing """ & sFldr & """"
For Each oFile In oFSO.GetFolder(sFldr).Files
If oFile.DateLastModified > dDate_ Then
dDate_ = oFile.DateLastModified
sFile_ = oFile.Path
End if
Next
For Each oFolder In oFSO.GetFolder(sFldr).SubFolders
ProcessFolder(oFolder.path)
Next
End sub -
OS Command batch script issue (FTP)
All,
I am running into a problem (i think it's simple) which I just can't seem to figure out. I have a FTP command which is in a batch script and I can run it manually (Its run in an old enviroment with Informatica) and the ftp script works just fine. When I use the OS Command to launch the bat file, it accesses the bat file but in the ftp log all I see it doing is copying the local directory into the first line of the log and then just copying the rest of the ftp script. It does nothing else!!
Does anyone have any ideas? I have copied the script and forced it into one bat file, tried running it from a local directory, running it from the server, combining everything into a single source for lcd and script, I am running out of ideas!!
- Another point is that I have to use this process as I am moving files from a server to a mainframe environment and need the ascii translate function in FTP.
Thanks,
AbhiUpdate:
After some searching (and soul searching;) ) I was able to find a way to call the FTP file through an shell batch. So for instance I have a shell script that calls the FTP script. This seems to work but now the log does not create correctly (the ftp script is creating the log) it seems to copy the script from the ftp file and paste it in the log file. -
File copying in Batch script and renaming
HI,
I am using the below batch script to copy the files from current folder to the specified location.
(@echo off
echo copying files to destination
copy *.eps* \\10.10.14.13\adman\in\displ )
I am facing 2 problems in the above script..
1. I am not able to select a particular file and run the script, for e.g if the folder got more (eps) files it copies all the files to the location.
2. I want to insert my user login name at the end of the each copied file.
My file name look like (F0#CGDBANG000947532#.eps
) copy to F0#CGDBANG000947532#username.eps
Thanks for all the helpHi,
About this issue, I recommend you consult Script Center forum for professional help:
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or
learn from your interaction with us. Thank you for your understanding.
Karen Hu
TechNet Community Support -
How to install windows costume ISO using batch script over network?
I have developing one click or silent installation in network through source of windows ISO file. I 'am getting trouble in middle. I need batch file, it should contains script and this script will installs given OS's software/image.
Hi Ganesh_Lakkakula,
For batch scripting issues, it would be better ask to the scripting forum.
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Calling oracle procedure from batch script
i have a .bat file, in which i am using sqlldr to load into a staging table from csv file, and then using merge to insert / update into target table
i have 2 doubts
1) my first doubt is regarding batch script..how to handle the errorlevels which are greater than 1?
so generally speaking, how do i handle all the errors at once..and make sure the control goes to
run_sqlldr0 always? and handle the error meaningfully if its other than 0 ?
below is my batch script, and i get error
goto run_sqlldr2
the system cannot find the batch label specified - run_sqlldr2
@echo on
call oraenv.bat
if not exist %mainpath% goto mainpath_def
if not exist %scripts% goto scriptspath_def
if not exist %logs% goto logspath_def
if not exist %data% goto datapath_def
goto x1
:x1
goto run_sqlldr%ERRORLEVEL%
echo run_sqlldr%ERRORLEVEL%
if run_sqlldr%ERRORLEVEL% NEQ 0 goto run_sqlldr1
echo "entering sqlldr"
:run_sqlldr1
echo "entered sqlldr1"
echo "some error"
echo mergedata%ERRORLEVEL%
:run_sqlldr0
echo "entered sqlldr0"
sqlldr userid = scott/tiger@orcl control=%mainpath%\cm.ctl log=%logs%\cm.log discard=%logs%\cm.dsc bad=%logs%\cm.bad SILENT=(HEADER, FEEDBACK)
goto mergedata%ERRORLEVEL%
:mergedata1
echo "entered mergedata1"
echo cleandata%ERRORLEVEL%
:mergedata0
sqlplus -s scott/tiger@orcl @%scripts%\merge_stg.sql
goto cleandata%ERRORLEVEL%
:cleandata1
echo "entered cleandata1"
sqlplus -s scott/tiger@orcl @%scripts%\clean_stg.sql
goto exit
:cleandata0
echo "entered cleandata0"
echo "error in removing data"
goto exit
:mainpath_def
echo "mainpath not existing as specified %mainpath%, Please edit ORAENV with correct value"
goto exit
:scriptspath_def
echo "scripts path not existing as specified %scripts%, Please edit ORAENV with correct value"
goto exit
:logspath_def
echo "Logs path not existing as specified %logs%, Please edit ORAENV with correct value"
goto exit
:datapath_def
echo "Data path not existing as specified %data%, Please edit ORAENV with correct value"
goto exit
:exit
2) my second doubt, is this the right way of calling the stored procedures merge_stg and clean_stg?
in clean_stg, i use dynamic sql to truncate the staging table
create or replace procedure trunstg is
lsql varchar2(2000) := 'truncate table stg_ldrtest';
begin
execute immediate lsql;
end;
/i have changed the code
@echo on
call oraenv.bat
if not exist %mainpath% goto mainpath_def
if not exist %scripts% goto scriptspath_def
if not exist %logs% goto logspath_def
if not exist %data% goto datapath_def
goto x1
:x1
goto run_sqlldr%ERRORLEVEL%
echo run_sqlldr errorlevel: %ERRORLEVEL%
if run_sqlldr%ERRORLEVEL% NEQ 0 goto run_sqlldr1
echo "entering sqlldr"
:run_sqlldr1
echo "entered sqlldr1"
echo "some error"
:run_sqlldr2
echo errorlevel: %errorlevel%
echo mergedata%ERRORLEVEL%
:run_sqlldr0
echo "entered sqlldr0"
sqlldr userid = gautam/gautam@orcl control=%mainpath%\cm.ctl log=%logs%\cm.log discard=%logs%\cm.dsc bad=%logs%\cm.bad SILENT=(HEADER, FEEDBACK)
goto mergedata%ERRORLEVEL%
:mergedata1
echo "entered mergedata1"
goto end
echo cleandata%ERRORLEVEL%
:mergedata0
sqlplus -s gautam/gautam@orcl @%scripts%\merge_stg.sql
goto cleandata%ERRORLEVEL%
:cleandata1
echo "entered cleandata1"
echo "cleaning error"
goto end
:cleandata0
sqlplus -s gautam/gautam@orcl @%scripts%\clean_stg.sql
goto end
:mainpath_def
echo "mainpath not existing as specified %mainpath%, Please edit ORAENV with correct value"
goto exit
:scriptspath_def
echo "scripts path not existing as specified %scripts%, Please edit ORAENV with correct value"
goto exit
:logspath_def
echo "Logs path not existing as specified %logs%, Please edit ORAENV with correct value"
goto exit
:datapath_def
echo "Data path not existing as specified %data%, Please edit ORAENV with correct value"
goto exit
:end
EXIT
so the error is ORA - 30926, unable to get a stable set of
rows in the source tables
my merge is
MERGE INTO ldrtest D
USING (SELECT code,id,row_name,col1,col2,col3,crt_tm,md_tm,crt_user,mod_usr FROM stg_ldrtest) S
ON (d.code = s.code and d.id = s.id and d.row_name=s.row_name )
WHEN MATCHED THEN UPDATE SET d.col1 = s.col1,
d.col2 = s.col2,
d.col3 = s.col3,
d.crt_tm = s.crt_tm,
d.md_tm = s.md_tm,
d.crt_user = s.crt_user,
d.mod_usr = s.mod_usr
WHEN NOT MATCHED THEN INSERT (d.code,d.id,d.row_name,d.col1,d.col2,d.col3,d.crt_tm,d.md_tm,d.crt_user,d.mod_usr)
VALUES (s.code,s.id,S.row_name, s.col1,s.col2,s.col3,s.crt_tm,s.md_tm,s.crt_user,s.mod_usr);
i did not understand what this error means..
could anyone please help me out -
Using MaxL in batch script to get Essbase database size before proceeding
I have a batch script which dynamically generates some MaxL before passing it to ESSMSH. I would like to insert a command at the beginning of the MaxL script, to get and assess the size of the database before proceeding. If the database is empty I would like the script to quit. This is to prevent the script from exporting data and overwriting the previous export file if the database is empty.
The generated MaxL (modified) is currently as follows. What logic can I add to the MaxL script, to assess the database size and go to the "errorhandler" label if it is empty? Is this even possible?
login %USER% identified by %PASS% on %SERVER%;
iferror "errorhandler";
/* log file */
spool stdout on to '<directory>.log';
iferror "errorhandler";
/* error file */
spool stderr on to '<directory>.err';
iferror "errorhandler";
/* export data */
set timestamp on;
execute calculation %APP%.%DB%.C_Export;
iferror "errorhandler";
/* reset database */
alter database %APP%.%DB% reset data;
iferror "errorhandler";
/* import data */
import database %APP%.%DB% data from server data_file "<filename>.txt" on error abort;
iferror "errorhandler";
/* calculate database */
execute calculation default on %APP%.%DB%;
iferror "errorhandler";
/* error handler */
spool off;
define label "errorhandler";
logout;
exit;Hi Stuart,
Yes I was aware of display database "app"."db"; however this will output a table rather than a specific value. And what logic can I then add to the MaxL script to assess the specific value of "Db Status" and go to the "errorhandler" label if it is empty?
It would seem this needs to be done via a VBScript, to loop through the file rows to find the value before proceeding accordingly. But I was hoping there might be a way to do this within MaxL. -
Keyboard shortcut to stop batch script?
Hello all,
I've written a javascript designed to process a batch of files.
Is there anyway to assign a keystroke to stop the script arbitrarily (ESC doesn't seem to work) while it is running?
For example, as I was watching the script do its thing on hundreds of files, I noticed that the first dozen or so were not what I wanted.
They didn't "fail" per se, I could just tell that the results weren't good... so I didn't want to sit there while the script processed the other 100 files.
But, the only way I could get the script to stop was to Force Quit Illustrator.If you were to have run the batch script from the ESTK you could use the stop button there. Otherwise I'm not sure there is a way.
Maybe you are looking for
-
Windows 7 home premium reinstallation
Hai All, IN my lenovo g550 laptop having windows 7 home premium,some of the software crashing problem i formatted My C drive and re installed a dowloaded OS of home premium ,if i gave the product key of prevoius os key ,is it accep
-
How to search for a particular word in a string?
How to search for a particular word in a string? thanks for your help....
-
Hi, I am interested in expanding my skill sets in the area of SAP. I understand there is a functional and development side. From my experience I feel that I am most suited both (for the development side) and seem to be leaning towards XI or BI areas.
-
How can i determine if a UOM conversion is being used in a query?
I need to find all the queries that are using a QTY UOM conversion. i tried to do a where used and it didn't return anything.
-
Can anyone help me locate the error?
Hi, Same question but with tagged code, so people can read it. I have been working on a small game, and have been able to make most of it run. However, every now and again when i try to start it, it loads the frame and graphics, but don't start the g