茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    Oracle表空間管理
    來源:易賢網(wǎng) 閱讀:1021 次 日期:2014-10-17 10:48:36
    溫馨提示:易賢網(wǎng)小編為您整理了“Oracle表空間管理”,方便廣大網(wǎng)友查閱!

    2 表空間

    Oracle磁盤管理中的最高邏輯層是表空間,Oracle11g中必須創(chuàng)建的4個表空間是SYSTEM, SYSAUX,TEMP, UNDOTBS1。

    2 SYSTEM:存儲數(shù)據(jù)字典等,pl/sql代碼等。

    2 SYSAUX:存儲與數(shù)據(jù)庫選項相關(guān)的數(shù)據(jù)

    2 TEMP:用于大的排序操作

    2 UNDUTBS1:為讀一致性和恢復(fù)的目的,存儲事務(wù)信息。

    表空間的下一層是段,一個段只能駐留在一個表空間中;一個或多個區(qū)可以組成一個段,每個區(qū)只能駐留在一個數(shù)據(jù)文件中;一組連續(xù)的數(shù)據(jù)塊可以組成一個區(qū)。如果要查詢表空間與對應(yīng)的數(shù)據(jù)文件的相關(guān)信息,可以從dba_data_files數(shù)據(jù)字典中查詢表空間及其包含的數(shù)據(jù)文件,舉例如下:

    SQL> col tablespace_name for a10;

    SQL> col file_name for a50;

    SQL> col bytes for 999,999,999;

    SQL>Select tablespace_name,file_name, bytes fromdba_data_files order by tablespace_name;

    1、 SYSTEM表空間

    SYSTEM表空間存放內(nèi)部數(shù)據(jù)和數(shù)據(jù)字典,主要存放SYS用戶的各個對象和其他用戶的少量對象。例如:查詢USERS表空間中存放的數(shù)據(jù)對象及其類型和擁有者。

    SQL>col owner for a10;

    SQL>col segment_name for a30;

    SQL>col segment_type for a20;

    SQL>select segment_type,segment_name,owner fromdba_segments where tablespace_name='USERS';

    2、 SYSAUX表空間

    SYSAUX表空間充當SYSTEM表空間的輔助表空間,主要用于存儲除數(shù)據(jù)字典以外的其他數(shù)據(jù)對象。例如,查詢SYSAUX表空間所存放的用戶及其所擁有的對象數(shù)量:

    Select owner as 用戶, count(segment_name) as 對象數(shù)量 fromdba_segments where tablespace_name='SYSAUX' group by owner;

    3、 創(chuàng)建表空間

    創(chuàng)建表空間的語法如下:

    Create [smallfile | bigfile] tablespace tablespace_name

    Datafile '/path/filename' size num[k|m] reuse

    ['/path/filename' size num[k|m]reuse]

    [, …]

    [autoextend [on|off] next ] num[k|m]

    [maxsize [unlimited | num[k|m]]]

    [mininum extent num[k|m]]

    [default storage storage]

    [online | offline]

    [logging | nologging]

    [permanent | temporary]

    [extent management dictionary | local [autoallocate |uniform size num[k|m]]];

    說明:

    ? smallfile | bigfile:表示創(chuàng)建的是小文件表空間還是大文件表空間

    ? autoextend [on|off] next:表示數(shù)據(jù)文件為自動擴展或非自動擴展,如為自動擴展則需要設(shè)置next的值。

    ? maxsize:表示數(shù)據(jù)文件自動擴展時,允許數(shù)據(jù)文件擴展的最大長度字節(jié)數(shù),如果指定unlimited關(guān)鍵字,則不需要指定字節(jié)長度。

    ? minimum extent:指出在表空間的extent的最小值,這個參數(shù)可以減少空間碎片,保證在表空間的extent是這個數(shù)值的整數(shù)倍。

    ? online | offline:創(chuàng)建表空間時可以指定為在線或離線。

    ? permanent | temporary:指定創(chuàng)建表空間是永久表空間或臨時表空間。默認為永久表空間。

    ? logging | nologging:指定該表空間內(nèi)的表在加載數(shù)據(jù)時是否產(chǎn)生日志,默認為產(chǎn)生日志,即使設(shè)定為nologging,但在進行insert,update,delete操作時,oracle仍會將信息記錄到redo log buffer中。

    ? extent management dictionary | local:指定表空間的擴展方式是使用數(shù)據(jù)字典管理還是本地化管理。默認為本地化管理。

    ? autoallocate | uniform size:如果采用本地化管理,在表空間擴展時,指定每次區(qū)的擴展大小是系統(tǒng)自動指定還是按照同等大小進行。如果設(shè)定uniform關(guān)鍵字,默認擴展大小為1MB。

    ? reuse:表示如果該文件存在,則清除該文件再重建該文件;若文件不存在,則創(chuàng)建該文件。

    ? default storage:設(shè)定以后要創(chuàng)建的表、索引、簇的存儲參數(shù)值。

    4、 刪除表空間

    ? 刪除空的表空間,但是不包含物理文件

    drop tablespacetablespace_name;

    ? 刪除非空表空間,但是不包含物理文件

    drop tablespacetablespace_name including contents;

    ? 刪除空表空間,包含物理文件

    drop tablespace tablespace_nameincluding datafiles;

    ? 刪除非空表空間,包含物理文件

    drop tablespacetablespace_name including contents and datafiles;

    ? 如果其他表空間中的表有外鍵等約束關(guān)聯(lián)到了本表空間中的表的字段,就要加上CASCADECONSTRAINTS

    drop tablespacetablespace_name including contents and datafiles CASCADE CONSTRAINTS;

    5、 案例

    ? 創(chuàng)建表空間,然后刪除該表空間。

    Createtablespace exampletb

    Datafile 'E: examp01.dbf' size 5M autoextend on next 128k maxsize 1000m,

    'E: examp02.dbf' size 5Mautoextend on next 128k maxsize 1000m;

    說明:以上例子創(chuàng)建的表空間由examp01.dbf和examp02.dbf兩個文件組成。創(chuàng)建完成后,可以發(fā)現(xiàn)在相應(yīng)路徑下增加了2個文件。

    drop tablespaceexampletb;

    ? 創(chuàng)建表空間和表,然后刪除該表空間。

    Createtablespace exampletb Datafile 'E: examp01.dbf'size 5M autoextendon next 128k maxsize 1000m reuse,

    'E:examp02.dbf' size 5Mautoextend on next 128k maxsize 1000m reuse;

    create tablescott.student

    (

    id number,

    name VARCHAR2(10)

    )tablespaceexampletb;

    說明:向student表插入數(shù)據(jù)時,數(shù)據(jù)將存儲在表空間exampletb中,而exampletb表空間擁有一個或多個數(shù)據(jù)文件,所以student數(shù)據(jù)最終存儲到examp01和examp02的數(shù)據(jù)文件中。

    drop tablespaceexampletb including contents;

    ? 創(chuàng)建表空間,然后刪除該表空間及數(shù)據(jù)文件。

    Create tablespaceexampletb

    Datafile 'E: examp01.dbf' size 5M autoextend on next 128k maxsize 1000mreuse,

    'E:examp02.dbf' size 5Mautoextend on next 128k maxsize 1000m reuse;

    drop tablespaceexampletb including datafiles;

    ? 創(chuàng)建表空間和表,然后刪除該表空間及數(shù)據(jù)文件。

    Createtablespace exampletb

    Datafile 'E: examp01.dbf' size 5M autoextend on next 128k maxsize 1000m,

    'E:examp02.dbf' size 5Mautoextend on next 128k maxsize 1000m;

    create tablescott.student

    (

    id number,

    name VARCHAR2(10)

    )tablespaceexampletb;

    drop tablespaceexampletb including contents and datafiles;

    說明:如果drop tablespace語句中含有datafiles,那datafiles之前必須有contents關(guān)鍵字,不然會提示錯誤。

    ? 創(chuàng)建兩個表空間,分別在其中創(chuàng)建主碼表和外碼表,然后刪除包含主碼表的表空間及數(shù)據(jù)文件。

    Createtablespace exampletb1

    Datafile 'E: examp03.dbf' size 5M autoextend on next 128k maxsize 1000m;

    Createtablespace exampletb2

    Datafile 'E: examp02.dbf' size 5M autoextend on next 128k maxsize 1000m;

    create tabletest1(mobile number(13) primary key)tablespace exampletb1;

    create table test2(mobile number(13) references test1(mobile)) tablespace exampletb2;

    drop tablespace exampletb1 including contents and datafiles cascade constraints;

    更多信息請查看IT技術(shù)專欄

    更多信息請查看數(shù)據(jù)庫
    易賢網(wǎng)手機網(wǎng)站地址:Oracle表空間管理
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇剩?/div>

    2026國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)