All language subtitles for [SubtitleTools.com] Monitoring Space Usage - Learning Oracle 12c [Video]

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,140 --> 00:00:02,510 In this lesson, we're going to be 2 00:00:02,510 --> 00:00:04,710 talking about monitoring space usage 3 00:00:04,710 --> 00:00:06,930 and managing it to some degree. 4 00:00:06,930 --> 00:00:10,410 So monitoring space is one of and has always 5 00:00:10,410 --> 00:00:14,700 been one of the DBA's eternal toiling jobs that they must do, 6 00:00:14,700 --> 00:00:17,760 because you have, always, a limited amount of space, 7 00:00:17,760 --> 00:00:19,080 and yet the needs of more and. 8 00:00:19,080 --> 00:00:22,110 More data seem to press on the DBA. 9 00:00:22,110 --> 00:00:25,290 And so you have to make sure that you're monitoring space 10 00:00:25,290 --> 00:00:29,250 so that space is not filling up and causing errors. 11 00:00:29,250 --> 00:00:31,710 And some companies have some pretty strict rules about that 12 00:00:31,710 --> 00:00:35,190 as well, so it's important to know how to monitor space. 13 00:00:35,190 --> 00:00:37,110 And just from a practical perspective, 14 00:00:37,110 --> 00:00:38,700 monitoring space is normally done 15 00:00:38,700 --> 00:00:40,330 a couple of different ways. 16 00:00:40,330 --> 00:00:44,790 Sometimes it can be done on a daily basis, where a DBA would 17 00:00:44,790 --> 00:00:48,630 connect into different databases and run one of the queries 18 00:00:48,630 --> 00:00:51,660 that I'm going to show you, or use a tool 19 00:00:51,660 --> 00:00:54,120 and just check and see how much space is available. 20 00:00:54,120 --> 00:00:55,980 And if something is running out of space, 21 00:00:55,980 --> 00:00:59,790 then the DBA can choose to go in and add space. 22 00:00:59,790 --> 00:01:03,000 Another way that we can do monitoring of space is through 23 00:01:03,000 --> 00:01:06,090 some kind of automatic system-- so some kind of monitoring 24 00:01:06,090 --> 00:01:08,700 system like Oracle Enterprise Manager-- 25 00:01:08,700 --> 00:01:11,160 that's constantly looking at your space usage 26 00:01:11,160 --> 00:01:15,030 and would report a problem if thresholds are crossed. 27 00:01:15,030 --> 00:01:18,000 Let's take a couple of looks at different ways 28 00:01:18,000 --> 00:01:19,920 that we can monitor space. 29 00:01:19,920 --> 00:01:24,360 So what I want to show you is a new view in SQL Developer. 30 00:01:24,360 --> 00:01:27,450 This is a view that allows you to do some more 31 00:01:27,450 --> 00:01:28,960 administrative tasks-- 32 00:01:28,960 --> 00:01:31,830 so beyond just writing the SQL. 33 00:01:31,830 --> 00:01:35,950 So we're going to open that view and click View and go down 34 00:01:35,950 --> 00:01:38,320 to DBA. 35 00:01:38,320 --> 00:01:40,920 And it opens the DBA view. 36 00:01:40,920 --> 00:01:44,940 This feature isn't present in every version of SQL Developer. 37 00:01:44,940 --> 00:01:48,010 Some of the later ones are the only ones that have it. 38 00:01:48,010 --> 00:01:50,670 However, the version that comes with Oracle 12c 39 00:01:50,670 --> 00:01:52,510 does have this feature. 40 00:01:52,510 --> 00:01:55,750 So we need to add a connection to this view. 41 00:01:55,750 --> 00:01:56,790 So we click Add. 42 00:01:56,790 --> 00:01:59,160 And fortunately, we don't have to completely add 43 00:01:59,160 --> 00:02:00,420 new information. 44 00:02:00,420 --> 00:02:02,280 We just choose one of the existing ones 45 00:02:02,280 --> 00:02:03,780 that we already have. 46 00:02:03,780 --> 00:02:06,240 And if we're going to monitor space usage, 47 00:02:06,240 --> 00:02:09,270 we're going to need to choose a privileged account. 48 00:02:09,270 --> 00:02:13,680 And so here we're going to choose our system account, 49 00:02:13,680 --> 00:02:14,980 and open this. 50 00:02:14,980 --> 00:02:17,100 And then there are a number of different operations 51 00:02:17,100 --> 00:02:18,660 here that we can do. 52 00:02:18,660 --> 00:02:20,640 This version of SQL Developer supports 53 00:02:20,640 --> 00:02:25,410 things like container databases and the new features of 12c, 54 00:02:25,410 --> 00:02:29,550 but it also has a Storage section. 55 00:02:29,550 --> 00:02:32,710 So underneath Storage, we have archive logs and control files 56 00:02:32,710 --> 00:02:34,090 and various things. 57 00:02:34,090 --> 00:02:36,520 But one of the things we're interested in for the purposes 58 00:02:36,520 --> 00:02:38,530 of this lesson are Tablespaces. 59 00:02:38,530 --> 00:02:42,220 So we click that, and it gives us some tablespace information. 60 00:02:42,220 --> 00:02:45,190 So it'll tell us that the users tablespace has 61 00:02:45,190 --> 00:02:49,420 5 megs allocated, 3 megs free, 2 megs used, 62 00:02:49,420 --> 00:02:53,060 percent free, and percent used-- all of those types of things. 63 00:02:53,060 --> 00:02:55,210 So this is a good, quickie way to come and look 64 00:02:55,210 --> 00:02:57,070 at our tablespaces. 65 00:02:57,070 --> 00:03:00,670 We can also click Data Files down here, 66 00:03:00,670 --> 00:03:02,650 and we can actually get a graph here 67 00:03:02,650 --> 00:03:05,500 that shows us how much of each one of our data 68 00:03:05,500 --> 00:03:08,040 files is available. 69 00:03:08,040 --> 00:03:10,250 So that's certainly one way it can be done. 70 00:03:10,250 --> 00:03:12,570 Another way is just to leverage the data dictionary. 71 00:03:12,570 --> 00:03:15,080 So let's do a couple of queries, here. 72 00:03:15,080 --> 00:03:20,070 Let's start out with select * from dba_data_files, 73 00:03:20,070 --> 00:03:22,500 which gives us quite a bit of information. 74 00:03:22,500 --> 00:03:27,110 So let's modify this just a little bit to see what we want. 75 00:03:32,270 --> 00:03:32,770 So 76 00:03:32,770 --> 00:03:36,680 This is going to give us data files and their size. 77 00:03:36,680 --> 00:03:40,810 So when we do bytes divided by 1024 divided by 1024, 78 00:03:40,810 --> 00:03:43,880 we're taking it from the bytes to megabytes. 79 00:03:43,880 --> 00:03:46,240 So the list of the files, the tablespaces 80 00:03:46,240 --> 00:03:49,290 they belong with, and then their bytes. 81 00:03:49,290 --> 00:03:51,950 Now, Oracle also has a data dictionary view 82 00:03:51,950 --> 00:03:54,370 called dba_free_space. 83 00:03:54,370 --> 00:03:58,630 That'll give us free space in each one of our table spaces. 84 00:03:58,630 --> 00:04:01,960 So to leverage that, select tablespace_name. 85 00:04:07,070 --> 00:04:09,160 So the information in dba_free_space 86 00:04:09,160 --> 00:04:11,020 is actually based on extent. 87 00:04:11,020 --> 00:04:14,230 So it's going to be a lot of rows in dba_free_space. 88 00:04:14,230 --> 00:04:17,890 What we want to do is aggregate that together to give us, 89 00:04:17,890 --> 00:04:22,490 actually, the amount of space that's free in our tablespaces. 90 00:04:22,490 --> 00:04:25,760 So for each tablespace, this is the amount of megabytes 91 00:04:25,760 --> 00:04:29,450 that's free-- again, bytes divided by 1024 twice-- 92 00:04:29,450 --> 00:04:31,640 and gives us that free space. 93 00:04:31,640 --> 00:04:34,220 So DBAs are very big on writing scripts 94 00:04:34,220 --> 00:04:36,530 that can do the monitoring of space usage, 95 00:04:36,530 --> 00:04:40,700 and everybody has their own that they've refined over the years. 96 00:04:40,700 --> 00:04:44,870 For the last example, I wanted to bring out one here-- 97 00:04:44,870 --> 00:04:47,190 demonstrate this a little bit. 98 00:04:47,190 --> 00:04:48,990 So what this is going to do is actually 99 00:04:48,990 --> 00:04:52,200 use a couple of subqueries on dba_data_files 100 00:04:52,200 --> 00:04:57,000 and dba_free_space to bring that all together with these columns 101 00:04:57,000 --> 00:04:59,910 that they label as tablespace, used meg, free meg, 102 00:04:59,910 --> 00:05:02,840 and total meg, as well as percent free. 103 00:05:02,840 --> 00:05:08,730 If we execute this, notice that we get a fairly nice display 104 00:05:08,730 --> 00:05:11,490 of tablespace and how much is used and free, 105 00:05:11,490 --> 00:05:13,050 and the percentage is free. 106 00:05:13,050 --> 00:05:16,870 So that's a little bit about monitoring space usage. 8744

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.