Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    3

    Red face Unanswered: STARTUP/SHUTDOWN Oracle database via .BAT file and SVRMGRL

    Hi All,

    I would like to automate process of starting up Oracle 8i database on WIN2000 machine. I understand i can set to start Oracle8i ( SID ) service to automatic ( using Services control panel ) but i would like to automate the sequence of starting and shuting down Oracle database through use of SVRMGRL

    SET ORACLE_SID=CABP

    SVRMGRL
    > connect internal/manager
    > startup

    or shuting down database

    SET ORACLE_SID=CABP

    SVRMGRL
    > connect internal/manager
    > shutdown immediate

    Thanks

    Regards
    Dejan

  2. #2
    Join Date
    Apr 2003
    Location
    Greenville, SC (USA)
    Posts
    1,155
    Set it up as a .BAT file and run it in the AT scheduler...

    submit a job to the scheduler that does ...

    svrmgrl @filename

    the above file should look something like ...

    set instance instancename
    connect internal/password@instancename
    shutdown immediate ... (or whatever you are looking to do)
    exit

  3. #3
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311
    Hi,

    the best way to do this:

    create a .bat file which contains the following lines per database:

    --
    set oracle_sid=ORCL
    net stop oracle<homename>agent (for example oracle902agent)

    svrmgrl @stop.sql

    net stop oracleserviceORCL
    --

    Create a .sql file with the following lines:
    connect internal/pwd
    shutdown immediate
    exit

    The first file sets the environment setting for the db, stop the oracleagent and starts svrmgrl and calls a shutdown script for the database. AFter shutting down the instance (windows service) should be stopped and possibly also the listener.

    Hope this help. If you have any questions or want a sample (i do this all the time), contact me via email.

    Edwin

  4. #4
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198

    Re: STARTUP/SHUTDOWN Oracle database via .BAT file and SVRMGRL

    Originally posted by dejanj
    Hi All,

    I would like to automate process of starting up Oracle 8i database on WIN2000 machine. I understand i can set to start Oracle8i ( SID ) service to automatic ( using Services control panel ) but i would like to automate the sequence of starting and shuting down Oracle database through use of SVRMGRL

    Thanks

    Regards
    Dejan
    I do a dump before shutdown, this is what is in my batch file.

    SET ORACLE_SID=PROD
    D:\ORACLE\ORA81\BIN\EXP.EXE system/****** PARFILE=D:\ORADUMP\PROD\EXPORT.PAR
    D:\ORACLE\ORA81\BIN\ORADIM -SHUTDOWN -SID PROD -USRPWD ******* -SHUTTYPE SRVC,INST -SHUTMODE I

    I do an oradim shutdown because IMH it is the most graceful method, and can be done from the command line.

    To do the startup, it is either
    NET START ORACLESERVICEPROD
    or
    D:\ORACLE\ORA81\BIN\ORADIM -STARTUP -SID PROD -STARTTYPE SRVC,INST -USRPWD ****** -PFILE D:\ORACLE\ORADATA\PROD\INITPROD.ORA

    That way you don't even need svrmgrl.

    If all you are doing is the the startup and shutdown you don't even need a batch file. just put the oradim commands in the task scheduler. I'm using the batch files just because I do a dump before shutdown and an analyze on startup.
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

  5. #5
    Join Date
    Sep 2003
    Posts
    3

    Startup/Shutdown Oracle

    Originally posted by gbrabham
    Set it up as a .BAT file and run it in the AT scheduler...

    submit a job to the scheduler that does ...

    svrmgrl @filename

    the above file should look something like ...

    set instance instancename
    connect internal/password@instancename
    shutdown immediate ... (or whatever you are looking to do)
    exit
    Thanks very much. The crucial line was svrmgrl @filename plus i 've found out that i have AUTOSTARTUP = TRUE and AUTOSHUTDOWN=TRUE in registry ( THis is to startup/shutdown Oracle database as Oracle instance is up or down. So if i want to proceed with this way i need to have it set to FALSE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •