Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,390 --> 00:00:04,870
In this lesson, we're going to
study the concept of a database
2
00:00:04,870 --> 00:00:07,240
block in Oracle.
3
00:00:07,240 --> 00:00:11,080
So a database block is
the smallest atomic unit
4
00:00:11,080 --> 00:00:13,900
of space in an Oracle database.
5
00:00:13,900 --> 00:00:16,480
If you've ever heard the
concept of an operating system
6
00:00:16,480 --> 00:00:19,000
block or a file
system block, this
7
00:00:19,000 --> 00:00:21,130
is sort of analogous to that.
8
00:00:21,130 --> 00:00:25,240
So, when Oracle stores
space or reads space,
9
00:00:25,240 --> 00:00:29,680
it never reads less than
the size of an Oracle block.
10
00:00:29,680 --> 00:00:34,690
So, even if it only needs one
row that's maybe 100 bytes,
11
00:00:34,690 --> 00:00:38,170
it still reads the
entire block into memory.
12
00:00:38,170 --> 00:00:41,650
So database blocks
are stored on disk
13
00:00:41,650 --> 00:00:46,510
in the form of extents and
segments and then data files.
14
00:00:46,510 --> 00:00:49,240
But the blocks are the
smallest part of that.
15
00:00:49,240 --> 00:00:53,800
And so a database block is
read into a memory buffer
16
00:00:53,800 --> 00:00:56,320
or a buffer in the cache.
17
00:00:56,320 --> 00:00:58,720
So we have something
like the SGA
18
00:00:58,720 --> 00:01:01,390
and the buffer cache
that's present there.
19
00:01:01,390 --> 00:01:03,190
And so the database
blocks are actually
20
00:01:03,190 --> 00:01:05,780
read into those buffers.
21
00:01:05,780 --> 00:01:10,340
The database blocks size is
defined by the DB block size
22
00:01:10,340 --> 00:01:12,950
parameter in the database.
23
00:01:12,950 --> 00:01:15,560
And this is defined at creation.
24
00:01:15,560 --> 00:01:19,040
And, once the database is
created with a certain block
25
00:01:19,040 --> 00:01:21,320
size, it cannot be changed.
26
00:01:21,320 --> 00:01:23,840
So your only option if you
want to change the block
27
00:01:23,840 --> 00:01:28,190
size of the entire database
is to export all of the data
28
00:01:28,190 --> 00:01:32,180
out, recreate the database
with the new block size,
29
00:01:32,180 --> 00:01:34,730
and then import
the data back in.
30
00:01:34,730 --> 00:01:37,340
So the database
block sizes are going
31
00:01:37,340 --> 00:01:41,660
to match the buffer sizes
because a block fits perfectly
32
00:01:41,660 --> 00:01:43,650
into a buffer, if you will.
33
00:01:43,650 --> 00:01:46,970
So if we had an 8K block
size for the database,
34
00:01:46,970 --> 00:01:50,660
that means our buffers are
going to be 8K as well.
35
00:01:50,660 --> 00:01:54,020
And, since the block size cannot
be changed after creation,
36
00:01:54,020 --> 00:01:59,000
it's important that we know how
to properly size our database
37
00:01:59,000 --> 00:02:04,610
block, so what block size is
available to us and what is
38
00:02:04,610 --> 00:02:08,340
most advisable for
our certain situation.
39
00:02:08,340 --> 00:02:12,020
So, to look at the anatomy
of a database block a little,
40
00:02:12,020 --> 00:02:15,280
let's say this is
one database block.
41
00:02:15,280 --> 00:02:20,380
Database block consists of
header information, free space,
42
00:02:20,380 --> 00:02:22,060
and used space.
43
00:02:22,060 --> 00:02:24,040
So the header
information is going
44
00:02:24,040 --> 00:02:27,370
to be a small amount that's
used for the block that
45
00:02:27,370 --> 00:02:30,670
will have information,
such as something called
46
00:02:30,670 --> 00:02:33,880
the DBA or the
Data Block Address,
47
00:02:33,880 --> 00:02:37,150
where it's located
physically on disk,
48
00:02:37,150 --> 00:02:40,060
and some other information
about columns and tables
49
00:02:40,060 --> 00:02:42,720
that are within the block.
50
00:02:42,720 --> 00:02:45,540
The next section
is the free space.
51
00:02:45,540 --> 00:02:48,420
So a database block will
have space that's used
52
00:02:48,420 --> 00:02:50,030
and space that's not.
53
00:02:50,030 --> 00:02:52,080
And so the free
space will be what
54
00:02:52,080 --> 00:02:57,760
we constitute as the open and
available space for new rows.
55
00:02:57,760 --> 00:02:59,800
The used space
will be the actual
56
00:02:59,800 --> 00:03:03,490
rose on disk within the block.
57
00:03:03,490 --> 00:03:09,460
So, if we see here, we could
look at this as a row of data.
58
00:03:09,460 --> 00:03:13,240
And so the used space is going
to be filled with row data,
59
00:03:13,240 --> 00:03:15,910
and then the free space
will be available for use.
60
00:03:15,910 --> 00:03:21,010
So this line actually moves
within every database block.
61
00:03:21,010 --> 00:03:24,340
As a block begins to fill
up with more and more rows
62
00:03:24,340 --> 00:03:29,410
of data, this free space
gets less and less.
63
00:03:29,410 --> 00:03:32,230
So we said that this
sizing of a database block
64
00:03:32,230 --> 00:03:35,060
was very important because
it can't be changed.
65
00:03:35,060 --> 00:03:37,160
So what are our possibilities?
66
00:03:37,160 --> 00:03:41,200
Well, we can have a database
block size between 2 kilobytes
67
00:03:41,200 --> 00:03:43,150
and 32 kilobytes.
68
00:03:43,150 --> 00:03:46,480
So how do we decide
what is best?
69
00:03:46,480 --> 00:03:49,870
Well, let's start with
the middle which is 8K.
70
00:03:49,870 --> 00:03:55,390
So the sizing possibilities are
2K to 32k in a doubling order,
71
00:03:55,390 --> 00:03:56,200
if you will.
72
00:03:56,200 --> 00:03:58,930
2, 4, 8, 16, and 32.
73
00:03:58,930 --> 00:04:02,140
Those are the five possibilities
for our block size.
74
00:04:02,140 --> 00:04:04,840
The default is 8K.
75
00:04:04,840 --> 00:04:08,860
And, for most situations,
that's going to be a good size.
76
00:04:08,860 --> 00:04:11,000
Let's look at the top end.
77
00:04:11,000 --> 00:04:14,310
So the smallest block
possibility is 2K.
78
00:04:14,310 --> 00:04:17,290
2K will not be used
all that often.
79
00:04:17,290 --> 00:04:19,750
You won't generally see
it being used because it's
80
00:04:19,750 --> 00:04:22,030
a very small block size.
81
00:04:22,030 --> 00:04:25,180
The next is more
common and that is 4K.
82
00:04:25,180 --> 00:04:29,620
So a 4K block size is going
to be ideal for situations
83
00:04:29,620 --> 00:04:33,160
where the database does
something like, OLTP,
84
00:04:33,160 --> 00:04:36,290
a lot of online
transaction processing.
85
00:04:36,290 --> 00:04:40,210
So this is many small
discrete transactions.
86
00:04:40,210 --> 00:04:43,300
So we could think of an OLTP as
something like an order entry
87
00:04:43,300 --> 00:04:47,560
system, maybe an online
store of some kind
88
00:04:47,560 --> 00:04:51,370
because you go and
you have a page that
89
00:04:51,370 --> 00:04:54,550
shows you the possible
things that you can purchase,
90
00:04:54,550 --> 00:04:56,380
then you create a shopping cart.
91
00:04:56,380 --> 00:04:58,960
And, once you filled all that
information about your order,
92
00:04:58,960 --> 00:05:02,410
you click Submit and that's
a single discrete transaction
7556
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.