All technological notes.
Tablespace point-in-time recovery (TSPITR)Tablespace point-in-time recovery (TSPITR)
Tablespace point-in-time recovery (TSPITR)Architecture:
Target database:
Control file:
Backup sets:
Archived redo logs:
Auxiliary instance:


Steps to TSPITR:
auxiliary instance, starts it, and connects to ittablespaces that will be recovered offlinecontrol file from a point in time before the target time to the auxiliary instancedata files from the recovery set and the auxiliary set to the auxiliary instanceauxiliary database with the RESETLOGS optiondictionary metadata about objects in the recovered tablespaces to the target databaseauxiliary instance.
SWITCH commands on the target database so that the target database control file points to the data files in the recovery set that were recovered on the auxiliary instance.dictionary metadata from the auxiliary instance to the target instanceSituations for TSPITR:
TRUNCATE TABLE statementdata manipulation language (DML statement that has affected only a subset of the databaselogical schema to a different point from the rest of the physical databaseTSPITR uses transportable tablespaces and Data Pump.
target time.recovery set.Tools to investigate changes to your database and to help determine the correct target time for TSPITR:
Oracle Flashback QueryOracle Flashback Transaction QueryOracle Flashback Version QueryRecovery with a recovery catalog:
Recovery with a current control file:
The current control file does not contain a record of an older incarnation of the recovered tablespace.
TSPITR and bring a tablespace online, you cannot use any backup from a time earlier than the moment you brought the tablespace online.TSPITR if you choose the wrong target time the first time 如果操作错误, 则不能恢复到重新上线之前If you can restore a backup control file from before that time: 除非能恢复 cf 到之前
incomplete recovery of the whole database to any time prior to or equal to the time when you brought the tablespace onlineAlternatives:
Flashback tools and the data still available as undo data, it is usually much simpler to use the Flashback tools for undoing unwanted changes (rather than TSPITR).If objects in the tablespace that you are recovering have relationships with objects in other tablespaces, you can:
Use the DBMS_TTS.TRANSPORT_SET_CHECK procedure to determine whether the tablespaces in the recovery set are self-contained.
RMAN TSPITR automatically executes the DBMS_TTS.TRANSPORT_SET_CHECK procedure for the recovery set tablespaces and verifies that the query against TRANSPORT_SET_VIOLATIONS returns no rows.
TSPITR processing, and any tablespace containment violations must be resolved before TSPITR can proceed.Can execute the procedure and query the view as a precautionary measure:
DBMS_TTS.TRANSPORT_SET_CHECK ('USERS,EXAMPLE') ;
SELECT * FROM TRANSPORT_SET_VIOLATIONS;
TS_PITR_OBJECTS_TO_BE_DROPPED to determine which objects will be lost after TSPITR.Use Export before TSPITR and Import after TSPTIR to preserve and re-create the lost objects.
SELECT OWNER, NAME, TABLESPACE NAME,
TO_CHAR (CREATION TIME, 'YYYY-MM-DD:HH24:MI:SS')
FROM TS_PITR_OBJECTS_TO_ BE_ DROPPED
WHERE TABLESPACE NAME IN ('USERS', 'EXAMPLE')
AND CREATION TIME >
TO DATE ('2018-APR-03:08:30:00', 'YY-MON-DD:HH24:MI:SS')
ORDER BY TABLESPACE NAME, CREATION TIME;
TSPITR OptionsFully automated TSPITR (recommended method):
auxiliary destination.Customized TSPITR with an automatic auxiliary instance:
parameters.channel configurations.TSPITR using your own auxiliary instance:
auxiliary instance used in TSPITR.When you perform fully automated TSPITR, you must:
Steps:
auxiliary destination by using the AUXILIARY DESTINATION option.cannot use backups of any tablespaces that participate in TSPITR taken before TSPITR after you perform TSPITR. 不能使用之前的备份
Example:
CONNECT TARGET
RECOVER TABLESPACE users, example
-- assumes that
-- NLS_DATE_FORMAT is setto 'yyyy-mm-dd:hh24:mi:ss’
-- NLS_LANG is set to AMERICAN AMERICA.WE8BMSWIN1252.
UNTIL TIME '2018-06-29:08:00:00'
-- Specify the auxiliary destination
AUXILIARY DESTINATION '/u0l/app/oracle/oradata/aux';
To improve TSPITR performance, use the existing image copies of the recovery set and auxiliary set data files
data files from a backup.Methods:
CONFIGURE AUXNAME command:
auxiliary set data file image copy.SET NEWNAME command:
RUN {
SET NEWNAME FOR DATAFILE '$ORACLE_BASE/oradata/orcl/users0l.dbf'
TO '/u0l/backup/users0l.dbf';
RECOVER TABLESPACE users UNTIL SEQUENCE 1300 THREAD 1;
}
To customize RMAN TSPITR, can use an RMAN-managed auxiliary instance:
Rename or relocate your recovery set data files.
SET NEWNAME to rename the recovery set data files so that they are not restored and recovered in their original locations.Specify a location other than the auxiliary destination for some or all of the auxiliary set data files.
SET NEWNAME and DB_FILE_NAME_CONVERT to provide rules for converting data file names in the target database to data file names for the auxiliary database. 创建映射image copy backups of your data files before TSPITR.auxiliary instance.auxiliary instance.Improve performance:
image copies of the recovery set and auxiliary set data files on disk rather than restoring them from backupRecommends
Not recommended, but supported:
To create an auxiliary instance:
auxiliary instance.auxiliary instance.auxiliary instance.To perform TSPITR with auxiliary instance:
NOMOUNT mode. 注意是 nomountRMAN client to the target and auxiliary instances.RECOVER TABLESPACE command.File name conflicts:
SET NEWNAME, CONFIGURE AUXNAME, and DB_FILE_NAME_CONVERT causes multiple files in the auxiliary or recovery sets to have the same nameRMAN cannot identify tablespaces with undo segments:
Caused by:
During TSPITR, RMAN needs information about which tablespaces had undo segments at the TSPITR target time.
recovery catalog:
recovery catalogControl file or if the information is not found in the recovery catalog
tablespaces with undo segments at the target time is the same as the set of tablespaces with undo segments at the present 会假设 tbsp 在目标时间和当前都是相同.Solution:
tablespaces with undo segments at the target time in the UNDO TABLESPACE clause.Restarting manual auxiliary instance after TSPITR failure:
auxiliary instance and there is a failure in TSPITR, then before you can retry TSPITR, you must shut down the auxiliary instance, correct the problem, and put the auxiliary instance back in NOMOUNT mode. 使用自有实例并在恢复时失败, 需要关闭实例, 处理错误, 然后重新启动实例并处于 nomount 模式.