非系统表空间损坏,rman备份恢复
2017-04-24 23:17
267 查看
实验条件:有完整可用备份
--查询表空间情况
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
UNDOTBS2 ONLINE
GOLDGATE ONLINE
FDA01 ONLINE
FDA02 ONLINE
ANDY ONLINE
9 rows selected.
SQL>
col tablespace_name for a15
col file_name for a50
SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files where tablespace_name='ANDY' ORDER BY tablespace_name;
TABLESPACE_NAME FILE_ID FILE_NAME TOTAL_SPACE
--------------- ---------- -------------------------------------------------- -----------
ANDY 3 /home/oracle/app/oradata/orcl/andy01.dbf 10
ANDY 5 /home/oracle/app/oradata/orcl/andy02.dbf 1
--模拟表空间损坏
[oracle@11g orcl]$ ll andy*
-rw-r-----. 1 oracle oinstall 10493952 Mar 24 17:41 andy01.dbf
-rw-r-----. 1 oracle oinstall 1056768 Mar 24 17:53 andy02.dbf
[oracle@11g orcl]$ rm -rf andy*
[oracle@11g trace]$ cat alert_orcl.log |grep ORA-
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/home/oracle/app/oradata/orcl/andy01.dbf'
ORA-27041: unable to open file
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/home/oracle/app/oradata/orcl/andy02.dbf'
ORA-27041: unable to open file
--恢复过程
SQL> alter tablespace andy offline;
alter tablespace andy offline
*
ERROR at line 1:
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/home/oracle/app/oradata/orcl/andy01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
如果文件不存在,就加immediate参数
SQL> alter tablespace andy offline immediate;
Tablespace altered.
rman>restore tablespace andy;
rman>recover tablespace andy;
rman>sql 'alter tablespace andy online';
sql statement: alter tablespace andy online
--查询表空间情况
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------ ---------
SYSTEM ONLINE
SYSAUX ONLINE
TEMP ONLINE
USERS ONLINE
UNDOTBS2 ONLINE
GOLDGATE ONLINE
FDA01 ONLINE
FDA02 ONLINE
ANDY ONLINE
9 rows selected.
SQL>
col tablespace_name for a15
col file_name for a50
SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 0) total_space
FROM dba_data_files where tablespace_name='ANDY' ORDER BY tablespace_name;
TABLESPACE_NAME FILE_ID FILE_NAME TOTAL_SPACE
--------------- ---------- -------------------------------------------------- -----------
ANDY 3 /home/oracle/app/oradata/orcl/andy01.dbf 10
ANDY 5 /home/oracle/app/oradata/orcl/andy02.dbf 1
--模拟表空间损坏
[oracle@11g orcl]$ ll andy*
-rw-r-----. 1 oracle oinstall 10493952 Mar 24 17:41 andy01.dbf
-rw-r-----. 1 oracle oinstall 1056768 Mar 24 17:53 andy02.dbf
[oracle@11g orcl]$ rm -rf andy*
[oracle@11g trace]$ cat alert_orcl.log |grep ORA-
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/home/oracle/app/oradata/orcl/andy01.dbf'
ORA-27041: unable to open file
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/home/oracle/app/oradata/orcl/andy02.dbf'
ORA-27041: unable to open file
--恢复过程
SQL> alter tablespace andy offline;
alter tablespace andy offline
*
ERROR at line 1:
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/home/oracle/app/oradata/orcl/andy01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
如果文件不存在,就加immediate参数
SQL> alter tablespace andy offline immediate;
Tablespace altered.
rman>restore tablespace andy;
rman>recover tablespace andy;
rman>sql 'alter tablespace andy online';
sql statement: alter tablespace andy online
相关文章推荐
- 非系统表空间损坏,rman备份恢复
- 非系统数据文件损坏,rman备份恢复
- 非系统数据文件损坏,rman备份恢复
- instance和media损坏恢复-RMAN(三) --增量备份
- RMAN备份与恢复系列之非系统表空间恢复
- 通过RMAN备份duplicate异机克隆恢复数据库
- rman基于备份的控制文件的不完全恢复
- 备份恢复7——rman维护命令
- 用 rman 备份自动备份控制文件恢复数据库
- 控制文件备份恢复——部分控制文件丢失或损坏
- RMAN 系列(九) ---- 调整RMAN备份与恢复操作的性能
- 归档模式下无备份数据文件损坏的完全恢复-2
- Linux下Oracle9i RMAN备份及恢复步骤介绍
- ORACLE DATABASE 11G RMAN 备份与恢复
- Oracle RMAN 在一台新机器上恢复另台机器的全备份
- RMAN 备份与恢复 实例
- Rman备份与恢复1之目标数据库
- RMAN 系列(九) ---- 调整RMAN备份与恢复操作的性能
- RMAN 备份与恢复 实例
- 深入oracle 12c数据库备份与恢复(优化RMAN性能、Oracle flashback技术)