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

[kingsql sharing] implementation of XTTS_V4 version of Oracle cross-version migration

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article describes the steps required to use v4 cross-platform transferable tablespaces (xtts) with rman incremental backups

Migrate data with minimal application downtime.

# # #

I hope this article can be helpful to you, if you need a script, please leave a message, thank you for your closure and support

# # #

The first is to copy the full backup from the source to the destination.

Then, by using a series of incremental backups (each less than the last backup)

Before any downtime is required, the data in the target system can be almost synchronized with the source system.

This process requires downtime only during the final incremental backup and metadata export / import.

This document describes the cross-platform incremental backup v4 process that can be used with 11.2.0.4 and later.

This new process is a simplified version of the previous version of XTTS.

There are the following differences in this version:

i. This procedure uses simplified commands. One command (--backup) is for the source and one command (--restore) is for the destination.

/ / it used to be a series of gorgeous operations, such as pforce talk, c talk, I talk, r ray talk, etc. Now only 2 parameters are needed.

ii. This process only requires copying a file between the $tmpdir (res.txt) of the source and destination.

iii. This process automatically parses the added data files without additional intervention.

iv. This procedure allows multiple incremental backups to be taken from the source without running the restore. "after that, all incremental backups in the target are immediately restored."

1-initial setup

Perform the following steps to configure the environment to use cross-platform incremental backups:

1.1-install the target database software and create the target database

Install the required Oracle database software on the target system on which the target database will run.

Identify (or create) a database on the target system to transfer tablespaces to it

And create the schema users required for the tablespace transfer. That is, the user who owns the object in the transferred tablespace.

1.2-identifies the tablespace to be transferred

Identifies the tablespace in the source database to be transferred.

The tablespaces ts1 and ts2 will be used in the examples in this document.

As mentioned above, the limitations and considerations of transportable tablespaces must be followed.

1.3-install the XttConvert script on the source system

On the source system, as the owner of the Oracle software

Download and extract the support scripts attached to this document as rman-xttconvert-ver4.zip.

[oracle@kingsql] $pwd

/ home/oracle/xttv4

[oracle@kingsql] $unzip rman_xttconvert_VER4.zip

Inflating: xtt.properties

Inflating: xttcnvrtbkupdest.sql

Inflating: xttdbopen.sql

Inflating: xttdriver.pl

Inflating: xttprep.tmpl

Extracting: xttstartupnomount.sql

1.4-create the necessary directories

Source side:

The backup location defined by the src_scratch_location parameter in the xtt.properties file.

Destination side:

The backup location defined by the dest_scratch_location parameter in the xtt.properties file.

The location of the data file on the target, defined by the dest_datafile_location parameter in the xtt.properties file.

1.5-configure xtt.properties on the source system

Edit the xtt.properties file on the source system with a site-specific configuration.

More information about parameters in the xtt.properties file

See the parameter description in the configuration file xtt.properties section in the appendix below.

Only the following parameters are required for this procedure. Others are available for selection and / or use.

Tablespaces

Platformid

Src_scratch_location

Dest_scratch_location

Dest_datafile_location

(12c special addition)-- usermantransport=1

1.6-copy xttconvert scripts and xtt.properties to the target system

[oracle@kingsql] $scp-r / home/oracle/xttv4 oracle@destsql:/home/oracle/xttv4

1.7-set the TMPDIR environment variable

[oracle@kingsql] $export TMPDIR=/home/oracle/xttv4

[oracle@destsql] $export TMPDIR=/home/oracle/xttv4

2.-preparation phase

In the preparation phase, the data files in the table space to be transferred are backed up to the source

The backup is transferred to the target system and restored by the xttdriver.pl script.

2.1-run a backup on the source system

On the source system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the source database

Run the backup as follows:

