码迷,mamicode.com
首页 > 数据库 > 详细

oracle 11g 手工热备-数据库

时间:2018-01-25 00:19:58      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:down   tomat   ide   red   not   instance   mod   com   acl   

查看数据库是否处于归档模式,开启数据库热备模式,拷贝操作系统数据库数据文件到备份目录

SYS@PROD> archive log list
Database log mode          Archive Mode
Automatic archival         Enabled
Archive destination        /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4
SYS@PROD> alter database begin backup;
Database altered.
SYS@PROD> host
[oracle@enmoedu1 PROD]$ rm -rf /home/oracle/bak/*
[oracle@enmoedu1 PROD]$ cp *.dbf /home/oracle/bak
[oracle@enmoedu1 PROD]$ exit
exit
SYS@PROD> alter database end backup;
Database altered.

删除所有的数据文件

SYS@PROD> host
[oracle@enmoedu1 PROD]$ rm -rf *.dbf
[oracle@enmoedu1 PROD]$ ll
total 172652
-rw-r----- 1 oracle oinstall  9748480 Jan 24 22:50 control01.ctl
-rw-r----- 1 oracle oinstall  9748480 Jan 24 22:50 control02.ctl
-rw-r----- 1 oracle oinstall 52429312 Jan 24 22:50 redo01.log
-rw-r----- 1 oracle oinstall 52429312 Jan 24 22:41 redo02.log
-rw-r----- 1 oracle oinstall 52429312 Jan 24 22:41 redo03.log
[oracle@enmoedu1 PROD]$ 

启动数据库报错

SYS@PROD> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@PROD> startup
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size          2257840 bytes
Variable Size         536874064 bytes
Database Buffers      289406976 bytes
Redo Buffers            6565888 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/PROD/system01.dbf‘
SYS@PROD> 

拷贝热备后的数据文件到原数据文件目录

[oracle@enmoedu1 PROD]$ cp /home/oracle/bak/*.dbf ./ ——拷贝数据文件到以前的数据文件目录
[oracle@enmoedu1 PROD]$ exit
exit
SYS@PROD> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
SYS@PROD> alter database open——尝试打开数据库,报错
  2  ;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/PROD/system01.dbf‘

恢复数据库

SYS@PROD> recover database;——恢复数据库
Media recovery complete.
SYS@PROD> alter database open;——开库
Database altered.
SYS@PROD> select status from v$instance;
STATUS
------------
OPEN

oracle 11g 手工热备-数据库

标签:down   tomat   ide   red   not   instance   mod   com   acl   

原文地址:http://blog.51cto.com/12185273/2064840

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