Oracle Database offline backup (cold backup) and precautions

Source: Internet
Author: User

Today, I will introduce you to the implementation of offline backup in oracle databases and some precautions when using offline backup in oracle databases. Let's take a look.

Cold backup is a physical backup of database files. It is usually performed after the database is shut down normally through a shutdown normal or shutdown immediate command. When the database is closed, all files used by the database can be backed up. These files constitute a complete image when a database is closed.
Cold backup usually backs up the following files:
All data files
All control files
All online redo logs
Initialize the parameter file initsid. ora (optional)
Run the following SQL statement to view all the files to be backed up:

The Code is as follows: Copy code

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

Record the path and file name of all these files, and back up them to disk or tape together with the initialization parameter file.


How do I back up a database offline after shutdown?

Offline backup directly copies the physical file to a single location. If you want to start the database at the backup location, write a new init file, modify the location of the control file, and then execute the code

The Code is as follows: Copy 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 does not work, because the log in the control file and the location of the data file are not modified, and the database cannot be opened. You need to start the database to the mount state, and then open the database after modification.

The physical backup content does not need to be restored.

Precautions for offline backup


Full offline backup, also known as cold backup. The existence of cold backup is to protect the site, so that we can start from scratch when recovery fails.
We know that the data file is the disk space reserved by oracle to the OS. If we applied for 50 GB when planning the database
It may only use 100 M, and we need less valid data for cold backup, maybe only 5 M, but we still have to back up 50 GB of data.
This is the disadvantage of cold backup.
 
During Cold backup, backup may be incomplete or junk data is backed up. Therefore, we must refer to what the database sees.
Generally, the main Cold Standby objects are datafile, controlfile, and redo log file. We can use several views
Where are they located.
 
For data files:

The Code is as follows: Copy code
[SQL]
SQL> select file_name from dba_data_files;
Www. bKjia. c0m
FILE_NAME
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------
/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
Control file:
[SQL]
SQL> select name from v $ controlfile;
NAME
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------
/U01/app/oracle/oradata/ORCL/controlfile/o1_mf_8050hgreen _. ctl
/U01/app/oracle/flash_recovery_area/ORCL/controlfile/o1_mf_8050hgqh _. ctl
 
Log File:
[Html]
SQL> select member from v $ logfile;

MEMBER
Certificate ------------------------------------------------------------------------------------------------------------------------------------------------------
/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_00008050hhn1 _. log
/U01/app/oracle/flash_recovery_area/ORCL/onlinelog/o1_mf_20178050hkdv _. log

 
To shorten the backup time and save disk space, we can make the following minor adjustments:
1) Check the currently activated oracle undo. This undo will be a member of the cold backup.
 

The Code is as follows: Copy code
[Html]
SQL> show parameter undo
Www. bKjia. c0m
NAME TYPE VALUE
-----------------------------------------------------------------------------
Undo_management string AUTO
Undo_retention integer 900
Undo_tablespace string UNDOTBS1
 


2) We do not need to back up temporary temp files because oracle does not check the temporary files when it is started.
3) if multiple images exist in the control file, we can back up only one of them.
After completing the preceding friendly reminders, we can turn off the instance and start cold backup.
[SQL]
Shutdown immediate

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.