A cold backup is a physical backup of a database file, usually after the database is shut down normally through a shutdown normal or shutdown immediate command. When the database is closed, the individual files it uses can be backed up. These files form a full image of a database shutdown.
Cold backup typically backs up the following files:
All data files
All control files
All online redo Logs
Initialize parameter file Initsid.ora (optional)
First execute the following SQL statement to view all files that need 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 of these files, and back up to disk or tape together with the initialization parameter file.
How do I back up the database offline after shutdown?
Offline backup directly copy the physical files to a location, if you want to start the database in the location of the backup, write a new init file, modify the control file location, and then execute the code
| 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 not, because the control file Log,data file location is not modified, can not open the database, need to boot to mount state, modify and then open.
The contents of the physical backup do not need to be restored
Considerations for offline backups
Full offline backup, also known as cold backup. Cold backup exists to protect the site from starting from scratch when we fail to recover.
We know that the data files are the disk space reserved for Oracle to the OS, and if we plan the database, we apply for 50g, a start Oracle
Maybe only 100M, we need less effective data when we are cold, maybe only 5 m, but we still have to back up 50g.
This is the disadvantage of Lengbei.
A condition where the backup may be incomplete or the junk data is backed up when the cold standby is being made. Therefore, we must be in the database to see whichever.
Typically, the main object of Lengbei is datafile,controlfile and redo log file. We can use a few views to see
where they hide.
To the data file:
| The code is as follows |
Copy Code |
[SQL] Sql> select file_name from Dba_data_files; Www.111cn.net 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 To the control file: [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
To 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, usually we can do the following fine-tuning:
1 To view the undo that is currently activated by Oracle, this undo will act as a member of the Lengbei.
| The code is as follows |
Copy Code |
[HTML] Sql> Show Parameter Undo Www.111cn.net NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ Undo_management string AUTO Undo_retention Integer 900 Undo_tablespace string UNDOTBS1
|
2 for temp temporary files, we do not have to back up because Oracle does not check for temporary files when it is powered on.
3 for control files, there are multiple mirrors, we can only back up one of them.
After completing a few of the above friendship reminders, we can start to turn off the example, and start making cold preparation.
[SQL]
Shutdown immediate