RMAN uses backup to transmit tablespaces

Source: Internet
Author: User

RMAN uses backup to transmit tablespaces

The method for creating a tablespace set in the Oracle Database Management Manual requires that the tablespace transmitted during the execution of tablespace transfer should be opened in read-only mode. In contrast, when RMAN uses backup to create a tablespace for transmission, it does not need to access the online data files of the tablespace to be transmitted. This eliminates the need to set the tablespace to read-only mode. The result is that the availability of the source database is improved, especially for large tablespaces, because the tablespace is still read/write during transmission and the read-only mode is dependent on the database load, it may take a long time.

Using RMAN to create a tablespace set allows you to specify a destination time point, SCN, or restore the Restore Point in the window, and the data transmission time is not the time of transport tablespace. For example, if your backup retention policy is to ensure a one-week recovery window and you want to create a tablespace for the transfer to report the contents of the database on the last day of each month, RMAN can be used to complete this task at any time in the first week of the next month.

RMAN's transport tablespace command is used to create a transfer tablespace set from the RMAN backup. Note: if you do not use RMAN to back up the database, The RMAN transport tablespace command can still be used to create a transfer tablespace set. However, for the expected scn for the tablespace set to be transmitted, there must be copies of all data files in the tablespace set to be transmitted, in addition, to run the transport tablespace command, use the RMAN catalog command to register copies of data files and archived redo logs to the RMAN archive. When RMAN records all the required backups and logs, the tablespace can be transferred.

When to use RMAN to create a transfer tablespace set
You can use the transport tablespace command of RMAN to create any tablespace that needs to be transferred, as long as you have the Database Backup required to restore the tablespace to the specified SCN.

However, it is more useful in the following two special cases:
. Use the tablespace archive to create a tablespace set for transmission. For example, some tablespaces in the database are used for quarterly reports. Use transport
The tablespace command is used to create a transfer tablespace set for these tablespaces that are stored in the tablespace archive. Then, the requested tablespace version in the archive is appended to some other databases to generate reports.

When you want to use a stream to synchronize data from the source database to the target database, you must install the stream. To use the target database to promptly update data to the specified SCN, the two databases must be synchronized.

-------------------------------------- Recommended reading --------------------------------------

RMAN: Configure an archive log deletion policy

Basic Oracle tutorial-copying a database through RMAN

Reference for RMAN backup policy formulation

RMAN backup learning notes

Oracle Database Backup encryption RMAN Encryption

-------------------------------------- Split line --------------------------------------

The following instances are required to generate a tablespace set for transmission using RMAN:
1. RMAN Client
2. The source database contains the transmitted tablespace.
3. Archive and redo log backup of the source database will be used to restore the transmitted tablespace
4. Auxiliary instance. The instance created by RMAN on the host where the source database is located is used to restore and restore the tablespace. If it is successfully restored, it will be cleared.
5. The secondary set contains the data files and other files required to execute the tablespace to be transmitted, but they are not part of the recovery set. The secondary set includes: copies of system and sysaux tablespaces, undo tablespaces, and data files with undo segments or rollback segments in the source database. The auxiliary instance also has other related files, such as control files, parameter files, and online redo log files, but these are part of the auxiliary set.
6. auxiliary directory. When the transport tablespace command of RMAN is executed, the directory on the disk is used to store the auxiliary set files, such as parameter files, data Files (except data files for the tablespace), control files, and online redo log files of auxiliary instances. If the tablespace is successfully transferred, these files will be deleted.
Note: Setting the secondary directory is optional. However, if the secondary directory is not set, you must ensure that all the secondary instance files, including all data files, are, the auxiliary instance parameters are used to specify the storage directory for online redo log files. Oracle recommends that you use the auxiliary directory to simplify the transport tablespace command.
7. The tablespace Directory, which stores copies of data files and the disk directory of the output files after the tablespace transfer command is completed.
8. The transfer set contains the Data file of the transmitted tablespace and the export dump file used for the additional table space in the target database (usually Data Pump export ).
9. Sample import script (generated by RMAN) and Data Pump exported log files used in the target database's additional table space.

RMAN uses backup to perform the operation of transferring tablespaces
1. During the startup phase, RMAN will build a secondary instance. First, RMAN automatically creates a parameter file for the secondary instance and starts and moves the secondary instance to the nomount state. Then, RMAN uses the control file backup of the source database to restore the control file of the secondary instance and load the control file.

2. when the auxiliary instance control file is loaded, RMAN uses the source database backup, the auxiliary data file in the auxiliary directory and the transfer set file in the tablespace directory to restore the auxiliary instance and the transfer set data file. RMAN then performs the switch operation in the secondary instance. Therefore, the secondary instance uses the restored data file as the data file of the secondary instance.

RMAN restores the secondary instance by time. This updates the content in the dataset and the dataset data file to the target time point specified by the transport tablespace command. (If no directory time is specified, full recovery is performed ). When you run the transport tablespace command, the archive and redo log files will be restored to the secondary directory (or other directories) and deleted after they are applied to the secondary instance.

