{"id":424,"date":"2009-02-13T10:50:49","date_gmt":"2009-02-13T15:50:49","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=424"},"modified":"2009-02-13T10:58:18","modified_gmt":"2009-02-13T15:58:18","slug":"oracle-notes","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=424","title":{"rendered":"Oracle Notes"},"content":{"rendered":"<p>Data Blocks, Extents, Segments<\/p>\n<p>\u00a7Data Blocks<br \/>\n\u2022Overhead<br \/>\n\tHeader: block addr, seg type<br \/>\n\tTable dir: tables having rows<br \/>\n\tRow dir: actual rows info<br \/>\n\u2022Free space<br \/>\n\u2022Row data<\/p>\n<p>\u00a7PCTFREE, PCTUSED, Row Chaining<br \/>\n\u2022PCTFREE: pct of block spc reseved for updates<br \/>\n\u2022PCTUSED: before new rows can be inserted<br \/>\n\u2022Row Chaining: a row spanning more than two data blocks<br \/>\n\u2022Row Migrating: caused by update<\/p>\n<p>\u00a7Extents<br \/>\n\u2022Locally managed<br \/>\n-reduce data dictionry contention<br \/>\n-don&#8217;t care number of extents a segment acquires<br \/>\n-easier space management<br \/>\n-never fragment with uiniform policy<\/p>\n<p>\u2022Dictionary managed<\/p>\n<p>Estimate orcle table size<br \/>\n\u2022ANALYZE TABLE <tbl> COMPUTE|ESTIATE STATISTICS;<br \/>\n\u2022SELECT avg_row_len<br \/>\nFROM dba_tables<br \/>\nWHERE table_name=&#8217;<tbl>&#8216;;<br \/>\n\u2022rough estimate of table size<br \/>\navg_row_len*number_of_rows*(1+PCTFREE\/100)*1.15<\/p>\n<p><strong>Index<\/strong><\/p>\n<p>&#8211; 5% rule:<br \/>\nuse idx when accessing < 5% of rows.\n\n- concatenated indexes:\nmust include leading columns\n\n-DBA_INDEXES\n-DBA-IND_COLUMNS\n-USER_INDEXES\n-USER_IND_COLUMNS\n\nLocally managed tablespace\n\u2022available since 8.1.5\n\u2022minimum extent size is 64k\n\u2022size default to 1m\n\u2022default to autoallocate\n\n\u2022ex1\ncreate tablespace local_uniform_size datafile 'e:\\ora816\\db\\local_tbs01.dbf' size 10m extent management local uniform size 10k;\n\n\u2022ex2\ncreate tablespace local_uniform_size datafile 'e:\\ora816\\db\\local_tbs01.dbf' size 10m extent management local autoallocate;\n\n\u2022check tablespace info\nselect substr(tablespace_name,1,20) Tablespace, initial_extent\/1024 \"I-Ex(kb)\", next_extent\/1024 \"N-Ex(kb)\", min_extlen, extent_management, allocation_type from dba_tablespaces where tablespace_name like 'LOC%';\n\n\u2022Migrate to lmt (available 8.1.6)\nexecute SYS.dbms_space_admin.tablespace_migrate_TO_local('SAMTABLESPACE');\n\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Data Blocks, Extents, Segments \u00a7Data Blocks \u2022Overhead Header: block addr, seg type Table dir: tables having rows Row dir: actual rows info \u2022Free space \u2022Row data \u00a7PCTFREE, PCTUSED, Row Chaining \u2022PCTFREE: pct of block spc reseved for updates \u2022PCTUSED: before &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=424\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[35],"tags":[],"class_list":["post-424","post","type-post","status-publish","format-standard","hentry","category-oracle"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-6Q","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=424"}],"version-history":[{"count":4,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions"}],"predecessor-version":[{"id":433,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/424\/revisions\/433"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}