Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Klastry
- Robert Sokolowski
- Zad 1.
- create user succeeded.
- grant resource succeeded.
- grant create succeeded.
- grant SELECT_CATALOG_ROLE succeeded.
- alter user sh succeeded.
- alter user sh succeeded.
- CREATE TABLE succeeded.
- CREATE TABLE succeeded.
- CREATE TABLE succeeded.
- CREATE TABLE succeeded.
- alter session set succeeded.
- 1 rows inserted
- 1 rows inserted
- (...)
- 2 Odczyt informacji o klasteryzowanych tabelach
- 2.1 odczytac nazwy i typy atrybutów tabeli WYPLATY i TEMATY
- desc nazwa_tabeli;
- desc wyplaty;
- Name Null Type
- ------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- NR_PRAC NUMBER(38)
- NR_TEM NUMBER(38)
- DATA_NALICZ DATE
- DATA_WYPL DATE
- KWOTA NUMBER(10,1)
- 5 rows selected
- desc tematy;
- Name Null Type
- ------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- NR_TEM NUMBER(38)
- TEMAT VARCHAR2(30)
- DATA_ROZP DATE
- DATA_ODB DATE
- NR_PRAC_KT NUMBER(38)
- NR_TEM_NADRZ NUMBER(38)
- 2.2 oszacowac dlugosci poszczególnych kolumn tabel
- select avg(vsize(atrybut)) from nazwa_tabeli;
- select avg(vsize(nr_prac)),avg(vsize(nr_tem)),avg(vsize(data_nalicz)),avg(vsize(data_wypl)),avg(vsize(kwota)) from wyplaty;
- AVG(VSIZE(NR_PRAC)) AVG(VSIZE(NR_TEM)) AVG(VSIZE(DATA_NALICZ)) AVG(VSIZE(DATA_WYPL)) AVG(VSIZE(KWOTA))
- ---------------------- ---------------------- ----------------------- ---------------------- ----------------------
- 2 2.22058823529411764705882352941176470588 7 7 2.85294117647058823529411764705882352941
- 1 rows selected
- select avg(vsize(nr_tem)),avg(vsize(temat)),avg(vsize(data_rozp)),avg(vsize(data_odb)),avg(vsize(nr_prac_kt)), avg(vsize(nr_tem_nadrz)) from tematy;
- AVG(VSIZE(NR_TEM)) AVG(VSIZE(TEMAT)) AVG(VSIZE(DATA_ROZP)) AVG(VSIZE(DATA_ODB)) AVG(VSIZE(NR_PRAC_KT)) AVG(VSIZE(NR_TEM_NADRZ))
- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------
- 2.15555555555555555555555555555555555556 17.02222222222222222222222222222222222222 7 7 2 2
- 1 rows selected
- 2.3 Odczytac ilosc róznych kluczy klastra
- select count(distinct atrybut) from nazwa_tabeli;
- select count(distinct NR_PRAC), count(distinct nr_tem), count(distinct data_nalicz), count(distinct data_wypl), count(distinct kwota) from wyplaty;
- COUNT(DISTINCTNR_PRAC) COUNT(DISTINCTNR_TEM) COUNT(DISTINCTDATA_NALICZ) COUNT(DISTINCTDATA_WYPL) COUNT(DISTINCTKWOTA)
- ---------------------- ---------------------- -------------------------- ------------------------ ----------------------
- 35 34 57 57 65
- 1 rows selected
- select count(distinct NR_TEM), count(distinct TEMAT), count(distinct DATA_ROZP), count(distinct DATA_ODB), count(distinct NR_PRAC_KT), count(distinct NR_TEM_NADRZ) from tematy;
- COUNT(DISTINCTNR_TEM) COUNT(DISTINCTTEMAT) COUNT(DISTINCTDATA_ROZP) COUNT(DISTINCTDATA_ODB) COUNT(DISTINCTNR_PRAC_KT) COUNT(DISTINCTNR_TEM_NADRZ)
- ---------------------- ---------------------- ------------------------ ----------------------- ------------------------- ---------------------------
- 45 45 45 34 18 2
- 1 rows selected
- 2.4 Odczytac ilosc wierszy przypadajacych na klucz klastra
- select avg(count(*)) from nazwa_tabeli group by atrybut_kluczowy;
- select avg(count(*)) from wyplaty group by NR_PRAC;
- AVG(COUNT(*))
- ----------------------
- 5.82857142857142857142857142857142857143
- 1 rows selected
- select avg(count(*)) from tematy group by NR_TEM;
- AVG(COUNT(*))
- ----------------------
- 1
- 1 rows selected
- 2.5 Odczytac wartosci parametrów: INI_TRANS, PCT_FREE z perspektywy USER_TABLES
- select INI_TRANS, PCT_FREE from USER_TABLES
- INI_TRANS PCT_FREE
- ---------------------- ----------------------
- 1 10
- 1 10
- 1 10
- 1 10
- 4 rows selected
- 1. Utwórz tabele S_PRAC w przestrzeni danych USERS jako kopie tabeli pracownicy:
- create table s_prac as select nr_prac, nazwisko, nr_zesp from pracownicy;
- create table succeeded.
- 2. Utwórz w przestrzeni USERS (opcja tablespace USERS) klaster haszujacy PRAC_CLUSTER o 100
- wartosciach kluczy (opcja hashkeys1
- ) opartych o kolumne typu int. Kazdy klucz ma miec 80 bajtów (opcja
- size).
- CREATE CLUSTER PRAC_CLUSTER (id int)
- HASHKEYS 100
- HASH IS id
- SIZE 80
- TABLESPACE USERS
- CREATE CLUSTER succeeded.
- 3. W klastrze PRAC_CLUSTER utwórz tabele H_PRAC z kolumnami jak w tabeli pracownicy:
- create table h_prac
- cluster prac_cluster (nr_prac) as select * from pracownicy;
- create table succeeded.
- 4. Sprawdz efektywnosc klastra, okreslajac najpierw liczbe bitów zarezerwowanych dla kazdego klucza
- klastra (key_size):
- ANALYZE TABLE h_prac COMPUTE STATISTICS;
- SELECT cluster_name, cluster_type, key_size, hashkeys, avg_blocks_per_key
- FROM user_clusters;
- SELECT count(*) as keycount, avg(c) as mean, stddev(c) as stddev
- FROM (
- SELECT count(*) as c
- FROM H_PRAC
- GROUP BY NR_PRAC
- );
- ANALYZE TABLE h_prac succeeded.
- CLUSTER_NAME CLUSTER_TYPE KEY_SIZE HASHKEYS AVG_BLOCKS_PER_KEY
- ------------------------------ ------------ ---------------------- ---------------------- ----------------------
- PRAC_CLUSTER HASH 80 101 1
- 1 rows selected
- KEYCOUNT MEAN STDDEV
- ---------------------- ---------------------- ----------------------
- 42 1 0
- 1 rows selected
- 5. Utwórz klaster indeksowy o nazwie DEPT_PRAC_CLUSTER. Kolumna klucza klastra (np. o nazwie klucz)
- powinna byc typu int. Uzyj nizej wymienionych parametrów:
- size 55
- tablespace USERS
- storage (initial 5K)
- CREATE CLUSTER DEPT_PRAC_CLUSTER (klucz int)
- TABLESPACE USERS
- SIZE 55
- STORAGE (initial 5K);
- CREATE CLUSTER succeeded.
- 6. Skopiuj tabele s_prac do klastr DEPT_PRAC_CLUSTER uzywajac do grupowania kolumny nr_zesp.
- Nazwij kopie I_PRAC.
- create table i_prac cluster dept_prac_cluster (nr_zesp) as select * from s_prac;
- Co sie stalo?
- Polecenia nie udalo sie wywolac z racji braku indeksu. Komunikat:
- Error starting at line 1 in command:
- create table i_prac cluster dept_prac_cluster (nr_zesp) as select * from s_prac
- Error at Command Line:1 Column:73
- Error report:
- SQL Error: ORA-02032: clustered tables cannot be used before the cluster index is built
- 02032. 00000 - "clustered tables cannot be used before the cluster index is built"
- *Cause: User attempted to perform a DML statement on a clustered table
- for which no cluster index has yet been created.
- *Action: Create the cluster index.
- 7. Utwórz indeks klastra DEPT_PRAC_CLUSTER o nazwie DEPT_PRAC_CLUSTER_IDX. Ustaw przestrzen
- tabel na USERS, inne parametry zostaw domyslne.
- create index DEPT_PRAC_CLUSTER_IDX on cluster DEPT_PRAC_CLUSTER;
- TABLESPACE USERS;
- CREATE CLUSTER succeeded.
- 8. Ponownie skopiuj tabele s_prac do klastra DEPT_PRAC_CLUSTER uzywajac do grupowania kolumny
- nr_zesp. Nazwij kopie I_PRAC.
- create table succeeded.
- 9. Dodaj do klastra DEPT_PRAC_CLUSTER tabele I_DEPT, bedaca kopia tabeli zespoly:
- create table i_dept cluster dept_prac_cluster (nr_zesp) as select * from zespoly ;
- create table succeeded.
- 10. W perspektywie USER_SEGMENTS obejrzyj ile przestrzeni zajmuje kazdy z utworzonych obiektów
- w przestrzeni USERS.
- select * from USER_SEGMENTS;
- SEGMENT_NAME PARTITION_NAME SEGMENT_TYPE SEGMENT_SUBTYPE TABLESPACE_NAME BYTES BLOCKS EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS MAX_SIZE RETENTION MINRETENTION PCT_INCREASE FREELISTS FREELIST_GROUPS BUFFER_POOL
- --------------------------------------------------------------------------------- ------------------------------ ------------------ --------------- ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- --------- ---------------------- ---------------------- ---------------------- ---------------------- -----------
- PRACOWNICY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- TEMATY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- WYPLATY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- ZESPOLY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- S_PRAC TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- PRAC_CLUSTER CLUSTER ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- DEPT_PRAC_CLUSTER CLUSTER ASSM USERS 65536 8 1 16384 1 2147483645 2147483645 DEFAULT
- DEPT_PRAC_CLUSTER_IDX INDEX ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
- 8 rows selected
- 4 Sledzenie statystyk o utworzonym klastrze i pomiary czasu wykonania zapytan
- 1. Zatwierdz strukture klastra, wszystkich jego tabel i wszystkich indeksów z nim zwiazanych, wlaczajac w to
- indeks klastra:
- analyze cluster prac_cluster validate structure cascade;
- …
- analyze table pracownicy estimate statistics;
- analyze table h_prac estimate statistics;
- analyze table i_prac estimate statistics;
- analyze cluster prac_cluster validate structure cascade;
- analyze cluster DEPT_PRAC_CLUSTER validate structure cascade;
- analyze table tematy validate structure cascade;
- analyze table pracownicy estimate statistics;
- analyze table h_prac estimate statistics;
- analyze table i_prac estimate statistics;
- analyze cluster prac_cluster succeeded.
- analyze cluster DEPT_PRAC_CLUSTER succeeded.
- analyze table tematy succeeded.
- analyze table pracownicy succeeded.
- analyze table h_prac succeeded.
- analyze table i_prac succeeded.
- 2. Podlacz sie do bazy jako uzytkownik sys:
- connect sys/manager@orcl as sysdba;
- I odczytaj informacje z perspektywy dba_tables:
- select * from dba_tables where table_name ='PRACOWNICY' or table_name = 'H_PRAC';
- OWNER TABLE_NAME TABLESPACE_NAME CLUSTER_NAME IOT_NAME STATUS PCT_FREE PCT_USED INI_TRANS MAX_TRANS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE FREELISTS FREELIST_GROUPS LOGGING BACKED_UP NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN AVG_SPACE_FREELIST_BLOCKS NUM_FREELIST_BLOCKS DEGREE INSTANCES CACHE TABLE_LOCK SAMPLE_SIZE LAST_ANALYZED PARTITIONED IOT_TYPE TEMPORARY SECONDARY NESTED BUFFER_POOL ROW_MOVEMENT GLOBAL_STATS USER_STATS DURATION SKIP_CORRUPT MONITORING CLUSTER_OWNER DEPENDENCIES COMPRESSION COMPRESS_FOR DROPPED READ_ONLY
- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ -------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------- --------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------- ---------------------- ---------- ---------- ----- ---------- ---------------------- ------------------------- ----------- ------------ --------- --------- ------ ----------- ------------ ------------ ---------- --------------- ------------ ---------- ------------------------------ ------------ ----------- ------------------ ------- ---------
- ORA1 PRACOWNICY USERS VALID 10 1 255 65536 1 2147483645 YES N 42 5 3 7767 0 34 0 0 1 1 N ENABLED 42 25-NOV-16 NO N N NO DEFAULT DISABLED NO NO DISABLED YES DISABLED DISABLED NO NO
- ORA1 H_PRAC USERS PRAC_CLUSTER VALID 0 0 0 65536 1 2147483645 YES N 42 4 4 5381 0 35 0 0 1 1 N ENABLED 42 25-NOV-16 NO N N NO DEFAULT DISABLED NO NO DISABLED YES ORA1 DISABLED DISABLED NO NO
- 2 rows selected
- 3. Podlacz sie do bazy ponownie jako uzytkownik orax:
- connect orax/orax@orcl;
- 4. W perspektywie USER_SEGMENTS sprawdz ile jest bloków w tabelach poklastrowanych
- i niepoklastrowanych:
- select bytes, blocks, extents, segment_name from user_segments where
- segment_name = 'PRAC_CLUSTER' or
- segment_name = 'PRACOWNICY' or
- segment_name = 'DEPT_PRAC_CLUSTER' or
- segment_name = 'ZESPOLY' or
- segment_name = 'S_PRAC' or
- segment_name = 'DEPT_PRAC_CLUSTER_IDX';
- BYTES BLOCKS EXTENTS SEGMENT_NAME
- ---------------------- ---------------------- ---------------------- ---------------------------------------------------------------------------------
- 65536 8 1 DEPT_PRAC_CLUSTER
- 65536 8 1 DEPT_PRAC_CLUSTER_IDX
- 65536 8 1 PRACOWNICY
- 65536 8 1 PRAC_CLUSTER
- 65536 8 1 S_PRAC
- 65536 8 1 ZESPOLY
- 6 rows selected
- 5. Sprawdz plan wykonania zapytania, wykonujac: set autotrace on;
- a nastepnie wykonujac zapytanie SQL na tabeli (-ach) poklastrowanej (-ych) i niepoklastrowanej (-ych).
- set autotrace on;
- AutoTrace Enabled
- select * from s_prac;
- select * from h_prac;
- select * from i_prac;
- select * from zespoly;
- select * from i_dept;
- select * from tematy;
- NR_PRAC NAZWISKO NR_ZESP
- ---------------------- --------------- ----------------------
- 1 GRZYBEK 4
- 2 GRZYBIARZ 5
- 3 WIREK 6
- 4 JANECZEK 5
- 5 TADECZEK 4
- 6 PODWISLAK 3
- 7 WOJTECKA 2
- 8 WUJEK 1
- 9 TRUMAN 5
- 10 ZUBEK 2
- 11 SKRZYPEK 5
- 12 POPKO 6
- 13 NOWY 1
- 14 RAZOWA 3
- 15 FULAK 4
- 16 KOTULA 2
- 17 KULANEK 3
- 18 KULAWIK 6
- 19 SKOCZEK 5
- 20 WIEZYCKA 1
- 21 BUJAK 3
- 22 BIERNAT 5
- 23 LUBELSKI 1
- 24 IWAN 2
- 25 JASKOLA 5
- 26 REBUS 3
- 27 REDOKS 1
- 28 SKOREK 4
- 29 KIPER 5
- 30 REPIK 2
- 31 NIEZALEZNY 1
- 32 WILK 3
- 33 MISIURA 4
- 34 KRAUS 5
- 35 WILCZEK 6
- 36 WILCZYNSKI 7
- 37 GABKA 7
- 38 KRAK 8
- 39 SZCZERBIEC 8
- 40 PSTROWSKI 7
- 41 SZCZERBIEC 8
- 42 rows selected
- Plan hash value: 889985163
- ----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 42 | 1806 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| S_PRAC | 42 | 1806 | 3 (0)| 00:00:01 |
- ----------------------------------------------------------------------------
- Note
- -----
- - dynamic sampling used for this statement
- Statistics
- -----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- NR_PRAC PLEC DATA_UR NAZWISKO NR_ZESP
- ---------------------- ---- ------------------------- --------------- ----------------------
- 1999-11-11
- 1 M 1948-09-12 GRZYBEK 4
- 2 K 1957-02-17 GRZYBIARZ 5
- 3 M 1965-11-06 WIREK 6
- 4 K 1959-10-07 JANECZEK 5
- 5 M 1961-03-15 TADECZEK 4
- 6 M 1949-09-17 PODWISLAK 3
- 7 K 1947-08-19 WOJTECKA 2
- 8 K 1948-07-28 WUJEK 1
- 9 K 1964-05-07 TRUMAN 5
- 10 K 1962-05-04 ZUBEK 2
- 11 M 1956-04-10 SKRZYPEK 5
- 12 K 1968-11-03 POPKO 6
- 13 M 1945-08-21 NOWY 1
- 14 K 1949-08-17 RAZOWA 3
- 15 K 1960-09-16 FULAK 4
- 16 M 1953-09-13 KOTULA 2
- 17 M 1951-01-25 KULANEK 3
- 18 M 1961-07-25 KULAWIK 6
- 19 M 1958-05-08 SKOCZEK 5
- 20 K 1952-11-04 WIEZYCKA 1
- 21 M 1953-02-23 BUJAK 3
- 22 K 1947-05-09 BIERNAT 5
- 23 M 1946-10-10 LUBELSKI 1
- 24 M 1963-11-03 IWAN 2
- 25 K 1959-03-17 JASKOLA 5
- 26 K 1950-10-06 REBUS 3
- 27 K 1947-04-09 REDOKS 1
- 28 K 1952-03-14 SKOREK 4
- 29 M 1955-10-11 KIPER 5
- 30 K 1957-10-09 REPIK 2
- 31 M 1964-11-11 NIEZALEZNY 1
- 32 M 1945-12-10 WILK 3
- 33 M 1934-10-05 MISIURA 4
- 34 M 1954-09-04 KRAUS 5
- 35 M 1934-12-25 WILCZEK 6
- 36 M 1945-12-10 WILCZYNSKI 7
- 37 M 1934-10-05 GABKA 7
- 38 M 1954-09-04 KRAK 8
- 39 M 1934-12-25 SZCZERBIEC 8
- 40 M 1984-10-05 PSTROWSKI 7
- 41 M 1934-12-25 SZCZERBIEC 8
- 42 rows selected
- Plan hash value: 1060896720
- ----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 42 | 1134 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| H_PRAC | 42 | 1134 | 3 (0)| 00:00:01 |
- ----------------------------------------------------------------------------
- Statistics
- -----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- NR_PRAC NAZWISKO NR_ZESP
- ---------------------- --------------- ----------------------
- 1 GRZYBEK 4
- 2 GRZYBIARZ 5
- 3 WIREK 6
- 4 JANECZEK 5
- 5 TADECZEK 4
- 6 PODWISLAK 3
- 7 WOJTECKA 2
- 8 WUJEK 1
- 9 TRUMAN 5
- 10 ZUBEK 2
- 11 SKRZYPEK 5
- 12 POPKO 6
- 13 NOWY 1
- 14 RAZOWA 3
- 15 FULAK 4
- 16 KOTULA 2
- 17 KULANEK 3
- 18 KULAWIK 6
- 19 SKOCZEK 5
- 20 WIEZYCKA 1
- 21 BUJAK 3
- 22 BIERNAT 5
- 23 LUBELSKI 1
- 24 IWAN 2
- 25 JASKOLA 5
- 26 REBUS 3
- 27 REDOKS 1
- 28 SKOREK 4
- 29 KIPER 5
- 30 REPIK 2
- 31 NIEZALEZNY 1
- 32 WILK 3
- 33 MISIURA 4
- 34 KRAUS 5
- 35 WILCZEK 6
- 36 WILCZYNSKI 7
- 37 GABKA 7
- 38 KRAK 8
- 39 SZCZERBIEC 8
- 40 PSTROWSKI 7
- 41 SZCZERBIEC 8
- 42 rows selected
- Plan hash value: 2536723742
- ----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 42 | 798 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| I_PRAC | 42 | 798 | 3 (0)| 00:00:01 |
- ----------------------------------------------------------------------------
- Statistics
- -----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- NR_ZESP NAZWA_ZESP NR_PRAC_KZ NR_INST
- ---------------------- ------------------------------ ---------------------- ----------------------
- 1 OPROGRAMOWANIE 1 1
- 2 TEORIA INFORMATYKI 2 1
- 3 SIECI KOMPUTEROWE 3 1
- 4 BUDOWA 4 1
- 5 AUTOMATY 25 3
- 6 BUDOWA KOPARKI 10 5
- 7 PIECE 21 6
- 8 WEGIEL 29 5
- 9 KONSTRUKCJA 33 5
- 10 LIKWIDACJA 21 6
- 11 POZIOMZEROWY 37 5
- 11 rows selected
- Plan hash value: 4044335737
- -----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- -----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 11 | 781 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| ZESPOLY | 11 | 781 | 3 (0)| 00:00:01 |
- -----------------------------------------------------------------------------
- Note
- -----
- - dynamic sampling used for this statement
- Statistics
- -----------------------------------------------------------
- 4 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- NR_ZESP NAZWA_ZESP NR_PRAC_KZ NR_INST
- ---------------------- ------------------------------ ---------------------- ----------------------
- 1 OPROGRAMOWANIE 1 1
- 2 TEORIA INFORMATYKI 2 1
- 3 SIECI KOMPUTEROWE 3 1
- 4 BUDOWA 4 1
- 5 AUTOMATY 25 3
- 6 BUDOWA KOPARKI 10 5
- 7 PIECE 21 6
- 8 WEGIEL 29 5
- 9 KONSTRUKCJA 33 5
- 10 LIKWIDACJA 21 6
- 11 POZIOMZEROWY 37 5
- 11 rows selected
- Plan hash value: 1153213081
- ----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 11 | 396 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| I_DEPT | 11 | 396 | 3 (0)| 00:00:01 |
- ----------------------------------------------------------------------------
- Statistics
- -----------------------------------------------------------
- 1 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- NR_TEM TEMAT DATA_ROZP DATA_ODB NR_PRAC_KT NR_TEM_NADRZ
- ---------------------- ------------------------------ ------------------------- ------------------------- ---------------------- ----------------------
- 1 ADA SRODOWISKO 1990-01-01 1991-12-31 32
- 2 ADA EDYTOR 1990-03-01 1990-12-31 33 1
- 3 ADA KOMPILATOR 1990-09-01 1991-10-31 34 1
- 4 PASCAL KOMPILATOR 1983-03-21 1984-03-20 35
- 5 BAZA DANYCH - SPOLEM 1987-04-20 1987-09-17 32
- 6 BAZA DANYCH - PZU 1986-03-10 1986-07-28 29
- 8 PROCEDURY GRAFICZNE 1992-04-24 1992-08-22 21
- 10 PROJEKTOWANIE UKLADOW 1983-12-11 1984-03-20 26
- 11 ANALIZATOR WIDMA 1987-06-19 1987-11-16 29
- 13 LISP - KOMPILATOR 1985-01-08 1985-03-19 31
- 14 PROLOG - KOMPILATOR 1992-06-23 1992-08-22 34
- 15 STEROWANIE GAZOCIAGIEM 1983-08-22 1983-11-10 11
- 16 STEROWANIE TASMOCIAGIEM 1984-02-09 1984-03-20 25
- 17 STEROWNIK TURBINY W ELEKTROWNI 1987-08-18 1987-10-17 35
- 18 KARTA EMULATORA PC 1986-07-08 1986-09-26 32
- 20 GENERATOR SYGNALOW W.CZ. 1992-08-22 1992-11-20 34
- 21 ANALIZATOR STANOW 1983-10-21 1983-11-10 11
- 22 KANAL WIZJI - OPROGRAMOWANIE 1984-04-09 1984-05-19 31
- 24 CZUJNIK CISNIENIA 1986-09-06 1986-10-26 10
- 25 ANALIZATOR STEZENIA JONOW 1985-05-08 1985-06-17 27
- 28 WZMACNIACZ W.CZ. 1984-06-08 1984-12-15 29
- 30 MONITOR ZNAKOWY 1986-11-05 1986-11-25 21
- 31 DYSK 1985-04-01 1985-08-09 31
- 32 STEROWANIE REAKTOREM 1994-07-01 1994-03-03 18
- 33 GUPTA 1999-06-25 1999-02-15 1
- 34 PRZETWARZANIE WEKTOROWE 1986-12-15 1986-07-28 36
- 35 PRZETWARZANIE ROWNOLEGLE 1985-08-16 1985-03-19 37
- 36 PRZETWARZANIE ROZPROSZONE 1993-01-29 1992-08-22 33
- 37 ASSEMBLERY 1984-03-29 1983-10-11 36
- 38 SYMULATOR 1984-09-16 1984-03-20 37
- 39 BEZPIECZENSTWO 1988-03-25 1988-06-13 32
- 40 ODTWARZANIE 1987-02-13 1987-06-23 38
- 41 ARCHIWIZACJA 1985-07-10 1984-12-12 38
- 42 SLABOPLATNY 2000-06-18 2000-07-08 23
- 43 ZEROWY 2000-06-28 1999-11-11 23
- 44 KANALY WIZJI 1984-06-07 1983-10-11 21
- 45 KARTA MONITORA 1985-11-24 1985-03-19 32
- 100 ZESTAW KOMPUTEROWY 1985-01-01 1988-10-31 31
- 101 KARTA PROCESORA 1988-10-15 1989-01-13 10 100
- 102 MONITOR GRAFICZNY 1987-06-17 1987-07-07 25 100
- 103 GENERATOR DZWIEKU 1987-06-27 1987-08-06 33 100
- 104 STEROWNIK DYSKU 1990-01-04 1990-03-05 35 100
- 105 KARTA MONITORA GRAFICZNEGO 1991-02-28 1991-04-19 33 100
- 106 MODUL I/O 1988-02-18 1988-03-29 1 100
- 107 ZASILACZ 1990-02-03 1990-03-05 32 100
- 45 rows selected
- Plan hash value: 2328567157
- ----------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- ----------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 45 | 3330 | 3 (0)| 00:00:01 |
- | 1 | TABLE ACCESS FULL| TEMATY | 45 | 3330 | 3 (0)| 00:00:01 |
- ----------------------------------------------------------------------------
- Note
- -----
- - dynamic sampling used for this statement
- Statistics
- -----------------------------------------------------------
- 4 recursive calls
- 0 db block gets
- 0 db block gets direct
- 0 consistent gets - examination
- 0 calls to kcmgcs
- 0 HSC OLTP recursive compression
- 0 HSC OLTP inline compression
- 0 HSC OLTP Drop Column
- 0 Heap Segment Array Updates
- 0 securefile allocation bytes
- Wyraznie widac, ze dla tabel klastrowanych ilosc bajtow jest zdecydowanie mniejsza
- 5 Czynnosci koncowe
- 1. Utwórz klaster haszowany TEST1_HASH w przestrzeni USERS, zakladajac, ze do pobrania rekordu
- uzywana jest glównie kolumna nr_prac typu int. Uzyj kolumny data_ur jako funkcji haszujacej (opcja hash
- is) i okresl 20 kluczy haszujacych (hashkeys). Zdefiniuj 55 [B] do przechowywania wierszy z ta sama
- wartoscia haszujaca. Co sie stalo?
- create cluster TEST1_HASH (nr_prac int)
- hashkeys 20
- HASH IS data_ur
- size 55
- tablespace USERS
- Error starting at line 1 in command:
- create cluster TEST1_HASH (nr_prac int)
- hashkeys 20
- HASH IS data_ur
- size 55
- tablespace USERS
- Error at Command Line:1 Column:0
- Error report:
- SQL Error: ORA-02467: Column referenced in expression not found in cluster definition
- 02467. 00000 - "Column referenced in expression not found in cluster definition"
- *Cause: A column in the hash is expression was not present in cluster
- definition.
- *Action: Recreate the cluster and correct the error in hash expression.
- 2. Utwórz klaster TEST2_HASH z kluczem nr_tem int, specyfikujac po opcji hash is atrybut nr_prac. Co sie
- stalo?
- create cluster TEST2_HASH (nr_tem int)
- hashkeys 20
- HASH IS nr_prac
- Error starting at line 1 in command:
- create cluster TEST2_HASH (nr_tem int)
- hashkeys 20
- HASH IS nr_prac
- Error at Command Line:1 Column:0
- Error report:
- SQL Error: ORA-02467: Column referenced in expression not found in cluster definition
- 02467. 00000 - "Column referenced in expression not found in cluster definition"
- *Cause: A column in the hash is expression was not present in cluster
- definition.
- *Action: Recreate the cluster and correct the error in hash expression.
- 3. Zmodyfikuj parametry pamieciowe klastra prac_cluster poleceniem ALTER CLUSTER podajac po slowie
- STORAGE: (next 400K pctincrease 50);
- Co sie stalo?
- alter cluster prac_cluster STORAGE (next 400K pctincrease 50);
- Error starting at line 1 in command:
- alter cluster prac_cluster STORAGE (next 400K pctincrease 50)
- Error report:
- SQL Error: ORA-25150: ALTERING of extent parameters not permitted
- 25150. 00000 - "ALTERING of extent parameters not permitted"
- *Cause: An attempt was made to alter the extent parameters for a segment
- in a tablespace with autoallocate or uniform extent allocation
- policy.
- *Action: Remove the appropriate extent parameters from the command.
- 4. Spróbuj zmienic poleceniem ALTER CLUSTER parametr SIZE klastra prac_cluster na wartosc 100. Co sie
- stalo?
- alter cluster prac_cluster SIZE 100;
- Error starting at line 1 in command:
- alter cluster prac_cluster SIZE 100
- Error report:
- SQL Error: ORA-02466: The SIZE and INITRANS options cannot be altered for HASH CLUSTERS.
- 02466. 00000 - "The SIZE and INITRANS options cannot be altered for HASH CLUSTERS."
- *Cause: An attempt was made to change the SIZE and INITRANS options after
- the hash cluster was created.
- *Action: Do not specify this option.
- 5. Spróbuj usunac klaster PRAC_CLUSTER. Co sie stalo?
- drop cluster prac_cluster;
- Error starting at line 1 in command:
- drop cluster prac_cluster
- Error report:
- SQL Error: ORA-00951: cluster not empty
- 00951. 00000 - "cluster not empty"
- *Cause:
- *Action:
- 6. Wykonaj jeszcze raz polecenie z pkt. poprzedniego, dodajac opcje INCLUDING TABLES.
- drop cluster prac_cluster INCLUDING TABLES;
- drop cluster prac_cluster succeeded.
- 7. Usun wszystkie stworzone przez siebie obiekty:
- drop table i_prac;
- drop table s_prac;
- drop table i_dept;
- drop cluster dept_prac_cluster;
- drop index dept_prac_cluster_idx;
- drop table i_prac succeeded.
- drop table s_prac succeeded.
- drop table i_dept succeeded.
- drop cluster dept_prac_cluster succeeded.
- drop index dept_prac_cluster_idx succeeded.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement