【备份恢复】物理冷备份及恢复-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

【备份恢复】物理冷备份及恢复

冷备:,即关闭数据库备份,要求备份数据库三大文件(数据文件、控制文件、日志文件)及参数文件、口令文件;同时冷备之前要一致性关库,以触发ckpt实现三大文件一致性,以使恢复数据库是不需要recover;

网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、微信小程序、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了公主岭免费建站欢迎大家使用!

1.查看备份文件绝对路径(重要)

SYS@ORA11GR2>selectname fromv$datafile;

 

NAME

--------------------------------------------------------/u01/app/oracle/oradata/ORA11GR2/system01.dbf

/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf

/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf

/u01/app/oracle/oradata/ORA11GR2/users01.dbf

/u01/app/oracle/oradata/ORA11GR2/example01.dbf

/u01/app/oracle/oradata/ORA11GR2/ts_ora11gr2_01.dbf

/u01/app/oracle/oradata/ORA11GR2/undotbs2_01.dbf

 

7 rows selected.

 

SYS@ORA11GR2>selectname fromv$controlfile;

 

NAME

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

/u01/app/oracle/oradata/ORA11GR2/control01.ctl

/u01/app/oracle/oradata/ORA11GR2/control02.ctl

/u01/app/FRA/control03.ctl

 

SYS@ORA11GR2>

 

SYS@ORA11GR2>selectmember fromv$logfile;

 

MEMBER

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

/u01/app/oracle/oradata/ORA11GR2/redo03.log

/u01/app/oracle/oradata/ORA11GR2/redo02.log

/u01/app/oracle/oradata/ORA11GR2/redo01.log

/u01/app/oracle/oradata/ORA11GR2/redo01_a.log

/u01/app/oracle/oradata/ORA11GR2/redo02_a.log

/u01/app/oracle/oradata/ORA11GR2/redo03_a.log

/u01/app/FRA/redo01_b.log

/u01/app/FRA/redo02_b.log

/u01/app/FRA/redo03_b.log

 

9 rows selected.

 

SYS@ORA11GR2>

 

2.一致性关闭数据库:(触发CKPT,然后实施备份)

SYS@ORA11GR2>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@ORA11GR2>

 

3.回到操作系统层复制镜像(所有数据库文件)

——创建备份目录:

[oracle@wang ~]$ mkdir cold

[oracle@wang ~]$ ls

cold

[oracle@wang ~]$ cd cold/

[oracle@wang cold]$ ls

[oracle@wang cold]$

[oracle@wang cold]$ pwd

/home/oracle/cold

 

——备份控制文件、数据文件、redo日志到备份目录:

[oracle@wang ~]$ cd /u01/app/oracle/oradata/

ORA11GR2/ PROD/    

[oracle@wang ~]$ cd /u01/app/oracle/oradata/

[oracle@wang oradata]$

[oracle@wang oradata]$ cd ORA11GR2

[oracle@wang ORA11GR2]$ ls

control01.ctl redo02.log   ts_ora11gr2_01.dbf

control02.ctl redo03_a.log undotbs01.dbf

example01.dbf redo03.log   undotbs2_01.dbf

redo01_a.log  sysaux01.dbf users01.dbf

redo01.log    system01.dbf

redo02_a.log  temp01.dbf

[oracle@wang ORA11GR2]$ pwd

/u01/app/oracle/oradata/ORA11GR2

[oracle@wang ORA11GR2]$ cp * /home/oracle/cold/

[oracle@wang ORA11GR2]$

成功,验证:

[oracle@wang cold]$ du -sh

2.3G   .

[oracle@wang cold]$ ll

total 2383092

-rw-r----- 1 oracle oinstall  9748480 Sep 27 15:12control01.ctl

-rw-r----- 1 oracle oinstall  9748480 Sep 27 15:12control02.ctl

-rw-r----- 1 oracle oinstall 363077632 Sep 27 15:12 example01.dbf

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12redo01_a.log

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12redo01.log

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12 redo02_a.log

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12 redo02.log

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12 redo03_a.log

-rw-r----- 1 oracle oinstall 52429312 Sep 27 15:12 redo03.log

-rw-r----- 1 oracle oinstall 660611072 Sep 27 15:12 sysaux01.dbf

-rw-r----- 1 oracle oinstall 849354752 Sep 27 15:12 system01.dbf

-rw-r----- 1 oracle oinstall 51388416 Sep 27 15:12 temp01.dbf

-rw-r----- 1 oracle oinstall 20979712 Sep 27 15:12 ts_ora11gr2_01.dbf

