Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,460 --> 00:00:04,730
In this lesson, we'll be
talking about instance shutdown,
2
00:00:04,730 --> 00:00:06,530
or in a single
instance database,
3
00:00:06,530 --> 00:00:09,640
it would really be an instance
and a database shutdown.
4
00:00:09,640 --> 00:00:11,930
So when we shutdown the
database, what we're attempting
5
00:00:11,930 --> 00:00:16,190
to do is release all the
resources associated with it,
6
00:00:16,190 --> 00:00:18,580
and making it
unavailable to users.
7
00:00:18,580 --> 00:00:20,750
And that way we can do
certain kinds of maintenance,
8
00:00:20,750 --> 00:00:24,620
such as patching, cold
backups, those types of things.
9
00:00:24,620 --> 00:00:27,320
The differences in the way
we shut down our database
10
00:00:27,320 --> 00:00:29,900
are really based
on how it occurs,
11
00:00:29,900 --> 00:00:31,760
the steps that are
taken leading up
12
00:00:31,760 --> 00:00:34,670
to the final shutdown
of the database.
13
00:00:34,670 --> 00:00:37,980
And we, as the DBA,
have control over that.
14
00:00:37,980 --> 00:00:40,760
So we'll look at each
of the individual ways
15
00:00:40,760 --> 00:00:44,670
to do a shutdown, and the
recommended ones as well.
16
00:00:44,670 --> 00:00:47,660
So the first one is
a shutdown command.
17
00:00:47,660 --> 00:00:50,010
It's also shutdown normal.
18
00:00:50,010 --> 00:00:53,240
So we can type in shutdown
or shutdown normal.
19
00:00:53,240 --> 00:00:55,790
Either one will
accomplish the same task.
20
00:00:55,790 --> 00:00:58,820
When a shutdown normal
occurs, the database
21
00:00:58,820 --> 00:01:03,620
waits for all the sessions that
are connected to gracefully
22
00:01:03,620 --> 00:01:08,180
disconnect, exit programs
that connect to the database,
23
00:01:08,180 --> 00:01:11,320
and then it proceeds with
a shutdown of the database.
24
00:01:11,320 --> 00:01:15,370
Even though this is the default,
if we just type in shutdown,
25
00:01:15,370 --> 00:01:17,480
that doesn't mean it's
the preferred way.
26
00:01:17,480 --> 00:01:19,840
So even though this is
considered the nicest way
27
00:01:19,840 --> 00:01:23,770
to do a shutdown, it's really
impractical in a true sense.
28
00:01:23,770 --> 00:01:26,740
Because in a normal
maintenance situation
29
00:01:26,740 --> 00:01:28,960
where you need to take
down the database,
30
00:01:28,960 --> 00:01:31,750
you can't necessarily
wait for everyone
31
00:01:31,750 --> 00:01:35,290
to get back to their desks
or log-in or whatever,
32
00:01:35,290 --> 00:01:37,720
type in their password,
and then disconnect
33
00:01:37,720 --> 00:01:40,600
from their application that's
connected to the database.
34
00:01:40,600 --> 00:01:43,010
It's also affected by
things like agents,
35
00:01:43,010 --> 00:01:44,770
so enterprise
manager agents that
36
00:01:44,770 --> 00:01:47,500
connect to the database,
any of those kind of things
37
00:01:47,500 --> 00:01:51,230
will prevent you from being
able to shutdown the database.
38
00:01:51,230 --> 00:01:54,950
So even though it is the
most graceful if you will,
39
00:01:54,950 --> 00:01:57,880
in terms of how it deals
with connected sessions,
40
00:01:57,880 --> 00:02:03,180
it's generally not practical
to do a shutdown normal.
41
00:02:03,180 --> 00:02:05,660
The next is shutdown
transactional.
42
00:02:05,660 --> 00:02:08,430
And in a shutdown
transactional, the database
43
00:02:08,430 --> 00:02:11,670
waits for any
uncommitted transactions
44
00:02:11,670 --> 00:02:14,550
to complete and
commit, and then it
45
00:02:14,550 --> 00:02:19,290
will disconnect those users and
those jobs from the database,
46
00:02:19,290 --> 00:02:21,570
and then proceed
with the shutdown.
47
00:02:21,570 --> 00:02:23,310
Shutdown transactional
is probably
48
00:02:23,310 --> 00:02:25,860
a little more practical
than shutdown normal,
49
00:02:25,860 --> 00:02:27,810
but still has some
problems with it,
50
00:02:27,810 --> 00:02:32,880
in that if anyone has a session
that just hasn't done a commit,
51
00:02:32,880 --> 00:02:35,560
that would prevent you from
taking down the database.
52
00:02:35,560 --> 00:02:40,000
So a long running job or a hung
job, something of that nature,
53
00:02:40,000 --> 00:02:41,370
that would completely
prevent you
54
00:02:41,370 --> 00:02:43,740
from being able to take
down the database, at least
55
00:02:43,740 --> 00:02:45,420
as a shutdown transactional.
56
00:02:45,420 --> 00:02:49,320
So from that perspective, it's
not completely practical either
57
00:02:49,320 --> 00:02:51,890
to do a shutdown transactional.
58
00:02:51,890 --> 00:02:54,860
The most common way to
shutdown a database is to type
59
00:02:54,860 --> 00:02:56,480
shut shutdown immediate.
60
00:02:56,480 --> 00:02:59,510
And during a shutdown immediate,
all the connected sessions
61
00:02:59,510 --> 00:03:01,460
are disconnected immediately.
62
00:03:01,460 --> 00:03:05,720
Any transactions that are in
the process are rolled back.
63
00:03:05,720 --> 00:03:08,060
And then those sessions
are disconnected,
64
00:03:08,060 --> 00:03:11,580
and the database
completes its shutdown.
65
00:03:11,580 --> 00:03:13,520
So this is a graceful
shutdown, point
66
00:03:13,520 --> 00:03:15,360
of perspective of the database.
67
00:03:15,360 --> 00:03:16,550
So everything goes down.
68
00:03:16,550 --> 00:03:18,080
It's closed normally.
69
00:03:18,080 --> 00:03:20,150
The instance is
released properly.
70
00:03:20,150 --> 00:03:22,460
The data files are
all checked pointed
71
00:03:22,460 --> 00:03:24,380
and synchronized together.
72
00:03:24,380 --> 00:03:26,300
So typically, the
way we do a shutdown
73
00:03:26,300 --> 00:03:28,160
is a shutdown immediate.
74
00:03:28,160 --> 00:03:31,500
The last type of shutdown we
can do is to shutdown abort.
75
00:03:31,500 --> 00:03:34,490
Now this is not
advisable to do, but it
76
00:03:34,490 --> 00:03:36,950
is something that
happens very frequently
77
00:03:36,950 --> 00:03:38,750
in the life of a DBA.
78
00:03:38,750 --> 00:03:41,570
In a shutdown abort,
what Oracle does
79
00:03:41,570 --> 00:03:44,490
is immediately
disconnect the instance.
80
00:03:44,490 --> 00:03:47,720
So what it actually does
is crash the database
81
00:03:47,720 --> 00:03:52,280
in a pretty similar way as
if we just pulled the power
82
00:03:52,280 --> 00:03:53,870
on the server itself.
83
00:03:53,870 --> 00:03:57,000
Maybe a little more graceful
than that, but not much.
84
00:03:57,000 --> 00:04:00,410
So it disconnects the instance,
and when it shuts down,
85
00:04:00,410 --> 00:04:03,200
it's considered in
an unstable state.
86
00:04:03,200 --> 00:04:05,540
So anytime you do
a shutdown abort,
87
00:04:05,540 --> 00:04:08,960
you want to make sure that
you do a clean startup,
88
00:04:08,960 --> 00:04:10,970
and then a shutdown
immediate to get
89
00:04:10,970 --> 00:04:13,520
both the clean startup
and the clean shutdown
90
00:04:13,520 --> 00:04:15,140
after a shutdown abort.
91
00:04:15,140 --> 00:04:17,990
And I've heard many
stories as a DBA
92
00:04:17,990 --> 00:04:22,580
about people who are DBAs who
did a shutdown abort prior
93
00:04:22,580 --> 00:04:24,620
to doing a database backup.
94
00:04:24,620 --> 00:04:28,880
And the problem with that is
that that backup, the database
95
00:04:28,880 --> 00:04:32,450
that gets backed up, is backed
up in an inconsistent state,
96
00:04:32,450 --> 00:04:35,060
and very likely, you
wouldn't be able to recover
97
00:04:35,060 --> 00:04:36,440
from that backup.
98
00:04:36,440 --> 00:04:40,430
So it's very important that if
you do a shutdown abort, which
99
00:04:40,430 --> 00:04:42,620
does happen on many occasions.
100
00:04:42,620 --> 00:04:44,300
For whatever
reason, the database
101
00:04:44,300 --> 00:04:46,670
may not go down with
a shutdown immediate.
102
00:04:46,670 --> 00:04:49,130
There could be bugs or
problems or hung sessions
103
00:04:49,130 --> 00:04:51,780
or something that prevents
it from doing a shutdown.
104
00:04:51,780 --> 00:04:54,480
Then a shutdown
abort is necessary.
105
00:04:54,480 --> 00:04:55,700
But it's not advisable.
106
00:04:55,700 --> 00:04:59,310
It's a last resort
type of action.
107
00:04:59,310 --> 00:05:02,070
When we deal with
Windows, we must also
108
00:05:02,070 --> 00:05:04,740
remember to shut down
the services that
109
00:05:04,740 --> 00:05:08,460
run in order to truly
release the resources that
110
00:05:08,460 --> 00:05:09,900
are used by Oracle.
111
00:05:09,900 --> 00:05:14,370
So in Windows, every
enterprise type of application,
112
00:05:14,370 --> 00:05:16,470
anything that needs
access to shared
113
00:05:16,470 --> 00:05:18,840
memory and those
kinds of resources,
114
00:05:18,840 --> 00:05:20,670
has to run as a service.
115
00:05:20,670 --> 00:05:22,420
And Oracle is number exception.
116
00:05:22,420 --> 00:05:25,890
So Oracle runs as a
service in Windows.
117
00:05:25,890 --> 00:05:28,560
And so, when we go
into the services,
118
00:05:28,560 --> 00:05:31,770
we'll also need to
shut down the services.
119
00:05:31,770 --> 00:05:34,590
Windows DBAs that work
on Oracle sometimes
120
00:05:34,590 --> 00:05:37,590
will just use the service
to shut down the database.
121
00:05:37,590 --> 00:05:40,380
And depending on how you
have the service shutdown,
122
00:05:40,380 --> 00:05:43,320
it either does a shutdown
immediate or a shutdown abort,
123
00:05:43,320 --> 00:05:46,090
so that's something we
definitely have to be aware of.
124
00:05:46,090 --> 00:05:49,180
So let's take a look
at this process.
125
00:05:49,180 --> 00:05:51,960
I have my command
line interface here.
126
00:05:51,960 --> 00:05:53,380
I'm going to do a SQL plus.
127
00:05:53,380 --> 00:05:55,810
I'm going to connect to sysdba.
128
00:05:55,810 --> 00:05:59,770
That's going to be the role that
has the ability to do start ups
129
00:05:59,770 --> 00:06:01,120
and shut downs.
130
00:06:01,120 --> 00:06:04,580
And then we'll do a
shutdown immediate.
131
00:06:08,980 --> 00:06:11,860
And so, we complete the
shut shutdown immediate.
132
00:06:11,860 --> 00:06:13,090
The database is closed.
133
00:06:13,090 --> 00:06:14,830
Its dismounted, and
then it indicates
134
00:06:14,830 --> 00:06:17,630
that the instance is shutdown.
135
00:06:17,630 --> 00:06:19,760
This means all the
instance resources,
136
00:06:19,760 --> 00:06:22,130
such as the background
processes and memory caches,
137
00:06:22,130 --> 00:06:23,180
are released.
138
00:06:23,180 --> 00:06:26,090
Now this isn't completely
true in Windows,
139
00:06:26,090 --> 00:06:28,310
because Windows will
allocate those resources
140
00:06:28,310 --> 00:06:30,210
from the service perspective.
141
00:06:30,210 --> 00:06:33,230
So I'm going to start
the database back up,
142
00:06:33,230 --> 00:06:36,870
and then we'll look
at a shutdown abort.
143
00:06:36,870 --> 00:06:37,370
All right.
144
00:06:37,370 --> 00:06:39,810
Our database is in open state.
145
00:06:39,810 --> 00:06:43,220
So when we did the shutdown
immediate, it took some time.
146
00:06:43,220 --> 00:06:46,190
It was going through the process
of disconnecting sessions,
147
00:06:46,190 --> 00:06:48,170
checking the data
files for closure,
148
00:06:48,170 --> 00:06:51,260
releasing the instance, all
of those types of things.
149
00:06:51,260 --> 00:06:53,470
So going to do in this
case a shutdown abort.
150
00:06:56,670 --> 00:06:58,090
Even though it
took a little time,
151
00:06:58,090 --> 00:07:01,210
notice that it didn't do the
process of closing the database
152
00:07:01,210 --> 00:07:02,470
and dismounting it.
153
00:07:02,470 --> 00:07:04,750
It simply says
instance shutdown.
154
00:07:04,750 --> 00:07:09,250
So we've released the instance,
basically, in a hard fashion.
155
00:07:09,250 --> 00:07:12,160
So this is not an advisable
way to shut down the database,
156
00:07:12,160 --> 00:07:14,670
unless we absolutely need to.
12766
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.