ITPub博客

首页 > 数据库 > Oracle > 手动备份表空间

手动备份表空间

原创 Oracle 作者:GM_DBA 时间:2013-12-04 19:36:03 0 删除 编辑
实验步骤: 
1.手工备份example表空间的数据文件; 
2.除备份的文件; 
3.手工恢复被删除的文件; 

操作如下: 
(1) 查看example表空间所包含的文件; 
SYS@GMDBA> set lines 200 
SYS@GMDBA> col file_name for a45 
SYS@GMDBA> select file_id,file_name,tablespace_name from dba_data_files; 
FILE_ID FILE_NAME TABLESPACE_NAME 
---------- --------------------------------------------- ------------------ 
1 /u01/app/oracle/oradata/GMDBA/system01.dbf SYSTEM 
2 /u01/app/oracle/oradata/GMDBA/sysaux01.dbf SYSAUX 
3 /u01/app/oracle/oradata/GMDBA/undotbs01.dbf UNDOTBS1 
4 /u01/app/oracle/oradata/GMDBA/users01.dbf USERS 
5 /u01/app/oracle/oradata/GMDBA/example01.dbf EXAMPLE 
6 /u01/app/oracle/oradata/GMDBA/test01.dbf TEST 
7 /u01/app/oracle/oradata/GMDBA/test02.dbf TEST 
7 rows selected. 

(2) 将表空间至于热备状态; 

SYS@GMDBA> alter tablespace example begin backup; 
Tablespace altered. 

(3) 手工备份数据文件; 

SYS@GMDBA> !cp /u01/app/oracle/oradata/GMDBA/example01.dbf /home/oracle/example01.dbf 

(4) 结束热备状态; 

SYS@GMDBA> alter tablespace example end backup; 
Tablespace altered. 

(5) 删除文件,以制造故障; 

SYS@GMDBA> !rm -rf /u01/app/oracle/oradata/GMDBA/example01.dbf 

(6) 重启数据库发现无法open; 

SYS@GMDBA> shutdown immediate 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SYS@GMDBA> startup 
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance 
ORACLE instance started. 
Total System Global Area 422670336 bytes 
Fixed Size 1345380 bytes 
Variable Size 327157916 bytes 
Database Buffers 88080384 bytes 
Redo Buffers 6086656 bytes 
Database mounted. 
ORA-01157: cannot identify/lock data file 5 - see DBWR trace file 
ORA-01110: data file 5: '/u01/app/oracle/oradata/GMDBA/example01.dbf' 

(7) 手工恢复数据文件; 

SYS@GMDBA> !mv /home/oracle/example01.dbf /u01/app/oracle/oradata/GMDBA/ 
[oracle@GMDBA ~]$ sqlplus / as sysdba 
SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 3 14:58:44 2013 
Copyright (c) 1982, 2011, Oracle. All rights reserved. 
Connected to: 
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production 
With the Partitioning, OLAP, Data Mining and Real Application Testing options 
SYS@GMDBA> recover datafile '/u01/app/oracle/oradata/GMDBA/example01.dbf'; 
Media recovery complete. 

SYS@GMDBA> alter database open; 
Database altered. 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29319205/viewspace-1062217/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 闪回数据库
请登录后发表评论 登录
全部评论

注册时间:2013-11-20

  • 博文量
    33
  • 访问量
    207648