Recover database files to be prepared: Rman full backup (including data files, log files, control files, parameter files), record source database dbid
First, install the database Oracle database software and create the same data file directory, log file directory, and control file directory as the source database server by creating the same name as the source database and database SID and modifying the database dbid with the source database dbid.
Ii. Modification of dbid:
Sql>conn/as SYSDBA;
Sql> select dbid from V$database;
DBID
----------
1465764760
Sql> Show Parameter Db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Db_name string Eygle
sql> exec dbms_backup_restore.nidbegin (' Eygle ', ' eygle ', ' 3935589514 ', ' 1465764760 ', 0,0,10)
The PL/SQL process has completed successfully.
Sql> select dbid from V$database;
DBID
----------
1465764760
Sql> variable a number;
Sql> variable B
Sql> variable c number;
sql> exec dbms_backup_restore.nidprocessdf (0,0,:A,:B,:C);
The PL/SQL process has completed successfully.
Sql> print:a
A
----------
0
Sql> print:b
B
----------
1
Sql> Print:c
C
----------
1
Sql> exec DBMS_BACKUP_RESTORE.NIDPROCESSCF (: a,:b);
The PL/SQL process has completed successfully.
Sql> print:a
A
----------
1
Sql> print:b
B
----------
1
sql> exec dbms_backup_restore.nidend;
The PL/SQL process has completed successfully.
Sql> select dbid from V$database;
DBID
----------
3935589514
After the successful modification of dbid, the parameter files, control files, data files and log files are recovered in sequence:
Sql>startup Nomount Force
sql>host;
C:\Documents and Settings\administrator>rman Target/recovery Manager : Release 10.2.0.1.0-production on Wednesday September 1 23:1 9:41 Copyright (c) 1982, Oracle. All rights reserved. Connect to target database: study (not loaded)
----Recovery parameter file
rman> restore SPFile to Pfile ' D:\ORACLE\DATABASE\INITSTORDA. ORA ' from ' D:\ORACLE\backup\C-3350757905-20090826-03 ';
--Recovery control file rman> restore Controlfile from ' F:\FULL-x\CONTROL7286087020. CTL '; Start Restore in January-September-10
Replacing the recovery directory with the target database control file
Allocated channel: Ora_disk_1
Channel ora_disk_1:sid=156 devtype=disk Channel ora_disk_1: Restoring Control files
Channel Ora_disk_1: Restore Complete, spents: 00:00:06
Output filename =d:\oracle\product\10.2.0\oradata\study\control01. Ctl
Output filename =d:\oracle\product\10.2.0\oradata\study\control02. Ctl
Output filename =d:\oracle\product\10.2.0\oradata\study\control03. Ctl
Completed restore in January-September -10 rman> ALTER DATABASE mount; The database is loaded
Freed Channel: ora_disk_1 rman>----Recover all available data files sql> select File#,name from V$datafile; file# NAME
---------- ------------------------------------------------------------
1 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\SYSTEM01. Dbf
2 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\UNDOTBS01. Dbf
3 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\SYSAUX01. Dbf
4 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\USERS01. Dbf
5 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\STREAMS_TBS01. Dbf
6 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\PHONE01. Dbf
7 D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\PHONE02. DBF has selected 7 rows.
rman> restore DataFile 1,2,3,4,5,6; Start Restore in January-September-10
Using Channel Ora_disk_1 Channel Ora_disk_1: Starting to recover data file backup sets
Channel Ora_disk_1: Specifying a data file to recover from a backup set
Restoring data file 00001 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\SYSTEM01. Dbf
Restoring data file 00002 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\UNDOTBS01. Dbf
Restoring data file 00003 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\SYSAUX01. Dbf
Restoring data file 00004 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\USERS01. Dbf
Restoring data file 00005 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\STREAMS_TBS01. Dbf
Restoring data file 00006 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\STUDY\PHONE01. Dbf
Channel Ora_disk_1: Reading backup segment F:\FULL-X\0CLMRBQU_1_1
Channel Ora_disk_1: restored backup Segment 1
Segment handle = F:\FULL-X\0CLMRBQU_1_1 Mark = tag20100901t231645
Channel Ora_disk_1: Restore Complete, spents: 00:01:15
Complete restore in January-September -10----Restore Archive log file rman> run{
2> set Archivelog destination to '/racbackup ';
3> restore Archivelog all;
4>}----Restore Database sql> conn/as sysdba sql> recover database using Backup controlfile until cancel; ----Specify resetlogs keyword, start database to open state
sql> ALTER DATABASE open resetlogs; The database is now back to normal
Sql>conn/as SYSDBA; ----Modify the user password Sql>alter users sys identified by SYS; ----Modify the password file method C:\Documents and Settings\administrator>orapwd file=c:\oracle\product\11.2.0\dbhome_1\database\ Pwddmsasc.ora Password=sys Force=y