Advertisement
kanciastopantalones

klastry

Nov 25th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.81 KB | None | 0 0
  1. Klastry
  2.  
  3. Robert Sokolowski
  4.  
  5. Zad 1.
  6. create user succeeded.
  7. grant resource succeeded.
  8. grant create succeeded.
  9. grant SELECT_CATALOG_ROLE succeeded.
  10. alter user sh succeeded.
  11. alter user sh succeeded.
  12.  
  13.  
  14.  
  15. CREATE TABLE succeeded.
  16. CREATE TABLE succeeded.
  17. CREATE TABLE succeeded.
  18. CREATE TABLE succeeded.
  19. alter session set succeeded.
  20. 1 rows inserted
  21. 1 rows inserted
  22. (...)
  23.  
  24.  
  25.  
  26.  
  27. 2 Odczyt informacji o klasteryzowanych tabelach
  28.  
  29. 2.1 odczytac nazwy i typy atrybutów tabeli WYPLATY i TEMATY
  30. desc nazwa_tabeli;
  31.  
  32.  
  33. desc wyplaty;
  34. Name Null Type
  35. ------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  36. NR_PRAC NUMBER(38)
  37. NR_TEM NUMBER(38)
  38. DATA_NALICZ DATE
  39. DATA_WYPL DATE
  40. KWOTA NUMBER(10,1)
  41.  
  42. 5 rows selected
  43.  
  44.  
  45. desc tematy;
  46. Name Null Type
  47. ------------------------------ -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  48. NR_TEM NUMBER(38)
  49. TEMAT VARCHAR2(30)
  50. DATA_ROZP DATE
  51. DATA_ODB DATE
  52. NR_PRAC_KT NUMBER(38)
  53. NR_TEM_NADRZ NUMBER(38)
  54.  
  55.  
  56.  
  57. 2.2 oszacowac dlugosci poszczególnych kolumn tabel
  58. select avg(vsize(atrybut)) from nazwa_tabeli;
  59.  
  60. select avg(vsize(nr_prac)),avg(vsize(nr_tem)),avg(vsize(data_nalicz)),avg(vsize(data_wypl)),avg(vsize(kwota)) from wyplaty;
  61.  
  62. AVG(VSIZE(NR_PRAC)) AVG(VSIZE(NR_TEM)) AVG(VSIZE(DATA_NALICZ)) AVG(VSIZE(DATA_WYPL)) AVG(VSIZE(KWOTA))
  63. ---------------------- ---------------------- ----------------------- ---------------------- ----------------------
  64. 2 2.22058823529411764705882352941176470588 7 7 2.85294117647058823529411764705882352941
  65.  
  66. 1 rows selected
  67.  
  68.  
  69. 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;
  70.  
  71. 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))
  72. ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------
  73. 2.15555555555555555555555555555555555556 17.02222222222222222222222222222222222222 7 7 2 2
  74.  
  75. 1 rows selected
  76.  
  77.  
  78.  
  79. 2.3 Odczytac ilosc róznych kluczy klastra
  80. select count(distinct atrybut) from nazwa_tabeli;
  81.  
  82.  
  83. select count(distinct NR_PRAC), count(distinct nr_tem), count(distinct data_nalicz), count(distinct data_wypl), count(distinct kwota) from wyplaty;
  84.  
  85. COUNT(DISTINCTNR_PRAC) COUNT(DISTINCTNR_TEM) COUNT(DISTINCTDATA_NALICZ) COUNT(DISTINCTDATA_WYPL) COUNT(DISTINCTKWOTA)
  86. ---------------------- ---------------------- -------------------------- ------------------------ ----------------------
  87. 35 34 57 57 65
  88.  
  89. 1 rows selected
  90.  
  91.  
  92. 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;
  93.  
  94. COUNT(DISTINCTNR_TEM) COUNT(DISTINCTTEMAT) COUNT(DISTINCTDATA_ROZP) COUNT(DISTINCTDATA_ODB) COUNT(DISTINCTNR_PRAC_KT) COUNT(DISTINCTNR_TEM_NADRZ)
  95. ---------------------- ---------------------- ------------------------ ----------------------- ------------------------- ---------------------------
  96. 45 45 45 34 18 2
  97.  
  98. 1 rows selected
  99.  
  100.  
  101. 2.4 Odczytac ilosc wierszy przypadajacych na klucz klastra
  102. select avg(count(*)) from nazwa_tabeli group by atrybut_kluczowy;
  103.  
  104. select avg(count(*)) from wyplaty group by NR_PRAC;
  105.  
  106. AVG(COUNT(*))
  107. ----------------------
  108. 5.82857142857142857142857142857142857143
  109.  
  110. 1 rows selected
  111.  
  112.  
  113. select avg(count(*)) from tematy group by NR_TEM;
  114.  
  115. AVG(COUNT(*))
  116. ----------------------
  117. 1
  118.  
  119. 1 rows selected
  120.  
  121.  
  122.  
  123. 2.5 Odczytac wartosci parametrów: INI_TRANS, PCT_FREE z perspektywy USER_TABLES
  124.  
  125. select INI_TRANS, PCT_FREE from USER_TABLES
  126.  
  127. INI_TRANS PCT_FREE
  128. ---------------------- ----------------------
  129. 1 10
  130. 1 10
  131. 1 10
  132. 1 10
  133.  
  134. 4 rows selected
  135.  
  136.  
  137.  
  138.  
  139. 1. Utwórz tabele S_PRAC w przestrzeni danych USERS jako kopie tabeli pracownicy:
  140. create table s_prac as select nr_prac, nazwisko, nr_zesp from pracownicy;
  141.  
  142. create table succeeded.
  143.  
  144.  
  145. 2. Utwórz w przestrzeni USERS (opcja tablespace USERS) klaster haszujacy PRAC_CLUSTER o 100
  146. wartosciach kluczy (opcja hashkeys1
  147. ) opartych o kolumne typu int. Kazdy klucz ma miec 80 bajtów (opcja
  148. size).
  149.  
  150. CREATE CLUSTER PRAC_CLUSTER (id int)
  151. HASHKEYS 100
  152. HASH IS id
  153. SIZE 80
  154. TABLESPACE USERS
  155.  
  156. CREATE CLUSTER succeeded.
  157.  
  158. 3. W klastrze PRAC_CLUSTER utwórz tabele H_PRAC z kolumnami jak w tabeli pracownicy:
  159. create table h_prac
  160. cluster prac_cluster (nr_prac) as select * from pracownicy;
  161.  
  162. create table succeeded.
  163.  
  164.  
  165. 4. Sprawdz efektywnosc klastra, okreslajac najpierw liczbe bitów zarezerwowanych dla kazdego klucza
  166. klastra (key_size):
  167.  
  168.  
  169. ANALYZE TABLE h_prac COMPUTE STATISTICS;
  170. SELECT cluster_name, cluster_type, key_size, hashkeys, avg_blocks_per_key
  171. FROM user_clusters;
  172. SELECT count(*) as keycount, avg(c) as mean, stddev(c) as stddev
  173. FROM (
  174. SELECT count(*) as c
  175. FROM H_PRAC
  176. GROUP BY NR_PRAC
  177. );
  178.  
  179.  
  180. ANALYZE TABLE h_prac succeeded.
  181. CLUSTER_NAME CLUSTER_TYPE KEY_SIZE HASHKEYS AVG_BLOCKS_PER_KEY
  182. ------------------------------ ------------ ---------------------- ---------------------- ----------------------
  183. PRAC_CLUSTER HASH 80 101 1
  184.  
  185. 1 rows selected
  186.  
  187. KEYCOUNT MEAN STDDEV
  188. ---------------------- ---------------------- ----------------------
  189. 42 1 0
  190.  
  191. 1 rows selected
  192.  
  193. 5. Utwórz klaster indeksowy o nazwie DEPT_PRAC_CLUSTER. Kolumna klucza klastra (np. o nazwie klucz)
  194. powinna byc typu int. Uzyj nizej wymienionych parametrów:
  195. size 55
  196. tablespace USERS
  197. storage (initial 5K)
  198.  
  199. CREATE CLUSTER DEPT_PRAC_CLUSTER (klucz int)
  200. TABLESPACE USERS
  201. SIZE 55
  202. STORAGE (initial 5K);
  203.  
  204. CREATE CLUSTER succeeded.
  205.  
  206.  
  207. 6. Skopiuj tabele s_prac do klastr DEPT_PRAC_CLUSTER uzywajac do grupowania kolumny nr_zesp.
  208. Nazwij kopie I_PRAC.
  209. create table i_prac cluster dept_prac_cluster (nr_zesp) as select * from s_prac;
  210. Co sie stalo?
  211.  
  212. Polecenia nie udalo sie wywolac z racji braku indeksu. Komunikat:
  213.  
  214. Error starting at line 1 in command:
  215. create table i_prac cluster dept_prac_cluster (nr_zesp) as select * from s_prac
  216. Error at Command Line:1 Column:73
  217. Error report:
  218. SQL Error: ORA-02032: clustered tables cannot be used before the cluster index is built
  219. 02032. 00000 - "clustered tables cannot be used before the cluster index is built"
  220. *Cause: User attempted to perform a DML statement on a clustered table
  221. for which no cluster index has yet been created.
  222. *Action: Create the cluster index.
  223.  
  224.  
  225.  
  226.  
  227. 7. Utwórz indeks klastra DEPT_PRAC_CLUSTER o nazwie DEPT_PRAC_CLUSTER_IDX. Ustaw przestrzen
  228. tabel na USERS, inne parametry zostaw domyslne.
  229.  
  230. create index DEPT_PRAC_CLUSTER_IDX on cluster DEPT_PRAC_CLUSTER;
  231. TABLESPACE USERS;
  232.  
  233. CREATE CLUSTER succeeded.
  234.  
  235.  
  236. 8. Ponownie skopiuj tabele s_prac do klastra DEPT_PRAC_CLUSTER uzywajac do grupowania kolumny
  237. nr_zesp. Nazwij kopie I_PRAC.
  238.  
  239. create table succeeded.
  240.  
  241.  
  242. 9. Dodaj do klastra DEPT_PRAC_CLUSTER tabele I_DEPT, bedaca kopia tabeli zespoly:
  243. create table i_dept cluster dept_prac_cluster (nr_zesp) as select * from zespoly ;
  244.  
  245. create table succeeded.
  246.  
  247.  
  248. 10. W perspektywie USER_SEGMENTS obejrzyj ile przestrzeni zajmuje kazdy z utworzonych obiektów
  249. w przestrzeni USERS.
  250.  
  251. select * from USER_SEGMENTS;
  252.  
  253. 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
  254. --------------------------------------------------------------------------------- ------------------------------ ------------------ --------------- ------------------------------ ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- --------- ---------------------- ---------------------- ---------------------- ---------------------- -----------
  255. PRACOWNICY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  256. TEMATY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  257. WYPLATY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  258. ZESPOLY TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  259. S_PRAC TABLE ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  260. PRAC_CLUSTER CLUSTER ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  261. DEPT_PRAC_CLUSTER CLUSTER ASSM USERS 65536 8 1 16384 1 2147483645 2147483645 DEFAULT
  262. DEPT_PRAC_CLUSTER_IDX INDEX ASSM USERS 65536 8 1 65536 1 2147483645 2147483645 DEFAULT
  263.  
  264. 8 rows selected
  265.  
  266.  
  267. 4 Sledzenie statystyk o utworzonym klastrze i pomiary czasu wykonania zapytan
  268.  
  269. 1. Zatwierdz strukture klastra, wszystkich jego tabel i wszystkich indeksów z nim zwiazanych, wlaczajac w to
  270. indeks klastra:
  271. analyze cluster prac_cluster validate structure cascade;
  272. analyze table pracownicy estimate statistics;
  273. analyze table h_prac estimate statistics;
  274. analyze table i_prac estimate statistics;
  275.  
  276.  
  277. analyze cluster prac_cluster validate structure cascade;
  278. analyze cluster DEPT_PRAC_CLUSTER validate structure cascade;
  279. analyze table tematy validate structure cascade;
  280. analyze table pracownicy estimate statistics;
  281. analyze table h_prac estimate statistics;
  282. analyze table i_prac estimate statistics;
  283.  
  284. analyze cluster prac_cluster succeeded.
  285. analyze cluster DEPT_PRAC_CLUSTER succeeded.
  286. analyze table tematy succeeded.
  287. analyze table pracownicy succeeded.
  288. analyze table h_prac succeeded.
  289. analyze table i_prac succeeded.
  290.  
  291.  
  292. 2. Podlacz sie do bazy jako uzytkownik sys:
  293. connect sys/manager@orcl as sysdba;
  294. I odczytaj informacje z perspektywy dba_tables:
  295. select * from dba_tables where table_name ='PRACOWNICY' or table_name = 'H_PRAC';
  296.  
  297. 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
  298. ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ -------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------- --------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ------------------------- ---------------------- ---------- ---------- ----- ---------- ---------------------- ------------------------- ----------- ------------ --------- --------- ------ ----------- ------------ ------------ ---------- --------------- ------------ ---------- ------------------------------ ------------ ----------- ------------------ ------- ---------
  299. 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
  300. 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
  301.  
  302. 2 rows selected
  303.  
  304.  
  305. 3. Podlacz sie do bazy ponownie jako uzytkownik orax:
  306. connect orax/orax@orcl;
  307.  
  308.  
  309. 4. W perspektywie USER_SEGMENTS sprawdz ile jest bloków w tabelach poklastrowanych
  310. i niepoklastrowanych:
  311. select bytes, blocks, extents, segment_name from user_segments where
  312. segment_name = 'PRAC_CLUSTER' or
  313. segment_name = 'PRACOWNICY' or
  314. segment_name = 'DEPT_PRAC_CLUSTER' or
  315. segment_name = 'ZESPOLY' or
  316. segment_name = 'S_PRAC' or
  317. segment_name = 'DEPT_PRAC_CLUSTER_IDX';
  318.  
  319.  
  320. BYTES BLOCKS EXTENTS SEGMENT_NAME
  321. ---------------------- ---------------------- ---------------------- ---------------------------------------------------------------------------------
  322. 65536 8 1 DEPT_PRAC_CLUSTER
  323. 65536 8 1 DEPT_PRAC_CLUSTER_IDX
  324. 65536 8 1 PRACOWNICY
  325. 65536 8 1 PRAC_CLUSTER
  326. 65536 8 1 S_PRAC
  327. 65536 8 1 ZESPOLY
  328.  
  329. 6 rows selected
  330.  
  331.  
  332. 5. Sprawdz plan wykonania zapytania, wykonujac: set autotrace on;
  333. a nastepnie wykonujac zapytanie SQL na tabeli (-ach) poklastrowanej (-ych) i niepoklastrowanej (-ych).
  334.  
  335.  
  336.  
  337.  
  338. set autotrace on;
  339.  
  340. AutoTrace Enabled
  341.  
  342. select * from s_prac;
  343. select * from h_prac;
  344. select * from i_prac;
  345. select * from zespoly;
  346. select * from i_dept;
  347. select * from tematy;
  348.  
  349. NR_PRAC NAZWISKO NR_ZESP
  350. ---------------------- --------------- ----------------------
  351.  
  352. 1 GRZYBEK 4
  353. 2 GRZYBIARZ 5
  354. 3 WIREK 6
  355. 4 JANECZEK 5
  356. 5 TADECZEK 4
  357. 6 PODWISLAK 3
  358. 7 WOJTECKA 2
  359. 8 WUJEK 1
  360. 9 TRUMAN 5
  361. 10 ZUBEK 2
  362. 11 SKRZYPEK 5
  363. 12 POPKO 6
  364. 13 NOWY 1
  365. 14 RAZOWA 3
  366. 15 FULAK 4
  367. 16 KOTULA 2
  368. 17 KULANEK 3
  369. 18 KULAWIK 6
  370. 19 SKOCZEK 5
  371. 20 WIEZYCKA 1
  372. 21 BUJAK 3
  373. 22 BIERNAT 5
  374. 23 LUBELSKI 1
  375. 24 IWAN 2
  376. 25 JASKOLA 5
  377. 26 REBUS 3
  378. 27 REDOKS 1
  379. 28 SKOREK 4
  380. 29 KIPER 5
  381. 30 REPIK 2
  382. 31 NIEZALEZNY 1
  383. 32 WILK 3
  384. 33 MISIURA 4
  385. 34 KRAUS 5
  386. 35 WILCZEK 6
  387. 36 WILCZYNSKI 7
  388. 37 GABKA 7
  389. 38 KRAK 8
  390. 39 SZCZERBIEC 8
  391. 40 PSTROWSKI 7
  392. 41 SZCZERBIEC 8
  393.  
  394. 42 rows selected
  395.  
  396. Plan hash value: 889985163
  397.  
  398. ----------------------------------------------------------------------------
  399. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  400. ----------------------------------------------------------------------------
  401. | 0 | SELECT STATEMENT | | 42 | 1806 | 3 (0)| 00:00:01 |
  402. | 1 | TABLE ACCESS FULL| S_PRAC | 42 | 1806 | 3 (0)| 00:00:01 |
  403. ----------------------------------------------------------------------------
  404.  
  405. Note
  406. -----
  407. - dynamic sampling used for this statement
  408.  
  409. Statistics
  410. -----------------------------------------------------------
  411. 0 recursive calls
  412. 0 db block gets
  413. 0 db block gets direct
  414. 0 consistent gets - examination
  415. 0 calls to kcmgcs
  416. 0 HSC OLTP recursive compression
  417. 0 HSC OLTP inline compression
  418. 0 HSC OLTP Drop Column
  419. 0 Heap Segment Array Updates
  420. 0 securefile allocation bytes
  421. NR_PRAC PLEC DATA_UR NAZWISKO NR_ZESP
  422. ---------------------- ---- ------------------------- --------------- ----------------------
  423. 1999-11-11
  424. 1 M 1948-09-12 GRZYBEK 4
  425. 2 K 1957-02-17 GRZYBIARZ 5
  426. 3 M 1965-11-06 WIREK 6
  427. 4 K 1959-10-07 JANECZEK 5
  428. 5 M 1961-03-15 TADECZEK 4
  429. 6 M 1949-09-17 PODWISLAK 3
  430. 7 K 1947-08-19 WOJTECKA 2
  431. 8 K 1948-07-28 WUJEK 1
  432. 9 K 1964-05-07 TRUMAN 5
  433. 10 K 1962-05-04 ZUBEK 2
  434. 11 M 1956-04-10 SKRZYPEK 5
  435. 12 K 1968-11-03 POPKO 6
  436. 13 M 1945-08-21 NOWY 1
  437. 14 K 1949-08-17 RAZOWA 3
  438. 15 K 1960-09-16 FULAK 4
  439. 16 M 1953-09-13 KOTULA 2
  440. 17 M 1951-01-25 KULANEK 3
  441. 18 M 1961-07-25 KULAWIK 6
  442. 19 M 1958-05-08 SKOCZEK 5
  443. 20 K 1952-11-04 WIEZYCKA 1
  444. 21 M 1953-02-23 BUJAK 3
  445. 22 K 1947-05-09 BIERNAT 5
  446. 23 M 1946-10-10 LUBELSKI 1
  447. 24 M 1963-11-03 IWAN 2
  448. 25 K 1959-03-17 JASKOLA 5
  449. 26 K 1950-10-06 REBUS 3
  450. 27 K 1947-04-09 REDOKS 1
  451. 28 K 1952-03-14 SKOREK 4
  452. 29 M 1955-10-11 KIPER 5
  453. 30 K 1957-10-09 REPIK 2
  454. 31 M 1964-11-11 NIEZALEZNY 1
  455. 32 M 1945-12-10 WILK 3
  456. 33 M 1934-10-05 MISIURA 4
  457. 34 M 1954-09-04 KRAUS 5
  458. 35 M 1934-12-25 WILCZEK 6
  459. 36 M 1945-12-10 WILCZYNSKI 7
  460. 37 M 1934-10-05 GABKA 7
  461. 38 M 1954-09-04 KRAK 8
  462. 39 M 1934-12-25 SZCZERBIEC 8
  463. 40 M 1984-10-05 PSTROWSKI 7
  464. 41 M 1934-12-25 SZCZERBIEC 8
  465.  
  466. 42 rows selected
  467.  
  468. Plan hash value: 1060896720
  469.  
  470. ----------------------------------------------------------------------------
  471. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  472. ----------------------------------------------------------------------------
  473. | 0 | SELECT STATEMENT | | 42 | 1134 | 3 (0)| 00:00:01 |
  474. | 1 | TABLE ACCESS FULL| H_PRAC | 42 | 1134 | 3 (0)| 00:00:01 |
  475. ----------------------------------------------------------------------------
  476.  
  477. Statistics
  478. -----------------------------------------------------------
  479. 0 recursive calls
  480. 0 db block gets
  481. 0 db block gets direct
  482. 0 consistent gets - examination
  483. 0 calls to kcmgcs
  484. 0 HSC OLTP recursive compression
  485. 0 HSC OLTP inline compression
  486. 0 HSC OLTP Drop Column
  487. 0 Heap Segment Array Updates
  488. 0 securefile allocation bytes
  489. NR_PRAC NAZWISKO NR_ZESP
  490. ---------------------- --------------- ----------------------
  491.  
  492. 1 GRZYBEK 4
  493. 2 GRZYBIARZ 5
  494. 3 WIREK 6
  495. 4 JANECZEK 5
  496. 5 TADECZEK 4
  497. 6 PODWISLAK 3
  498. 7 WOJTECKA 2
  499. 8 WUJEK 1
  500. 9 TRUMAN 5
  501. 10 ZUBEK 2
  502. 11 SKRZYPEK 5
  503. 12 POPKO 6
  504. 13 NOWY 1
  505. 14 RAZOWA 3
  506. 15 FULAK 4
  507. 16 KOTULA 2
  508. 17 KULANEK 3
  509. 18 KULAWIK 6
  510. 19 SKOCZEK 5
  511. 20 WIEZYCKA 1
  512. 21 BUJAK 3
  513. 22 BIERNAT 5
  514. 23 LUBELSKI 1
  515. 24 IWAN 2
  516. 25 JASKOLA 5
  517. 26 REBUS 3
  518. 27 REDOKS 1
  519. 28 SKOREK 4
  520. 29 KIPER 5
  521. 30 REPIK 2
  522. 31 NIEZALEZNY 1
  523. 32 WILK 3
  524. 33 MISIURA 4
  525. 34 KRAUS 5
  526. 35 WILCZEK 6
  527. 36 WILCZYNSKI 7
  528. 37 GABKA 7
  529. 38 KRAK 8
  530. 39 SZCZERBIEC 8
  531. 40 PSTROWSKI 7
  532. 41 SZCZERBIEC 8
  533.  
  534. 42 rows selected
  535.  
  536. Plan hash value: 2536723742
  537.  
  538. ----------------------------------------------------------------------------
  539. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  540. ----------------------------------------------------------------------------
  541. | 0 | SELECT STATEMENT | | 42 | 798 | 3 (0)| 00:00:01 |
  542. | 1 | TABLE ACCESS FULL| I_PRAC | 42 | 798 | 3 (0)| 00:00:01 |
  543. ----------------------------------------------------------------------------
  544.  
  545. Statistics
  546. -----------------------------------------------------------
  547. 0 recursive calls
  548. 0 db block gets
  549. 0 db block gets direct
  550. 0 consistent gets - examination
  551. 0 calls to kcmgcs
  552. 0 HSC OLTP recursive compression
  553. 0 HSC OLTP inline compression
  554. 0 HSC OLTP Drop Column
  555. 0 Heap Segment Array Updates
  556. 0 securefile allocation bytes
  557. NR_ZESP NAZWA_ZESP NR_PRAC_KZ NR_INST
  558. ---------------------- ------------------------------ ---------------------- ----------------------
  559. 1 OPROGRAMOWANIE 1 1
  560. 2 TEORIA INFORMATYKI 2 1
  561. 3 SIECI KOMPUTEROWE 3 1
  562. 4 BUDOWA 4 1
  563. 5 AUTOMATY 25 3
  564. 6 BUDOWA KOPARKI 10 5
  565. 7 PIECE 21 6
  566. 8 WEGIEL 29 5
  567. 9 KONSTRUKCJA 33 5
  568. 10 LIKWIDACJA 21 6
  569. 11 POZIOMZEROWY 37 5
  570.  
  571. 11 rows selected
  572.  
  573. Plan hash value: 4044335737
  574.  
  575. -----------------------------------------------------------------------------
  576. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  577. -----------------------------------------------------------------------------
  578. | 0 | SELECT STATEMENT | | 11 | 781 | 3 (0)| 00:00:01 |
  579. | 1 | TABLE ACCESS FULL| ZESPOLY | 11 | 781 | 3 (0)| 00:00:01 |
  580. -----------------------------------------------------------------------------
  581.  
  582. Note
  583. -----
  584. - dynamic sampling used for this statement
  585.  
  586. Statistics
  587. -----------------------------------------------------------
  588. 4 recursive calls
  589. 0 db block gets
  590. 0 db block gets direct
  591. 0 consistent gets - examination
  592. 0 calls to kcmgcs
  593. 0 HSC OLTP recursive compression
  594. 0 HSC OLTP inline compression
  595. 0 HSC OLTP Drop Column
  596. 0 Heap Segment Array Updates
  597. 0 securefile allocation bytes
  598. NR_ZESP NAZWA_ZESP NR_PRAC_KZ NR_INST
  599. ---------------------- ------------------------------ ---------------------- ----------------------
  600. 1 OPROGRAMOWANIE 1 1
  601. 2 TEORIA INFORMATYKI 2 1
  602. 3 SIECI KOMPUTEROWE 3 1
  603. 4 BUDOWA 4 1
  604. 5 AUTOMATY 25 3
  605. 6 BUDOWA KOPARKI 10 5
  606. 7 PIECE 21 6
  607. 8 WEGIEL 29 5
  608. 9 KONSTRUKCJA 33 5
  609. 10 LIKWIDACJA 21 6
  610. 11 POZIOMZEROWY 37 5
  611.  
  612. 11 rows selected
  613.  
  614. Plan hash value: 1153213081
  615.  
  616. ----------------------------------------------------------------------------
  617. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  618. ----------------------------------------------------------------------------
  619. | 0 | SELECT STATEMENT | | 11 | 396 | 3 (0)| 00:00:01 |
  620. | 1 | TABLE ACCESS FULL| I_DEPT | 11 | 396 | 3 (0)| 00:00:01 |
  621. ----------------------------------------------------------------------------
  622.  
  623. Statistics
  624. -----------------------------------------------------------
  625. 1 recursive calls
  626. 0 db block gets
  627. 0 db block gets direct
  628. 0 consistent gets - examination
  629. 0 calls to kcmgcs
  630. 0 HSC OLTP recursive compression
  631. 0 HSC OLTP inline compression
  632. 0 HSC OLTP Drop Column
  633. 0 Heap Segment Array Updates
  634. 0 securefile allocation bytes
  635. NR_TEM TEMAT DATA_ROZP DATA_ODB NR_PRAC_KT NR_TEM_NADRZ
  636. ---------------------- ------------------------------ ------------------------- ------------------------- ---------------------- ----------------------
  637. 1 ADA SRODOWISKO 1990-01-01 1991-12-31 32
  638. 2 ADA EDYTOR 1990-03-01 1990-12-31 33 1
  639. 3 ADA KOMPILATOR 1990-09-01 1991-10-31 34 1
  640. 4 PASCAL KOMPILATOR 1983-03-21 1984-03-20 35
  641. 5 BAZA DANYCH - SPOLEM 1987-04-20 1987-09-17 32
  642. 6 BAZA DANYCH - PZU 1986-03-10 1986-07-28 29
  643. 8 PROCEDURY GRAFICZNE 1992-04-24 1992-08-22 21
  644. 10 PROJEKTOWANIE UKLADOW 1983-12-11 1984-03-20 26
  645. 11 ANALIZATOR WIDMA 1987-06-19 1987-11-16 29
  646. 13 LISP - KOMPILATOR 1985-01-08 1985-03-19 31
  647. 14 PROLOG - KOMPILATOR 1992-06-23 1992-08-22 34
  648. 15 STEROWANIE GAZOCIAGIEM 1983-08-22 1983-11-10 11
  649. 16 STEROWANIE TASMOCIAGIEM 1984-02-09 1984-03-20 25
  650. 17 STEROWNIK TURBINY W ELEKTROWNI 1987-08-18 1987-10-17 35
  651. 18 KARTA EMULATORA PC 1986-07-08 1986-09-26 32
  652. 20 GENERATOR SYGNALOW W.CZ. 1992-08-22 1992-11-20 34
  653. 21 ANALIZATOR STANOW 1983-10-21 1983-11-10 11
  654. 22 KANAL WIZJI - OPROGRAMOWANIE 1984-04-09 1984-05-19 31
  655. 24 CZUJNIK CISNIENIA 1986-09-06 1986-10-26 10
  656. 25 ANALIZATOR STEZENIA JONOW 1985-05-08 1985-06-17 27
  657. 28 WZMACNIACZ W.CZ. 1984-06-08 1984-12-15 29
  658. 30 MONITOR ZNAKOWY 1986-11-05 1986-11-25 21
  659. 31 DYSK 1985-04-01 1985-08-09 31
  660. 32 STEROWANIE REAKTOREM 1994-07-01 1994-03-03 18
  661. 33 GUPTA 1999-06-25 1999-02-15 1
  662. 34 PRZETWARZANIE WEKTOROWE 1986-12-15 1986-07-28 36
  663. 35 PRZETWARZANIE ROWNOLEGLE 1985-08-16 1985-03-19 37
  664. 36 PRZETWARZANIE ROZPROSZONE 1993-01-29 1992-08-22 33
  665. 37 ASSEMBLERY 1984-03-29 1983-10-11 36
  666. 38 SYMULATOR 1984-09-16 1984-03-20 37
  667. 39 BEZPIECZENSTWO 1988-03-25 1988-06-13 32
  668. 40 ODTWARZANIE 1987-02-13 1987-06-23 38
  669. 41 ARCHIWIZACJA 1985-07-10 1984-12-12 38
  670. 42 SLABOPLATNY 2000-06-18 2000-07-08 23
  671. 43 ZEROWY 2000-06-28 1999-11-11 23
  672. 44 KANALY WIZJI 1984-06-07 1983-10-11 21
  673. 45 KARTA MONITORA 1985-11-24 1985-03-19 32
  674. 100 ZESTAW KOMPUTEROWY 1985-01-01 1988-10-31 31
  675. 101 KARTA PROCESORA 1988-10-15 1989-01-13 10 100
  676. 102 MONITOR GRAFICZNY 1987-06-17 1987-07-07 25 100
  677. 103 GENERATOR DZWIEKU 1987-06-27 1987-08-06 33 100
  678. 104 STEROWNIK DYSKU 1990-01-04 1990-03-05 35 100
  679. 105 KARTA MONITORA GRAFICZNEGO 1991-02-28 1991-04-19 33 100
  680. 106 MODUL I/O 1988-02-18 1988-03-29 1 100
  681. 107 ZASILACZ 1990-02-03 1990-03-05 32 100
  682.  
  683. 45 rows selected
  684.  
  685. Plan hash value: 2328567157
  686.  
  687. ----------------------------------------------------------------------------
  688. | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
  689. ----------------------------------------------------------------------------
  690. | 0 | SELECT STATEMENT | | 45 | 3330 | 3 (0)| 00:00:01 |
  691. | 1 | TABLE ACCESS FULL| TEMATY | 45 | 3330 | 3 (0)| 00:00:01 |
  692. ----------------------------------------------------------------------------
  693.  
  694. Note
  695. -----
  696. - dynamic sampling used for this statement
  697.  
  698. Statistics
  699. -----------------------------------------------------------
  700. 4 recursive calls
  701. 0 db block gets
  702. 0 db block gets direct
  703. 0 consistent gets - examination
  704. 0 calls to kcmgcs
  705. 0 HSC OLTP recursive compression
  706. 0 HSC OLTP inline compression
  707. 0 HSC OLTP Drop Column
  708. 0 Heap Segment Array Updates
  709. 0 securefile allocation bytes
  710.  
  711.  
  712. Wyraznie widac, ze dla tabel klastrowanych ilosc bajtow jest zdecydowanie mniejsza
  713.  
  714.  
  715. 5 Czynnosci koncowe
  716.  
  717. 1. Utwórz klaster haszowany TEST1_HASH w przestrzeni USERS, zakladajac, ze do pobrania rekordu
  718. uzywana jest glównie kolumna nr_prac typu int. Uzyj kolumny data_ur jako funkcji haszujacej (opcja hash
  719. is) i okresl 20 kluczy haszujacych (hashkeys). Zdefiniuj 55 [B] do przechowywania wierszy z ta sama
  720. wartoscia haszujaca. Co sie stalo?
  721.  
  722.  
  723.  
  724.  
  725. create cluster TEST1_HASH (nr_prac int)
  726. hashkeys 20
  727. HASH IS data_ur
  728. size 55
  729. tablespace USERS
  730.  
  731. Error starting at line 1 in command:
  732. create cluster TEST1_HASH (nr_prac int)
  733. hashkeys 20
  734. HASH IS data_ur
  735. size 55
  736. tablespace USERS
  737. Error at Command Line:1 Column:0
  738. Error report:
  739. SQL Error: ORA-02467: Column referenced in expression not found in cluster definition
  740. 02467. 00000 - "Column referenced in expression not found in cluster definition"
  741. *Cause: A column in the hash is expression was not present in cluster
  742. definition.
  743. *Action: Recreate the cluster and correct the error in hash expression.
  744.  
  745.  
  746.  
  747. 2. Utwórz klaster TEST2_HASH z kluczem nr_tem int, specyfikujac po opcji hash is atrybut nr_prac. Co sie
  748. stalo?
  749.  
  750.  
  751.  
  752. create cluster TEST2_HASH (nr_tem int)
  753. hashkeys 20
  754. HASH IS nr_prac
  755. Error starting at line 1 in command:
  756. create cluster TEST2_HASH (nr_tem int)
  757. hashkeys 20
  758.  
  759. HASH IS nr_prac
  760. Error at Command Line:1 Column:0
  761. Error report:
  762. SQL Error: ORA-02467: Column referenced in expression not found in cluster definition
  763. 02467. 00000 - "Column referenced in expression not found in cluster definition"
  764. *Cause: A column in the hash is expression was not present in cluster
  765. definition.
  766. *Action: Recreate the cluster and correct the error in hash expression.
  767.  
  768.  
  769. 3. Zmodyfikuj parametry pamieciowe klastra prac_cluster poleceniem ALTER CLUSTER podajac po slowie
  770. STORAGE: (next 400K pctincrease 50);
  771. Co sie stalo?
  772.  
  773.  
  774.  
  775. alter cluster prac_cluster STORAGE (next 400K pctincrease 50);
  776.  
  777. Error starting at line 1 in command:
  778. alter cluster prac_cluster STORAGE (next 400K pctincrease 50)
  779. Error report:
  780. SQL Error: ORA-25150: ALTERING of extent parameters not permitted
  781. 25150. 00000 - "ALTERING of extent parameters not permitted"
  782. *Cause: An attempt was made to alter the extent parameters for a segment
  783. in a tablespace with autoallocate or uniform extent allocation
  784. policy.
  785. *Action: Remove the appropriate extent parameters from the command.
  786.  
  787.  
  788.  
  789. 4. Spróbuj zmienic poleceniem ALTER CLUSTER parametr SIZE klastra prac_cluster na wartosc 100. Co sie
  790. stalo?
  791.  
  792.  
  793. alter cluster prac_cluster SIZE 100;
  794.  
  795. Error starting at line 1 in command:
  796. alter cluster prac_cluster SIZE 100
  797.  
  798.  
  799.  
  800. Error report:
  801. SQL Error: ORA-02466: The SIZE and INITRANS options cannot be altered for HASH CLUSTERS.
  802. 02466. 00000 - "The SIZE and INITRANS options cannot be altered for HASH CLUSTERS."
  803. *Cause: An attempt was made to change the SIZE and INITRANS options after
  804. the hash cluster was created.
  805. *Action: Do not specify this option.
  806.  
  807.  
  808.  
  809. 5. Spróbuj usunac klaster PRAC_CLUSTER. Co sie stalo?
  810.  
  811.  
  812.  
  813. drop cluster prac_cluster;
  814.  
  815. Error starting at line 1 in command:
  816. drop cluster prac_cluster
  817. Error report:
  818. SQL Error: ORA-00951: cluster not empty
  819. 00951. 00000 - "cluster not empty"
  820. *Cause:
  821. *Action:
  822.  
  823.  
  824.  
  825. 6. Wykonaj jeszcze raz polecenie z pkt. poprzedniego, dodajac opcje INCLUDING TABLES.
  826.  
  827.  
  828.  
  829. drop cluster prac_cluster INCLUDING TABLES;
  830.  
  831. drop cluster prac_cluster succeeded.
  832.  
  833. 7. Usun wszystkie stworzone przez siebie obiekty:
  834.  
  835.  
  836.  
  837. drop table i_prac;
  838. drop table s_prac;
  839. drop table i_dept;
  840. drop cluster dept_prac_cluster;
  841. drop index dept_prac_cluster_idx;
  842.  
  843. drop table i_prac succeeded.
  844. drop table s_prac succeeded.
  845. drop table i_dept succeeded.
  846. drop cluster dept_prac_cluster succeeded.
  847. drop index dept_prac_cluster_idx succeeded.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement