Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Script for performing clean shutdown before windows shutdown

Re: Script for performing clean shutdown before windows shutdown

From: Andreas Sheriff <spamcontrol_at_iion.com>
Date: Fri, 26 Aug 2005 14:10:08 -0700
Message-ID: <%zLPe.47125$Ji4.33662@fed1read03>


Comments inline.

<fitzjarrell_at_cox.net> wrote in message
news:1125084808.407326.274810_at_g44g2000cwa.googlegroups.com...
>
> Andreas Sheriff wrote:
>> "Holger Baer" <holger.baer_at_science-computing.de> wrote in message
>> news:ddsdcq$s2r$1_at_news.BelWue.DE...
>> > Andreas Sheriff wrote:
>> > > "Holger Baer" <holger.baer_at_science-computing.de> wrote in message
>> > > news:ddqef3$pfa$1_at_news.BelWue.DE...
>> > >
>> > >>Andreas Sheriff wrote:
>> > >>
>> > >>><bdbafh_at_gmail.com> wrote in message
>> > >>>news:1124119055.886364.226290_at_g14g2000cwa.googlegroups.com...
>> > >>>
>> > >>>
>> > >>>>Your fears are well founded.
>> > >>>>
>> > >>>>Even with the service configured to perform a shutdown immediate
>> > >>>>when
>> > >>>>the service is stopped, if control is not returned within the "wait
>> > >>>>to
>> > >>>>kill service timeout" the process is terminated in a non-graceful
>> > >>>>fashion and crash recovery will be required ... possibly requiring
>> > >>>>media recovery to be performed.
>> > >>>>
>> > >>>>best approach is to:
>> > >>>>
>> > >>>>connect / as sysdba
>> > >>>>alter system switch logfile;
>> > >>>>shutdown abort
>> > >>>>startup mount restrict
>> > >>>>alter system set job_queue_processes=0;
>> > >>>>alter database open;
>> > >>>>shutdown immediate
>> > >>>>
>> > >>>>then stop the operating system service.
>> > >>>>
>> > >>>>you'll also want to alter the value for the registry key
>> > >>>>HKLM\SYSTEM\CurrentControlSet\Control\WaitToKillServiceTimeout
>> > >>>>the default is 20000 (20 seconds).
>> > >>>>I'd recommend setting it to at least 300 seconds.
>> > >>>>
>> > >>>>hth.
>> > >>>>
>> > >>>>-bdbafh
>> > >>>>
>> > >>>
>> > >>>
>> > >>>DO NOT SHUTDOWN ABORT
>> > >>>
>> > >>>If you're that fearful, execute a SHUTDOWN IMMEDIATE manually every
>> time
>> > >>>you
>> > >>>wish to stop or restart the OS. Don't rely on scripts to do it for
>> > >>>you
>> > >>>because scripts can fail.
>> > >>>
>> > >>
>> > >>Only that SHUTDOWN IMMEDIATE might wait a long time if, e.g. the
>> > >>Intelligent(?)
>> > >>Agent is running.... So scripting isn't too bad, provided you know
>> > >>the
>> > >>limitations.
>> > >>
>> > >>In general shutting down everything that connects to the database
>> > >>(Intelligent Agent,
>> > >>DBConsole/EnterpriseManager....) should be shutdown first, then the
>> > >>database, and
>> > >>finally the listener (although the listener can be shutdown upfront
>> > >>to
>> > >>prevent logins).
>> > >>
>> > >>On a busy database you might still have problems with shutdown
>> immediate,
>> > >>though.
>> > >>
>> > >>And if you don't trust Oracle to recover from a shutdown abort, don't
>> use
>> > >>Oracle.
>> > >>Or invest in proper HW, OS and training.
>> > >>
>> > >>Regards,
>> > >>Holger
>> > >
>> > >
>> > > SHUTDOWN IMMEDIATE will not wait.
>> >
>> > Not my experience. However, I have to admit that setting up a test case
>> > with Intelligent Agent failed, too.
>> > >
>> > > From the 10gR2 SQL PLUS documentation:
>> > > (SHUTDOWN) IMMEDIATE
>> > >
>> > > Does not wait for current calls to complete or users to disconnect
>> > > from
>> the
>> > > database.
>> > >
>> > > Further connects are prohibited. The database is closed and
>> > > dismounted.
>> The
>> > > instance is shutdown and no instance recovery is required on the next
>> > > database startup.
>> > >
>> > > If you don't believe me, try it. Start several transactions from
>> several
>> > > sources, including the agent/console/EM/etc... and you'll see that
>> > > any
>> > > active transaction will be rolled back, no further connections will
>> > > be
>> > > allowed, and the database will shutdown.
>> > >
>> > > SHUTDOWN TRANSACTIONAL will wait, however.
>> > >
>> > > And if IMMEDIATE seems to wait, that's only because the database is
>> > > busy
>> > > finishing activity it needs to shutdown.
>> >
>> > I'm perfectly aware of the differences between shutdown normal,
>> transactional, immediate,
>> > abort, thank you.
>> >
>> > But I've seen Intelligent Agent preventing an idle instance from
>> > shutting
>> down
>> > with IMMEDIATE and so you're on the safe side to shutdown local
>> > services
>> first
>> > before shutting down the instance.
>> >
>> > But any way, my point was that there is no intrinsic harm in using
>> SHUTDOWN ABORT.
>> > So the suggestion of BDBAFH stands.
>> >
>> > Regards,
>> > Holger
>>
>> SHUTDOWN ABORT is the same thing as executing
>> kill -s KILL $(ps -Af | gawk '/ora_${ORACLE_SID}/{print $2}')
>> It KILLs all Oracle instance processes for that SID. You go ahead and
>> keep
>> using SHUTDOWN ABORT.
>
> And I will when I deem it necessary. Let's look at the suggested
> procedure again:
>
> connect / as sysdba
> alter system switch logfile;
> shutdown abort
> startup mount restrict
> alter system set job_queue_processes=0;
> alter database open;
> shutdown immediate
>
> I see no issue with what has been posted. A shutdown abort has been
> issued to ensure the instance stops. A startup mount restrict is then
> executed, followed by an alter dsatabase open, to enable the necessary
> recovery after the shutdown abort. The database is finally shutdown
> immediate, requiring no recovery on startup.
>
> Had only a simple 'shutdown abort' been suggested I may have tended to
> agree with your assessment. However, in this situation your advice is
> wrong.
>
>
>>
>> There are only two instances in which you should use SHUTDOWN ABORT
>> 1. When the instance is not responding. An alternative would be to use
>> STARTUP FORCE then SHUTDOWN IMMEDIATE. STARTUP FORCE would call SHUTDOWN
>> ABORT anyway, then restart the instance. Using SHUTDOWN abort directly
>> or
>> indirectly may require recovery, or even restore at the next startup.
>> 2. When the instance isn't started at all. In my 9i RAC class we've had
>> to
>> use SHUTDOWN ABORT after shutting down the instance normally because
>> there
>> were left over footprints (muteces and or semaphores, I suspect) for the
>> instance after a normal shutdown.
>>
>
> Incorrect. This is a case where shutdown abort is useful, especially
> as other Oracle services may be running which could interfere with a
> plain-vanilla shutdown immediate.
>
> Shutdown abort is no worse than any other shutdown mode, it only defers
> recovery until the next startup. Yes, it is a 'brute force' method to
> shutdown an instance; sometimes that is necesary to ensure the instance
> stops in a timely manner. One cannot wait forever for Oracle to shut
> down when a server is in the midst of a reboot.
>

