oracle(資料檔案)

來源:互聯網
上載者:User

標籤:base   歸檔   logs   create   啟動資料庫   select   size   lin   包含資料庫   

--建立資料檔案create tablespace--建立資料表空間同時建立資料檔案create temporary tablespace --建立暫存資料表空間的同時建立臨時資料檔案 alter tablespace...add datafile --向資料表空間添加資料檔案 alter tablespace...add tempfile--向暫存資料表空間添加資料檔案 create database --建立資料庫時建立資料檔案 alter database...create datefile--資料氈恢複操作時,建立一個資料檔案取代出現故障的資料檔案 --例alter tablespace users add datafile ‘d:\app\administrator\oradata\orcl\users02.dbf‘ size 10m;--修改資料檔案大小select file_name,autoextensible from dba_data_files;--查看當前資料庫所有資料檔案的擴充方式。--例alter database datafile ‘d:\app\administrator\oradata\orcl\users04.dbf‘size 10m autoextend on next 512k maxsize 100m;--改變資料檔案的可用性--要進行資料檔案的離線備份時,需要先將資料檔案離線。--需要重新命名資料檔案或改變資料檔案的位置時,需要先將資料檔案離線。--如果Oracle在寫入某個資料檔案時發生錯誤,系統會自動將該資料檔案設定為離線狀態,並且記錄在警示檔案中。排除故障後,需要以手動方式重新將該資料檔案恢複為聯機狀態。--資料檔案丟失或損壞,需要在啟動資料庫之前將資料檔案離線。--歸檔模式下:alter database datafile…online|offline--設定永久性資料檔案的離線與聯機。alter database tempfile…online|offline--設定臨時資料檔案的離線與聯機。--將ORCL資料庫設定為歸檔模式。shutdown immediate--資料庫己經關閉,己經卸載資料庫,常式己關閉startup mount--常式己啟動--例alter database datafile‘d:\app\administrator\oradata\orcl\users01.dbf‘offline;--離線recover datafile‘d:\app\administrator\oradata\orcl\users01.dbf‘;--完成介質恢複。alter database datafile‘d:\app\administrator\oradata\orcl\users01.dbf‘online;--聯機--非歸檔模式下資料檔案的離線--由於資料庫處於非歸檔模式,資料檔案離線後,會導致資訊的丟失,從而使該資料檔案無法再聯機,--即無法使用了。因此,在非歸檔模式下,通常不能將shutdown immediatestartup mountalter database noarchivelog;alter database open;alter database datafile ‘d:\app\administrator\product\11.2.0\dbhome_1\database\users3.dbf‘ offline for drop;select file_name,from dba_data_files where tablespace_name = ‘users‘;--注意 使用該語句只是將資料檔案離線,資料檔案不可用,並沒有從資料字典以及控制檔案中刪除該資料檔案資訊,也沒有從磁碟上刪除該資料檔案。--該檔案隨後可以隨其所屬資料表空間的刪除而刪除。alter tablespace users datafile offline;select name,status from v$datafile where ts# = (select ts# from  v$tablespace where name=‘users‘);--查看users資料表空間各個資料檔案的狀態recover tablespce users;--改變資料檔案的名稱與位置alter tablespacle…rename datafile…to--改變同一個資料表空間中的資料檔案的名稱與位置。alter database rename file…to--改變多個資料表空間中的資料檔案的名稱與位置--例select file_name,bytes from dba_data_files where tablespace_name = ‘users‘;alter tablespace users datafile offline;host copy d:\app\administrator\oradata\orcl\users02.dbf d:\disk1\users02.dbfhost copy d:\app\administrator\oradata\orcl\users04.dbf d:\disk1\users04.dbfalter tablespace users rename datafile ‘d:\app\administrator\oradata\orcl\users02.dbf‘,‘d:\app\administrator\oradata\orcl\users04.dbf‘ to‘d:\disk1\users02.dbf‘,‘d:\disk1\users02.dbf‘alter tablespace users online;--修改多個資料表空間中資料檔案的名稱與位置select file_name, bytes from dba_data_files where tablespace_name in(‘users‘,‘example‘);shutdown immediatestartup mounthost copy d:\app\administrator\oradata\orcl\users01.dbf d:\disk2\users01.dbfhost copy d:\app\administrator\oradata\orcl\example01.dbf d:\disk2\example01.dbfalter database rename file_namealter database open;--刪除資料檔案alter tablespace…drop datafile--刪除永久資料表空間中指定的空的資料檔案。alter tablespace…drop tempfile--刪除暫存資料表空間中指定的空的臨時資料檔案。--例alter tablespace users drop datafile‘d:\app\administrator\product\11.2.0\dbhome_1\database\users03.dbf‘;alter tablespace temp drop tempfile‘d:\app\administrator\oradata\orcl\temp02.dbf‘;alter database tempfile‘d:\app\administrator\oradata\orcl\temp02.dbf‘drop;--查詢資料檔案dba_data_files--包含資料庫所有資料檔案的資訊,包括資料檔案所屬的資料表空間,資料檔案編號等dba_temp_files--包含資料庫所有臨時資料檔案的資訊dba_extents--包含所有資料表空間中己分配的區的描述資訊user_extents--包含目前使用者所擁有的對象在所有資料表空間中己分配的區的描述資訊dba_free_space--包含資料表空間中空閑區的描述資訊user_free_space--包含目前使用者可以訪問的資料表空間中空閑區的描述資訊v$datafile--包含從控制檔案中擷取的資料檔案資訊v$datafile_header--包含從資料檔案頭部擷取的資訊v$tempfile--包含所有臨時資料檔案的基本資料

 

oracle(資料檔案)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.