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

Implementation of Oracle 10g DG data File Migration

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Background: due to insufficient space, the DG of a customer's Oracle 10g migrated some data files to other directories, but now the original directory has been successfully expanded, and the previously migrated data files need to be migrated back again.

Environment: Oracle 10.2.0.5 DG stand-alone

The first thing that comes to mind is that 10gDG is applied in mount mode, and the process of implementing this requirement can be easily simulated in the test environment:

1. Query the current DG status 2. Stop DG application 3. Back up the copy of copy to the new directory and switch to 4. Delete the previous directory and open the application

1. Query the status of current DG

Query the status of the current DG:

Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > select name, database_role, open_mode from gv$database;NAME DATABASE_ROLE OPEN_MODE- JY PHYSICAL STANDBY MOUNTEDSQL > select recovery_mode from v$archive_dest_status RECOVERY_MODE---MANAGED REAL TIME APPLYIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLE11 rows selected.SQL > select * from v$dataguard_stats NAME VALUE UNIT TIME_COMPUTED -apply finish time + 00 0000 to second 00.0 day (2) to second (1) interval 05-MAY-2018 10:04: 20apply lag + 00 00:00:12 day (2) to second (0) interval 05-MAY-2018 10:04:20estimated startup time 41 second 05-MAY-2018 10:04:20standby has been open N 05-MAY-2018 10:04:20transport lag + 00 00:00:00 day (2) to second (0) interval 05-MAY-2018 10:04:20

You can see that DG is in a normal application state.

two。 Stop the DG application

Stop the DG application:

SQL > alter database recover managed standby database cancel;Database altered.

3. Back up a copy of copy to a new directory and switch

3.1 confirm the data files that need to be migrated

Check the current data files and make sure to migrate the three files back to the original directory:

SQL > select file#, name from v$datafile FILE# NAME- 1 / oradata/jy/datafile/system.256.839673875 2 / oradata/jy/datafile/undotbs1.258.839673877 3 / oradata/jy/datafile/sysaux.257.839673877 4 / oradata / jy/datafile/users.259.839673877 5 / oradata/jy/datafile/example.267.839673961 6 / oradata/jy/datafile/undotbs2.268.839674103 7 / oradata/jy/datafile/dbs_d_school.276.840618437 8 / oradata/jy/datafile/dbs_cssf_gt.289.848228741 9 / datafile/dbs_data9.dbf 10 / datafile/dbs_data10.dbf 11 / datafile/dbs_data11.dbf11 rows selected.

3.2 back up copies of related data files:

Write a script:

Vi copy_datafile.sh echo "= Begin at: `date` =" > > / tmp/copy_datafile_ `date +% Y% m% d`.logrman target / / tmp/copy_datafile_ `date +% Y% m% d`.logrun {allocate channel C1 device type disk;allocate channel c2 device type disk;allocate channel c3 device type disk;backup as copy datafile 9 format'/ oradata/jy/datafile/dbs_data9.dbf';backup as copy datafile 10 format'/ oradata/jy/datafile/dbs_data10.dbf' Backup as copy datafile 11 format'/ oradata/jy/datafile/dbs_data11.dbf';release channel C1 politics release channel c2bot release channel c3;} EOFecho "= End at: `date` =" > > / tmp/copy_datafile_ `date +% Y% m% d`.log

Background execution script: nohup sh copy_datafile.sh &

The log is as follows:

