ITPub博客

首页 > 数据库 > Oracle > 基于非归档的冷备份恢复

基于非归档的冷备份恢复

原创 Oracle 作者:nathanzhn 时间:2014-02-19 15:45:20 0 删除 编辑

基于非归档的冷备份恢复—为脱机恢复,不完全恢复,在冷备份之后发生的数据库变化将无法恢复,而且冷备份恢复必须是全库恢复,包括数据文件、联机日志、控制文件的restore,不能做数据库的局部恢复,比如只恢复某个表空间或某个数据文件。

冷备能恢复成功的先决条件是,当你在做冷备的时候,数据库是shutdown已关闭的状态,这样才能保证一致性。

下面是执行步骤,因该步骤比较简单,就只列出脚本没有实际操作的结果:

1.        shutdown immediate –这一步是必须放在第一步的

2.        select name from v$datafile;

3.        select member from v$logfile;

4.        select name from v$controlfile;

5.        show parameter spfile;

6.        根据以上四步操作,取得要备份的文件清单,然后做冷拷贝

cp /u01/app/oracle/oradata/PROD/disk1/system001.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/example1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/indx1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/tools1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/users1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo101.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo102.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo103.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo201.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo202.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo203.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/redo301.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/redo302.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk3/redo303.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk4/redo104.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk4/redo204.log /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk1/control01.ctl /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/oradata/PROD/disk2/control02.ctl /home/oracle/coldbackup/20140125-1

cp /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora /home/oracle/coldbackup/20140125-1

7.        当数据库冷备份恢复时,先将数据库shutdown(可能是正常关闭immediate,也可能是异常关闭abort),然后执行数据库文件删除,再将冷备份拷贝到对应的数据库目录

rm -f /u01/app/oracle/oradata/PROD/disk1/system001.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/example1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/indx1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/tools1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/users1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf

rm -f /u01/app/oracle/oradata/PROD/disk1/redo101.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo102.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo103.log

rm -f /u01/app/oracle/oradata/PROD/disk1/redo201.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo202.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo203.log

rm -f /u01/app/oracle/oradata/PROD/disk1/redo301.log

rm -f /u01/app/oracle/oradata/PROD/disk2/redo302.log

rm -f /u01/app/oracle/oradata/PROD/disk3/redo303.log

rm -f /u01/app/oracle/oradata/PROD/disk4/redo104.log

rm -f /u01/app/oracle/oradata/PROD/disk4/redo204.log

rm -f /u01/app/oracle/oradata/PROD/disk1/control01.ctl

rm -f /u01/app/oracle/oradata/PROD/disk2/control02.ctl

rm -f /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora

 

cp /home/oracle/coldbackup/20140125-1/system001.dbf    /u01/app/oracle/oradata/PROD/disk1/system001.dbf

cp /home/oracle/coldbackup/20140125-1/undotbs01.dbf    /u01/app/oracle/oradata/PROD/disk1/undotbs01.dbf

cp /home/oracle/coldbackup/20140125-1/sysaux01.dbf     /u01/app/oracle/oradata/PROD/disk1/sysaux01.dbf

cp /home/oracle/coldbackup/20140125-1/example1.dbf     /u01/app/oracle/oradata/PROD/disk1/example1.dbf

cp /home/oracle/coldbackup/20140125-1/indx1.dbf        /u01/app/oracle/oradata/PROD/disk1/indx1.dbf

cp /home/oracle/coldbackup/20140125-1/tools1.dbf       /u01/app/oracle/oradata/PROD/disk1/tools1.dbf

cp /home/oracle/coldbackup/20140125-1/users1.dbf       /u01/app/oracle/oradata/PROD/disk1/users1.dbf

cp /home/oracle/coldbackup/20140125-1/oltp1.dbf        /u01/app/oracle/oradata/PROD/disk1/oltp1.dbf

cp /home/oracle/coldbackup/20140125-1/tbs_tommie01.dbf /u01/app/oracle/oradata/PROD/disk1/tbs_tommie01.dbf

cp /home/oracle/coldbackup/20140125-1/redo101.log      /u01/app/oracle/oradata/PROD/disk1/redo101.log

cp /home/oracle/coldbackup/20140125-1/redo102.log      /u01/app/oracle/oradata/PROD/disk2/redo102.log

cp /home/oracle/coldbackup/20140125-1/redo103.log      /u01/app/oracle/oradata/PROD/disk3/redo103.log

cp /home/oracle/coldbackup/20140125-1/redo201.log      /u01/app/oracle/oradata/PROD/disk1/redo201.log

cp /home/oracle/coldbackup/20140125-1/redo202.log      /u01/app/oracle/oradata/PROD/disk2/redo202.log

cp /home/oracle/coldbackup/20140125-1/redo203.log      /u01/app/oracle/oradata/PROD/disk3/redo203.log

cp /home/oracle/coldbackup/20140125-1/redo301.log      /u01/app/oracle/oradata/PROD/disk1/redo301.log

cp /home/oracle/coldbackup/20140125-1/redo302.log      /u01/app/oracle/oradata/PROD/disk2/redo302.log

cp /home/oracle/coldbackup/20140125-1/redo303.log      /u01/app/oracle/oradata/PROD/disk3/redo303.log

cp /home/oracle/coldbackup/20140125-1/redo104.log      /u01/app/oracle/oradata/PROD/disk4/redo104.log

cp /home/oracle/coldbackup/20140125-1/redo204.log      /u01/app/oracle/oradata/PROD/disk4/redo204.log

cp /home/oracle/coldbackup/20140125-1/control01.ctl    /u01/app/oracle/oradata/PROD/disk1/control01.ctl

cp /home/oracle/coldbackup/20140125-1/control02.ctl    /u01/app/oracle/oradata/PROD/disk2/control02.ctl

cp /home/oracle/coldbackup/20140125-1/spfilePROD.ora /u01/app/oracle/product/10.2.0/db_1/dbs/spfilePROD.ora

8.        拷贝完成后,启动数据库 startup up

 

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

请登录后发表评论 登录
全部评论

注册时间:2014-01-23

  • 博文量
    49
  • 访问量
    262778