Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Copy the database by user-managed hot backup

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Create instance, password file, initialization parameter file, and corresponding directory of target library

> oradim-new-sid dup (required under Windows)

> orapwd file=pwddup password=xxxxxx (required under Windows)

> mkdir% ORACLE_BASE%\ admin\ dup

> mkdir% ORACLE_BASE%\ admin\ dup\ adump

> mkdir% ORACLE_BASE%\ admin\ dup\ bdump

> mkdir% ORACLE_BASE%\ admin\ dup\ cdump

> mkdir% ORACLE_BASE%\ admin\ dup\ udump

two。 Start a hot backup in the source library and copy the data files to the target library directory

GO > alter database begin backup

3. Source database stops hot backup

GO > alter database end backup

4. Archive the current log of the source database and copy it to the target library archive directory

GO > select * from v$log

GROUP# SEQUENCE# ARC STATUS

-

1 10 YES ACTIVE

2 11 NO CURRENT

3 9 YES INACTIVE

GO > alter system archive log current

5. Start the target library to the nomount state and create a control file

DUP > startup nomount

= =

CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS FORCE LOGGING ARCHIVELOG

MAXLOGFILES 16

MAXLOGMEMBERS 3

MAXDATAFILES 100

MAXINSTANCES 8

MAXLOGHISTORY 292

LOGFILE

GROUP 1'D:\ DATA\ ORACLE10GR2\ DUP\ REDO01.LOG' SIZE 50m

GROUP 2'D:\ DATA\ ORACLE10GR2\ DUP\ REDO02.LOG' SIZE 50m

GROUP 3'D:\ DATA\ ORACLE10GR2\ DUP\ REDO03.LOG' SIZE 50m

-- STANDBY LOGFILE

DATAFILE

'd:\ DATA\ ORACLE10GR2\ DUP\ SYSTEM01.DBF'

'd:\ DATA\ ORACLE10GR2\ DUP\ UNDOTBS01.DBF'

'd:\ DATA\ ORACLE10GR2\ DUP\ SYSAUX01.DBF'

'd:\ DATA\ ORACLE10GR2\ DUP\ USERS01.DBF'

CHARACTER SET AL32UTF8

= =

6. Do media recovery to the target library

DUP > recover database using backup controlfile until cancel

ORA-00279: change 2521364 generated at 09/23/2012 16:04:19 needed for thread 1

ORA-00289: suggestion: d:\ DATA\ ORACLE10GR2\ FLASH_RECOVERY_AREA\ DUP\ ARCHIVELOG\ 2012 09 / 23\ O1_MF_1_10_%U_.ARC

ORA-00280: change 2521364 for thread 1 is in sequence # 10

Specify log: {= suggested | filename | AUTO | CANCEL}

D:\ DATA\ ORACLE10GR2\ FLASH_RECOVERY_AREA\ DUP\ ARCHIVELOG\ 2012 09 / 23\ O1_MF_1_10_85XF6VRV_.ARC

...

Specify log: {= suggested | filename | AUTO | CANCEL}

D:\ DATA\ ORACLE10GR2\ FLASH_RECOVERY_AREA\ DUP\ ARCHIVELOG\ 2012 09 / 23\ O1_MF_1_11_85XF9846_.ARC

...

Specify log: {= suggested | filename | AUTO | CANCEL}

Cancel

Media recovery cancelled.

7. Open the target library in resetlogs mode

DUP > alter database open resetlogs

8. Add temporary files to the target library

DUP > alter tablespace temp add tempfile'd:\ Data\ oracle10gr2\ dup\ temp01.dbf' size 5m reuse

DUP > select file#,name from v$tempfile

FILE# NAME

1 D:\ DATA\ ORACLE10GR2\ DUP\ TEMP01.DBF

9. Modify the target library DBID

DUP > select dbid,name from v$database

DBID NAME

1002322791 DUP

DUP > shutdown immediate

DUP > startup mount

> nid target=sys/oracle

DBNEWID: Release 10.2.0.5.0-Production on Sun Sep 23 16:32:51 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to database DUP (DBID=1002322791)

Connected to server version 10.2.0

Control Files in database:

D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL01.CTL

D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL02.CTL

D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL03.CTL

Change database ID of database DUP? (y / [N]) = > y

Proceeding with operation

Changing database ID from 1002322791 to 165619252

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL01.CTL-modified

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL02.CTL-modified

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL03.CTL-modified

Datafile D:\ DATA\ ORACLE10GR2\ DUP\ SYSTEM01.DBF-dbid changed

Datafile D:\ DATA\ ORACLE10GR2\ DUP\ UNDOTBS01.DBF-dbid changed

Datafile D:\ DATA\ ORACLE10GR2\ DUP\ SYSAUX01.DBF-dbid changed

Datafile D:\ DATA\ ORACLE10GR2\ DUP\ USERS01.DBF-dbid changed

Datafile D:\ DATA\ ORACLE10GR2\ DUP\ TEMP01.DBF-dbid changed

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL01.CTL-dbid changed

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL02.CTL-dbid changed

Control File D:\ DATA\ ORACLE10GR2\ DUP\ CONTROL03.CTL-dbid changed

Instance shut down

Database ID for database DUP changed to 165619252.

All previous backups and archived redo logs for this database are unusable.

Database is not aware of previous backups and archived logs in Recovery Area.

Database has been shutdown, open database with RESETLOGS option.

Succesfully changed database ID.

DBNEWID-Completed succesfully.

DUP > startup mount

DUP > alter database open resetlogs

DUP > select dbid,name from v$database

DBID NAME

-

165619252 DUP

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report