这篇文章主要介绍了oracle 11g中如何手工热备数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
查看数据库是否处于归档模式,开启数据库热备模式,拷贝操作系统数据库数据文件到备份目录
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中如何手工热备数据库”这篇文章对大家有帮助,同时也希望大家多多支持亿速云,关注亿速云行业资讯频道,更多相关知识等着你来学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。