热搜
您的位置:首页 >> 健康

如何恢复只有完好数据文件的数据库

2019年12月04日 栏目:健康

如何恢复一个只有完好数据文件的数据库?在没有控制文件备份的情况下,重新创建控制文件也是其中一个选择。 本文欲将此数据文件恢复成数据库TTI,

如何恢复一个只有完好数据文件的数据库?在没有控制文件备份的情况下,重新创建控制文件也是其中一个选择。 本文欲将此数据文件恢复成数据库TTI,实例名TTI

$ORACLE_HOME=d:oracleora921、创建相关目录

d:oracleoradatatti --拷贝数据文件到此目录下,如果没有redolog文件,需要手工创建

d:oracleadminttibdump

d:oracleadmintticdump

d:oracleadmintticreate

d:oracleadminttipfile

d:oracleadminttiudump2、创建初始化文件(本例的初始化文件D:oracleadminttipfileinit.ora)

可拷贝现有数据库的初始化文件进行修改,主要修改内容如下:

db_name=tti

background_dump_dest=D:oracleadminttibdump

core_dump_dest=D:oracleadmintticdump

timed_statistics=TRUE

user_dump_dest=D:oracleadminttiudump

control_files=("D:oracleoradatattiCONTROL01.CTL", "D:oracleoradatattiCONTROL02.CTL", "D:oracleoradatattiCONTROL03.CTL")

instance_name=tti

dispatchers="(PROTOCOL=TCP) (SERVICE=ttiXDB)"3、创建实例及密码文件

开始-〉执行-〉cmd

D:>oradim.exe -new -sid tti -startmode m

D:>orapwd.exe file=d:oracleora92databasePWDtti.ora password=zlw001

4、添加监听和连接

1)在d:oracleora92networkadminlistener.ora中的SID_LIST_LISTENER下面添加如下内容:

(SID_DESC =

(GLOBAL_DBNAME = tti)

(ORACLE_HOME = D:oracleora92)

(SID_NAME = tti)

)2)在d:oracleora92networkadmintnsnames.ora中添加如下内容:

(这里注意:如果你的d:oracleora92networkadminsqlnet.ora中的参数

NAMES.DEFAULT_DOMAIN = ###,则你的tnsnames.ora中下面的title那里也要改为tti.###)

498)this.style.width=498;" align=top>tti = #title

498)this.style.width=498;" align=top>(DESCRIPTION =

498)this.style.width=498;" align=top>(ADDRESS_LIST =

498)this.style.width=498;" align=top>(ADDRESS = (PROTOCOL = TCP)(HOST = MIS011)(PORT = 1521))

498)this.style.width=498;" align=top>)

498)this.style.width=498;" align=top>(CONNECT_DATA =

498)this.style.width=498;" align=top>(SERVER = DEDICATED)

498)this.style.width=498;" align=top>(SERVICE_NAME = tti)

498)this.style.width=498;" align=top>)

498)this.style.width=498;" align=top>)5、开始重建控制文件 1)在类似的数据库(比如数据库名称"rman")上执行:

alter database backup controlfile to trace;然后在D:oracleadminrmanudump下找到最新的trace文件,以文本方式打开,找到类似下面的一段话:

STARTUP NOMOUNT

CREATE CONTROLFILE REUSE DATABASE "rman" NORESETLOGS ARCHIVELOG

-- SET STANDBY TO MAXIMIZE PERFORMANCE

MAXLOGFILES 50

MAXLOGMEMBERS 5

MAXDATAFILES 100

MAXINSTANCES 1

MAXLOGHISTORY 226

LOGFILE

GROUP 1 'D:ORACLEORADATARMANREDO01.LOG' SIZE 100M,

GROUP 2 'D:ORACLEORADATARMANREDO02.LOG' SIZE 100M,

GROUP 3 'D:ORACLEORADATARMANREDO03.LOG' SIZE 100M

-- STANDBY LOGFILE

DATAFILE

'D:ORACLEORADATARMANSYSTEM01.DBF',

'D:ORACLEORADATARMANUNDOTBS01.DBF',

'D:ORACLEORADATARMANCWMLITE01.DBF',

'D:ORACLEORADATARMANDRSYS01.DBF',

'D:ORACLEORADATARMANEXAMPLE01.DBF',

'D:ORACLEORADATARMANINDX01.DBF',

'D:ORACLEORADATARMANODM01.DBF',

'D:ORACLEORADATARMANTOOLS01.DBF',

'D:ORACLEORADATARMANUSERS01.DBF',

'D:ORACLEORADATARMANXDB01.DBF',

'D:ORACLEORADATARMANTEST.ORA'

CHARACTER SET WE8MSWIN12522)将上面这段话修改为如下:

STARTUP NOMOUNT

