offline tablespace 的幾種方式 (轉)
offline tablespace 的幾種方式 | |||||||||||
想要offline tablespace有以下三種方式: OFFLINE {NORMAL | TEMPORARY | IMMEDIATE} 其中,normal是預設的。 下面通過測試說明幾種情況的異同: ----offline normal: idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841678 1416800082 idle>alter tablespace test_increment offline normal; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841750 1416841750 1416800082 ----offline normal,tablespace內所有的資料檔案上觸發checkpoint。 checkpoint_change#增加。 idle>alter tablespace test_increment online; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841783 1416841750 ----online時,不需要media recovery,同時tablespace內所有的資料檔案上再次觸發checkpoint。 checkpoint_change#增加。 ----offline temporary: idle>alter tablespace test_increment offline temporary; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841826 1416841826 1416841750 idle>alter tablespace test_increment online; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841836 1416841750 ----證明了文件中的如下說法: ----If no files are offline, but you use the temporary option, media recovery is not required to bring the tablespace back online. ----offline immediate: idle>alter tablespace test_increment offline immediate; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841836 1416841875 1416841750 ----offline immediate,tablespace內所有的資料檔案上不觸發checkpoint。 checkpoint_change#不變。 idle>alter tablespace test_increment online; alter tablespace test_increment online * ERROR 位於第 1 行: ORA-01113: ?? 3 ?????? ORA-01110: ???? 3: 'D:ORA92ORADATAORACLETEST_INCREMENT01.DBF' ----將tablespace online 時需要media recovery。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841836 1416841875 1416841750 idle>recover datafile 3; 完成介質恢復。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841875 1416841875 1416841750 idle>alter tablespace test_increment online; 表空間已更改。 idle>select checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ------------------ ------------ --------------- 1416841912 1416841750 ----online時,tablespace內所有的資料檔案上再次觸發checkpoint。 checkpoint_change#增加。 ---為了更清楚的說明offline temporary,我們新加一資料檔案。 idle>alter tablespace test_increment add datafile 2 'd:ora92oradataoracletest_increment02.dbf' size 5m; 表空間已更改。 idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842065 1416842037 4 1416842189 0 idle>alter database datafile 3 offline; 資料庫已更改。 idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842065 1416842321 1416842037 4 1416842189 0 ---單個的offline資料檔案,checkpoint_change#不變。 idle>alter tablespace test_increment offline temporary; 表空間已更改。 idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842065 1416842321 1416842037 4 1416842351 1416842351 0 ---對照之前的checkpoint,可以發現:offline temporary只對那些online的資料檔案進行checkpoint,而且在將tablespace online 的時候,那些進行過checkpoint的資料檔案將不需要media recovery(下面可以看出)。 idle>alter session set nls_language=american; Session altered. idle>alter tablespace test_increment online; alter tablespace test_increment online * ERROR at line 1: ORA-01113: file 3 needs media recovery ORA-01110: data file 3: 'D:ORA92ORADATAORACLETEST_INCREMENT01.DBF' ----將tablespace online 的時候,那些進行過checkpoint的資料檔案將不需要media recovery idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842065 1416842321 1416842037 4 1416842351 1416842351 0 idle>recover datafile 3; Media recovery complete. idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842321 1416842321 1416842037 4 1416842351 1416842351 0 idle>alter tablespace test_increment online; Tablespace altered. idle>select file#,checkpoint_change#,last_change#,offline_change# from v$datafile where ts#=14; FILE# CHECKPOINT_CHANGE# LAST_CHANGE# OFFLINE_CHANGE# ---------- ------------------ ------------ --------------- 3 1416842448 1416842037 4 1416842448 0 Oracle 文件的解釋: Taking Tablespaces OfflineYou may want to take a tablespace offline for any of the following reasons:
When a tablespace is taken offline, Oracle takes all the associated files offline. The SYSTEM tablespace can never be taken offline. You can specify any of the following options when taking a tablespace offline:
Specify TEMPORARY only when you cannot take the tablespace offline normally. In this case, only the files taken offline because of errors need to be recovered before the tablespace can be brought online. Specify IMMEDIATE only after trying both the normal and temporary options. The following example takes the users tablespace offline normally: ALTER TABLESPACE users OFFLINE NORMAL; Before taking an online tablespace offline, consider taking the following actions:
|
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/756652/viewspace-242083/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- c# 多執行緒的幾種方式 【轉載】C#執行緒
- Flutter工具:Dart中幾種常用的Json轉Object方式FlutterDartJSONObject
- Unity反射的幾種方式Unity反射
- css引入的幾種方式CSS
- Kubernetes 幾種儲存方式效能對比 (轉載)
- python 非同步的幾種方式Python非同步
- python的幾種輸出方式Python
- python的幾種輸入方式Python
- react 路由的幾種使用方式React路由
- OAuth的幾種授權方式OAuth
- JavaScript的幾種繼承方式JavaScript繼承
- 程式碼迭代的幾種方式
- Spring注入Bean的幾種方式SpringBean
- 玩轉SpringBoot:SpringBoot的幾種定時任務實現方式Spring Boot
- 剛體在三維空間的旋轉-幾種表達方式
- 檔案上傳的幾種方式
- sql最佳化的幾種方式SQL
- C#解析json的幾種方式C#JSON
- spring註冊bean的幾種方式SpringBean
- 實現 JavaScript 沙箱的幾種方式JavaScript
- Golang語言排序的幾種方式Golang排序
- 程式間的幾種通訊方式
- App相互喚醒的幾種方式APP
- 陣列去重的幾種方式陣列
- Express 提交資料的幾種方式Express
- python接收郵件的幾種方式Python
- Spring - 獲取ApplicationContext的幾種方式SpringAPPContext
- sqlplus常用的幾種登入方式SQL
- 幾種結匯方式分享
- sed中變數引用的幾種方式變數
- js 中斷迴圈的幾種方式JS
- Android生成ViewModel例項的幾種方式AndroidView
- 執行緒池建立的幾種方式執行緒
- Android 截圖實現的幾種方式Android
- JavaScript物件的建立方式有幾種?JavaScript物件
- VMware連線網路的幾種方式
- 攻擊伺服器的幾種方式伺服器
- hook的幾種方式及原理學習Hook