[每日一题] 11gOCP 1z0-052 :2013-08-31 数据库的存储结构....................................................A8 http://blog.csdn.net/guoyjoe/article/details/10784599 、 正确答案:A 将逻辑存储与物理存储分开是关系数据库范例的必要部分。关系数据
[每日一题] 11gOCP 1z0-052 :2013-08-31 数据库的存储结构....................................................A8
http://blog.csdn.net/guoyjoe/article/details/10784599
、
正确答案:A
将逻辑存储与物理存储分开是关系数据库范例的必要部分。关系数据库范例表明:编程人员只处理逻辑结构,而让数据库去管理到物理结构的映射。这意味着,可以重新组织物理存储,也可以将整个数据库移动到完全不同的硬件和操作系统上,而应用程序意识不到任何更改。
如下图展示Oracle存储模型,逻辑结构在左,物理结构在右。
注释:
从图示可以看出,数据库的存储结构可以分成两条路线去理解:
一是逻辑结构,即数据库由各个表空间组成,表空间由各个段组成,段由各个区段组成,区段由各个oracle块组成;
二是物理结构,即数据库由各个表空间组成,表空间由各个操作系统级别的文件组成,(操作系统级别的)文件由各个操作系统块组成。
疑问:一个段只能存放在一个操作系统级别的文件上吗?还是可以跨文件存放?
1、Oracle数据库逻辑结构
(1)DATABASE:一个数据库可划分为多个称为表空间的逻辑存储单元。
如下查询一个数据库中有七个表空间
[html] view plaincopy
- gyj@OCM> select tablespace_name from dba_tablespaces;
- TABLESPACE_NAME
- ------------------------------
- SYSTEM
- SYSAUX
- UNDOTBS1
- TEMP
- USERS
- EXAMPLE
- GYJ
(2)TABLESPACE:只能属一个数据库,包括一个或多个文件。如下表空间GYJ下有两个数据文件。
[html] view plaincopy
- gyj@OCM> col tablespace_name for a20
- gyj@OCM> col file_name for a50
- gyj@OCM> select tablespace_name,file_name from dba_data_files where tablespace_name='GYJ';
- TABLESPACE_NAME FILE_NAME
- -------------------- --------------------------------------------------
- GYJ /u01/app/oracle/oradata/ocm/gyj01.dbf
- GYJ /u01/app/oracle/oradata/ocm/gyj02.dbf
(3)SEGMENT:存在于表空间中,包含一个或多个区。
包括:表段、表分区段、索引段、索引分区段、临时段、撤销段、BLOB、CLOB
[html] view plaincopy
- gyj@OCM> select distinct segment_type from dba_segments;
- SEGMENT_TYPE
- ------------------
- LOBINDEX
- INDEX PARTITION
- TABLE SUBPARTITION
- ROLLBACK
- TABLE PARTITION
- NESTED TABLE
- LOB PARTITION
- LOBSEGMENT
- INDEX
- TABLE
- TYPE2 UNDO
- CLUSTER
查T1段所在的表空间、区的信息。
[html] view plaincopy
- gyj@OCM> select TABLESPACE_NAME,EXTENTS,BYTES/1024/1024||'M',BLOCKS from user_segments where segment_name='T1';
- TABLESPACE_NAME EXTENTS BYTES/1024/1024||'M' BLOCKS
- -------------------- ---------- ----------------------------------------- ----------
- GYJ 1 .0625M 8
(4)EXTENT:由相邻的数据块的组成,这意味着每个区只能存在于一个数据文件中。
[html] view plaincopy
- gyj@OCM> select TABLESPACE_NAME,EXTENT_ID,FILE_ID,BLOCK_ID,BYTES,BLOCKS from dba_extents where segment_name='T1' and owner='GYJ';
- TABLESPACE_NAME EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS
- -------------------- ---------- ---------- ---------- ---------- ----------
- GYJ 0 6 176 65536 8
(5)BLOCK:是数据库中最小的I/O单元,db_block_size
[html] view plaincopy
- gyj@OCM> show parameter db_block_size
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- db_block_size integer 8192
2、Oracle数据库物理结构
(1)、OS文件
A、仅属于一个表空间
B、是构成表空间的基础文件
(2)、OS块
A、 tune2fs-l /dev/sda1
[html] view plaincopy
- [root@mydb ~]# tune2fs -l /dev/sda1
- tune2fs 1.39 (29-May-2006)
- Filesystem volume name: /boot
- Last mounted on: not available>
- Filesystem UUID: 866e46b9-cb84-4271-b694-4ca3d25dc621
- Filesystem magic number: 0xEF53
- Filesystem revision #: 1 (dynamic)
- Filesystem features: has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super
- Default mount options: user_xattr acl
- Filesystem state: clean
- Errors behavior: Continue
- Filesystem OS type: Linux
- Inode count: 26104
- Block count: 104388
- Reserved block count: 5219
- Free blocks: 89230
- Free inodes: 26070
- First block: 1
- Block size: 1024
- Fragment size: 1024
- Reserved GDT blocks: 256
- Blocks per group: 8192
- Fragments per group: 8192
- Inodes per group: 2008
- Inode blocks per group: 251
- Filesystem created: Mon Aug 12 19:59:14 2013
- Last mount time: Sat Aug 31 20:35:07 2013
- Last write time: Sat Aug 31 20:35:07 2013
- Mount count: 16
- Maximum mount count: -1
- Last checked: Mon Aug 12 19:59:14 2013
- Check interval: 0 (none>)
- Reserved blocks uid: 0 (user root)
- Reserved blocks gid: 0 (group root)
- First inode: 11
- Inode size: 128
- Journal inode: 8
- Default directory hash: tea
- Directory Hash Seed: 12499f4f-6bd0-40d2-8a7a-6224b8f449dd
- Journal backup: inode blocks
B、扇区:512字节操作系统一次IO的大小
[html] view plaincopy
- [root@mydb ~]# fdisk -l
- Disk /dev/sda: 26.8 GB, 26843545600 bytes
- 255 heads, 63 sectors/track, 3263 cylinders
- Units = cylinders of 16065 * 512 = 8225280 bytes
- Device Boot Start End Blocks Id System
- /dev/sda1 * 1 13 104391 83 Linux
- /dev/sda2 14 144 1052257+ 82 Linux swap / Solaris
- /dev/sda3 145 3263 25053367+ 83 Linux

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

SublimeText3漢化版
中文版,非常好用

Dreamweaver Mac版
視覺化網頁開發工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!