= Begin at: Sat May 5 10:51:24 CST 2018=Recovery Manager: Release 10.2.0.5.0-Production on Sat May 5 10:51:24 2018Copyright (c) 1982, 2007, Oracle. All rights reserved.connected to target database: JY (DBID=857123342, not open) RMAN > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > 10 > 11 > 12 > 13 > using target database control file instead of recovery catalogallocated channel: c1channel C1: sid=152 devtype=DISKallocated channel: c2channel c2: sid=159 devtype=DISKallocated channel: c3channel c3: sid=144 devtype=DISKStarting backup at 05-MAY-18channel C1: starting datafile copyinput datafile fno=00009 name=/datafile/dbs_data9.dbfoutput filename=/oradata/jy/datafile/dbs_data9.dbf tag=TAG20180505T105125 recid=22 stamp=975322288channel C1: datafile copy complete Elapsed time: 00:00:03Finished backup at 05-MAY-18Starting backup at 05-MAY-18channel c1: starting datafile copyinput datafile fno=00010 name=/datafile/dbs_data10.dbfoutput filename=/oradata/jy/datafile/dbs_data10.dbf tag=TAG20180505T105129 recid=23 stamp=975322292channel c1: datafile copy complete, elapsed time: 00:00:07Finished backup at 05-MAY-18Starting backup at 05-MAY-18channel c1: starting datafile copyinput datafile fno=00011 name=/datafile/dbs_data11.dbfoutput filename=/oradata/jy/datafile/dbs_data11.dbf tag=TAG20180505T105136 recid=24 stamp=975322315channel c1: datafile copy complete Elapsed time: 00:00:25Finished backup at 05-MAY-18released channel: c1released channel: c2released channel: c3RMAN > Recovery Manager complete.=End at: Sat May 5 10:52:02 CST 2018 =

3.3Toggle data file to copy copy:

RMAN > list copy of database Using target database control file instead of recovery catalogList of Datafile CopiesKey File S Completion Time Ckp SCN Ckp Time Name--10 9 A 05-MAY-18 35303533 05-MAY-18 / oradata/jy/datafile/dbs_data9.dbf11 10 A 05- MAY-18 35303533 05-MAY-18 / oradata/jy/datafile/dbs_data10.dbf12 11 A 05-MAY-18 35303533 05-MAY-18 / oradata/jy/datafile/dbs_data11.dbfRMAN > switch datafile 9 10 11 to copy Datafile 9 switched to datafile copy "/ oradata/jy/datafile/dbs_data9.dbf" datafile 10 switched to datafile copy "/ oradata/jy/datafile/dbs_data10.dbf" datafile 11 switched to datafile copy "/ oradata/jy/datafile/dbs_data11.dbf"

4. Delete the previous directory and open the application

4.1 Delete previous files:

RMAN > list copy of database List of Datafile CopiesKey File S Completion Time Ckp SCN Ckp Time Name--13 9 A 05-MAY-18 35309314 05-MAY-18 / datafile/data9.dbf14 10 A 05-MAY-18 35309314 05-MAY-18 / datafile / data10.dbf15 11 A 05-MAY-18 35309314 05-MAY-18 / datafile/datafile11.dbfRMAN > delete copy of datafile 9, 10, 10, 11 Allocated channel: ORA_DISK_1channel ORA_DISK_1: sid=146 devtype=DISKList of Datafile CopiesKey File S Completion Time Ckp SCN Ckp Time Name--13 9 A 05-MAY-18 35309314 05-MAY-18 / datafile/data9.dbf14 10 A 05 -MAY-18 35309314 05-MAY-18 / datafile/data10.dbf15 11 A 05-MAY-18 35309314 05-MAY-18 / datafile/datafile11.dbfDo you really want to delete the above objects (enter YES or NO)? Yesdeleted datafile copydatafile copy filename=/datafile/data9.dbf recid=13 stamp=975320371deleted datafile copydatafile copy filename=/datafile/data10.dbf recid=14 stamp=975320371deleted datafile copydatafile copy filename=/datafile/datafile11.dbf recid=15 stamp=975320371Deleted 3 objects

4.2 Open the log application:

SQL >-- recover_std_realSQL > alter database recover managed standby database using current logfile disconnect from session;Database altered.SQL > set lines 1000SQL > select * from v$dataguard_stats NAME VALUE UNIT TIME_COMPUTED -apply finish time + 00 0000 to second 00.0 day (2) interval 05-MAY-2018 10:20:56apply lag (1) + 00 00:02:00 day (2) to second (0) interval 05-MAY-2018 10:20:56estimated startup time 41 second 05-MAY-2018 10:20:56standby has been open N 05-MAY-2018 10:20:56transport lag + 00 00:00:00 day (2) to second (0) interval 05-MAY-2018 10:20:56SQL > select recovery_mode from v$archive_dest_status RECOVERY_MODE---MANAGED REAL TIME APPLYIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLEIDLE11 rows selected.

At this point, we have completed the customer's needs, we can think more about, what if the customer environment is 11g ADG environment? What will be the difference?

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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