Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,270 --> 00:00:02,730
In this lesson,
we're going to take
2
00:00:02,730 --> 00:00:05,520
a look at bigfile tablespaces.
3
00:00:05,520 --> 00:00:09,450
Now, bigfile tablespaces
are a relatively new feature
4
00:00:09,450 --> 00:00:13,080
of Oracle, around the
10g, 11g time period.
5
00:00:13,080 --> 00:00:15,240
And bigfile tablespaces
were created
6
00:00:15,240 --> 00:00:21,030
to address the needs of VLDBs,
or Very Large Databases.
7
00:00:21,030 --> 00:00:26,460
So in this scenario, what if we
say our database is truly huge,
8
00:00:26,460 --> 00:00:28,350
I mean very big?
9
00:00:28,350 --> 00:00:30,930
What if it is so
big that it requires
10
00:00:30,930 --> 00:00:35,760
more than the maximum database
size of eight petabytes?
11
00:00:35,760 --> 00:00:40,080
So with smallfile tablespaces,
our maximum size of a database
12
00:00:40,080 --> 00:00:41,580
is eight petabytes.
13
00:00:41,580 --> 00:00:45,390
What if our database needs
to be larger than that?
14
00:00:45,390 --> 00:00:48,380
Or what if we have a
table in our database
15
00:00:48,380 --> 00:00:53,300
that is so big that it uses
up too many data files?
16
00:00:53,300 --> 00:00:56,630
For instance, let's say
we have a table that's
17
00:00:56,630 --> 00:01:00,290
along the four terabyte size.
18
00:01:00,290 --> 00:01:04,460
Now, a four terabyte table will
be contained in a tablespace.
19
00:01:04,460 --> 00:01:07,640
And that tablespace
will contain data files.
20
00:01:07,640 --> 00:01:10,520
But since the maximum
size of a data file
21
00:01:10,520 --> 00:01:14,270
is 32 gigabytes for
an 8K block size,
22
00:01:14,270 --> 00:01:18,170
that means we'd have hundreds
and hundreds of data files.
23
00:01:18,170 --> 00:01:20,420
So what if we have a
very large database
24
00:01:20,420 --> 00:01:23,090
or what if we have
large tables, and we
25
00:01:23,090 --> 00:01:27,470
need to increase our capacity
and our manageability?
26
00:01:27,470 --> 00:01:30,560
Well, that's where bigfile
tablespaces come in.
27
00:01:30,560 --> 00:01:33,560
And one of the features
of bigfile tablespaces
28
00:01:33,560 --> 00:01:36,620
is that because of
the increase in size
29
00:01:36,620 --> 00:01:39,170
that it allows for
a data file, we only
30
00:01:39,170 --> 00:01:43,310
have one data file per
bigfile tablespace.
31
00:01:43,310 --> 00:01:47,060
So it becomes a one-to-one
relationship between tablespace
32
00:01:47,060 --> 00:01:48,270
and data file.
33
00:01:48,270 --> 00:01:50,630
So for bigfile
tablespaces we don't
34
00:01:50,630 --> 00:01:53,240
have multiple data
files contained
35
00:01:53,240 --> 00:01:55,790
by the name of a tablespace.
36
00:01:55,790 --> 00:01:58,340
So let's look at the
numbers here a little bit.
37
00:01:58,340 --> 00:02:04,220
So the maximum size of a data
file in a bigfile tablespace
38
00:02:04,220 --> 00:02:08,410
is going to be the block
size times roughly 4 billion.
39
00:02:08,410 --> 00:02:11,600
Now, smallfile
tablespaces' max size
40
00:02:11,600 --> 00:02:14,300
are the block size
times 4 million.
41
00:02:14,300 --> 00:02:17,240
So this is an order
of magnitude larger.
42
00:02:17,240 --> 00:02:21,080
And again, the result
is, say, a 32k block,
43
00:02:21,080 --> 00:02:23,750
which is the largest
block size in a database,
44
00:02:23,750 --> 00:02:26,930
times roughly 4
billion gives us a max
45
00:02:26,930 --> 00:02:32,900
size on a data file in a bigfile
tablespace for 128 terabytes.
46
00:02:32,900 --> 00:02:34,820
So that's an order
of magnitude larger
47
00:02:34,820 --> 00:02:39,510
than 128 gigabytes with
smallfile tablespaces.
48
00:02:39,510 --> 00:02:43,370
So if we apply that number,
that maximum data file number,
49
00:02:43,370 --> 00:02:46,130
times the maximum
number of data files,
50
00:02:46,130 --> 00:02:48,740
we see that the maximum
size of a database
51
00:02:48,740 --> 00:02:52,400
with bigfile tablespaces
is eight exabytes.
52
00:02:52,400 --> 00:02:56,660
So again, an order of magnitude
larger than that eight petabyte
53
00:02:56,660 --> 00:03:00,350
limit with smallfile
tablespaces.
54
00:03:00,350 --> 00:03:04,220
So let's do some operations
with bigfile tablespaces
55
00:03:04,220 --> 00:03:06,740
and look at some general
commands that apply
56
00:03:06,740 --> 00:03:09,690
to all tablespaces as well.
57
00:03:09,690 --> 00:03:11,970
So let's create a
bigfile tablespace.
58
00:03:11,970 --> 00:03:13,730
And in order to do
that, it's always
59
00:03:13,730 --> 00:03:16,670
good to know where the
data files are located,
60
00:03:16,670 --> 00:03:20,090
so we'll do a select
star from dba_data_files.
61
00:03:22,760 --> 00:03:27,800
Now we create
bigfile tablespace.
62
00:03:27,800 --> 00:03:32,750
Give it a name, datafile.
63
00:03:32,750 --> 00:03:36,070
I'm just copying and
pasting the location in.
64
00:03:36,070 --> 00:03:37,670
I'll say big_ts01.
65
00:03:40,980 --> 00:03:42,240
size, 100 meg.
66
00:03:45,660 --> 00:03:51,580
And now if we select star
from dba_tablespaces,
67
00:03:51,580 --> 00:03:55,920
we see BIG_TS for Tablespace.
68
00:03:55,920 --> 00:03:59,090
We see its block size,
initial and next extent.
69
00:04:02,930 --> 00:04:06,950
And way over to the right,
we see in the BIGFILE column
70
00:04:06,950 --> 00:04:08,550
it says YES.
71
00:04:08,550 --> 00:04:12,570
All these others are smallfile
tablespaces, so they say NO.
72
00:04:15,760 --> 00:04:18,350
And let's look at
dba_data_files to see our data
73
00:04:18,350 --> 00:04:24,540
file belonging to the
tablespace BIG_TS.
74
00:04:24,540 --> 00:04:26,640
Now that we have
bigfile tablespaces
75
00:04:26,640 --> 00:04:30,480
and we have less to worry
about as far as reaching
76
00:04:30,480 --> 00:04:33,420
the maximum size, we
can talk about a subject
77
00:04:33,420 --> 00:04:35,130
called autoextend.
78
00:04:35,130 --> 00:04:39,330
Now, this applies both to data
files in bigfile or smallfile
79
00:04:39,330 --> 00:04:40,770
tablespaces.
80
00:04:40,770 --> 00:04:44,010
But it's especially useful
with a bigfile tablespace.
81
00:04:44,010 --> 00:04:46,680
Since we have this large
limit and we will not
82
00:04:46,680 --> 00:04:50,940
be adding other data files
to a bigfile tablespace,
83
00:04:50,940 --> 00:04:52,740
we can do something
called autoextend.
84
00:04:52,740 --> 00:04:55,530
And with autoextend,
the tablespace
85
00:04:55,530 --> 00:04:59,520
will grow automatically
when it is filled.
86
00:04:59,520 --> 00:05:02,820
So when that data file
belonging to the tablespace
87
00:05:02,820 --> 00:05:07,260
reaches its maximum size, let's
say in our example 100 meg,
88
00:05:07,260 --> 00:05:10,770
then it will automatically
extend, add more extents,
89
00:05:10,770 --> 00:05:14,400
and continue to grow without
worrying about errors that
90
00:05:14,400 --> 00:05:17,050
might come saying,
you're out of space
91
00:05:17,050 --> 00:05:18,420
and the DBA gets
up in the middle
92
00:05:18,420 --> 00:05:21,690
of the night, the on-call,
and fixes the tablespace,
93
00:05:21,690 --> 00:05:23,400
so on and so forth.
94
00:05:23,400 --> 00:05:27,300
So in order to
turn autoextend on,
95
00:05:27,300 --> 00:05:32,430
let's do an alter
database datafile command,
96
00:05:32,430 --> 00:05:37,090
referring to file ID number 5.
97
00:05:37,090 --> 00:05:39,170
autoextend on.
98
00:05:41,820 --> 00:05:45,740
Now if we look at
dba_data_files,
99
00:05:45,740 --> 00:05:48,830
we have this
AUTOEXTENSIBLE column.
100
00:05:48,830 --> 00:05:53,610
And it says YES, that
it's autoextensible.
101
00:05:53,610 --> 00:05:58,790
Notice that the other ones
are as well by default.
102
00:05:58,790 --> 00:06:02,060
Tablespaces can be taken
online and offline.
103
00:06:02,060 --> 00:06:04,640
That is to say, they
are made unavailable
104
00:06:04,640 --> 00:06:06,590
when they're taken offline.
105
00:06:06,590 --> 00:06:10,250
So to take our bigfile
tablespace offline,
106
00:06:10,250 --> 00:06:17,440
we say alter tablespace
big_ts offline.
107
00:06:17,440 --> 00:06:20,500
And so now that
tablespace is offline.
108
00:06:20,500 --> 00:06:31,850
So if we were to say create
table test, we'd get the error,
109
00:06:31,850 --> 00:06:37,390
tablespace 'BIG_TS' is offline,
cannot allocate space in it.
110
00:06:37,390 --> 00:06:43,270
And so to bring it back online,
alter tablespace big_ts online.
111
00:06:46,410 --> 00:06:48,090
And now it is online again.
112
00:06:50,700 --> 00:06:54,550
Tablespaces can also be
put into read-only mode.
113
00:06:54,550 --> 00:06:58,200
So when a read-only
tablespace is created,
114
00:06:58,200 --> 00:07:01,140
or a tablespace is put
into read-only mode,
115
00:07:01,140 --> 00:07:04,180
there's obviously no
rights that can occur.
116
00:07:04,180 --> 00:07:05,960
So let's take a look at this.
117
00:07:05,960 --> 00:07:12,330
alter tablespace
big_ts read only.
118
00:07:12,330 --> 00:07:14,670
And the tablespace is altered.
119
00:07:14,670 --> 00:07:19,740
So let's try to create this
table in the tablespace.
120
00:07:19,740 --> 00:07:24,630
Again, 'BIG_TS' is read-only,
cannot allocate space in it.
121
00:07:24,630 --> 00:07:27,210
So if we want to put a
read-only tablespace back
122
00:07:27,210 --> 00:07:31,500
into read/write mode,
we say alter tablespace,
123
00:07:31,500 --> 00:07:36,120
tablespace name, read write.
124
00:07:36,120 --> 00:07:41,170
And now the tablespace is
back online and available
125
00:07:41,170 --> 00:07:42,780
for writes.
10176
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.