如何从备份中恢复 Oracle 10G 数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2205495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:58:14  来源:igfitidea点击:

How to restore Oracle 10G database from backup

oracleoracle10grecovery

提问by user196614

I have an Oracle 10G database. I ran following script to take the backup of the database.

我有一个 Oracle 10G 数据库。我运行以下脚本来备份数据库。

alter tablespace EMP2010 begin backup;
host copy G:\ORACLE\PRODUCT.2.0\ORADATA\ORCL\EMP2010.DBF G:\orabackup\database\
alter tablespace EMP2010 end backup;

alter tablespace PAYROLL2010 begin backup;
host copy G:\ORACLE\PRODUCT.2.0\ORADATA\ORCL\PAYROLL2010.DBF G:\orabackup\database\
alter tablespace PAYROLL2010 end backup;

host copy G:\ORACLE\PRODUCT.2.0\ORADATA\ORCL\REDO2010_1.LOG G:\orabackup\database\
host copy G:\ORACLE\PRODUCT.2.0\ORADATA\ORCL\REDO2010_2.LOG G:\orabackup\database\
host copy G:\ORACLE\PRODUCT.2.0\ORADATA\ORCL\REDO2010_2.LOG G:\orabackup\database\

alter system switch logfile;
host sleep 60
host copy G:/oracle/product/10.2.0/oradata/orcl/arch* G:\orabackup\database\/
alter database backup controlfile to 'G:\orabackup\database\/controlbackup.bac';

The backup generated .dbf, .log and .bac files. Now I want to restore the database from the above taken backup files. I do not want to use RMAN.

备份生成了 .dbf、.log 和 .bac 文件。现在我想从上面的备份文件中恢复数据库。我不想使用 RMAN。

I have come to know that using following command I can restore the .dbf files into tablespace:

我已经知道使用以下命令可以将 .dbf 文件恢复到表空间中:

imp transport_tablespace=Y tablespace=(Ts Name) 
    file='location of dump file C:\user.dmp'
    datafiles=('location of dbf file')

In above imp command, I do not understand which file to supply against "location of .dmp file" as my backup has not generated any .dmp file.

在上面的 imp 命令中,我不知道要针对“.dmp 文件的位置”提供哪个文件,因为我的备份没有生成任何 .dmp 文件。

Can anyone please help?

有人可以帮忙吗?

回答by APC

IMP is the mechanism for importing database objects previously exported using EXP. This does not apply in your case.

IMP 是导入以前使用 EXP 导出的数据库对象的机制。这不适用于您的情况。

What you need to do is manually restore the database. To do this use RECOVER DATABASE. There is lots of things relating to this topic, far more than can be covered here, so the best thing for you to do is read the online documentation.

您需要做的是手动恢复数据库。要做到这一点,请使用RECOVER DATABASE. 有很多与此主题相关的内容,远远超出此处涵盖的范围,因此您最好阅读在线文档

回答by Gary Myers

You can use IMP with transportable tablespaces to move datafiles but you need an EXP as well.

您可以使用带有可传输表空间的 IMP 来移动数据文件,但您也需要一个 EXP。

Your EMP2010.DBF contains a bunch of data for the contents of tables/indexes. However your SYSTEM.DBF contains the metadata (eg what columns are in the table, which tables are in which tablespace). Without the metadata, the contents of EMP2010.DBF are unintelligible.

您的 EMP2010.DBF 包含一组表/索引内容的数据。但是,您的 SYSTEM.DBF 包含元数据(例如,表中有哪些列,哪些表在哪个表空间中)。如果没有元数据,EMP2010.DBF 的内容是无法理解的。

An EXP can export the metadata (with ROWS=N) into a DMP file.

EXP 可以将元数据(ROWS=N)导出到 DMP 文件中。

You don't need to worry about moving redo logs, archived redo logs or control files for a transportable tablespaces copy.

您无需担心移动重做日志、归档重做日志或可传输表空间副本的控制文件。