What do you think would happen if Oracle were in the middle of writing to a block when you issue SHUTDOWN ABORT?

There are some disk systems that would prevent partial writes, but then again, there are some disk systems that do not prevent partial writes and leaves files open.

It's never good to have a partial write done to a disk or to kill programs that have files open. If it were ok to use SHUTDOWN ABORT because it's "no more worse than any other shutdown mode", then why don't you just hit "the big red switch" and be done with it?
I'll tell you how you can find out.
Just type lsof on any unix system and you'll see.

Sure, use shutdown abort as a last resort, but only as a last resort, not as a replacement for your usual shutdown procedure.

> Again, this is surprising advice from a professed OCP.

OCP, 6 years Oracle experience and twelve years programming experience with all kinds of languages and operating systems.

Again, this is surprising advice form a professed Oracle Professional without credentials.

>
>> --
>>
>> Andreas Sheriff
>> Oracle 9i Certified Professional
>> Oracle 10g Certified Professional
>> Oracle 9i Certified PL/SQL Developer
>> ----
>> "If you don't eat your meat, you cannot have any pudding.
>> "How can you have any pudding, if you don't eat your meat?"
>>
>> DO NOT REPLY TO THIS EMAIL
>> Reply only to the group.
>
>
> David FItzjarrell
>

-- 
Andreas
Oracle 9i Certified Professional
Oracle 10g Certified Professional
Oracle 9i Certified PL/SQL Developer


"If you don't eat your meat, you cannot have any pudding.
"How can you have any pudding if you don't eat your meat?!?!"
---

WARNING:
DO NOT REPLY TO THIS EMAIL
Reply to me only on this newsgroup 
Received on Fri Aug 26 2005 - 16:10:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US