Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,360 --> 00:00:03,280
In this lesson, we're
going to take a look
2
00:00:03,280 --> 00:00:07,300
at a collection of segments
forming our next larger unit
3
00:00:07,300 --> 00:00:09,830
of space called a datafile.
4
00:00:09,830 --> 00:00:14,110
So a datafile will be a
collection of segments.
5
00:00:14,110 --> 00:00:17,920
So in our case, we have
tables called EMP, and BONUS,
6
00:00:17,920 --> 00:00:20,770
and DEPT. And each
one of those tables
7
00:00:20,770 --> 00:00:23,890
has an actual physical
segment that belongs
8
00:00:23,890 --> 00:00:26,140
to it, that stores its data.
9
00:00:26,140 --> 00:00:29,200
So if we look at the
rows in the EMP table,
10
00:00:29,200 --> 00:00:31,780
they're actually stored
in the EMP segment,
11
00:00:31,780 --> 00:00:33,460
which is made up of extents.
12
00:00:33,460 --> 00:00:35,830
And those extents are
made up of blocks.
13
00:00:35,830 --> 00:00:39,160
So a datafile is
going to contain all
14
00:00:39,160 --> 00:00:41,150
of those different segments.
15
00:00:41,150 --> 00:00:45,130
So when we actually go out
to the operating system,
16
00:00:45,130 --> 00:00:46,600
here's where we
can actually start
17
00:00:46,600 --> 00:00:51,110
to see the physical
constructs that Oracle stores.
18
00:00:51,110 --> 00:00:55,690
So we can actually go and
see a data01.dbf file--
19
00:00:55,690 --> 00:00:57,340
for instance.
20
00:00:57,340 --> 00:00:59,650
So all of those
different segments
21
00:00:59,650 --> 00:01:03,280
will be contained in a datafile.
22
00:01:03,280 --> 00:01:06,100
We have a few different
types of datafiles--
23
00:01:06,100 --> 00:01:09,220
the most common being the
ones that are non-specific
24
00:01:09,220 --> 00:01:11,810
data datafiles-- if you will.
25
00:01:11,810 --> 00:01:16,240
And so those are going to be
the segments and tables that
26
00:01:16,240 --> 00:01:18,580
contain application data.
27
00:01:18,580 --> 00:01:21,040
So user data, application data--
28
00:01:21,040 --> 00:01:25,380
very much, the lion's share and
the largest part of a database
29
00:01:25,380 --> 00:01:27,640
will be in those
non-specific datafiles.
30
00:01:27,640 --> 00:01:29,830
But there are a couple
of datafiles that we
31
00:01:29,830 --> 00:01:31,930
might call specific files.
32
00:01:31,930 --> 00:01:35,170
And that would be-- for
instance-- the undo data.
33
00:01:35,170 --> 00:01:38,470
So whenever a transaction
occurs and there
34
00:01:38,470 --> 00:01:42,430
is a before image of
data that's generated,
35
00:01:42,430 --> 00:01:44,800
it's stored in
undo segments that
36
00:01:44,800 --> 00:01:47,320
are in an undo table space.
37
00:01:47,320 --> 00:01:51,610
And so that undo table space
contains those datafiles.
38
00:01:51,610 --> 00:01:53,260
Also, temporary data.
39
00:01:53,260 --> 00:01:56,350
So whenever sorts occur,
they occur in memory,
40
00:01:56,350 --> 00:01:58,270
unless they fill
the memory and have
41
00:01:58,270 --> 00:02:00,050
to be written out to disk--
42
00:02:00,050 --> 00:02:03,310
in which case, they're stored
in temporary datafiles that
43
00:02:03,310 --> 00:02:07,100
are referred to as temp files.
44
00:02:07,100 --> 00:02:10,700
So a little bit of knowledge
about the limits of datafiles
45
00:02:10,700 --> 00:02:13,280
can help us calculate
both the size
46
00:02:13,280 --> 00:02:16,520
of datafiles that we can
have and the maximum size
47
00:02:16,520 --> 00:02:18,200
of an Oracle database.
48
00:02:18,200 --> 00:02:21,290
So the limits on the
size of a datafile
49
00:02:21,290 --> 00:02:28,910
are 4,194,304 times the
size of the database block.
50
00:02:28,910 --> 00:02:33,110
So in our example, there--
if we use an 8K block size,
51
00:02:33,110 --> 00:02:36,350
then the maximum size
of a datafile for us
52
00:02:36,350 --> 00:02:38,630
will be 32 gigabytes.
53
00:02:38,630 --> 00:02:41,690
Now, that's not terribly large.
54
00:02:41,690 --> 00:02:45,020
It is certainly not outside
the realm of possibility
55
00:02:45,020 --> 00:02:48,470
that you could have tablespaces
that require datafiles
56
00:02:48,470 --> 00:02:50,160
that are larger than that.
57
00:02:50,160 --> 00:02:53,180
But that's the limit
for a datafile.
58
00:02:53,180 --> 00:02:59,990
The maximum number of datafiles
in a database is 65,533.
59
00:02:59,990 --> 00:03:03,950
So if we calculate the
maximum block size--
60
00:03:03,950 --> 00:03:09,200
which is 32K times
the 4 million plus--
61
00:03:09,200 --> 00:03:12,980
we come up with a maximum
database size of 8 petabytes.
62
00:03:12,980 --> 00:03:16,640
So in this case, the datafiles
that we're talking about here--
63
00:03:16,640 --> 00:03:18,860
the maximum size that we
could have for a database
64
00:03:18,860 --> 00:03:20,810
is 8 petabytes.
65
00:03:20,810 --> 00:03:23,660
Now you might think that's out
of the realm of possibility,
66
00:03:23,660 --> 00:03:24,980
but it's most certainly not.
67
00:03:24,980 --> 00:03:28,160
There are data stores
around the world that are
68
00:03:28,160 --> 00:03:30,840
petabyte orders of magnitude.
69
00:03:30,840 --> 00:03:34,550
So that's where the limits
of the database that Oracle
70
00:03:34,550 --> 00:03:38,420
provides are pushed
against the limits.
71
00:03:38,420 --> 00:03:42,140
So we can discover
information about datafiles
72
00:03:42,140 --> 00:03:44,390
using data dictionary views.
73
00:03:44,390 --> 00:03:47,180
And they're going to be the
views that you see here,
74
00:03:47,180 --> 00:03:48,290
primarily.
75
00:03:48,290 --> 00:03:50,090
There are other views, as well.
76
00:03:50,090 --> 00:03:52,700
But the most common
for datafiles--
77
00:03:52,700 --> 00:03:54,560
at least non-specific
datafiles--
78
00:03:54,560 --> 00:03:58,460
will be DBA_DATA_FILES
and V$DATAFILE.
79
00:03:58,460 --> 00:03:59,980
And for temp files--
80
00:03:59,980 --> 00:04:04,490
will be DBA_TEMP_FILES
and V$TEMPFILE.
81
00:04:04,490 --> 00:04:12,200
So we can take a look
at the data dictionary
82
00:04:12,200 --> 00:04:14,570
and see the kind of
information that we
83
00:04:14,570 --> 00:04:17,660
get from DBA_DATA_FILES.
84
00:04:17,660 --> 00:04:21,260
Now the reason that we can't
see this is that our user--
85
00:04:21,260 --> 00:04:25,880
Scott-- is not provided
with the proper permissions
86
00:04:25,880 --> 00:04:27,890
to look at these views.
87
00:04:27,890 --> 00:04:30,410
So these are DBA
level views and they
88
00:04:30,410 --> 00:04:33,520
require DBA level privileges.
89
00:04:33,520 --> 00:04:36,240
So we need our
second connection--
90
00:04:36,240 --> 00:04:38,370
system at ORCL.
91
00:04:38,370 --> 00:04:40,770
So this is the
system user, which
92
00:04:40,770 --> 00:04:44,190
is a user with high level
rights, that can see things
93
00:04:44,190 --> 00:04:46,440
like data dictionary views.
94
00:04:46,440 --> 00:04:50,370
While the Scott user can
see things like the tables
95
00:04:50,370 --> 00:04:55,350
that he owns, he can't see the
more system-oriented aspects
96
00:04:55,350 --> 00:04:56,190
of the database.
97
00:05:00,700 --> 00:05:02,550
So this is the
kind of information
98
00:05:02,550 --> 00:05:05,320
that DBA_DATA_FILES provides us.
99
00:05:05,320 --> 00:05:07,110
First of all, we
have the file name.
100
00:05:07,110 --> 00:05:10,170
So we mentioned that a datafile
is a physical file that
101
00:05:10,170 --> 00:05:11,730
exists on disk.
102
00:05:11,730 --> 00:05:15,690
And in our case, here is
the name of that datafile.
103
00:05:15,690 --> 00:05:19,380
Files are named in this way
because our database by default
104
00:05:19,380 --> 00:05:23,370
is using Oracle managed
files, which means that Oracle
105
00:05:23,370 --> 00:05:25,530
controls the file naming.
106
00:05:25,530 --> 00:05:27,390
And then our full path is here.
107
00:05:27,390 --> 00:05:29,670
So if we went out onto
the operating system
108
00:05:29,670 --> 00:05:33,640
and found this path, we
would see this datafile.
109
00:05:33,640 --> 00:05:36,120
It's the table space
that it belongs to,
110
00:05:36,120 --> 00:05:39,600
the number of bytes,
the number of blocks.
111
00:05:39,600 --> 00:05:42,570
And then this information
goes on and on,
112
00:05:42,570 --> 00:05:43,770
as we scroll to the right.
113
00:05:46,370 --> 00:05:49,730
Let's take a look
at a similar view--
114
00:05:49,730 --> 00:05:52,900
V$DATAFILE.
115
00:05:52,900 --> 00:05:55,870
This gives us much of
the same information.
116
00:05:55,870 --> 00:05:58,120
It gives us a file
number, which is called
117
00:05:58,120 --> 00:06:01,060
file ID in DBA_DATA_FILES.
118
00:06:01,060 --> 00:06:04,510
And we have to come
over a little more,
119
00:06:04,510 --> 00:06:08,030
we see the size information.
120
00:06:08,030 --> 00:06:10,340
And then a column
called Name that has
121
00:06:10,340 --> 00:06:13,370
the name of the
datafiles and their path.
122
00:06:16,530 --> 00:06:17,720
So what about temp files?
123
00:06:22,120 --> 00:06:25,860
So in this case, we have one
temp file in the database,
124
00:06:25,860 --> 00:06:28,110
and its path is here.
125
00:06:28,110 --> 00:06:30,150
DBA_TEMP_FILES will
be structured much
126
00:06:30,150 --> 00:06:32,640
like DBA_DATA_FILES is.
127
00:06:32,640 --> 00:06:36,750
A file ID number for the name
of the table space associated
128
00:06:36,750 --> 00:06:43,490
with it, the bytes, the
blocks, and so on and so forth.
129
00:06:43,490 --> 00:06:49,540
Similarly, we can
look at V$TEMPFILE.
130
00:06:49,540 --> 00:06:53,480
Again, structured
much like V$DATAFILE.
131
00:06:53,480 --> 00:06:57,940
We'll see size and
name information
132
00:06:57,940 --> 00:07:01,600
over as we scroll to the right.
133
00:07:01,600 --> 00:07:04,870
One important designation
that we might make here
134
00:07:04,870 --> 00:07:06,790
because you might think,
well, why would there
135
00:07:06,790 --> 00:07:10,210
be two data dictionary views--
136
00:07:10,210 --> 00:07:12,880
such as DBA_DATA_FILES
and V$DATAFILE--
137
00:07:12,880 --> 00:07:15,310
that both have the
same information?
138
00:07:15,310 --> 00:07:17,020
Well, first and
foremost, they don't have
139
00:07:17,020 --> 00:07:19,150
exactly the same information.
140
00:07:19,150 --> 00:07:22,060
There will be certain
information in one that's not
141
00:07:22,060 --> 00:07:23,740
in the other and vise versa.
142
00:07:23,740 --> 00:07:28,590
But the V$ views are useful
when a database is in a recovery
143
00:07:28,590 --> 00:07:32,820
mode so the database is
down for some reason,
144
00:07:32,820 --> 00:07:34,990
there's recovery
that has to occur.
145
00:07:34,990 --> 00:07:39,280
So often, in those situations,
we can look at the data files
146
00:07:39,280 --> 00:07:45,730
that we have in the views,
as opposed to the DBA views.
11549
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.