重建控制檔案與 datafile offline,tablespace read only
轉自:http://blog.sina.com.cn/s/blog_465a4a1e0100nvuv.html
假如資料庫中存在offline 的datafile,read only 的Tablespace,這時重建控制檔案,控制檔案中是否會有關於offline datafile, read only tablespace的資訊呢?
要如何恢復呢?
SQL> alter database datafile 3 offline;
資料庫已更改。
SQL> alter tablespace users read only;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
---其實Trace file中已經有了恢復的方法:
Trace file:
# Set #1. NORESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ICE" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 'D:\ORA92\ORADATA\ICE\REDO01.LOG' SIZE 100M,
GROUP 2 'D:\ORA92\ORADATA\ICE\REDO02.LOG' SIZE 100M,
GROUP 3 'D:\ORA92\ORADATA\ICE\REDO03.LOG' SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'D:\ORA92\ORADATA\ICE\SYSTEM01.DBF',
'D:\ORA92\ORADATA\ICE\UNDOTBS01.DBF',
'D:\ORA92\ORADATA\ICE\TEST01.DBF'
CHARACTER SET AL32UTF8
;
---注意存在offline的datafile的資訊,但是不存在read only tablespace(datafile)的資訊.
# Take files offline to match current control file.
ALTER DATABASE DATAFILE 'D:\ORA92\ORADATA\ICE\TEST01.DBF' OFFLINE;
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00004'
TO 'D:\ORA92\ORADATA\ICE\USER01.DBF';
# Online the files in read-only tablespaces.
ALTER TABLESPACE "USERS" ONLINE;
# No tempfile entries found to add.
----假如是offline drop的datafile會有什麼不同嗎?
SQL> alter tablespace users read write;
表空間已更改。
SQL> alter database datafile 3 online;
alter database datafile 3 online
*
ERROR 位於第 1 行:
ORA-01113: 檔案 3 需要介質恢復
ORA-01110: 資料檔案 3: 'D:\ORA92\ORADATA\ICE\TEST01.DBF'
SQL> recover datafile 3;
完成介質恢復。
SQL> alter database datafile 3 online;
資料庫已更改。
SQL> alter database datafile 3 offline drop;
資料庫已更改。
SQL> alter tablespace users read only;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
# Set #1. NORESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ICE" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 'D:\ORA92\ORADATA\ICE\REDO01.LOG' SIZE 100M,
GROUP 2 'D:\ORA92\ORADATA\ICE\REDO02.LOG' SIZE 100M,
GROUP 3 'D:\ORA92\ORADATA\ICE\REDO03.LOG' SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'D:\ORA92\ORADATA\ICE\SYSTEM01.DBF',
'D:\ORA92\ORADATA\ICE\UNDOTBS01.DBF',
'D:\ORA92\ORADATA\ICE\TEST01.DBF'
CHARACTER SET AL32UTF8
;
---offline drop跟offline 生成的Trace file中有關控制檔案的內容沒什麼不同,offline drop的datafile同樣包括在控制檔案裡。
# Take files offline to match current control file.
ALTER DATABASE DATAFILE 'D:\ORA92\ORADATA\ICE\TEST01.DBF' OFFLINE DROP;
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00004'
TO 'D:\ORA92\ORADATA\ICE\USER01.DBF';
# Online the files in read-only tablespaces.
ALTER TABLESPACE "USERS" ONLINE;
# No tempfile entries found to add.
假如資料庫中存在offline 的datafile,read only 的Tablespace,這時重建控制檔案,控制檔案中是否會有關於offline datafile, read only tablespace的資訊呢?
要如何恢復呢?
SQL> alter database datafile 3 offline;
資料庫已更改。
SQL> alter tablespace users read only;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
---其實Trace file中已經有了恢復的方法:
Trace file:
# Set #1. NORESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ICE" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 'D:\ORA92\ORADATA\ICE\REDO01.LOG' SIZE 100M,
GROUP 2 'D:\ORA92\ORADATA\ICE\REDO02.LOG' SIZE 100M,
GROUP 3 'D:\ORA92\ORADATA\ICE\REDO03.LOG' SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'D:\ORA92\ORADATA\ICE\SYSTEM01.DBF',
'D:\ORA92\ORADATA\ICE\UNDOTBS01.DBF',
'D:\ORA92\ORADATA\ICE\TEST01.DBF'
CHARACTER SET AL32UTF8
;
---注意存在offline的datafile的資訊,但是不存在read only tablespace(datafile)的資訊.
# Take files offline to match current control file.
ALTER DATABASE DATAFILE 'D:\ORA92\ORADATA\ICE\TEST01.DBF' OFFLINE;
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00004'
TO 'D:\ORA92\ORADATA\ICE\USER01.DBF';
# Online the files in read-only tablespaces.
ALTER TABLESPACE "USERS" ONLINE;
# No tempfile entries found to add.
----假如是offline drop的datafile會有什麼不同嗎?
SQL> alter tablespace users read write;
表空間已更改。
SQL> alter database datafile 3 online;
alter database datafile 3 online
*
ERROR 位於第 1 行:
ORA-01113: 檔案 3 需要介質恢復
ORA-01110: 資料檔案 3: 'D:\ORA92\ORADATA\ICE\TEST01.DBF'
SQL> recover datafile 3;
完成介質恢復。
SQL> alter database datafile 3 online;
資料庫已更改。
SQL> alter database datafile 3 offline drop;
資料庫已更改。
SQL> alter tablespace users read only;
表空間已更改。
SQL> alter database backup controlfile to trace;
資料庫已更改。
# Set #1. NORESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ICE" NORESETLOGS ARCHIVELOG
-- SET STANDBY TO MAXIMIZE PERFORMANCE
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 226
LOGFILE
GROUP 1 'D:\ORA92\ORADATA\ICE\REDO01.LOG' SIZE 100M,
GROUP 2 'D:\ORA92\ORADATA\ICE\REDO02.LOG' SIZE 100M,
GROUP 3 'D:\ORA92\ORADATA\ICE\REDO03.LOG' SIZE 100M
-- STANDBY LOGFILE
DATAFILE
'D:\ORA92\ORADATA\ICE\SYSTEM01.DBF',
'D:\ORA92\ORADATA\ICE\UNDOTBS01.DBF',
'D:\ORA92\ORADATA\ICE\TEST01.DBF'
CHARACTER SET AL32UTF8
;
---offline drop跟offline 生成的Trace file中有關控制檔案的內容沒什麼不同,offline drop的datafile同樣包括在控制檔案裡。
# Take files offline to match current control file.
ALTER DATABASE DATAFILE 'D:\ORA92\ORADATA\ICE\TEST01.DBF' OFFLINE DROP;
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# Files in read-only tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00004'
TO 'D:\ORA92\ORADATA\ICE\USER01.DBF';
# Online the files in read-only tablespaces.
ALTER TABLESPACE "USERS" ONLINE;
# No tempfile entries found to add.
相關文章
- 當存在read only或者offline表空間時,重建控制檔案時要注意!
- tablespace offline與datafile offline 區別
- datafile offline 與alter tablespace offline 的區別
- 含read only表空間的資料庫的控制檔案重建資料庫
- alter database datafile offline drop 與 alter tablespace drop datafile 區別Database
- read only tablespace backup restoreREST
- tablespace offline 和datafile offline的區別
- alter database datafile offline and alter database tablespace ...offlineDatabase
- oracle裡tablespace offline和datafile offline的區別Oracle
- 重建控制檔案後,對臨時表空間(temporary tablespace)進行重建
- 重建控制檔案
- 重建控制檔案--
- 關於tablespace在read only狀態下的DML ,DDL操作--Read-Only Tablespaces
- Oracle重建控制檔案Oracle
- DataGuard重建控制檔案
- oracle 重建控制檔案Oracle
- 備份與恢復--重建控制檔案
- 利用offline datafile檔案方式遷移資料
- ORA-25153: Temporary Tablespace is Empty 重建控制檔案導致丟失tempfile
- 【TABLESPACE】通過重建控制檔案調整表空間資料檔案位置及名稱
- oracle實驗記錄 (恢復read only tablespace(1))Oracle
- oracle實驗記錄 (恢復read only tablespace(2))Oracle
- Oracle 控制檔案的重建Oracle
- 利用trace重建控制檔案
- 如何重建RAC的控制檔案
- RAC環境重建控制檔案
- ORACLE控制檔案的重建 (轉)Oracle
- 控制檔案重建以及備份
- When you issue "ALTER TABLESPACE xxx READ ONLY",what will oracle do?Oracle
- 重建Oracle資料庫控制檔案Oracle資料庫
- idea怎麼修改檔案的file is read-onlyIdea
- ALTER DATABASE DATAFILE OFFLINEDatabase
- 重建控制檔案的恢復(noresetlogs)
- 重建控制檔案 recreate control file
- 控制檔案損壞重建實驗(上)
- 控制檔案損壞重建實驗(下)
- 通過DUMP檔案頭來觀察FILE OFFLINE,TABLESPACE OFFLINE,HOT BACKUP的區別(1)
- linux下操作檔案出現 Read-only file systemLinux