Restore an Oracle cold backup to another DB instance

Source: Internet
Author: User
Tags sqlplus

The replacement of the server requires the transfer of the Oracle database to another Oracle.
Description
1, the test environment is: Windows Server2003 and Oracle 10g.
2, 2 server installed program directory, the data directory is not the same.
Specially borrowed the Afshen brothers. Practice to restore an Oracle cold backup to another database instance operation article. But for beginners there is no detail, and my operation is a little bit different. In addition, I am a novice, only know that the work is done, but do not know whether this operation for database use has any impact, but also need late development use in know, hope to provide you with comparison as a reference in the operation. (due to the haste of the picture)

1) on the A database server operation:
will need to transfer the database a cold backup, cold backup, I am very simple.
Start-to-run: sqlplus
Sqlplus>conn Sourdb Sys as SYSDBA
Sqlplus>shutdown immediate \ \ Close the DB instance
After the prompt Oracle routine has been closed, copy the E:\Oracle\oradata\SourDB database directory in the corresponding a database.
My database directory contains REDO01.LOG, REDO02. LOG, REDO03. log,sysaux01. Dbf,system01. Dbf,temp01. Dbf,undotbs01. Dbf,users01. Dbf,zjtest. Dbf
CONTROL01. Ctl,control02. Ctl,control03. Ctl
Doubt: After the 3 control files found useless on the new database to regenerate control files on the line. Because of new contacts do not know, which students know, troubleshoot under.

2) in the B database (instance destdb)
My program is installed in x:\oracle\product\10.1.0\db_1\
Data Catalog in X:\oracle\database\DestDB (no subdirectories)
A, back up the control file of database B
Start-to-run: sqlplus
Sqlplus>conn DETDB Sys as SYSDBA
Sqlplus>alter database backup Controlfile to trace
Sqlplus>show parameter SPFile; Show SPFile Path
Sqlplus>create pfile from SPFile; Back up the control file for database B, generate the file under X:\oracle\product\10.1.0\db_1\database\ Initdestdb.ora, and back it up.

b, sqlplus>shutdown immediate \ \ Close the DB instance

Delete the data directory in the X:\oracle\database\DestDB directory of data files, control files and log files, anyway I am the directory is deleted. The Sourdb of the database A is backed up by *.log, *. DBF copied in.

Delete the X:\oracle\product\10.1.0\db_1\database\SPFILEDestDB.ORA control file in database B

Modify the Initdestdb.ora file to delete the *.control_files corresponding string

C. Start database B to Nomount State
Start-to-run: Sqlplus/nolog
Sql>conn Destdb as Sysdba
Sql>startup Nomount
The ORACLE routine has been started.
Total System Global area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 144964076 bytes
Database buffers 25165824 bytes
Redo buffers 1048576 bytes

\ \ Use the following statement to generate a new control file for database B, which will destdb the database name of the directory.
Sql>create controlfile SET DATABASE "Destdb" Resetlogs ARCHIVELOG
Maxlogfiles 16
Maxlogmembers 3
Maxdatafiles 100
Maxinstances 8
Maxloghistory 454
LOGFILE
GROUP 1 ' x:\oracle\database\DestDB\REDO01. LOG ' SIZE 10M,
GROUP 2 ' x:\oracle\database\DestDB\REDO02. LOG ' SIZE 10M,
GROUP 3 ' x:\oracle\database\DestDB\REDO03. LOG ' SIZE 10M
DataFile
' X:\oracle\database\DestDB\SYSTEM01. DBF ',
' X:\oracle\database\DestDB\UNDOTBS01. DBF ',
' X:\oracle\database\DestDB\SYSAUX01. DBF ',
' X:\oracle\database\DestDB\USERS01. DBF ',
' X:\oracle\database\DestDB\ZJTEST. DBF '
CHARACTER SET ZHS16GBK;

Close the database
Sql>shutdown Immediate

D, add (refer to Backup Initsourdb.ora)
*.control_files= ' X:\oracle\database\DestDB\control01.ctl ', ' x:\oracle\database\DestDB\control02.ctl ', ' x:\oracle \database\destdb\control03.ctl '
New control file, generate to directory X:\oracle\database\DestDB, modify Initsourdb.ora under X:\oracle\product\10.1.0\db_1\database\, I saw 3 control files generated in my directory, so I added 3.