CREATE CONTROLFILE set DATABASE "tti" RESETLOGS --注意这里要"set"

-- SET STANDBY TO MAXIMIZE PERFORMANCE

MAXLOGFILES 50

MAXLOGMEMBERS 5

MAXDATAFILES 100

MAXINSTANCES 1

MAXLOGHISTORY 226

LOGFILE

GROUP 1 'D:ORACLEORADATAttiREDO01.LOG' SIZE 100M,

GROUP 2 'D:ORACLEORADATAttiREDO02.LOG' SIZE 100M,

GROUP 3 'D:ORACLEORADATAttiREDO03.LOG' SIZE 100M

-- STANDBY LOGFILE

DATAFILE

'D:ORACLEORADATAttiSYSTEM01.DBF',

'D:ORACLEORADATAttiUNDOTBS01.DBF',

'D:ORACLEORADATAttiCWMLITE01.DBF',

'D:ORACLEORADATAttiDRSYS01.DBF',

'D:ORACLEORADATAttiEXAMPLE01.DBF',

'D:ORACLEORADATAttiINDX01.DBF',

'D:ORACLEORADATAttiODM01.DBF',

'D:ORACLEORADATAttiTOOLS01.DBF',

'D:ORACLEORADATAttiUSERS01.DBF',

'D:ORACLEORADATAttiXDB01.DBF',

'D:ORACLEORADATAttiTEST.ORA'

CHARACTER SET WE8MSWIN12523)开始重建控制文件

D:>sqlplus/nolog

SQL*Plus: Release 9.2.0.1.0 - Production on Thu Nov 16 09:08:19 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> conn sys/zlw001@tti as sysdba;

Connected to an idle instance.

SQL> startup nomount pfile=d:oracleadminttipfileinit.ora;

ORACLE instance started.

Total System Global Area 135338868 bytes

Fixed Size 453492 bytes

Variable Size 109051904 bytes

Database Buffers 25165824 bytes

Redo Buffers 667648 bytes

SQL> CREATE CONTROLFILE set DATABASE "tti" RESETLOGS

2 -- SET STANDBY TO MAXIMIZE PERFORMANCE

3 MAXLOGFILES 50

4 MAXLOGMEMBERS 5

5 MAXDATAFILES 100

6 MAXINSTANCES 1

7 MAXLOGHISTORY 226

8 LOGFILE

9 GROUP 1 'D:ORACLEORADATAttiREDO01.LOG' SIZE 100M,

10 GROUP 2 'D:ORACLEORADATAttiREDO02.LOG' SIZE 100M,

11 GROUP 3 'D:ORACLEORADATAttiREDO03.LOG' SIZE 100M

12 -- STANDBY LOGFILE

13 DATAFILE

14 'D:ORACLEORADATAttiSYSTEM01.DBF',

15 'D:ORACLEORADATAttiUNDOTBS01.DBF',

16 'D:ORACLEORADATAttiCWMLITE01.DBF',

17 'D:ORACLEORADATAttiDRSYS01.DBF',

18 'D:ORACLEORADATAttiEXAMPLE01.DBF',

19 'D:ORACLEORADATAttiINDX01.DBF',

20 'D:ORACLEORADATAttiODM01.DBF',

21 'D:ORACLEORADATAttiTOOLS01.DBF',

22 'D:ORACLEORADATAttiUSERS01.DBF',

23 'D:ORACLEORADATAttiXDB01.DBF',

24 'D:ORACLEORADATAttiTEST.ORA'

25 CHARACTER SET WE8MSWIN1252;

Control file created.

SQL> alter database open resetlogs;

Database altered.

SQL> select instance_name,status from v$instance;

INSTANCE_NAME STATUS

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

tti OPEN

SQL> select ts#,name from v$datafile;

file# NAME

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

1 D:ORACLEORADATATTISYSTEM01.DBF

2 D:ORACLEORADATATTIUNDOTBS01.DBF

3 D:ORACLEORADATATTICWMLITE01.DBF

4 D:ORACLEORADATATTIDRSYS01.DBF

5 D:ORACLEORADATATTIEXAMPLE01.DBF

6 D:ORACLEORADATATTIINDX01.DBF

7 D:ORACLEORADATATTIODM01.DBF

8 D:ORACLEORADATATTITOOLS01.DBF

9 D:ORACLEORADATATTIUSERS01.DBF

10 D:ORACLEORADATATTIXDB01.DBF

11 D:ORACLEORADATATTITEST.ORA

11 rows selected.

SQL>

至此全部结束!

查看本文来源

复旦大学附属中山医院
广济医院刘艳香
雅安治疗盆腔炎费用
杭州最好的专治癫痫病医院
德阳治疗宫颈炎医院
  • 友情链接
  • 合作媒体