[oracle@kingsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- backup

2.2-transfer the following files to the target system:

Backups created from source "src-scratch-location" to destination "scratch-location"

Res.txt file from source $tmpdir to destination $tmpdir:

[oracle@kingsql] $scp / src_scratch/* oracle@destsql:/dest_scratch

[oracle@kingsql] $scp res.txt oracle@destsql:/home/oracle/xttv4

2.3-restore data files on the target system

On the target system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the target database

Run the restore as follows:

[oracle@destsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- restore

3-roll forward phase

At this stage, an incremental backup is created from the source database, transferred to the target system, and converted to the target system endian format

It is then applied to the converted copy of the target data file to roll forward. This phase can be run multiple times.

The time required for each continuous incremental backup should be less than that required for the previous incremental backup

And will update the copy of the target data file in the source database.

At this stage, the data (source) being transferred is fully accessible.

3.1-create an incremental backup of the tablespace being transferred on the source system

On the source system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the source database

Run the following incremental steps to create:

[oracle@kingsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- backup

This step creates an incremental backup of all tablespaces listed in xtt.properties.

3.2-transfer incremental backups and res.txt to the target system

Incremental backup (between src-scratch-location and dest-scratch-location) and res.txt (between $tmpdirs)

Transfer from source to destination. The list of incremental backup files for the current backup can be found in the incrbacks.txt file of the source system.

[oracle@kingsql] $scp `cat incrbackups.txt` oracle@destsql:/dest_scratch_location

[oracle@kingsql] $scp res.txt oracle@destsql:/home/oracle/xttv4

3.3-apply incremental backups to data file copies on the target system

On the target system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the target database

Run the roll forward data file steps as follows:

[oracle@destsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- restore

The roll forward step connects to the target database and applies an incremental backup to the data file in the table space for each tablespace transferred.

Although multiple backups can be performed on the source without applying on the destination, the res.txt must be replicated after the last backup and before performing a "--restore" on the destination.

3.4-repeat roll forward phase 3 (3.1-3.3) or continue phase 4, resulting in incremental backup

There are two options at this time:

If you need to synchronize the files in the target database closer to the production system, repeat the roll forward phase, starting with step 3.1.

If the files in the target database are as close as possible to the source database, continue to the transfer phase.

4-final incremental backup

At this stage, the source data is made read-only and the destination data file is consistent with the source database by creating and applying a final incremental backup.

After the target data file is consistent, the regular transferable tablespace steps are performed

Export object metadata from the source database and import it into the target database.

Until the end of this phase, the data being transferred can only be accessed in read-only mode.

4.1-change the source tablespace in the source database to read-only

On the source system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the source database

Change the tablespace to be transferred to read-only.

SQL > alter tablespace TS1 read only

SQL > alter tablespace TS2 read only

4.2-create a final incremental backup of the tablespace being transferred on the source system:

On the source system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the source database

Run the backup as follows:

[oracle@kingsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- backup

Note: because the tablespace is in read-only mode, you can ignore the following warnings received:

#

Warning:

-

Warnings found in executing / home/oracle/radranly/convert_source/backup_Nov9_Fri_09_08_26_213//xttpreparenextiter.sql

#

Prepare newscn for Tablespaces:'T1'

DECLARE*

ERROR at line 1:

ORA-20001: TABLESPACE (S) IS READONLY OR

OFFLINE JUST CONVERT, COPY

ORA-06512: at line 284

4.3-transfer incremental backups and res.txt to the target system

[oracle@kingsql] $scp 'cat incrbackups.txt' oracle@destsql:/dest_scratch_location

[oracle@kingsql] $scp res.txt oracle@destsql:/home/oracle/xttv4

4.4-apply the last incremental backup to the destination data file

The final incremental backup must be applied to the target data file, and this step applies the last incremental backup to the data file on the destination.

[oracle@destsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-- restore

5-transfer phase: import object metadata into the target database

At this stage, you need to export the metadata for the tablespace from the source and insert the tablespace into the target.

5.1-the target library creates directory objects

SQL > create directory hzh as'/ home/oracle/destination/convert'

SQL > GRANT READ, WRITE ON DIRECTORY hzh TO system

5.2-Import to generate a new xttplugin.txt

On the target system, log in as Oracle, and the environment (ORACLE_HOME and ORACLE_SID environment variables) points to the target database

Run the generate data pump tts command steps as follows:

[oracle@destsql] $$ORACLE_HOME/perl/bin/perl xttdriver.pl-e

This will generate a sample command in the xttplugin.txt file

And set the transportable tablespaces parameters "transport_tablespaces" and "transport_datafiles" correctly.

In addition, a data pump export file is created.

5.3-create a database link on the target database

Connect to the target database and create a database link to the source database

SQL > create public database link ttslink connect to system identified by hongzhuohui using 'kingsql'

Verify that the database link can access the source system correctly

SQL > select name from v$database@ttslink

5.4-modify and execute the IMPDP command:

[oracle@dest] $impdp directory=hzh logfile=tts_imp.log network_link=ttslink\

Transport_full_check=no\

Transport_tablespaces=TS1,TS2\

Transport_datafiles='+DATA/prod/datafile/ts1.285.771686721',\

'+ DATA/prod/datafile/ts2.286.771686723',\

'+ DATA/prod/datafile/ts2.287.771686743'

6-validate data

6.1-check tablespace

In this step, the transferred data is read-only in the target database. Perform application-specific validation to validate the transferred data.

RMAN > validate tablespace TS1, TS2 check logical

6.2-change tablespace reads and writes in the target database

The final step is to make the target tablespace read and write in the target database.

SQL > alter tablespace TS1 read write

SQL > alter tablespace TS2 read write

7-clean up the environment

Source: src_scratch

Destination side: dest_scratch

Source side and destination side

$TMPDIR

Please indicate the source of the reprint

Hongzhuohui@qq.com

Originally, I haven't updated my blog for several years, but recently my students are writing blogs diligently, so it drives me.

-

I have found that I have written a website to copy and paste directly, and even pictures can be copied. Please add thank you O (∩ _ ∩) O to the author.

-

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