打印本文 打印本文 关闭窗口 关闭窗口
用Oracle的热备份重建数据库
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2177  更新时间:2009/4/22 22:10:31  文章录入:mintao  责任编辑:mintao
<1> 创建口令文件

如果原来的数据库配置了口令文件,并且在mount数据库时报如下错误:

ORA-01990: error opening password file ''''/home/oracle/app/oracle/product/8.1.6/dbs/orapw''''

可以到/home/oracle/app/oracle/product/8.1.6/dbs/路径下,用以下命令创建口令文件:

orapwd

其用法如下:

Usage: orapwd file=<fname> password=<password> entries=<users>

       where

      file - name of password file (mand),(口令文件的命名方式为:orapwSID

      password - password for SYS and INTERNAL (mand),

      entries - maximum number of distinct DBA and OPERs (opt),

       There are no spaces around the equal-to (=) character.

例如: orapwd  file=orapwora816  password=manager

然后重新执行如下语句mount数据库:

SVRMGR>startup mount

<2> 修改数据库文件的路径

如果在上述的步骤3中修改了恢复的数据库文件的路径,可以用如下语句对数据库文件重新命名 :

              alter database rename file ''''old_file'''' to ''''new_file'''';

如把原来路径/home/oracle/app/oracle/oradata/ora816下的文件system01.dbf改到了/u21/oracle/app/oracle/oradata/ora816下:

SVRMGR>alter database rename file

    ''''/home/oracle/app/oracle/oradata/ora816/system01.dbf''''

                to  ''''/u21/oracle/app/oracle/oradata/ora816/system01.dbf'''';

按照上面的方法把所有修改路径的数据库文件重新命名。

<3> 根据控制文件和归档日志文件恢复数据库

下面开始用控制文件和归档日志文件恢复数据库:

SVRMGR>recover database using backup controlfile until cancel;

出现如下提示:

ORA-00279: change 50971 generated at 08/23/2002 09:21:27 needed for thread 1

ORA-00289: suggestion: /home/oracle/app/oracle/admin/ora8/arch/arch_1_399.arc

ORA-00280: change 50971 for thread 1 is in sequence #399

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}输入:

       auto

如果有如下提示,则表示成功。

ORA-00279: change 51007 generated at 08/23/2002 11:23:13 needed for thread 1

ORA-00289: suggestion: /home/oracle/app/oracle/admin/ora8/arch/arch_1_400.arc

ORA-00280: change 51007 for thread 1 is in sequence #400

ORA-00278: log file ''''/home/oracle/app/oracle/admin/ora8/arch/arch_1_399.arc'''' noy

Log applied.

       意外处理:如果其它提示可能是需要的日志文件不存在,检查ORA-00289中该文件是否存在。

直到出现如下提示:

ORA-00279: change 51011 generated at 08/23/2002 11:23:45 needed for thread 1

ORA-00289: suggestion: /home/oracle/app/oracle/admin/ora8/arch/arch_1_401.arc

ORA-00280: change 51011 for thread 1 is in sequence #401

ORA-00278: log file ''''/home/oracle/app/oracle/admin/ora8/arch/arch_1_400.arc'''' noy

ORA-00308: cannot open archived log ''''/home/oracle/app/oracle/admin/ora8/arch

/arch_1_401.arc''''

ORA-27037: unable to obtain file status

Intel SVR4 UNIX Error: 2: No such file or directory

Additional information: 3

<4> 重置日志

SVRMGR>

上一页  [1] [2] [3]  下一页

打印本文 打印本文 关闭窗口 关闭窗口