码迷,mamicode.com
首页 > 其他好文 > 详细

手工热备份

时间:2014-07-28 03:09:00      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:热备份

1、首先要开归档,因为是热备份

设置表空间为只读

SQL> alter tablespace exec read only;

SQL> select tablespace_name,status from dba_tablespaces;


TABLESPACE_NAME                STATUS

------------------------------ ---------

SYSTEM                         ONLINE

SYSAUX                         ONLINE

TEMPTS                         ONLINE

TOOLS                          ONLINE

EXEC                           READ ONLY

QIANYI                         ONLINE

UNDO_SMALL2                    ONLINE

TEMPTS2                        ONLINE

GOLDENGATE                     ONLINE

TBS_GGUSER                     ONLINE

只读状态下备份报错,因为它对数据文件加不上锁

SQL> alter tablespace exec begin backup;

alter tablespace exec begin backup

*

ERROR at line 1:

ORA-01642: begin backup not needed for read only tablespace ‘EXEC‘

数据文件的scn号不一致了:

SQL> select file#,checkpoint_change# from v$datafile;


     FILE# CHECKPOINT_CHANGE#

---------- ------------------

         1            2831387

         2            2831387

         3            2831387

         4            2831387

         5            2834548

         6            2831387

         7            2831387

         8            2831387

将表空间设置生读写模式:

 

2、执行开始备份表空间的命令后,正常关库是无法成功的:

SQL> alter tablespace EXEC read write;

SQL> alter tablespace exec begin backup;

Tablespace altered.

SQL> shutdown immediate;
ORA-01149: cannot shutdown - file 5 has online backup set
ORA-01110: data file 5: ‘/u01/app/oracle/oradata/PROD/exec.dbf‘

 

可以用shutdown abort关库,但是这样会导致数据文件的scn号不一致,开库是需要恢复表空间

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  150994944 bytes
Fixed Size                  1218220 bytes
Variable Size              79694164 bytes
Database Buffers           67108864 bytes
Redo Buffers                2973696 bytes
Database mounted.
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: ‘/u01/app/oracle/oradata/PROD/exec.dbf‘
SQL> recover tablespace exec;
Media recovery complete.
SQL> alter database open;

本文出自 “柚子” 博客,请务必保留此出处http://6205351.blog.51cto.com/6195351/1530615

手工热备份,布布扣,bubuko.com

手工热备份

标签:热备份

原文地址:http://6205351.blog.51cto.com/6195351/1530615

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!