oracle 11g 手工热备-数据库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle 11g 手工热备-数据库相关的知识,希望对你有一定的参考价值。
查看数据库是否处于归档模式,开启数据库热备模式,拷贝操作系统数据库数据文件到备份目录
[email protected]> 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
[email protected]> alter database begin backup;
Database altered.
[email protected]> host
[[email protected] PROD]$ rm -rf /home/oracle/bak/*
[[email protected] PROD]$ cp *.dbf /home/oracle/bak
[[email protected] PROD]$ exit
exit
[email protected]> alter database end backup;
Database altered.
删除所有的数据文件
[email protected]> host
[[email protected] PROD]$ rm -rf *.dbf
[[email protected] 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
[[email protected] PROD]$
启动数据库报错
[email protected]> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[email protected]> 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‘
[email protected]>
拷贝热备后的数据文件到原数据文件目录
[[email protected] PROD]$ cp /home/oracle/bak/*.dbf ./ ——拷贝数据文件到以前的数据文件目录
[[email protected] PROD]$ exit
exit
[email protected]> select open_mode from v$database;
OPEN_MODE
--------------------
MOUNTED
[email protected]> 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‘
恢复数据库
[email protected]> recover database;——恢复数据库
Media recovery complete.
[email protected]> alter database open;——开库
Database altered.
[email protected]> select status from v$instance;
STATUS
------------
OPEN
以上是关于oracle 11g 手工热备-数据库的主要内容,如果未能解决你的问题,请参考以下文章