E, specify the Pfile parameter to start, and generate SPFile to complete the recovery work.
Sql>startup pfile= "X:\oracle\product\10.1.0\db_1\database\initsourDB.ORA";
The ORACLE routine has been started.
Total System Global area 171966464 bytes
Fixed Size 787988 bytes
Variable Size 144964076 bytes
Database buffers 25165824 bytes
Redo buffers 1048576 bytes
The database is loaded.
ORA-01589: To open a database you must use the Resetlogs or Noresetlogs option

sql> ALTER DATABASE open resetlogs;
The database has changed.

Sql> create SPFile from Pfile;
The file was created.

Sql> Select COUNT (*) from dba_users;
COUNT (*)
----------
30
Sql> Select COUNT (*) from dba_users where username= ' test ';
COUNT (*)
----------


Article Source: Flying Connaught Network (www.diybl.com): http://www.diybl.com/course/7_databases/oracle/oraclejs/20110814/558381.html

1, first install a new Oracle, including the service name, SID, the installation directory should be best consistent with the original Oracle directory.

2. Remove all datafile and logfile from the installation directory. (Files in Oradata directory)

3, copy the original data files to the Oradata directory, including system data files.

4, ALTER DATABASE backup Controlfile to trace; Back up the current database control file, control file general backup to D:\oracle\PRoduct\10.2.0\admin\bstest\udump, please note the latest one.

Delete the original control file, re-create a control file, please note that the location of the various paths are modified as follows:

CREATE controlfile SET DATABASE "TEST" Resetlogs Noarchivelog

Maxlogfiles 16

Maxlogmembers 3

Maxdatafiles 100

Maxinstances 8

Maxloghistory 292

LOGFILE

GROUP 1 ' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\REDO01. LOG ' SIZE 50M,

GROUP 2 ' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\REDO02. LOG ' SIZE 50M,

GROUP 3 ' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\REDO03. LOG ' SIZE 50M

--STANDBY LOGFILE

DataFile

' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\SYSTEM01. DBF ',

' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\UNDOTBS01. DBF ',

' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\SYSAUX01. DBF ',

' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\USERS01. DBF ',

' D:\ORACLE\PRODUCT\10.2.0\ORADATA\BSTEST\TEST. DAT '

CHARACTER SET ZHS16GBK

;

Note Modify the path of the data file, if it is the original data file, plus all of your original data file path, such as red is my original data file.


11. Restart, boot to startup mount;

Execute the Recover database;

Execute ALTER DATABASE open again; open successfully.

12, has been basically successful, but after such treatment, for the sake of safety,

It is best to export all the data first with exp before reinstalling Oracle and then re-importing it with Imp.

And when I export, I have an error: the hint temporary tablespace is empty.

With select name from V$tempfile; view, True null, then:

If temp01.dbf already exists, it is as follows:

Alter tablespace temp add tempfile ' D:\oracle\product\10.2.0\oradata\bstest\temp01.dbf '

Otherwise:

Alter tablespace temp add tempfile ' D:\oracle\product\10.2.0\oradata\bstest\temp01.dbf ' size 10M;

Then export with exp, success!


It's still not open. The following error occurred:
ALTER DATABASE open Resetlogs
*
ERROR on line 1th:
The Ora-01092:oracle routine terminates. Forcibly disconnecting the connection

10. Change the Undo log to Manual mode:

Alter system set undo_management= ' manual ' Scope=spfile;


5, startup Nomount; boot to the Nomount state, and then execute the above control file rebuild statement.

6. Execute recover database using Backup controlfile until cancel;

Enter the cancel carriage return and an error occurs.

7, ALTER DATABASE open resetlogs; The following error occurred after execution.

ORA-01194: File 1 requires more recovery to maintain consistency
ORA-01110: Data file 1: ' D:\ORACLE\ORADATA\ZQKH\SYSTEM01. DBF '

8, #系统文件出错, see "consistency" naturally think of _allow_resetlogs_corruption's implicit command
Alter system set "_allow_resetlogs_corruption" =true scope=spfile;
9, ALTER DATABASE open resetlogs;

Restore an Oracle cold backup to another DB instance

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.