Script to shutdown all databases run in the particular ORACLE_HOME

Hello,
I am searching for a shell script that would shutdown all the databases running in a particular ORACLE_HOME and then startup the same exact databases up again after a 'relink all' has been performed.
There are other databases in the particular ORACLE_HOME that are not running and I do not want to start thoses. I only want to shutdown and startup again only those databases that were running in the particular ORACLE_HOME. Thank you.

902029 wrote:
Hello,
I am searching for a shell script that would shutdown all the databases running in a particular ORACLE_HOME and then startup the same exact databases up again after a 'relink all' has been performed.
There are other databases in the particular ORACLE_HOME that are not running and I do not want to start thoses. I only want to shutdown and startup again only those databases that were running in the particular ORACLE_HOME. Thank you.vi db_stop_all.sh
and paste the below code. Here in ORASID you have to mention all the SID's which you want to shutdown.
export ORACLE_HOME=your oracle home
export PATH=$ORACLE_HOME/bin:$PATH
datestr=`date +20%y-%m-%d-%H.%M.%S`
logfile=db_shut_log_$datestr.log
ORAENV_ASK=NO
for ORASID in prod dev test
do
export ORACLE_SID=$ORASID
sqlplus "/as sysdba" <<!
spool DB_$ORASID.log
set echo off
set lines 300
set pages 300
col object_name for a30
select to_char(sysdate, 'dd-mon-yy hh24:mi:ss') from dual;
select instance_name,to_char(STARTUP_TIME, 'dd-mon-yy hh24:mi:ss') as "STARTUP_TIME",host_name from v\$instance;
select name,open_mode from v\$database;
shutdown immediate;
spool off
cat DB_*.log >> $logfile
done
rm DB_*.log
df -k >> $logfile