Once the restoration is complete, RMAN performs the open resetlogs operation on the secondary instance. At this time, the data file reflects the content of the destination time point specified by the tablespace operation during the tablespace transfer.

3. the recovery set tablespace of the secondary instance will be set to read-only mode, and the Data Pump is called to generate dump files for the recovery set tablespace. By default, the generated dump files are stored in the tablespace directory, you can also specify the dump file directory.

At this time, RMAN also generates a sample script for attaching the Data Pump import to the target database to transfer the tablespace. The script content will be written to a file named impscript. SQL and stored in the tablespace directory. The script command is also included in the output information of the transport tablespace command of RMAN.

If all operations are successful, RMAN closes the secondary instance and deletes all files generated by the transport tablespace command, Data Pump export logs, and sample import scripts except the transfer set files.

Note: the disappearance of transport tablespace does not automatically convert the data files in the recovery set in the byte sequence. If necessary, convert the data file to the byte sequence of the target database after creating the transfer set. The imported sample script assumes that the storage directory of the data files to be appended to the destination database's transfer tablespace is the same as that created by the transport tablespace operation. If these files are moved to the new disk directory before the tablespace is attached, you must modify the sample script to point to the new directory.

Restrictions on the RMAN transport tablespace command
Using RMAN to create a tablespace for transmission has the following restrictions:
1. The transport tablespace operation must be performed to restore the database to backup all the required tablespaces (including the tablespaces in the auxiliary set) and archived redo logs at the specified destination time point.

2. Because RMAN uses the Data Pump export and import tool during the creation of the transmitted tablespace through backup, if the transmitted tablespace uses XMLTypes, RMAN cannot be used for operations. In this case, the methods described in the Oracle management manual must be used.

3. Because RMAN will automatically create a secondary instance on the same host as the source instance for restoration and recovery, there will be performance overhead when executing the transport tablespace command.

4. If a tablespace is deleted, even if the SCN specified by the transport tablespace command is earlier than the SCN when the tablespace is deleted, the deleted tablespace cannot be included in the transport tablespace set of the transport tablepsace command.

5. If you rename a table space, you cannot use the transport tablespace command to create a table space set. The target time cannot be earlier than the time when the table space is deleted (RMAN has a name before the table space ).

6. You cannot transmit data to tables that do not have any restrictions or have no restrictions on the tables.

7. A dataset and a secondary dataset data file can contain any of the following objects:
-- Copy the master table
-- Some tables
-Tables with varray columns, nested tables, or external files
-- Snapshot log and snapshot table
-- Tablespace that contains undo or rollback segments
-- Contains the tablespace that belongs to the SYS user object addition and rollback segment

If you do not use the recovery directory to execute transport tablespace, there are two restrictions:
1. if you use the tablespace content at a time point in the past to create a transfer set, when the transport tablespace command is executed, the undo segments used by the tablespace set must be the same as the undo segments used by the tablespace selected during transmission. The tablespace that contains the undo segments required by the target SCN specified by the transport tablespace command is part of the auxiliary set. Unlike the recovery directory, The RMAN archives in the control file only contain tablespace records that contain the undo segments at that time. If the undo segment to be used in the tablespace is different from the specified destination time, the transport tablespace command will fail.

2. If the database has reused the backup record information required by the transport tablespace operation in the RMAN file, the operation fails because RMAN cannot locate the required backup. If the backup is still available, you can use the catalog command to register the required backup to the RMAN archive. However, if the database already overwrites the backup record in the control file, you may lose the required backup record information.

How to Use RMAN to create a tablespace set for Transmission

Use RMAN to transfer tablespaces
1. Check whether the platform of the source database and target database is the operating system platform supported by the table space transfer.
Confirm the source database operating system platform:
SQL> select d. platform_name, endian_format from v $ transportable_platform tp, v $ database d
2 where tp. platform_name = d. platform_name;

PLATFORM_NAME ENDIAN_FORMAT
Certificate -------------------------------------------------------------------------------------------------------------------
Linux IA (32-bit) Little


Confirm the target database operating system platform:
SQL> select d. platform_name, endian_format from v $ transportable_platform tp, v $ database d
2 where tp. platform_name = d. platform_name;

PLATFORM_NAME ENDIAN_FORMAT
Certificate -------------------------------------------------------------------------------------------------------------------
Linux IA (32-bit) Little


Here, the operating system platforms are all Linux

2. Check whether the tablespace to be transmitted is a self-contained tablespace (TSPITR, TEST ):
SQL> exec sys. dbms_tts.transport_set_check ('tspitr', true );

PL/SQL procedure successfully completed.


SQL> exec sys. dbms_tts.transport_set_check ('test', true );

PL/SQL procedure successfully completed.

SQL> select * from sys. transport_set_violations;

No rows selected

 

If no rows are selected, the tablespace contains only table data and can be transmitted.

