本文主要是介绍如何恢复一个只有完好数据文件的数据库?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在没有控制文件备份的情况下,重新创建控制文件也是其中一个选择。本文旨在帮助初学者学习之用,谢谢!!如何恢复一个只有完好数据文件的数据库?
本文欲将此数据文件恢复成数据库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:>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.###)
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文件,以文本方式打开,找到类似下面的一段话:
name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-1572879403720716&dt=1173066663984&hl=zh-CN&lmt=1165263495&alternate_ad_url=http%3A%2F%2Fwww.pcdog.com%2F0000js%2Fgoogle336.htm&format=336x280_as&output=html&channel=6686853775&url=http%3A%2F%2Fwww.pcdog.com%2Fedu%2Foracle%2F2006%2F11%2Fs175094_2.html&color_bg=FFFFFF&color_text=000000&color_link=0000ff&color_url=008000&color_border=FFFFFF&ad_type=text_image&ref=http%3A%2F%2Fwww.pcdog.com%2Fedu%2Foracle%2F2006%2F11%2Fs175094.html&cc=29&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_his=1&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency">
STARTUP NOMOUNTCREATE 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
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>
至此全部结束!
这篇关于如何恢复一个只有完好数据文件的数据库?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!