Need Steps of writing shell scripts to check DB health.
Hi,
I need the steps to generates the emails from Linux OS to checking the oracle 10g database health, different thrashhold limits, and checking alert log file for ORA- ERROR etc.
Thanks.
Hi there,
I don't have any knowledge of the EBS suite so I won't comment about it. In general, the DB console( free version of EM) doesn't take much resources and is able to do almost all what is needed to be done for a database. So you may give it a try.
Yes the email notification from EM works and works well. Again, you can try for once and see how it progresses in your environment.
We can also user DBMS Jobs to checking health and send an emais, Am I right?But there are jobs running already in 10g for this and are maintained by MMON process. If you are willing to do some thing beyond that than yes, you may code it yourself but I don't think its needed.
HTH
Aman....
Similar Messages
-
Need steps to create ant scripts for publishing and deploying projects.
Need steps to create ant scripts for publishing and deploying projects.
Have got ant, Oracle BPM Enterprise WL edition installed , Need to know what are the other configurations to be done.
Any working example would help me to understand, please do mail me at [email protected]
Thanks in advance.
-SreeSreekant,
Please find the build file to publish and deploy.
<project name="deployProject"
xmlns:fuego="antlib:fuego.tools.ant.enterprise"
xmlns:fuego.j2ee="antlib:fuego.tools.ant.j2ee" default = "publish">
<property file="./Properties/fuego_deploy.properties"/>
<fuego:passport id="fuego.passport"
directoryid="${fuego.directoryid}"
preset="engine" />
<target name="publish" description="Publish and deploy processes" depends = "takeInputs">
<!-- Open a session to the Oracle BPM directory -->
<fuego:session
passportref="fuego.passport"
verbose="true"
properties="${fuego.basedir}/conf/directory.xml"
haltonerror="true" >
<!-- Publish processes -->
<fuego:publish fpr="${fuego.project.name}"
deploy="true"
engine="${fuego.engineName}"
importdata = "${fuego.importdata}"
automaproles="${fuego.automaproles}"
automapbuspars = "${fuego.automapbuspars}"
automapvars="${fuego.automapvars}"
automapconfigs = "${fuego.automapconfigs}">
</fuego:publish>
</fuego:session>
</target>
<target name= "takeInputs" >
<input
message="Please enter admin-username:"
addproperty="fuego.participant"
/>
<input
message="Please enter admin-password:"
addproperty="fuego.password"
>
</input>
</target>
</project>
and find the properties I have used..
fuego.basedir=C:\OraBPMEnterpriseHome
fuego.directoryid=default
fuego.engineName = bpmengine
fuego.project.name = E:/antExamples/Project/CommonUtilities
# If the below property is true then ant script imports data from the project, as defined in Studio.
# This includes importing:
# •Holiday and Calendar rules
# •Organizational Units
# •Roles
# •Resource configurations
# •External Variables
fuego.importdata = true
#If the below property is true ant script automatically map abstract roles to real ones with the same name.
fuego.automaproles=true
#If the below property is true ant script automatically map business parameter variable names (as defined in the project design) to an business parameter variable id with the same name (as defined in the Fuego Enterprise directory).
fuego.automapbuspars = true
#If the below property is true ant script automatically map external variable names (as defined in the project design) to an external variable id with the same name (as defined in the Fuego Enterprise directory).
fuego.automapvars=true
#If the below property is true ant script automatically map External Resources configurations (as defined in the project design) to real Configurations with the same name (as defined in the Fuego Enterprise directory).
fuego.automapconfigs = true -
Power Shell Script for Check Remote machinces are live or not
I have required a Power Shell Script for Check multiple Remote machines are live or not.Please guide me
This will do it.
http://gallery.technet.microsoft.com/Ping-IP-Adress-Range-d90ce82d
¯\_(ツ)_/¯ -
Unix Shell Script to check file Format
Hello
I am New to shell scripting.Please help me to write a script for the below condition.Any help is highly appreciated.
I will get a text file every month like the one below
Sample file
Payslip.txt
========
EMPID EMAIL PCTAG#
4946:[email protected]:151207
4978:[email protected]:154434
5091:[email protected]:160784
5208:[email protected]:153601
5211:[email protected]:158963
5218:[email protected]:156967
5247:[email protected]:153760
5250:[email protected]:160078
5276:[email protected]:154693
I should check for the below conditions in the above file
Conditions:
=======
1.File should be seperated by colon(;)
2.EMPID should not be null
3.Email address and pc tag# should be null if it is missing
4.No empty record should be there
All the above four conditions should be checked
If any one of four conditions are not met then the file is invalid and it should exit with status saying that file is invalid.
If all the four conditions are met it should say that the file is valid
Any help is highly appreciated.It is urgent.
Thanks in advance
ManojTry this :
error()
{ echo -n "Line "$NR " "$LINE " " >>$STATUS
echo $1 >>$STATUS
NR=0
STATUS=/tmp/status.txt
rm -f $STATUS
cat Payslip.txt | while read LINE
do
NR=`expr $NR + 1`
### Check colons ###########
if [ ! "`echo $LINE | grep :`" ]; then
error "No colon"
continue
fi
EMPID=`echo $LINE | awk -F: '{print $1}'`
EMAIL=`echo $LINE | awk -F: '{print $2}'`
PCTAG=`echo $LINE | awk -F: '{print $3}'`
### Check null line ###########
if [ ! "$EMPID" -a ! "$EMAIL" -a ! "$PCTAG" ]; then
error "Null line"
continue
fi
### Check null EMPID ###########
if [ ! "$EMPID" ]; then
error "No Empid"
continue
fi
done
echo
if [ -f $STATUS ]; then
cat $STATUS
echo
echo "File is Invalid"
else
echo "File is Valid"
fi
echo -
Need help in writing the script in windows to read the file at runtime
Hi All,
I need a help with a Script. I need to read a filename from a directorty based on a specific format. I will be looking for the file in a directory that will have a file added to it each month. The script will need to go out to that directory determine the current month and Year and then grab that file based on the MONTHYEAR contained itn the file name and
in the same script pass the filename to SQL Loader.
The filename will consist of three parts VARIABLECONSTANTDATE.ext (example: FUELFILE11262007.txt: FUEL is a VARIABLE, FILE is constant, 11 two digit month, 26 two digit day,2007 four digit year.)
I am stuck as how to how to read that into a string, find the file name and then pass that to sql loader.
Any help much appreciated..
Looking forward for your response.Use of External Tables will ease your problem...
Here's what you can do:
1. Create External tables (fuelfile.asc)
2. Use Java code to read all filenames in a particular directory and store them in table
3. Use PL/SQL block to loop through each filename in the table and write the file to the file of external table (fuelfile.asc)
3.1 Transfer data from External table to main table
Aalap Sharma :) -
Need Help on Executing Shell Scripts through PL-SLQ
Hi All,
I am trying to execute a shell script from PL-SQL but I am not getting it right .
the code i used is as follows
----JAVA CLASS ---
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
import java.io.*;
public class Host {
public static void executeCommand(String command) {
try {
String[] finalCommand;
if (isWindows()) {
finalCommand = new String[4];
// Use the appropriate path for your windows version.
finalCommand[0] = "C:\\windows\\system32\\cmd.exe"; // Windows XP/2003
//finalCommand[0] = "C:\\winnt\\system32\\cmd.exe"; // Windows NT/2000
finalCommand[1] = "/y";
finalCommand[2] = "/c";
finalCommand[3] = command;
else {
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
new Thread(new Runnable(){
public void run() {
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ((buff = br_in.readLine()) != null) {
System.out.println("Process out :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_in.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process output.");
ioe.printStackTrace();
finally {
try {
br_in.close();
} catch (Exception ex) {}
}).start();
new Thread(new Runnable(){
public void run() {
BufferedReader br_err = null;
try {
br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
String buff = null;
while ((buff = br_err.readLine()) != null) {
System.out.println("Process err :" + buff);
try {Thread.sleep(100); } catch(Exception e) {}
br_err.close();
catch (IOException ioe) {
System.out.println("Exception caught printing process error.");
ioe.printStackTrace();
finally {
try {
br_err.close();
} catch (Exception ex) {}
}).start();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
public static boolean isWindows() {
if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
return true;
else
return false;
---PROCEDURE TO BE EXECUTED WHICH USES THE ABOVE JAVA CLASS IS ----
CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
AS LANGUAGE JAVA
NAME 'Host.executeCommand (java.lang.String)';
--- THE PERMISSIONS ---
call dbms_java.grant_permission('SYSTEM', 'SYS:java.io.FilePermission', '<<ALL FILES>>', 'read ,write, execute, delete');
call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
call dbms_java.grant_permission('SYSTEM', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
--- THE SHELL SCRIPT IS -----
#!/bin/sh
# This script removes the carriage returns from the Files having .DAT1 extensions in the /test/ Directory
# and the sends the single line stream to the new file with the use of 'gawk' command
# so finaly the files with same primary name but different secondary name are created
# e.g. file 'test.DAT1' is onverted to 'test.DAT'
# LOOP on /test/ DIRECTORY FOR SEARCHING FILES HAVING EXTENSION *.DAT1
for file_name in `ls /test/*.DAT1`
do
new_file_name=`echo $file_name | sed 's/DAT1/DAT/'`
# SEND THE CONTAINTS OF SELECTED FILE IN LOOP AS A CONTINUOUS STREAM TO NEW FILE NAME USING 'gawk' COMMAND
gawk 'BEGIN { ORS = "''" } { print $0 }' $file_name >> $new_file_name
# ABOVE LINE WILL CREATE A NEW FILE WITH SAME PRIMARY NAME BUT .DAT AS SECONDARY NAME(EXTENSION)
# REMOVE THE PRIOR FILE(s) AFTER SUCCESSFUL CALL TO 'gawk'
# $? returns 0 if the call to gawk command is succesfull
if test 0 = "$?"
then
rm -f $file_name
fi
done
# END LOOP ON /test/ DIRECTORY
---THE CALL TO THE PROCEDURE --
SQL>CALL DBMS_JAVA.SET_OUTPUT(1000000);
SQL>SET SERVEROUTPUT ON SIZE 1000000
SQL>exec host('/root/sh ecs_script.sh'); -----------------------------------------------1
now, the statement 1 is the path of the Shell Script ecs_script.sh
which uses gawk command and does some operations on some file..
but when i give the call in Statement 1 its giving error like
/bin/sh is not a directory
so i am not getting wHat should I do so that my script "ecs_script.sh" gets executed..
Please Help.@ Bhagat & Michaels
Dear Friends,
I changed my shell name as per ur suggestions
and recompiled the Java class source with
finalCommand[0] = "/bin/bash"; instead of finalCommand[0] = "/bin/sh";
and then recompiled the host procedure
executed the host procedure as per ur suggestion as follows (with out put)
SQL> exec host('/bin/bash ecs_script.sh')
PL/SQL procedure successfully completed.
bt, bt, bt, it still did not do any operations defined in the "ecs_script.sh"
in fact the script did nt executed.......
pls help , I am loosing my time..
regards. -
From Where i can help or manual about writing shell script in oracle
can any one help me to write shell script in oracle.
not sure what you meant by shell script in oracle. If ou want to write a shellscript that interacts with an oracle database, you ma want to refer to an unix programming book and sqlplus manual.
Rgds
Arvind Balaraman -
I need something to run shell scripts
I am working on an IBM computer with JDK 1.3
I am looking for a function similar to the VB shell function
Shell(pathname[,windowstyle])
Can anyone help me with this?Thanks again.
I tried that one too and the program hung up. Then I searched thru some other threads in this forum and somebody posted a good explanation about the problems with waitfor(). The recommended website is:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html -
Hi,
I have a requirement need a help.
Requirement states like this:
I need to write a shell script through which I need to search a huge lines code and to find out following information :
1. Total No of lines of the code
2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
4. No of procedure calls like how many procedures starting with "PROC_" used.
Can anyone help me in this ? I need to script.
My Unix version is :
$ uname -a
SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
Thanks in advance
[email protected]What you need here is a AWK script. This script will read the input as the source file (as command line
argument or as standard input), and process each like of the file read to look for the different patterns
in that line (looking for example if the line contans "SELECT " or "INSERT " etc...) and increment its
corresponding count. At the end of the script in the END section you can get the number of lines with the
NR awk inbuilt variable.
Hope this helps.
Hi,
I have a requirement need a help.
Requirement states like this:
I need to write a shell script through which I need to search a huge lines code and to find out following information :
1. Total No of lines of the code
2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
4. No of procedure calls like how many procedures starting with "PROC_" used.
Can anyone help me in this ? I need to script.
My Unix version is :
$ uname -a
SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
Thanks in advance
[email protected] -
Rwcgi60 on UNIX needs shell script ?
I am trying out Reports 6i on a Linux box.
Using Apache Webserver, I have mapped all the virtual directories with execute permission.
When I call rwcgi60 through the browser, I get the following output
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<CENTER><H1>
</CENTER></H1>
<BR></BODY>
</HTML>
But when i call a shell script (which in turn calls rwcgi60) through the browser, i get some output.
The shell script exports all the environment specific to Oracle Reports and calls rwcgi60.
Is the CGI intended to be called from a script file ? If no, what other configuration is necessary ?
Thanks.I am having exactly the same problem on Solaris. The information I have shoehorned out of support so far is that you do need a shell script to make this work. I have followed these instructions but am still having problems. The document which details this bug is unpublished by Oracle so I only got extracts. Detailed below.....if you do have success with this please let me know as I am tearing my hair out.
REPORTS60_SERVER
1. The REPORTS60_SERVER file is located in your Oracle_Home and is used to
start the Report Server.
2. You may need to modify this file for variables such as DISPLAY, TNS_ADMIN
and the REPORTS60_PATH to fit your environment. @Also, please refer to
@Note: 111548.1 for setting up the TNSNAMES.ORA file.
3. If you are not using a WebDB Listener, you can delete the section which
stops and starts it. However, make sure you have started up your Webserver
Listener.
4. Once this file has been modified, the command to execute it is:
reports60_server start
Shell Script (RUNREP.SH)
1. You will need to create a shell script to run RWCGI60. This shell will then
be called from RUNREP.HTM file. You can name it anything (the example is
called runrep.sh) and needs to include the following:
#!/bin/sh (or which ever shell you want to use)
- ORACLE_HOME="/u03/app/oracle/product/dev6i"; export ORACLE_HOME
- TNS_ADMIN="/u03/app/oracle/product/dev6i/network/admin"; export
TNS_ADMIN
- exec /u03/app/oracle/product/dev6i/tools/web60/cgi/rwcgi60
2. You will need to redefine the ORACLE_HOME and TNS_ADMIN due to BUG:1201156.
3. This script can be located anywhere as far as the Webserver
Listener is
concerned. However, the best place would be in the ORACLE_HOME/tools/web60/
cgi directory for which we already have a virtual name defined in the
listener configuration file.
RUNREP.HTM
1. The RUNREP.HTM file is located in the ORACLE_HOME/tools/web60/html
directory.
2. You will need to modify this file due to the above mentioned Bug.
Go to the function called runReport( ) and for the var cgiexe = "rwcgi60",
replace it with the above shell script.
Example: var cgiexe = "runrep.sh"
3. Next, modify the port number for the Webserver. This file assumes that you
will be using the WebDB listener and is installed on port 8080 (by default).
You will need to find the following and change it to the correct port
number:
<td><input TYPE="TEXT" NAME="WEBPORT" SIZE="4" VALUE="8080"></td>
Change the Port Number to the one your WebServer Listener is on, such as:
7777.
After doing all of the above, you are ready to run a report on the web using
CGI implementation. From the browser run the following URL:
http://your_machine_name:listener_port#/virtual_dir_for_cgi/runrep.htm
This brings up a Template for you to provide the report name. Also change the
parameter values here for the userid/password, port#, and reports_server. -
How to get return code or parameters from PL/SQL in my shell script ?
My shell script must check the result of PL/SQL's running, and decide what to do in the next step.
I think you put the problem the wrong way.
You should try to do as much as possible through your SQL scripts, and, if you need to make OS calls, you may do that using host(command_string).
If you need to transfer parameters from other programs to your FORMS (PL/SQL), then you have to see user_exit.
Some other means would be to have your PL/SQL write to certain OS files that the shell script may read, but that doesn't seem like good practice to me. -
Unix Shell Script-Windows Client
Forget it.If you have to write shell scripts for a Unix server, learn writing shell scripts on Unix. There are many good books and tutorials (and even more bad ones) available.Don't try to write shell scrips on Windows. There's only one tool which I know of which will enable you to use shell scripts on Windows, that's CygWin.Also why do you want to check Unix files from a Windows client??? Could you please explain in a little more detail what exactly the whole process will be? I suspect I may have misunderstood your question. Regards,Nico
Hi All, My Informatica server installed on Unix and my client is installed on Windows.Before processing the file i want to check the file data accoring to the requirement like header,footer,no of records using shell script and need to mail the person if the file has any issues.What is the basic systax to write the shell scripts on windows client to access the file on unix server.If possible give the required shell scripts also for this requirement .I am new to Shell scripting in informatica. Thanks in adavance. Regards,Vijaya
-
Migrating Shell scripts from HP-Unix 11i to OEL 5.0
Hi :
We recently migrated the databases from a HP-Unix server 11i to OEL 5.0 Server. As a part of the move we also had to migrate the shell scripts from Unix.
The source scripts uses B-Shell and when we try to run this on OEL nothing works. It looks like we may have to rewrite for BASH or KORN Shell in OEL 5.0.
I have very limited experience in writing shell scripts and need expert guidence on how the existing script could be modified to work in Linux. Any useful pointer would be great help.
Regards,
BalaBMP wrote:
Hi :
We recently migrated the databases from a HP-Unix server 11i to OEL 5.0 Server. As a part of the move we also had to migrate the shell scripts from Unix.
The source scripts uses B-Shell and when we try to run this on OEL nothing works. It looks like we may have to rewrite for BASH or KORN Shell in OEL 5.0.
I have very limited experience in writing shell scripts and need expert guidence on how the existing script could be modified to work in Linux. Any useful pointer would be great help.
Regards,
BalaI assume you mean 'Bourne shell' ... though possibly you have Posix (which is meant to be close to ksh).
In general ... with exceptions ... ksh and bash are a superset of (bourne shell).
Two things can help:
[1] Check the first line in the scripts and indicate what it is .....
head -1 some-shell-script.
Does hte she-bang command exit on OEL?
[2] Post one or show of the error messages here.
... It is possilbe you are getting one basic error/problem repeated everywhere rather than a lot of different eror messages
If you give examples ... without compromising your security .. that may be a more focused answer -
Executing if condition in a sql prompt with in a shell script
Hi all,
i need to write a shell script where i need to execute a sql statement. if the count from the above sql is greater than certain value i need to execute a another sql statement.After some time i need to check the count again using above sql and if the count is less than certain value i need to execute a different sql statement. One more time i need to check the count and then i need to get an email.
Could anyone help me in completing this script
Thanks,Could anyone help me in completing this scriptNot really because "shell script" is OS & Shell dependent & you decided to NOT share these details with us.
Just write a PL/SQL procedure & then you have an OS independent solution! -
Hi,
I dont know about shell scripting .since iam involved in the database administration side i dont know have much knowledge in unix shell scripting.
so, wat part does this shell scripting taked in database administration.so wat are all the things which i should get familiar to gain good knowledge in shell scripting.
so kindly provide me some docs/metalink IDS which will enrich my knowledge in shell scripting.
As a DBA upto wat level i should be good in shell scriptingHi;
I dont know about shell scripting .since iam involved in the database administration side i dont know have much knowledge in unix shell scripting.
As a DBA upto wat level i should be good in shell scriptingI belive atleast you have to learn until u can write some control or backup script or when you see some scripts you can understand what they are doing. There is no level or limitation to say "My information enough".
For instance i can type some scripts here but when i go some client they have wirtten and run scripts which can has more than 300-500 line scripts. Its mean its depend your workaround and company or clients needs&requests.
so, wat part does this shell scripting taked in database administration.so wat are all the things which i should get familiar to gain good knowledge in shell scripting.You can type many scripts as:
For backup
For check tablespace status
For check alert log error
For compiling invalid objects
and so on.
so kindly provide me some docs/metalink IDS which will enrich my knowledge in shell scripting.I suggest check first Hussein Sawwan previous greatest post about similar topic:
Shell Script
Shell Script
Also check below search:
http://forums.oracle.com/forums/search.jspa?threadID=&q=shell+scripting&objID=c3&dateRange=all&userID=&numResults=15
Hope it helps
Regard
Helios
Maybe you are looking for
-
Yes, my cousins iPod is disabled. It says "ipod is disabled, connect to iTunes", I did that and it will not connect to iTunes, because it needs the pass code. The pass code key board will not show up and I cant connect. Please help me figure this pro
-
I bought a second hand ipod 4 and it's not letting me sign into icloud. A message saying the five free accounts have already been registered to this ipod.? what can I do?
-
After Effects crashes on startup - Various Errors - Windows 7 64bit
AE CC 2014 13.1.1 Windows 7 64bit 12 GB Ram Intel Xeon CPR W3680 @ 3.33 GHz 3.33 GHz Hyper-threaded 12 cores NVIDIA Quadro 2000 After effects on startup crashes constantly on me. I get various errors, the newest is error code 1268; D_MCp_SetupExporte
-
Hi, Here is my issue: When a Managers go into the MSS portal, click on the Team Viewer and select "Peers", they end up in a loop. When they end the session and go back in, they are unable to open that Iview(screen). This happens in all the iviews
-
My adobe will not open my jpeg pics
My adobe will not open my jpeg pics