移動Oracle資料表空間資料檔案方案

來源:互聯網
上載者:User

移動Oracle資料表空間資料檔案方案

方案一:移動常規資料表空間(非系統資料表空間)資料檔案

/**************資料庫伺服器某個磁碟空間不足時移動常規資料表空間資料檔案*****************/

1、使用範圍:該操作在資料庫正常運行(open狀態)的條件下進行,但不能移動系統資料表空間裡面的資料檔案

2、步驟(windows系統下的操作):

1>準備工作:

C:\ sqlplus/nolog

SQL>connect sys/qazwsxedc@執行個體名 as sysdba;

2>使資料表空間離線:

SQL>alter tablespace TABS offline normal;

3>將資料表空間資料檔案複製到比較閒置磁碟:

例如:將D:\YAG_DB\ABS.ora 複製到E:\NEW\ABS.ora

4>執行alter tablespace rename datafile命令:

SQL>alter tablespace ABS rename datafile 'D:\YAG_DB\ABS.ora ' to 'E:\NEW\ABS.ora';

執行完,會顯示資料表空間已經更改(此命令的實際是修改控制檔案中資料表空間資料檔案的指標)

5>使資料表空間聯機:

SQL>alter tablespace ABS online;

6>此時可刪除D:\YAG_DB\ABS.ora

7>重啟資料庫:

SQL>shutdown immediate

SQL>startup

方案二:移動常系統資料表空間資料檔案

/****************資料庫伺服器某個磁碟空間不足時移動系統資料表空間資料檔案*****************/

1、使用範圍:該操作在資料庫處於mount 狀態才能進行,可移動系統資料表空間的資料檔案

2、步驟(Linux系統中的操作):

1># su - Oracle --切換到oracle使用者下

2># sqlplus /nolog

3>SQL>conn sys/pwd as sysdba

4>SQL>shutdown immediate --資料庫在啟動狀態時,先關閉

5>SQL>startup mount --將資料庫啟動為mount狀態

6>將要移動的系統資料表空間資料檔案複製到比較閒置分區目錄

eg:# mv /home/app/oracle/oradata/ORACLE_SID/system01.dbf /data/YAG_DB/ORACLE_SID

7>使用alter database rename file 命令

SQL>alter database rename file '/home/app/oracle/oradata/ORACLE_SID/system01.dbf' to '/data/YAG_DB/ORACLE_SID/system01.dbf';

8>開啟資料庫

SQL>alter databse open

9>檢查系統資料表空間的檔案路徑是否正確

SQL>select file#,name,status From v$datafile; --system系統資料表空間的檔案路徑name應為剛剛更改的路徑

Linux-6-64下安裝Oracle 12C筆記

RHEL6.4_64安裝單一實例Oracle 12cR1

Oracle 12C新特性之翻頁查詢

解讀 Oracle 12C 的 12 個新特性

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.