Record in tspitr and test before table space transfer:
SQL> conn tspitr/tspitr
Connected.
SQL> select count (*) from tspitr;

COUNT (*)
----------
50641

SQL> conn test/test
Connected.
SQL> select count (*) from test;

COUNT (*)
----------
50680


3. to back up the source database, you must add include current controlfile when performing the backup. Otherwise, the following error message will appear when you run the transport tablespace command:
Automatic instance removed
RMAN-00571: ========================================================== ==============================
RMAN-00569: ==================== error message stack follows ==========================
RMAN-00571: ========================================================== ==============================
RMAN-03002: failure of tranport tablespace command at 03/26/2015 20:24:22
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found-aborting restore
RMAN-06024: no backup or copy of the control file found to restore

[Oracle @ oracle11g admin] $ export NLS_DATE_FORMAT = 'yyyy-mm-dd hh24: mi: ss'
[Oracle @ oracle11g admin] $ rman target sys/zzh_2046 @ test catalog rman/rman @ jy

Recovery Manager: Release 10.2.0.5.0-Production on Thu Mar 26 20:01:33 2015

Copyright (c) 1982,200 7, Oracle. All rights reserved.

Connected to target database: TEST (DBID = 2168949517)
Connected to recovery catalog database

RMAN> backup as backupset database include current controlfile plus archivelog;


Starting backup at 20:32:19
Current log archived
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting archive log backupset
Channel ORA_DISK_1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 68 recid = 75 stamp = 875286167
Input archive log thread = 1 sequence = 69 recid = 76 stamp = 875291999
Input archive log thread = 1 sequence = 70 recid = 77 stamp = 875302397
Input archive log thread = 1 sequence = 71 recid = 78 stamp = 875308491
Input archive log thread = 1 sequence = 72 recid = 79 stamp = 875350203
Input archive log thread = 1 sequence = 73 recid = 80 stamp = 875351397
Input archive log thread = 1 sequence = 74 recid = 81 stamp = 875390545
Input archive log thread = 1 sequence = 75 recid = 82 stamp = 875390643
Input archive log thread = 1 sequence = 76 recid = 83 stamp = 875391627
Input archive log thread = 1 sequence = 77 recid = 84 stamp = 875391661
Input archive log thread = 1 sequence = 78 recid = 85 stamp = 875391764
Input archive log thread = 1 sequence = 79 recid = 86 stamp = 875392340
Channel ORA_DISK_1: starting piece 1 at 2015-03-26 20:32:22
Channel ORA_DISK_1: finished piece 1 at 2015-03-26 20:32:29
Piece handle =/u02/ora_test87539234213991 tag = TAG20150326T203220 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 2015-03-26 20:32:29

Starting backup at 20:32:29
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting full datafile backupset
Channel ORA_DISK_1: specifying datafile (s) in backupset
Input datafile fno = 00001 name =/u01/app/oracle/oradata/test/system01.dbf
Input datafile fno = 00003 name =/u01/app/oracle/oradata/test/sysaux01.dbf
Input datafile fno = 00005 name =/u01/app/oracle/oradata/test/example01.dbf
Input datafile fno = 00006 name =/u01/app/oracle/oradata/test/tspitr01.dbf
Input datafile fno = 00002 name =/u01/app/oracle/oradata/test/undotbs01.dbf
Input datafile fno = 00004 name =/u01/app/oracle/oradata/test/users01.dbf
Input datafile fno = 00007 name =/u01/app/oracle/oradata/test/test01.dbf
Channel ORA_DISK_1: starting piece 1 at 2015-03-26 20:32:30
Channel ORA_DISK_1: finished piece 1 at 2015-03-26 20:33:45
Piece handle =/u02/ora_test875392350_1001 tag = TAG20150326T203229 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Channel ORA_DISK_1: starting full datafile backupset
Channel ORA_DISK_1: specifying datafile (s) in backupset
Including current control file in backupset
Channel ORA_DISK_1: starting piece 1 at 2015-03-26 20:33:46
Channel ORA_DISK_1: finished piece 1 at 2015-03-26 20:33:47
Piece handle =/u02/ora_test875392425_1011 tag = TAG20150326T203229 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 2015-03-26 20:33:47

Starting backup at 20:33:47
Current log archived
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting archive log backupset
Channel ORA_DISK_1: specifying archive log (s) in backup set
Input archive log thread = 1 sequence = 80 recid = 87 stamp = 875392427
Channel ORA_DISK_1: starting piece 1 at 2015-03-26 20:33:49
Channel ORA_DISK_1: finished piece 1 at 2015-03-26 20:33:50
Piece handle =/u02/ora_test875392428_1021 tag = TAG20150326T203348 comment = NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 2015-03-26 20:33:50

Starting Control File and SPFILE Autobackup at 20:33:50
Piece handle =/u02/c-2168949517-20150326-07 comment = NONE
Finished Control File and SPFILE Autobackup at 20:33:54

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • 3
  • Next Page

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.