Similar Messages

  • To find out the database running in the Server

    Hi,
    How to find out the number of database running in the server other than this command : ps -ef | grep pmon
    Thanks,
    Suresh Bommalata.

    There's no single answer.
    1. What if one or more of the database instance(s) is/are down at the moment that you run "ps -ef | grep smon" ?
    2. "ps -ef" cannot be used on Windows.
    3. You could check the oratab file (the location is platform specific -- generally /opt or /var/opt or /etc on Unix/Linux) but not all databases may be registered on the oratab file
    4. You could look for the running (if any !) listener on the server and check the listener.ora listener.log file (database instances do not need to be in the listener.ora !)
    So : You have to run multiple checks.
    Hemant K Chitale
    Edited by: Hemant K Chitale on Aug 2, 2010 3:09 PM

  • I have 4 computers running Adobe CC under two different accounts (as 1 account can only be installed on two computers) i need it on a 5th computer now, do i need another account or can i set up something so all 5 run from the same account making it easier

    I have 4 computers running Adobe CC under two different accounts (as 1 account can only be installed on two computers) i need it on a 5th computer now, do i need another account or can i set up something so all 5 run from the same account making it easier?

    Check into a Team account
    -http://www.adobe.com/products/creativecloud/teams/benefits.html
    -assign a new team member http://forums.adobe.com/thread/1460939?tstart=0 may help
    -Team Installer http://forums.adobe.com/thread/1363686?tstart=0

  • Recreate remittance advices for all payment runs of the day at once a day.

    Hello Sap Gurus,
    Here we have requirment for remittacne advices , so please find below quey.
    1.      Run once a day and recreate all the remittance advices for all the payment runs of the day.
    2.       Convert this into PDF format and download to the LAN structure automatically.
    3.       This program should be scheduled in batch and have proper error handling to alert a user via email should there be a error in the download as we need to understand immediately if we donu2019t have all the remittance advices on the LAN.
    Please provide valuable inputs for the customised program? and is this possible with customised program? or any standard SAP avialable for ths requirement.
    Regards,
    Raj

    HI,
    You can create the same via a custom program with below steps:-
    (1) Fetch all the payment run IDs from table REGUV for a particular run date.
    (2) Then for each run date and run identification combination, call in loop Remittance Advice Printing Program (RFFOAVIS or RFFOAVIS_FPAYM) and it will generate the spool.
    (3) Then call the program RSTXPDFT4 to convert the spool into a PDF file and store on SAP aplication server.
    Then you can have a interface from SAP Application server to your LAN to have the file transferred.
    Regards,
    Gaurav

  • Need Power shell script to run on all databases.

    Hi,
    I have a stored procedure to generate report, using power shell script want to get all databases, run stored procedure on each database and generate the results as .csv file, output the file with database name (place it on directory) and  email .csv
    file.
    looking for script, can any one help pls?
    Naveen| Press Yes if the post is useful.

    Can you please share with me the codes
    Naveen| Press Yes if the post is useful.
    Dear N_14
    You can have a look on the followings
    http://www.csharp-station.com/Tutorial/AdoDotNet/lesson07
    http://www.codeproject.com/Articles/415732/Reading-and-Writing-CSV-Files-in-Csharp
    https://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage%28v=vs.110%29.aspx
    Best Regards
    mintssoul

  • Script to stop all weblogic instances running on a box

    Hi,
    Is there any script to stop all instances of weblogic running on a Unix box at once?
    My understanding is grep for weblogic processes and then issue kill -9 .
    Correct me if im wrong and also provide the right script to shutdown all weblogic instances.
    Thanks!!

    Hi,
    You can use simple JMX code to achieve the same (Shutting down all the Servers present inside a Domain at once) :
    Topic: Force Shutingdown WLS Using JMX
    http://middlewaremagic.com/weblogic/?p=55
    NOTE: The above JMX code is intended to just shut down the AdminServer you can remove the if {} block from from Line No -60 the following JMX code to shutdown all the Servers rather than shutting down Only the Admin Server.
    Thanks
    Ravish Mody

  • How do i create a database template from the command line?

    Hi,
    As part of implementing a backup and recovery strategy for a client (including disaster recovery) I want to automate the creation of a database template From an Existing Database (Structure as well as data) via a script that will run every night.
    The background to this is that we will also be using RMAN to take backups of the database concerned but the client does not want to wait while an RMAN backup is restored and so wants an additional level of insurance in the form of a ‘standby’ clone database.
    The idea is that nightly we will run a script that creates a database template from the Existing Database (Structure as well as data) and then transfers the 2 files involved e.g. DB_data_included.dbc and DB_data_included.DFB across to a standby server where they can be used to recreate the database in the event of us needing to after e.g. a complete server failure.
    So I have a couple of questions about this that I would be very grateful if something could answer for me:
    1)     Is it possible? That is, can a database template be created from some utility by supplying a series of parameter=value pairs on the command line?
    2)     If yes how do I go about it, what utility do I use (the emca utility?). and what parameters do I need to supply on the command line to create the template?
    3)     The intention is that the script to create the template will run in the early hours of the morning when no-one is using the database but what state does the database need to be in when the template creation script runs i.e. up, down, mounted and does the creation of a template affect the state of an already up database i.e. if I kick off the template creation script and the database is up will it switch it into mount mode or anything like that? My concern here is that I want to make sure I understand exactly what is going on so that no users or connected external systems are affected?
    Thanks in anticipation of someone being able to guide me on what to do or what documentation to read.
    Also if you require any clarification on what i'm asking please post up your query and i'll respond ASAP.
    Kind Regards,
    George Johnston
    OCP 9i DBA

    Sybrandb,
    Firstly thanks for you reponse.
    However, I don’t agree that dbca only creates empty databases otherwise why does the option to create a template from an existing database (structure as well as data) exist in the dbca wizard?
    I have performed a test case where I have a created a database template including data on one 10g server. I have then used the files generated to recreate that database on a separate server. When the new database is started it is an exact copy of the original. So it’s not empty at all , it’s exactly what the client wants.
    So I don’t agree that I’m gaining zero.
    Why is this approach doomed to fail?
    There a number of reasons why I “just set up a proper standby database”
    1.     Time – I’m on a customer site in a tight engagement where the customer wants maximum value for money. I don’t have standby database skills and the customer isn’t willing to pay for me to learn on the job so please understand the tight circumstances I’m working in.
    2.     Availability – As far as I know the client is running 10.2.0.3.0 standard edition. Correct me if I’m wrong but is standby db available in that edition. Where do I look to check V$OPTION.
    On the RMAN duplicating a database front it’s an area I haven’t used before but I will take a look at it.
    Also please revisit the context of my original posting where I state
    The background to this is that we will also be using RMAN to take backups of the database concerned but the client does not want to wait while an RMAN backup is restored and so wants an additional level of insurance in the form of a ‘standby’ clone database.
    So please understand that this a quick fix that the client wants developed in the minimum time possible in ADDITION to a full nightly RMAN backup being taken.
    In an ideal world I’d have the time to follow best practice but in the real world of on-site customer support I just need to get the job done operating under the customer imposed constraints.
    Many Thanks,
    George Johnston
    OCP 9i DBA

  • How do I get all administrators to see the 'My Subscriptions' that I have created?

    hi,
    We are running Microsoft Reporting Services 2012. If I create a new subscription under 'My Subscriptions' I can see them when I log in. However there are several administrators who belong to the Domain Administrators
    group (as I do) who cannot see the subscriptions that I create and I cant see theirs either.
    Under Site Settings >> Security, each of the administrators is set there with both 'System Administrator' and 'System User' checked, as is the Domain administrator account and the Domain Administrators
    group, of which we are all a member of.
    Is there anything else I can do to have all the subscriptions visible to everyone who is a domain administrator?
    Thanks in advance,
    JR

    Hi JR,
    In Reporting Services, we can manage all subscriptions with Content Manager Role in Report Manager. Using this task, we can view, modify, and delete any subscription for reports and linked reports, regardless of who owns the subscription. But we need navigate
    to an individual report, then go to the Subscriptions tab to manage the dependent subscriptions. While use the My Subscriptions page, you can view all of your subscriptions in one place. From this page, you can access and modify or delete any subscription
    that you own. You own only the subscriptions that you create. So we cannot view all subscriptions in the My Subscriptions page.
    Alternatively, we can use Transact-SQL script to list all existing subscriptions with the schedule data. For more details, please see:
    http://gallery.technet.microsoft.com/scriptcenter/List-all-SSRS-subscriptions-968ae4d5
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • SearchCatalogAvailabilityMonitor showing unhealthy for all database on DAG member mailbox server

    Hi All
    Help me to resolve server (all database) search catalogue availability monitor.
    I am facing a search catalogue "Unknown" issue for newly created copy database and also on same mailbox server
    "SearchCatalogAvailabilityMonitor" showing unhealthy for all database.
    For the newly created copy database I tried to reseed / update search index catalogue by using below PowerShell command but it stopped with below mentioned error.
    [PS] C:\Windows\system32>Update-MailboxDatabaseCopy -Identity DBTest\MBX1 -CatalogOnly
     Confirm
    Are you sure you want to perform this action?
    Seeding database copy "DBTest\MBX1".
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): y
    Confirm
    The mailbox database copy 'DBTest\MBX1' has failed to update from server . Do you want to clean up that update
    request now? Seeding cannot be requested for the same database copy until the failed request has been cleaned up by the
    server, which should automatically happen within 15 minutes.
    [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): y
    WARNING: Seeding of content index catalog for database 'DBTest' failed. Please verify that the Microsoft Search
    (Exchange) and the Host Controller service for Exchange services are running and try the operation again. Error: There
    was no endpoint listening at
    net.tcp://localhost:3863/Management/SeedingAgent-64310690-DEA4-47E1-9860-E8B2AC4E292A12/Single that could accept the
    message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more
    details..
    [PS] C:\Windows\system32>Get-MailboxDatabaseCopyStatus -Identity DBTest
    Name                                         
    Status          CopyQueue ReplayQueue LastInspectedLogTime   ContentIndex
                  Length    Length                            
    State
    DBTest\MBX2                              Mounted        
    0         0                                  Healthy
    DBTest\MBX1                              Healthy        
    0         0           2/8/2015 3:09:49 PM    Unknown
    DBTest\DRMBX1                            Healthy        
    0         0           2/8/2015 3:09:49 PM    Healthy
    Same time
    Result of get-serverhealth -server MBX1, also please note all database (Copy) search is in unhealthy condition and newly created copydatabase have no entry for "SearchCatalogAvailabilityMonitor".
    Name
    TargetResource
    HealthSetName
    AlertValue
    SearchCatalogAvailabilityMonitor
    DB01
    Search
    Unhealthy
    SearchCatalogAvailabilityMonitor
    DB06
    Search
    Unhealthy
    Reg
    Aditya

    Hi Deepak
    My both exchange servers on hyper V and there should not be resource problems.
    However I have already rebooted server. but it wont help.
    Mean while I get success to make search component healthy on my problematic server by below command but still content index folder is not coming automatically.
    [PS] C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Installer>.\installconfig.ps1 -action I –dataFolder  "C:\program files\Microsoft\Exchange Server\V15\bin\search\ceres\hostcontroller\data"
    Configuring Search Foundation for Exchange....
    Successfully configured Search Foundation for Exchange
    By running this command these are in health state now.
    Name
    TargetResource
    HealthSetName
    AlertValue
    SearchCatalogAvailabilityMonitor
    DB01
    Search
    healthy
    SearchCatalogAvailabilityMonitor
    DB06
    Search
    healthy
    Reg
    Aditya

  • SharePoint 2013 - All Databases Installed to C Drive - How Best to Move Them to Another Drive?

    Hello Community!
    I have a SharePoint 2013 install with all databases installed to the C drive, (no real content yet), I know need to move all those databases to the D drive which has been designated for data - what is the best way to do this?  Please provide guidance
    and script examples.
    Thanks!
    Tom
    Tom Molskow - Senior SharePoint Architect - Microsoft Community Contributor 2011 and 2012 Award -
    Linked-In - SharePoint Gypsy

    1. stop SharePoint services (IIS, timer, etc)
    2. detach from SQL
    3. move files
    4. attach to SQL
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Does iOS7 allow you to quit apps running in the background?

    I can't seem to close my apps running in the background. Before the upgrade, you could double click the home button and all apps running in the background would pull up; you could then hold one down and the app would allow you to cancel it. Now , the double tap brings up all background app but holding down on these apps doesn't allow them to be cancelled. Any suggestions would be helpful!

    Double tap home button, then swipe the app upward to close it.

  • ORACLE DATABASE SPACE USAGE report not showing all databases in 11g

    Hi All,
    I have scheduled "Oracle Database Space Usage (Group)" report for all databases available in the OEM11g. But in the report i am not able to see all the databases in the group. Can any one please help on this.
    Regards,
    GK

    We had the same problem in 12c EM. This had to something with "tablespace allocation metric". This metric was disabled for some databases. This could be your case in 11g also. This metalink note might worth seeing .
    Oracle Database Tablespace Monthly Space Usage shows no data (Doc ID 1536654.1)

  • How to know number of databases running

    HI Experts,
    How to easily know how many databases are running in Windows OS and Solaris OS
    Thanks
    Shaan

    Hi Adith,
    It means i have to loggin to sqlplus, but even if i logging to sqlplus it won't show total numbers of databases running on the server. Is there any other way to know.
    My query is how do I know about number and name of the databases running on a server which is unknown to me. Lsnrctl is one option, but it also doesn't give the 100% result.
    Thanks
    Shaan

  • Automatic startup/shutdown failed. Running the script manual..works...

    Hi,
    DB: Oracle9i
    Os: solaris 9
    /etc/rc0.d K05oracle -> /etc/init.d/oracledb
    /etc/rc3.d SS85oracle -> /etc/init.d/oracledb
    Oratab: i have put yes.
    Please help to resolve this issue...where can i check the startup log?
    what else i need to check?
    Thanks,
    Siva.

    Thanks for your reply....
    Script:
    #!/bin/sh
    case "$1" in
    'start')
    # Sets ORACLE_HOME to latest version on machine
    # ORACLE_HOME="`cut -d ":" -f 2 /var/opt/oracle/oratab | sort | tail -1`"
    ORACLE_HOME=`grep -v "^#" /var/opt/oracle/oratab|grep -v "^$"|cut -d ":" -f 2 | sort | tail -1`
    export ORACLE_HOME
    PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin
    # If you are running Oracle's Multi-Threaded Server, the SQL*Net
    # listener service must be started before the database is started.
    # If it is not, your dispatcher(s) will not start.
    if [ -f $ORACLE_HOME/bin/dbstart ]
    then
    echo "Starting up Oracle databases."
    su oracle -c "LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH;$ORACLE_HOME/bin/lsnrctl start"
    su oracle -c "LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH;$ORACLE_HOME/bin/dbstart"
    else
    echo "Can't find Oracle startup file."
    fi
    'stop')
    # Sets ORACLE_HOME to latest version on machine
    ORACLE_HOME="`cut -d ":" -f 2 /var/opt/oracle/oratab | sort | tail -1`"
    export ORACLE_HOME
    PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin
    if [ -f $ORACLE_HOME/bin/dbshut ]
    then
    echo "Shutting down Oracle databases."
    su oracle -c "LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH;$ORACLE_HOME/bin/dbshut"
    su oracle -c "LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH;$ORACLE_HOME/bin/lsnrctl stop"
    else
    echo "Can't find Oracle shutdown file."
    fi
    echo "Usage: /etc/init.d/database { start | stop }"
    esac

  • Obtain all list of queries run on the database in history.

    Good day to all of you.
    This is my first post here.
    We have an application where we need to study the set of all queries that were run successfully on the DB by users of that db.
    In particular, SELECT stats that were run on the DB Tables/Views...
    Therefore, does Oracle have a 'Query History' of some sort where SQL statements are stored in archives or something like that?
    If so, for how many days of data does it store ?
    Is the DBA_HIST_SQLTEXT View useful ? I took a look at it, however, it did not seem to store any of the queries that were run
    by users. It had some DML statements that i am sure were not run by any of the users.
    Any help in this regard would be greatly appreciated as this is central to what we wish to implement in the future.
    Thank you.
    Karan.

    welcome to forum,
    please refer the links:- it may be useful to you.
    Timestamp from DBA_HIST_SQLTEXT
    http://www.dba-oracle.com/t_time_series_sql_performance_tracking.htm

Maybe you are looking for

  • Trackpad zoom not working in photoshop

    I have photoshop CS3 - and all other adobe CS3 programs. For whatever reason, the zoom in/out on the magic track pad doesn't work. Other function like pan/scroll work. In other applications, like preview zoom in/out on the track pad does work. Is it

  • Remotely repair commad Adobe Reader 9.4 on Windows XP SP3 Clients

    We detected an issue with Adobe Reader 9.4 distribution on houndeds on computers, and we need to figure out how to execute a product repair unattended (Menu Help -> "Repair Adobe reader Installation") .We are using SMS 2003 as distribution software A

  • Icon on Selection -screen

    Is there any option to add icons to parameters/selection option fields. This can be done if screen is designed via Screen painter but looking for option if screen is defined using selection-screen option. Thanks anu

  • PSE 9 effects apple icons dissapeared.

    In adobe pohotoshop elements 9 "effects" apple icons that change and alter photos with the drag and drop option have dissapeared.  How do I make them re-appear? Thanks for your help.

  • How to use UpdateItem() in DataServiceTransaction

    Hello I am using the following code to push an entry to the client and also create a new one in the database. However subsequently I want to just update the previous entry with new volume and price. So I use the updateItem() as shown below.  Please n