Method of Cold Backup of oracle Database

  • 2021-09-11 21:46:25
  • OfStack

A cold backup is a physical backup of the database files, usually after the database is normally shut down with one shutdown normal or shutdown immediate command. When the database is shut down, all the files it uses can be backed up. These files constitute a complete image when a database is shut down.
Cold backup usually backs up the following files:
All data files
All control files
All online redo logs
Initialize parameter file initsid. ora (optional)
Start by executing the following SQL statement to view all files that need to be backed up:

 
SVRMGR> select * from v$datafile;
SVRMGR> select * from v$controlfile;
SVRMGR> select * from v$logfile;
 

Record the paths and filenames of all these files, and back them up to disk or tape together with the initialization parameter file 1.
How to back up the database offline after shutdown?
Offline backup directly copy the physical file to a location, if you want to start the database in the backup location, write a new init file, modify the location of control file, and then execute the code

SQL> startup mount
ORACLE instance started.
Total System Global Area   57124108 bytes
Fixed Size                    70924 bytes
Variable Size              40198144 bytes
Database Buffers           16777216 bytes
Redo Buffers                  77824 bytes
Database mounted.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: 'F:ORACLEORADATALHGSYSTEM01.DBF'
 

startup restrict is not good, because the positions of log and data files in the control file have not been modified, so the open database cannot be started, so it is necessary to start to mount state, and then open after modification.
The contents of physical backup do not need to be restored
Considerations for Offline Backup

Full offline backup, also known as cold backup. Cold backup exists to protect the site and prevent us from starting from scratch when recovery fails.
As we know, the data file is the disk space reserved by oracle to os. If we apply for 50g when planning the database, 1 will start oracle
Maybe only 100M is used, so we need less valid data for cold standby, maybe only 5M, but we still have to back up 50g.
This is the disadvantage of cold standby.

During cold standby, incomplete backup or junk data backup may occur. Therefore, we must take what we see in the database as the standard.
Generally, the main objects of cold standby are datafile, controlfile and redo, log and file. We can take a look at it with the help of several views
Where they are hiding.

In the data file:


[sql] 
SQL> select file_name from dba_data_files;  
    www.ofstack.com  
FILE_NAME  
------------------------------------------------------------------------------------------------------------------------------------------------------  
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_8050fkdh_.dbf  
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_8050fk3w_.dbf  
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_8050fkc6_.dbf  
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_8050fk2z_.dbf  
/u01/app/oracle/oradata/ORCL/datafile/o1_mf_example_8050jhm7_.dbf  
   In control documents: 
[sql] 
SQL> select name from v$controlfile;  
NAME  
------------------------------------------------------------------------------------------------------------------------------------------------------  
/u01/app/oracle/oradata/ORCL/controlfile/o1_mf_8050hgfp_.ctl  
/u01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_8050hgqh_.ctl  

   In the log file: 
[html] 
  SQL> select member from v$logfile;  

MEMBER  
------------------------------------------------------------------------------------------------------------------------------------------------------  
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_3_8050hq4s_.log  
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_3_8050hs2h_.log  
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_2_8050hm84_.log  
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_2_8050ho5o_.log  
/u01/app/oracle/oradata/ORCL/onlinelog/o1_mf_1_8050hhn1_.log  
/u01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_1_8050hkdv_.log  

In order to shorten backup time and save disk space, we can usually make the following fine adjustments:
1) Look at the undo currently activated by oracle, which will be used as a member of the cold standby.
 
[html] 
  SQL> show parameter undo  
    www.ofstack.com  
NAME                                 TYPE        VALUE  
------------------------------------ ----------- ------------------------------  
undo_management                      string      AUTO  
undo_retention                       integer     900  
undo_tablespace                      string      UNDOTBS1  
 

2) For temp temporary files, we don't have to back them up, because oracle doesn't check temporary files when booting.
3) For the control file, there are multiple mirrors, and we can back up only one of them.
After completing the above friendly reminders, we can start to turn off the examples and start cold preparation.
[sql]
shutdown immediate


Related articles: