Common data file backup and recovery common data file backup and recovery: Common Data Files refer to non-system tablespace, udo tablespace, temporary tablespace, read-only tablespace files. Common data files can be restored using a high-availability recovery policy, that is, they can be restored in the OPEN state. 1. When the instance is started, if the common data file is lost, inaccessible, and the header is damaged, it can only be started to the mount state. 2. When the instance is running, the common data file header is damaged. After the checkpoint occurs, because the checkpoint cannot be updated in the data file header, the status of the data file is automatically set to offline in the control file, at the same time, warning logs will record the offline records of the data file due to a checkpoint failure. 3. When an instance is running, if a common data file does not have a header data block damaged, the command to access the damaged data block will fail, and the data file itself will not be automatically offline. The backup method is the same as the backup of key data files. Core steps for restoring common data files: offline, report or switch, Incremental backup, Or redo log recovery ), finally, publish the data file. Recovery of common data files can be recovered both in the mount State and in the open state.
Non-Data File Header damage repair: Low-availability recovery policy (mount), high-availability recovery policy (open) Low-availability recovery policy: 1. Use shutdown abort to close the instance. 2. Use startup mount to enter the MOUNT state. 3. Use the restore or switch command to restore corrupted common data files. 4. Use the recover database command to archive logs and online logs. restore data files 5. Execute alter database open to open the database, recovery completed. RUN {shutdown abort; startup mount; restore datafile 'path'; recover database; alter database open;} High Availability recovery policy: 1. offline alter database datafile 'path' offline; 2. Run the restore or switch command to restore the damaged normal data file; 3. Run the recover tablespace or recover datafile command, use archive logs and online logs to restore data files; 4. Execute alter database datafile 'path' online; Publish the recovered data files and restore them. Run {SQL 'alter database datafile 5 offline'; restore datafile 5; recover datafile 5; SQL 'alter database datafile 5 online';} if the instance has stopped, run {startup mount; SQL 'alter database datafile 5 offline'; alter database open; restore datafile 5; recover datafile 5; SQL 'alter database datafile 5 on line ';} after the file header is damaged, the recovery steps after the file header is damaged are as follows: On the basis of the Low-availability and high-availability recovery policies, then, the data file is restored based on whether it is offline. Undeprecated low-availability recovery policies, deprecated low-availability recovery policies, and high-availability recovery policies. Step 1: Use shutdown abort to close the instance 2. Use startup mount to start the instance to the mount status; 3. Execute the restore or switch command to restore corrupted common data files. 4. Execute the recover database command to restore data files using archiving logs and online logs. 5. Execute the alter database open command to open data, RUN {shutdown abort; startup mount; restore datafile 5; recover datafile 5; alter database open ;} steps 1. Use shutdown abort to close the instance 2. Run the startup mount command to bring the instance to the mount state 3. Run alter database datafile 'path' o The nline command changes the status of the data file in the control file to online 4. Execute the restore or switch command to restore the corrupted Common Data File 5. Execute the recover database to restore the data file using the archive log and online log. 6. Execute alter database open to open data, run {shutdown abort; startup mount; alter database datafile 5 online; restore datafile 5; recover database; alter database open ;} the high-availability recovery policy must first Delete corrupted data files in the header before restore operations can be performed. Recovery steps: 1. Delete the damaged data file in the header; 2. If the instance is stopped, use startup mount to mount the instance. If the data is in the OPEN state, this process is ignored. 3. Run the alter database command to remove corrupted data files (offline). 4. If the instance has been stopped and the instance is mounted with startup, use alter database open to open the data. Otherwise, ignore this process. 5. Execute the restore or switch command to restore the damaged common data file. 6. Execute the recover tablespace or recover datafile command to restore the data file using the archive log and online log; 7. Execute the alter database command to re-launch the recovered data file. After the restoration, the instance does not stop deleting the damaged data file (rm/'path ') run {SQL 'alter database datafile 5 offline'; restore datafile 5; recover datafile 5; SQL 'alter database datafile 5 online ';) the instance has stopped deleting the damaged data file (rm/'path') run {startup mount; SQL 'atler database datafile 5 offlin E '; alter database open; restore datafile 5; recover datafile 5; SQL 'alter database datafile 5 online ';} backup and recovery of read-only data files are data files in read-only tablespaces. Backup: the backup of read-only data files is the same as that of other data files. Recovery: Because the read-only file does not have the "write (Change)" operation, no archiving log or redo log recovery is required. You only need to restore it. Steps for restoring a low-availability recovery policy in the MOUNT status: 1. Run the startup mount command to enter the MOUNT state. 2. Run the restore or switch command to restore the data file. 3. Run the alter database open command to open the database, restore the high-availability recovery policy in the OPEN state: 1. Run the alter database command to bring corrupted read-only data files offline. 2. Run the restore force or switch command to restore the data files. 3. Run the alter database datafile 5 online command to bring the data files online. The parameter files and control files must be in place for low-availability recovery. For high availability recovery, key database files must be in place. Lossless control file recovery means that the control file is not damaged when the read-only data file is damaged. --- If the data block is damaged, the channel deems that the read-only data file still exists and does not need to be restored. In this case, you must use the restore datafile 5 force command to restore run {SQL 'alter databae datafile 5 offline '; restore datafile 5 force; SQL 'alter database datafile 5 online';} You do not need to use the force keyword run {SQL 'alter database datafile 5 offline' when using image replication '; switch datafile 5 to datafilecopy 'path'; SQL 'alter database datafile 5 online';} recover when the control file is corrupted: recover when the read-only data file and the control file are damaged. The recovery steps include restoring the control file and read-only data file 1. Starting the database to the NOMOUNT state 2. Restoring the control file with the restore command 3. Starting the database to the MOUNT state 4. Using the restore command restore the read-only data file 5. Use the recover command to restore the entire data 6. Use the resetlogs method to open the database run {restore controlfile from autobackup; mount database; restore datafile 5; recover database; --- if the read-only data file is changed to the read/write status and there is no backup, the data file and the control file are damaged, you need to add a recover databae, otherwise, you do not need to recover the database; --- if the read-only data file is changed to the read/write status and there is no backup, the data file and the control file are damaged, you need to add a recover databae alter database open resetlogs ;}