error in creating a shell script to the status of the database

Hello

I'm working on a script that made the extraction of information from the database server and gives output on the instance state.

but I'm stuck. I get an error that I can't sort out.

Here is the script

{code}

ORATAB = / var/opt/oracle/oratab

echo "'date" ".

echo "status of databases Oracle"hostname": \n".

"DB ='egrep-i ': Y | ': N ' $ORATAB | "cut d": "-f1 | grep - v "-#" | "grep - v ' \ *"

PsList = "'ps - ef |" "grep pmon'."

for I in $db; do

echo "$pslist" | grep ' ora_pmon_$ I "> / dev/null 2 > $ 1

if (( $? )); then

echo "Instance Oracle - $i: down.

on the other

echo "Instance Oracle - $i: upward.

FI

fact

{/ code}

and here is the result

Oracle@mdcxuatdb05:~$ sh checkdb.sh

Tuesday, September 1, 2015 18:13:45 IST

Mdcxuatdb05 status of Oracle databases:

CHECKDB.sh [7]: cannot open

Oracle instance - egrep: down

CHECKDB.sh [7]: cannot open

Oracle instance - i: down

CHECKDB.sh [7]: cannot open

Oracle instance - ': Y |: N ': down

CHECKDB.sh [7]: cannot open

Oracle instance - $ORATAB: down

CHECKDB.sh [7]: cannot open

Oracle instance | : down

CHECKDB.sh [7]: cannot open

Oracle instance - cut: down

CHECKDB.sh [7]: cannot open

"" Oracle instance - d ': ': down

CHECKDB.sh [7]: cannot open

Oracle instance - f1: down

CHECKDB.sh [7]: cannot open

Oracle instance | : down

CHECKDB.sh [7]: cannot open

Oracle instance - grep: down

CHECKDB.sh [7]: cannot open

Oracle instance - v: down

CHECKDB.sh [7]: cannot open

Oracle instance - "-#": down

CHECKDB.sh [7]: cannot open

Oracle instance | : down

CHECKDB.sh [7]: cannot open

Oracle instance - grep: down

CHECKDB.sh [7]: cannot open

Oracle instance - v: down

CHECKDB.sh [7]: cannot open

Oracle instance - '-* ': down

can someone help me please in this matter.

I am running this script in solaris.

echo "$pslist" | grep ' ora_pmon_$ I "> / dev/null 2 >$ 1

change the line above to

echo $pslist | grep ' ora_pmon_$ I ">/dev/null 2 > & 1... updated the last of them, I just kept 1 to test

Tags: Database

