如何恢复一个只有完好数据文件的数据库?在没有控制文件备份的情况下,重新创建控制文件也是其中一个选择。
本文欲将此数据文件恢复成数据库TTI,实例名TTI
$ORACLE_HOME=d:oracleora92 |
1、创建相关目录
d:oracleoradatatti --拷贝数据文件到此目录下,如果没有redolog文件,需要手工创建
d:oracleadminttibdump d:oracleadmintticdump d:oracleadmintticreate d:oracleadminttipfile d:oracleadminttiudump |
2、创建初始化文件(本例的初始化文件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:>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.###)
tti = #title (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = MIS011)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = tti) ) ) |
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 WE8MSWIN1252 |
2)将上面这段话修改为如下:
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 WE8MSWIN1252 |
3)开始重建控制文件
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; Total System Global Area 135338868 bytes Control file created. SQL> alter database open resetlogs; Database altered. SQL> select instance_name,status from v$instance; INSTANCE_NAME STATUS SQL> select ts#,name from v$datafile; file# NAME 11 rows selected. SQL> |
至此全部结束!
(责任编辑:铭铭 mingming_ky@126.com TEL:(010)68476636)