-rw-r----- 1 oracle oinstall 94380032 Sep 27 15:12 undotbs01.dbf

-rw-r----- 1 oracle oinstall 104865792 Sep 27 15:12 undotbs2_01.dbf

-rw-r----- 1 oracle oinstall  6561792 Sep 27 15:12 users01.dbf

[oracle@wang cold]$

 

——备份参数文件及口令文件:

[oracle@wang ORA11GR2]$ cd $ORACLE_HOME/dbs

[oracle@wang dbs]$ cp initORA11GR2.ora spfileORA11GR2.ora /home/oracle/cold/

[oracle@wang dbs]$

[oracle@wang dbs]$ cp orapwORA11GR2 /home/oracle/cold/

验证:

[oracle@wang cold]$ ls initORA11GR2.ora

initORA11GR2.ora      

[oracle@wang cold]$ ls spfileORA11GR2.ora

spfileORA11GR2.ora

[oracle@wang cold]$ ls orapwORA11GR2

orapwORA11GR2

 

4.模拟删除$ORACLE_HOME/dbs的参数文件及密码文件,删除$ORACLE_HOME/oradata/ORA11GR2/下的所有数据库文件

[oracle@wang dbs]$ cd /u01/app/oracle/oradata/ORA11GR2/

[oracle@wang ORA11GR2]$ ls

control01.ctl example01.dbf redo01.log   redo02.log   redo03.log   system01.dbf ts_ora11gr2_01.dbf undotbs2_01.dbf

control02.ctl redo01_a.log  redo02_a.log redo03_a.log sysaux01.dbf temp01.dbf   undotbs01.dbf      users01.dbfv

[oracle@wang ORA11GR2]$rm *

[oracle@wang ORA11GR2]$ls

[oracle@wang ORA11GR2]$

 

5.启动实例(nomount):

SYS@ORA11GR2>startup nomount;

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initORA11GR2.ora'

SYS@ORA11GR2>

显示没有找到参数文件,恢复参数文件:

[oracle@wang cold]$ cp initORA11GR2.ora spfileORA11GR2.ora /u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@wang cold]$

再次启动实例:

SYS@ORA11GR2>startup nomount;

ORACLE instance started.

 

Total System Global Area 730714112 bytes

Fixed Size                 2256832 bytes

Variable Size            457179200 bytes

Database Buffers         268435456 bytes

Redo Buffers               2842624 bytes

SYS@ORA11GR2>

 

——实例启动

6.启动到mount:

SYS@ORA11GR2>alter database mount;

alter database mount

*

ERROR at line 1:

ORA-00205: error in identifying control file, check alert log for more info

 

 

SYS@ORA11GR2>

 

恢复控制文件:

[oracle@wang cold]$ cp control01.ctl control02.ctl /u01/app/oracle/oradata/ORA11GR2/

[oracle@wang cold]$

[oracle@wang ORA11GR2]$ pwd

/u01/app/oracle/oradata/ORA11GR2

[oracle@wang ORA11GR2]$

[oracle@wang ORA11GR2]$ ls

control01.ctl control02.ctl

再次启动到mount:

SYS@ORA11GR2>alter database mount;

 

Database altered.

 

SYS@ORA11GR2>

成功!

 

7.打开数据库:

SYS@ORA11GR2>alter database open;

alter database open

*

ERROR at line 1:

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'

 

——恢复数据文件及日志文件:

[oracle@wang cold]$ cp *dbf *log /u01/app/oracle/oradata/ORA11GR2/

[oracle@wang cold]$

[oracle@wang ORA11GR2]$ ls

control01.ctl example01.dbf redo01.log   redo02.log   redo03.log   system01.dbf ts_ora11gr2_01.dbf undotbs2_01.dbf

control02.ctl redo01_a.log  redo02_a.log redo03_a.log sysaux01.dbf temp01.dbf   undotbs01.dbf      users01.dbf

 

——再次打开数据库:

SYS@ORA11GR2>alter database open;

 

Database altered.

 

SYS@ORA11GR2>select status from v$instance;

 

STATUS

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

OPEN

 

SYS@ORA11GR2>

数据库已打开,恢复成功!!!!!!!!!

(数据库已从冷备恢复回来,不需要recovery,因为冷备是在一致性关闭数据库的基础上实施的,数据库已处于一致状态)

 

 


分享标题:【备份恢复】物理冷备份及恢复
文章出自:http://kswsj.cn/article/jiiiej.html

其他资讯