ITPub博客

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

手工备份表空间

原创 Oracle 作者:七_仔 时间:2015-05-23 17:08:56 0 删除 编辑
进行简单的手工表空间备份操作
查询一下表空间
select file_id,file_name,tablespace_name from dba_data_files;
  FILE_NAME                        TABLESPACE_NAME
------------------------------ ------------------------------
/u01/app/oracle/oradata/ENMOED    USERS
U/users01.dbf
/u01/app/oracle/oradata/ENMOED UNDOTBS1
U/undotbs01.dbf
/u01/app/oracle/oradata/ENMOED SYSAUX
U/sysaux01.dbf
/u01/app/oracle/oradata/ENMOED SYSTEM
U/system01.dbf
FILE_NAME                      TABLESPACE_NAME
------------------------------ -----------------------------
/u01/app/oracle/oradata/ENMOED ENMOEDU
U/ENMOEDU01.dbf
/u01/app/oracle/oradata/ENMOED ENMOEDU
U/EDNMOEDU02.db
/u01/app/oracle/oradata/ENMOED ENMOEDUBIG
U/enmoedubig.dbf

进行手工备份
SYS@ENMOEDU> alter tablespace ENMOEDUBIG begin backup;
alter tablespace ENMOEDUBIG begin backup
*
ERROR at line 1:
ORA-01123: cannot start online backup; media recovery not enabled
查询报错 在操作系统中
oerr ora 01123
[oracle@ENMOEDU ENMOEDU]$ oerr ora 01123
01123, 00000, "cannot start online backup; media recovery not enabled"
// *Cause: An attempt to start backup of an on-line tablespace failed because
//        media recovery is not enabled.
// *Action: Enable media recovery and retry this operation.

经过分析没有开启归档
查询归档状态
SYS@ENMOEDU> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     9
Current log sequence           10

在mount 下开启归档
SYS@ENMOEDU> alter database archivelog;
Database altered.

启动到open 

SYS@ENMOEDU> alter tablespace ENMOEDU begin backup;
Tablespace altered.SYS@ENMOEDU> !cp /u01/app/oracle/oradata/ENMOEDU/ENMOEDU01.dbf /home/oracle/ENMOEDU01.dbf;
SYS@ENMOEDU> alter tablespace ENMOEDU END BACKUP;
Tablespace altered.
表空间完成备份
删除表空间模拟故障
SYS@ENMOEDU> !rm /u01/app/oracle/oradata/ENMOEDU/ENMOEDU01.dbf
关闭数据库
启动数据库SYS@ENMOEDU> startup
ORACLE instance started.


Total System Global Area  422670336 bytes
Fixed Size                  1345380 bytes
Variable Size             318769308 bytes
Database Buffers           96468992 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/ENMOEDU/ENMOEDU01.dbf'
报错
解决方法SYS@ENMOEDU> !mv /home/oracle/ENMOEDU01.dbf /u01/app/oracle/oradata/ENMOEDU
将数据文件备份拷回去
启动数据库

SYS@ENMOEDU> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: '/u01/app/oracle/oradata/ENMOEDU/ENMOEDU01.dbf'
在进行恢复 recovery 
SYS@ENMOEDU> recover datafile 5;
Media recovery complete.

将数据库打开到 open 
alter database open;
SYS@ENMOEDU> alter database open;


Database altered.


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

上一篇: 增加日志文件组
请登录后发表评论 登录
全部评论

注册时间:2015-03-25

  • 博文量
    47
  • 访问量
    235637