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

12C RMAN backup and restore

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

Share

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

12C The redo log file is shared, so ARCHIVELOG mode can only be set at CDB level, not PDB level.

RMAN can operate cdb and pdb backups relatively well, while pdb backups and restores can be done through cdb.

= Backup =

The contents of a backup depend on how you connect to rman, either to cdb$root or to the associated pdb.

If connected to cdb, this command backs up all pdb and cdb$root.

If connected to pdb, the command backs up only the pdb connected to.

Backup only part of pdb:

rman>backup pluggable database PDBPROD1;

Back up only part of the tablespaces of pdb:

rman>backup tablespace PDBPROD1:USERS;rman>backup tablespace system, PDBPROD1:sysaux, pdbprod2:users;

If you do not add the format parameter to the backup command, the files backed up are placed in the flashback recovery area by default

rman>backup pluggable database pdbprod2 format '/home/oracle/back/%d_%U.full';

= Recovery =

Recovery of temporary files

PDB can be opened in the absence of temporary files. If any temporary files do not exist when the PDB is opened, they are automatically recreated.

These temporary files are also automatically recreated when CDB starts. Manual recreations can also be performed when connecting to PDB:

SQL> ALTER TABLESPACE temp ADD TEMPFILE '/u01/app/oracle/oradata/CDB1/PROD2/temp1_02.dbf' SIZE 50M;SQL> ALTER TABLESPACE temp DROP TEMPFILE '/u01/app/oracle/oradata/CDB1/PROD2/temp1_01.dbf';

Recovery of control files

If the control file is missing or corrupted, the instance will crash quickly and the entire CDB media recovery will be required since the control file belongs to CDB.

·Start CDB instance first.

·Then restore the control files from the backup.

·Load CDB.

·Then restore and open CDB in Reset Log.

SQL>STARTUP nomountSQL>restore controlfile from autobackup ;SQL>alter database mount;SQL>ALTER DATABASE OPEN RESETLOGS;

redo log file loss

Redo log files are divided into online Redo log files and archived Redo log files.

rman only backs up archived Redo log files, not online Redo log files.

If the online Redo log is corrupted, then recovery needs to be done in different cases:

1. inactive redo abnormal ORA-00316 ORA-00327

ALTER DATABASE CLEAR LOGFILE GROUP 2;

2. Normal shutdown database ACTIVE, current redo abnormal ORA-00316 ORA-01623

ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 1; or: --ALTER DATABASE CLEAR LOGFILE GROUP 1;recover database until cancel; #Enter specific online Redo files alter database open resetlogs;

3. Database abnormal shutdown current/active redo abnormal ORA-00316 ORA-01624 ORA-01194

sql>alter system set "_allow_resetlogs_corruption"=true scope=spfile;sql>recover database until cancel; --cancelsql>alter database open resetlogs;sql>startup force mountsql>alter database open resetlogs;sql>alter system set "_allow_resetlogs_corruption"=false scope=spfile;sql>alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*'; sql>shutdown immediatesql>startup##Use hidden parameters to skip database consistency checking ##It is best to export logically through expdp and import ##Of course, rman backup is also indispensable

4. Restore the whole library

startup nomountrestore controlfile from '';alter database mount;restore database;recover database;alter database open resetlogs;

Point-in-Time Recovery (PITR)

Incomplete recovery is the opposite of full recovery and is a recovery method for lost data, also known as database point-in-time recovery

Point-in-Time Recovery (PITR) is the recovery of the entire database to a previous point in time, log sequence number, or SCN number.

The PDB prototype is a child prototype of CDB. For example, if CDB is prototype 5 and PDB is prototype 3, the fully assigned prototype number for PDB is (5,3).

The initial prototype of PDB is 0. To see the prototype of PDB, query the V$PDB_INCARNATION view.

RMAN> LIST INCARNATION;--CDB performs PITR--startup force mountRUN {SET UNTIL SCN = 1712839 ;RESTORE DATABASE ;RECOVER DATABASE ;alter database open resetlogs;}--CDB performs TSPITR (Tablespace incomplete recovery)--rman target /RMAN> RECOVER TABLESPACE TEST UNTIL SCN 1756899 AUXILIARY DESTINATION '/u01/app/oracle/orateral'; RMAN> ALTER TABLESPACE TEST ONLINE;--PDB Execute PITR--RMAN> ALTER PLUGGABLE DATABASE PDBPROD2 CLOSE; RUN> RUN {SET UNTIL SCN = 1851648 ;RESTORE pluggable DATABASE PDBPROD2;RECOVER pluggable DATABASE PDBPROD2 AUXILIARY DESTINATION='/u01/app/oracle/oradata';ALTER PLUGGABLE DATABASE PDBPROD2 OPEN RESETLOGS; oracle}--PDB table space PITR--TSPITR--rman target /UNIT> RECOVER TABLESPACE PDBPROD2:test UNTIL SCN 88888 AUXILIARY DESTINATION '/u01/app/oracle/oradata'; UNIT> ALTER TABLESPACE PDBPROD2:test ONLINE;

Note:

1, the implementation of TSPITR table space can not be the default permanent table space of the database, otherwise an error will be reported.

2. Do not use 12.2.0.1 for this experiment, because bugs will report errors. ORA-65254: invalid path specified for the directory, patch 25074866 is required.

Datapatch Fails With "ORA-65254: invalid path specified for the directory" on PDB Where PATH_PREFIX is set (File ID 2296226.1)

Complete script:

run{ backup database format ''; sql 'alter system archive log current'; backup archivelog all format ''; backup current controlfile format ''; }

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