Shell script to stop/start oracle

hi
I want to build a shell script with argument the servername followed by either stop or start.
How to do that in shell?
thanks.

#/bin/sh
sqlplus -s "/as sysdba" <<!
startup
However, the output is:
ORACLE instance started.
Total System Global Area 612368384 bytes
Fixed Size 1281672 bytes
Variable Size 251658616 bytes
Database Buffers 356515840 bytes
Redo Buffers 2912256 bytes
Database mounted.
Database opened.
SP2-0103: Nothing in SQL buffer to run.
How to get rid of this output??
thx

Similar Messages

  • Script to Stop/Start Oracle Apps windows services

    Hello,
    I am trying to script 2 batch files, one to stop services and one to
    start services.
    So far I have the folloing for the stop script:
    Stop services:
    set ORACLE_HOME=e:\oracle\<sid>ora\8.0.6
    set ORACLE_SID=<SID>
    NET STOP "Oracle Reports Server [Rep60_HPP1]"
    NET STOP OracleApacheServerHPP1_spud
    NET STOP OracleFulfillmentServerHPP1_spud
    NET STOP OracleMetricsClientHPP1_spud
    NET STOP OracleMetricsServerHPP1_spud
    NET STOP OracleConcMgrHPP1_spud
    NET STOP OracleHPP1Ora806_1TNSListener80APPS_HPP1
    However sometimes the concurrent manager fails to stop correctly and I
    have to issue a 2nd command to forcefully shut it down. Does anyone
    know how I can write this into my script? before it moves onto the
    Apps Listener?
    Any advise would be appreciated.
    Thank you
    Sarah

    The error we sometimes get is that the concurrent manager was unable to stop we have to then use the following command to shut them down:
    CONCSUB.EXE APPS/appspassword@PROD SYSADMIN "System Administrator" SYSADMIN WAIT=Y CONCURRENT FND ABORT
    I was trying to use net stop in the script and if this didn't work, the script would issue the command above.
    Thank you

  • Shell script for stopping SAP

    Dear gurus,
    I'm writing the shell script to stop SAP:
    su - mhdadm;
    stopsap;
    when i execute, the script only successfully logon as user mhdadm, and not stopping the sap.
    please enlight me..
    Thanks for your help.
    Best regards,

    Hi,
    su - mhdadm;
    stopsap;
    Above method will not work. You can use below command to execute as <sid>adm user.
    Run this command or script as a ROOT...
    su - mhdadm -c "stopsap"
    ( su - <user_name> -c "command_to_execute" ) should be on same line...
    Just test it...
    Regards.
    Rajesh Narkhede

  • Skeleton Shell script needed to start jClient from prompt

    Hi,
    we like to call a class which uses an application module directly from command line. I wrote a little shell script which wraps the direct "java myClass" call (later on, we plan to use cron for automatic calls).
    We use the Configuration.createRootApplicationModule method for creation of our application module (the class and the bc4j.xcfg are both packed in the same jar).
    We run into some issues concerning setting the correct classpath:
    I suppose our classpath isn't set properly.
    Can anyone give me a list of BC4J jars (and other standard Oracle JARS) that must be in the classpath in that specific order? (incl. location where to find)
    Or maybe an extract of your shell script if any exists.
    Many thanks,
    Stefan

    Hi Arno,
    thank you for your help.
    @All:
    Below please find a working script to start a batch job(which uses an application module in local mode) under a linux environment where Oracle 10g iAS is installed.
    Have fun.
    Stefan
    # set up your directory where iAS 10g is installed
    IAS_HOME=/usr/bin/oracle/product/appserv
    export IAS_HOME
    # set path for proper lookup of java.bin
    export PATH=$PATH:$IAS_HOME/jdk/bin
    # minimum amount of jars to start an application module
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/lib/bc4jmt.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/lib/bc4jct.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/lib/bc4domorcl.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/lib/collections.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/lib/bc4jimdomains.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/BC4J/jlib/bc4jdomgnrc.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/jdbc/lib/classes12.zip
    CLASSPATH=$CLASSPATH:$IAS_HOME/lib/xmlparserv2.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/jlib/jdev-cm.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/jlib/ojmisc.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/jlib/share.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/j2ee/home/lib/ojsp.jar
    CLASSPATH=$CLASSPATH:$IAS_HOME/j2ee/home/jsp/lib/taglib/ojsputil.jar
    # define further project specific APIs here (e.g. Batch-Job JARs, Apache Jakarta FOP JARs)
    export CLASSPATH
    # set java options (here: allow minimum of 512 Mb and a max. of 1 GB of heap memory) and start Batch-Job
    java -Xms512m -Xmx1g MyBatchJob

  • Stop/start oracle 11 only takes about 2 secs

    I am using oracle 11. Sometimes my application tells me cannot connect to oracle, so I restart oracle service OracleServiceORCL11. But it is very weird stopping and starting only takes around 2 secs(normally it takes 1 minute).
    After restarting, connect oracle using sqlplus will report "Connected to an idle instance."

    After restarting, connect oracle using sqlplus will report "Connected to an idle instance."In the Registry is ORA_<SID>_AUTOSTART set to TRUE ?                                                                                                                                                                                                                                                                                                       

  • Script tp stop and start components

    Hi All,
    I know the steps to stop/start all the components managed by opmn in a standalone env.
    But, I need to know is there any differnece to stop/start components in a cluster env, as I have SOA installed on 2 nodes and wanted to create a shell script to stop/start comp.
    Please let me know if anyone have script.
    Regards
    Kumar

    All of those components are available as Windows services. You can use the relevant
    net stop
    commands to stop them.
    Regards,
    Stratos

  • Random SP2 error when starting oracle process through SHELL script

    Hi All,
    I am trying to process data in n-Number of tables through a package. The package is called through a shell script to create start data processing. All calls to the package are in a sql script which is basically exec calls-
    exec package.process ('T1','some param');
    exec package.process ('T1','some param');
    exec package.process ('T..n','some param');
    I have a shell script which I use to execute commands from the sql script. There is a reason behind using shell script. For some strange reason, I keep on getting -
    ERROR: logon denied - check for valid user with valid privileges
    SP2-0640: Not connected
    SP2-0641: "EXECUTE" requires connection to server
    SP2-0640: Not connected
    for some EXEC calls. Problem is, errors are generated at random. So in one run, I get error for T10,T11 and then in next run I might get for some other tables.
    However, when I am running the sql script from the sql prompt, all calls to the package are executed without any problem.
    This makes me think, it is something to do with the way database connection being initiated through UNIX.
    Has anyone faced similar issue? Your help/gudence is much appreciated.
    DB: Oracle 10.2.0.5
    OS: SUN Solaris 10
    Thanks in advance.

    Login credentials are provided inside the shell script.
    I did put a sleep(10) after EOF but no help. As mentioned if I run script file from sql promt, it runs without any hiccup. So it is the connection through the UNIX that is causing issue.
    As pointed out by Sybrand, I agree that it does not make a sense to connect and commit after every sql statement. So decided to change the shell script and so far, the result from my initial tests on a sample data is quite encouraging. Hopefully I will have a solution.
    But it will be nice to know why SHELL is doing what it is doing!!
    Legacy prog are sometime big time eye-openers..;)

  • Shell script to start forms and reports server on reboot

    Does anyone have on shell script to automatically start up the forms and reports server on unix after a reboot?
    thanks much

    I also recompiled the "test.fmb" that came with the 10g Forms and Server on my windows xp machine and when I downloaded it back to the Linux Forms and Server machine, it loss the functionality of the "OK" button which is suppose to perform "exit_form" when pressed.
    BTW, I am using 10G developer suite on windows xp.

  • Unix Shell Scripts with Oracle

    Any body who can give me the link where I can find the Unix Shell Scripts to access the Oracle database and execute the stored procedures and cursors.

    Your unix script will contain (at appropriate places):
    sqlplus -s username/pasword@server @your_sql_Script_that_calls_the procedure.SQLor
    sqlplus -s / @your_sql_Script_that_calls_the procedure.SQL

  • Need a shell script to backup archive log daily

    Hi All,
    We need a shell script to backup the archive logs daily after shutting down the concurrent manager and once the backup is completed, needs to start the concurrent manager through the script itself, if you have any ideas or sample scripts, please provide and help us.
    The objective is to backup the daily archive logs with out any loss of data.
    Thanks,

    I do not have a similar script to share, sorry. However, you may review the following links/notes:
    Note: 137181.1 - RMAN Backup Shell Script Example
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=137181.1
    Recovery Manager (RMAN) Manuals
    http://www.oracle.com/pls/db102/homepage

  • Versioning of shell scripts in Sun Solaris 9? (ident-string)

    Dear all,
    I have got a question about the versioning of shell scripts (e.g. start/stop scripts) in Sun Solaris 9:
    In every shell script I can find an information-"header" like ' ident "@(#)<name_of_script> <version> <date> SMI" '. Is this an "sun internal" or ist there a versioning-database or something else on Sun Solaris? If yes, is there a way to check in my own shell script there?
    Best Regards,
    Alex....

    That's a Sun internal revision control string. However, that doesn't prevent you from setting-up your own RCS (or CVS) archive for maintaining customizations. You can add your own RCS tags and check them into an archive. You can get RCS and CVS from http://www.sunfreeware.com/ .
    HTH,
    Roger S.

  • Calling a report from a shell script

    We are modifying all concurrent programs to encrypt the oracle password by using the "ENCRYPT" option in the concurrent program definition for all unix based programs.
    The db user/password is derived from the FCP_LOGIN within the shell script. If I submit the concurrent prorgam and go to the root directory on which the unix shell scripts are present and execute the following command :
    ps -ef
    I can see the call to the concurrent program and since I am using the encrypt method, i cannot see the password(I could see the password before the change)
    The problem is one of the shell scripts is calling an Oracle Report by using ar25run command which needs a userid as the parameter.
    So when I issue the above ps command, i can see the password in the call to this report.
    Is there any other way of passing the oracle user/password to the report? This is required for SOX compliance.
    thanks,

    I guess it should be the same problem as if you are calling CONCSUB from unix also, because both need userid and password.
    If that's the case probably metalink note 104541.1 might help you.

  • Creating new BAT file script to stop, restart and disable S I agent

    We have just installed BOXI3 and are in the process of updating some bat files for stopping, restarting and failover (to our backup servers)and disable services on the Central Configuration Manager.   In my old scripts we called each service  Examples (
    sc
    servername.net config "bobjspcengine" start= disabled                    
    sc
    servername.net config "BOBJWebiServer" start= disabled)
    I have a few  questions
    1.  Server Intelligence Agent... Where would I find it's name   like the BOBJWebiServer example?
    2.  If my bat file stops this agent does that automatically stop the CMS, Webi, Report services?
    3. This is for our support team in order to easliy stop Tomcat and other services for failing over to our DR sites and backups since the script automatically stops,  starts, restarts disables and enable services..., is this the best approach?   We put these bat files out on the servers and all they do is click on them to start the failover process.

    Try using
    Process Monitor for looking the key.
    For example, you may set the required value through the group policy and see what windows registry keys are changed.

  • Why has the sql statement been extucted two times in shell script?

    I tried to test rac load balance using the following shell script on suse 10 + oracle 10g rac.
    oracle@SZDB:~> more load_balance.sh
    #!/bin/bash
    for i in {1..20}
    do
    echo $i
    sqlplus -S system/oracle@ORA10G <<EOF
    select instance_name from v\$instance;
    EOF
    sleep 1
    done
    exit 0After execute shell script, I got the follow result.
    oracle@SZDB:~> ./load_balance.sh
    1
    INSTANCE_NAME
    ora10g2
    INSTANCE_NAME
    ora10g2
    2
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1
    3
    INSTANCE_NAME
    ora10g1
    INSTANCE_NAME
    ora10g1Seem the sql statement has been executed two times in each loop. If you feel free please help to have a look. Thanks in advance.
    Robinson

    You can end a SQL command in one of three ways:
    * with a semicolon (;)
    * with a slash (/) on a line by itself
    * with a blank line
    A semicolon (;) tells SQL*Plus that you want to run the current command that was entered. SQL*Plus processes the command and also stores the command in the SQL buffer.
    A blank line in a SQL statement or script tells SQL*Plus that you have finished entering the command, but do not want to run it yet, but it's stored the command on SQL Buffer.
    A slash (/) on a line by itself tells SQL*Plus that you wish to run the command stored on SQL buffer.

  • Running SQLPLUS from UNIX shell script

    I'm not sure if this is the right forum, but...
    How can I execute a sql file from inside the UNIX shell script, logging on to Oracle w/o supplying a UID/pwd? Normally, we log into UNIX using our own logon, then sudo as another user to login to Oracle. Now, I'm trying to create a UNIX shell script, where I'm already sudo'd as the UserID that logs into Oracle. I've tried the following, but can't get it to work. I'm a UNIX scripting noob. Any ideas?
    example:
    #! /usr/bin/ksh
    sqlplus / \@test.sql << EOF
    exit;
    EOF

    I'm a UNIX scripting noob.In which case I feel obligated to point you at William Robertson's excellent article Database Shellscripts Considered Harmful. Save yourself a world of pain.
    Cheers, APC

Maybe you are looking for