Similar Questions

  • sqlplus from a shell script with the variable in unix

    I'm having some trouble calling sqlplus from a shell script... I am basically asking for a path/name of file which I attribute to one to a variable called $code. Then use cp to move the file ($code) to a new directory. I think that there is something wrong with my sqlplus below. echo $code does not work yet. I thought that $code was variable, which I could see, but rather it seems that the script is trying to rerun the SQL command each time.

    Any help would be greatly appreciated... condensed version of the code is below. Thank you!

    file in $FILES
    do
    Code =""
    code ='sqlplus-s $USER_PWD < < EOF
    Set the off position;
    set pagesize 0;
    Select r.outfile_name OUTFILE
    some paintings
    where file_name = $file;
    EXPRESSIONS OF FOLKLORE"
    echo $code
    CP $code $newdir

    Hello

    I hope code below will help but set feedback off so that he won't be any info if no line selected

    echo ${CODE}
    if [ -z "${CODE}" ]
    then
    echo "No rows returned"
    else
    echo "Returned"
    fi
    

    Concerning
    CA
    uninstall security tool
    essential elements of the Security window
    Windows startup configuration
    the Award bios update

  • Error in creating a report defined by the user in the grid control

    I am trying to create a simple report user-defined in the OEM grid

    Under the tab 'Éléments', I have a 'Type' - 'SQL database Table'
    And I have this "Declaration" - SELECT * FROM SYS. DBA_USERS


    When I click on the 'Preview' button I get this error.
    Element rendering Error. Exception: ORA-00942: table or view does not exist

    I'm connected like SYSTEM.


    Isn't the SYS. Table dba_users accessible by the SYSTEM?

    Any advice on what I'm doing wrong.

    Published by: bfee_sdc on October 19, 2010 09:12

    When you start access to non SYSMAN or you must realize that the database you are referring to objects MGMT_VIEW is the repository of OEM database. Is that what you want?

  • Call a shell script using the OA framework page.

    Hi all
    I'm new to Framework.There OA is a condition in which I have to call a shell script using a Web page using OA framework. Can someone shed some light on how can we do this?

    Concerning

    Hello

    You can save the script shell as simultaneous program and submit this OAF page request.

    Sambi

  • Execution of a Shell Script in the process flow (USER_DEFINED)

    I split my path of the shell and in the value of the ORDER and he appears to find and run, but I got these errors:

    PF_FTS_SCRIPT
    Success

    PF_FTS_SCRIPT:RUN_SCRIPT
    Success


    Here - deleted fts.csv
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 9: rm: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 16: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 19: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 22: Cat: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 16: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 19: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 22: Cat: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 16: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 19: find: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 22: Cat: command not found
    /Home/Oracle/MIDAS_SCRIPTS/FTS_LOGS.sh: line 27: cc: command not found

    It seems he cannot use the standard linux commands to operate on the file for writing, ideas?

    RM fts.csv
    CP fts.csv $directory_to_copy_to

    THE CMD SHOULD BE SOMETHING LIKE THIS:
    ' / usr/bin/CP /user2/cog/ftp/lkp_dates/d.dat/user2/cog/ftp/lkp_dates /'d3_ "/ usr/bin/cut - f1-d '.' /user2/cog/ftp/lkp_dates/CURR_MONTH_YEAR.csv".dat ".
    / usr/bin/chmod 777/User2/cog/ftp/lkp_dates/d3 * OR DELETE in YOUR CASE.

    Please click on the link that I posted above.

  • Errors when creating FOD demo scripts

    I followed the steps of creation of oracle 11g scheme as written in http://www.oracle.com/technetwork/testcontent/connection11g-088156.html#t1s1:

    I got these errors:

    BuildFile: F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\build.xml

    init:

    [javac] F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\build.XML:38: caveat: 'includeantruntime' has not been defined, or by default in build.sysclasspath = last; Set to false for the reproducible versions

    [javac] Compiling 1 source file for F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\classes

    [javac] WARNING: class bootstrap [options] path not defined jointly with - source 1.5

    [javac] 1 WARNING

    setProperties:

    createDatabase:

    refreshSchema:

    BUILD FAILED

    F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\build.XML:51: The following error occurred during the execution of this line:

    F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\build.XML:100: The following error occurred during the execution of this line:

    F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\build.XML:63: The following error occurred during the execution of this line:

    F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\build.XML:28: C:\Oracle\Middleware\jdeveloper\wlserver_10.3\server\lib does not exist.

    Total duration: 11 seconds

    Hey guys find a solution for this.

    I followed the steps to solve the problem below:

    1 - in the build.properties file make sure that middleware.home=C:/Oracle/Middleware is where you have the folder oracle_common folder and jdeveloper. It wasn't the case for me, I had to change

    middleware. Home = C: / Oracle/middleware to middleware.home=C:/Oracle/Middleware//Oracle_Home.

    I also use Jdeveloper 12.1.3.

    2. fix the error below

    F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\build.XML:28: C:\Oracle\Middleware\jdeveloper\wlserver_10.3\server\lib does not exist.

    To do this, you need to click on the error. It will take you to the file in question (F:\programs\sql_oracle11g\sql\sql_oracle11_reference\Fusion_order_demo\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\build.xml).

    Search for below the line of code:

    You should change the wlserver_10.3 with the name of the folder that you have. in my case it was wlserver.

    3. you will notice after this line: you have: .

    it you must download the ojdbc6.jar and put it in the folder of the server weblogic C:\Oracle\Middleware\jdeveloper\wlserver guess.

    Those not done for me. hope that helps.

  • Extended analytics. Error when you try to connect to the database

    Hi all
    We created the UDL file to the star schema database, and configure the DSN on EPM System Configurator (11.1.1.3)
    UDL file is connected correctly, but when we try to 'Create star schema' we get an "Error occurred whil connection to the database" error.

    Any ideas? are we missing something?

    Concerning

    Have you given the grant of rights 'connect' to the database or schema?

    Varun

  • Create read only user to the database

    Hi all

    I need to create read only the user to one of the databases so that he should have the select query on all tables, views etc...

    Can I create a user of this type with the role OEM_MONITOR at once?

    Please advice
    Concerning
    Arun

    No.:

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> create user toem identified by toem;
    
    User created.
    
    SQL> grant oem_monitor to toem;
    
    Grant succeeded.
    
    SQL> select count(*) from hr.jobs;
    
      COUNT(*)
    ----------
            19
    
    SQL> connect toem/toem
    Connected.
    SQL> select count(*) from hr.jobs;
    select count(*) from hr.jobs
                            *
    ERROR at line 1:
    ORA-01031: insufficient privileges
    
    SQL>
    

    Grant select ANY TABLE might work, but note it is generally regarded as a bad security practice:
    http://download.Oracle.com/docs/CD/E11882_01/network.112/e10574/guidelines.htm#CHDHFIFG

    Edited by: P. Forstmann on March 8, 2010 21:31

  • Connection.setAutoCommit (false); She creates a transaction next to the database?

    I'm curious to know what the transaction is started next to the database? I use oracle as database and ojdbc6 driver to connect to the db jar.

    I'm also curious to know what exactly is a connection? There I can relate to a database session? taken do allow to install a java application on the database server?

    Thank you!

    I'm curious to know what the transaction is started next to the database? I use oracle as database and ojdbc6 driver to connect to the db jar.

    I'm also curious to know what exactly is a connection? There I can relate to a database session? taken do allow to install a java application on the database server?

    Thank you!

    Non - autocommit affecting false does NOT create a transaction.

    You can EASILY search the Web for definitions of terms such as the transaction, logon session.

    The Java tutorials has a track for "aid Operations."

    https://docs.Oracle.com/javase/tutorial/JDBC/basics/transactions.html

    Turn off autocommit Mode

    When a connection is created, it is in autocommit mode. This means that each SQL statement is treated as a transaction and is automatically committed right after his execution. (To be more precise, the default is for a SQL statement to be engaged when it is finished, not when it is executed. A statement is completed when all its result sets and update counts were recovered. In almost all cases, however, a statement is completed and therefore committed, just after his execution.)

    How to allow two or more instructions which lie in a transaction is to disable auto-commit mode. This is illustrated in the following code, where con is an active connection:

    on.setAutoCommit(false);
    

    The Java API tells you what a 'link'

    Connection (Java SE 7 platform)

    A connection (session), with a specific database. The SQL statements are executed and results are returned as part of a connection.

    See where it says "connection (session)?

    And the Oracle documentation can discuss those from the point of view of DB

    https://docs.Oracle.com/database/121/CNCPT/Transact.htm#CNCPT117

    Introduction to Transactions

    A transaction is a logical, Atomic work unit that contains one or more SQL statements. A transaction includes the SQL statements so that they are all committed, which means they are applied to the database, or all canceled, which means that they are cancelled from the database. Oracle database assigns to each transaction a unique identifier called transaction ID.

    Oracle transactions obey the basic properties of a database transaction, known as ACID properties. ACID is an acronym for the following:

    . . .

    After the end of a transaction, the next executable SQL statement automatically starts the following transaction.

    . . .

    The Oracle documentation also discuss when a transaction begins - which may be different from another database

    http://docs.Oracle.com/database/121/SQLRF/statements_10005.htm#SQLRF01705

    Use of the SET TRANSACTION statement to establish the current transaction in read-only or read-write, to establish its isolation level, assign it to a specified rollback segment or type a name for the transaction.

    A transaction is implicitly starts with any operation that requires a TX lock:

    • When a statement that changes data are issued
    • When a SELECT ... FOR UPDATE instruction is emitted
    • When a transaction is explicitly started with one SET TRANSACTION statement or the DBMS_TRANSACTION package
  • I use TDE tablespace encriptación and backup is performed (no encriptación rman). I get the error message when you try to restore the database

    I use TDE tablespace encriptación and backup is performed (no encriptación rman). I deleted the database and try to restore the backup. I get the error when you try to restore the database with rman restore database.

    ORA-19870: error when restoring backup piece + FRA_DG, oratst, backupset, 2015_03_2

    ORA-19913: could not decrypt the backup

    ORA-28365: portfolio is not open

    About what I know, you should be able to RESTORE the data, but no RECOVERY without portfolio being opened.

    Check the value of the variable environment - ORACLE_UNQNAME

    It has everything first a correct value and try to open the wallet.

    HTH,

    Pradeep

  • Uninstalling the add-on: error in updating Indesign CC 2015 of the database

    We want to install the add-on from the Adobe store.

    Adobe store comment is: installed

    But we do not see the add-on in > window > Add ons

    The add-on is not listened to.

    Now we want to remove the add-on, but we have an error in the update of the database.

    Thanks for a response

    Robert

    We have restarted the Mac and have uninstalled the add-on via the cloud creative Installer and start over again.

    Now it's working.

    But we tried 4 times before in the same way (without restarting the Mac).

  • E.M.P. 11.1.2.2 Config Error - EPMCFG-10368: unable to connect to the database.

    Hello

    I found the error when configuring EPM 11.1.2.2 below system

    Error message indicated as "EPMCFG-10368: unable to connect to the database." Check the database connection information'.

    Environment: Windows XP SP2, SQL Server 2005.

    Please help me solve the problem. Please also find the screen shot to http://ge.tt/6xqpj0L/v/0?c

    Kind regards
    Naveen

    Published by: Naveen on July 25, 2012 17:35

    Windows XP is not supported for client components not, I recommend that you install on an operating system that is supported so usually, when there is trouble connecting to SQL Server, it is down from TCP/IP not been activated, also correct for a static port, make sure that no firewalls are in place.

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • APEX_PUBLIC_USER creates several newspapers-ins in the database.

    Hello

    Our software team is new to the APEX, and the ADMINISTRATOR noted that whenever a user connects to an APEX application, there are several connections APEX_PUBLIC_USER created in the database.

    As soon as I entered the URL, he had 3 records of the APEX_PUBLIC_USER in the instance.

    Is this normal, or is there something that we should have Setup differently?

    Thank you
    Keisha

    It's normal. You see the sessions created for the modplsql connection pool. This improves performance by keeping the connections available for applications expected.

    Scott

  • Signature error code: customer ID is not in the database of the authorization

    Everything worked well on JDE 4.2. Then I installed JDE 4.5 and compiled my project to use it. But when I ask signature now it says "Code signing request failed because xxxxxxxxxx customer ID is not in the database for authorization.

    Please tell what is wrong.

    Thanks in advance

    Hello, there were several changes in the BlackBerry servers...

    See the following URL: http://supportforums.blackberry.com/t5/Java-Development/Signing-Client-does-not-exist-in-authorizati...

    Greetings

  • Script to the database data to TextInput

    Hello

    As it says in the title, I want to put the database data to Textinput. Here is my request:

    Cliché 2009-05-12 11-55-40.tiff

    Well, what I want to do is when you click on the rows in the Datagrid control, the 'Name' field is filled by the name in the DataGrid, the "address area" by the address in the Datagrid...

    Can someone help me? Please

    Thank you

    It is a minimal example:

    
    
         
              
         
    
         
    
         
    
    

Maybe you are looking for