select instance_name from v$instance;
select name from v$database;
select name from v$datafile;
查询日志模式:
archive log list;
shutdown immediate;
startup mount;
把日志改为归档模式:
alter database archivelog;
alter database open;
alter system archive log current;
select name from v$archived_log;
打开控制文件跟踪:
alter database backup controlfile to trace;
查看跟踪文件位置:
show parameter user_dump_dest
cmd:
set oracle_sid=orcl
rman target sys/abc
host "md c:back";
run
{
backup database;
format 'c:back%d_%s_%T_full.bak';
}
select file#,name from v$datafile;
传送以下文件到机器B:
c:back
d:oracleproduct10.2.0adminorcl
CREATE CONTROLFILE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:ORACLEPRODUCT10.2.0ORADATAORCLREDO01.LOG' SIZE 50M,
GROUP 2 'E:ORACLEPRODUCT10.2.0ORADATAORCLREDO02.LOG' SIZE 50M,
GROUP 3 'E:ORACLEPRODUCT10.2.0ORADATAORCLREDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'E:ORACLEPRODUCT10.2.0ORADATAORCLSYSTEM01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATAORCLUNDOTBS01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATAORCLSYSAUX01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATAORCLUSERS01.DBF',
'E:ORACLEPRODUCT10.2.0ORADATAORCLXM'
CHARACTER SET ZHS16GBK
机器B:
创建要恢复oracle的目录
e:oracleproduct10.2.0oradataorcl
e:oracleproduct10.2.0admin
e:oracleproduct10.2.0falsh_recovery_area
把收到的文件夹orcl放到e:oracleproduct10.2.0admin
拷贝
e:oracleproduct10.2.0adminorclpfile中的参数文件到自己真实数据库db_1database文件夹中,并改名为initorcl.ora
打开initorcl.ora
把里面的路径改为真实oracle数据库的位置
d:替换为e:
cmd1:
set oracle_sid=orcl
oracle orcl
等到提示ctrl+c
cmd2:
set oracle_sid=orcl
sqlplus / as sysdba
startup nomount;
cmd3:
set oracle_sid=orcl
rman target sys/abc
restore controlfile from 'C:backORCL_2_20090414_FULL.BAK';
cmd2:
alter database mount;
cmd3:
run{
set newname for datafile 1 to 'E:oracleproduct10.2.0oradataorclSYSTEM01.DBF';
set newname for datafile 2 to 'E:oracleproduct10.2.0oradataorclUNDOTBS01.DBF';
set newname for datafile 3 to 'E:oracleproduct10.2.0oradataorclSYSAUX01.DBF';
set newname for datafile 4 to 'E:oracleproduct10.2.0oradataorclUSERS01.DBF';
set newname for datafile 5 to 'E:oracleproduct10.2.0oradataorclXM';
restore database;
switch datafile all;
}
cmd2:
select name from v$database;
shutdown immediate;
startup mount;
alter database backup controlfile to trace;
找到跟踪文件:
重做控制文件:把里面的路径改为正确路径:
d:改为 e:
shutdown immediate;
startup nomount;
执行生成控制文件的语句;执行钱必须先删除.ctl的文件
alter database open resetlogs;
select name from v$database;
select member from v$logfile; 猜你喜欢