Oracle Basic physical backup cold and hot backup

Source: Internet
Author: User

Cold Backup Introduction: Cold Backup database is to back up all critical files including data files, control files, online redo log files, and copy them to another location after shutting down the database. In addition, cold backups can include backups of parameter files and password files, but these two backups can be selected as needed. , cold backup is actually a physical backup, a process of backing up a database physical file. Because cold backups are backed up with all database files except redo logs, they are also a full database backup.        Its advantages and disadvantages are as follows: 1, advantages: <1> Just copy files, is a very fast backup method.        <2> just copy the file back and you can restore it to a point in time.        The combination of <3> with the database archiving model allows the database to be restored well. <4> maintenance is less, but the security is relatively high.        2, Disadvantage: <1> in the process of database cold backup, the database must be in a closed state.        <2> when a cold backup is used alone, the database can only complete recovery based on a point in time.        <3> If disk space is limited, cold backups can only copy backup data to other external storage, such as tape, at a slower rate. <4> cold backups cannot be recovered on a per-table or per-user basis. 3, the specific backup steps are as follows: <1> log in with a DBA user or a privileged user, query dynamic performance views V$datafile, V$controlfile can list the database data files and control files separately.
Sql&gt; Select name from V$datafile;name
--------------------------------------------------------------------------------
/u02/oradata/db01/system01.dbf
/u02/oradata/db01/undotbs01.dbf
/u02/oradata/db01/sysaux01.dbf
/u02/oradata/db01/users01.dbfsql&gt; Select name from V$controlfile;name
--------------------------------------------------------------------------------
/u02/oradata/db01/control01.ctl
/u02/oradata/db01/control02.ctl
/u02/oradata/db01/control03.ctl
/u01/app/oracle/bak/control04.ctl<2> shut down the database as a DBA user or a privileged user. Sql&gt; Conn/as Sysdba;
Connected.
Sql&gt; Shutdown normal
Database closed.
Database dismounted.
ORACLE instance shut down.<3> Copy the data file and copy it to a separate hard disk or disk. Control files are mirrored to each other, so only one control file can be copied. Cp/u02/oradata/db01/*.dbf/u01/app/oracle/bakcp/u02/oradata/db01/*.ctl/u01/app/oracle/bak<4> the startup routine to open the database. Sql&gt; Conn/as Sysdba;
Connected to an idle instance.
Sql&gt; Startup
ORACLE instance started. Total System Global area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 83887696 bytes
Database buffers 197132288 bytes
Redo buffers 2973696 bytes
Database mounted.
Database opened.
Sql&gt;
Second, hot backup:   hot backup is the way to back up a database using archive log mode in the case of database running. Hot backup requires the database to operate in Archive log mode and requires a large amount of file space. Once the database is in Archive Loh mode, it can be backed up, and when the backup is performed, it can only be done at the data file level or table space. 1. Advantage:          <1> can be backed up in table space or data file level, backup time is short.           <2> to achieve seconds recovery (restore to a point in time).           <3> restores almost all database entities.           <4> Recovery is fast and in most cases resumes when the database is still working.           <5> backup database is still available. 2, shortcomings:         <1> because it is difficult to maintain, so be careful carefully, do not allow "to fail to end."          <2> If the hot backup is unsuccessful, the resulting results are not available for point-in-time recovery.          <3> can not be wrong, otherwise serious consequences. 3. Set initial archive mode:          Set archive mode the database must be in Mount instead of open:          <1> First See if the database is in archive log mode:         sql&gt; Archive log List; 
Database log mode No Archive mode
Automatic Archival Disabled
Archive Destination Use_db_recovery_file_dest
Oldest online log sequence 1
Current log sequence 2 <2> start database in Mount state: sql&gt; startup Mount;
ORACLE instance started. Total System Global area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 83887696 bytes
Database buffers 197132288 bytes
Redo buffers 2973696 bytes
Database mounted. <3> set the database to archive mode: sql&gt;        ALTER DATABASE Archivelog;        Database altered. <4> Open Database: sql&gt;     ALTER DATABASE open;    Database altered. <5> set the database to auto-archive using the following command: sql&gt;    Alter system set LOG_ARCHIVE_START=TRUE Scope=spfile; System altered.
<6> determine that the database is in archive mode, and set AutoArchive:sql&gt; archive log list; 
Database log mode               Archive mode 
Automatic archival              enabled 
Archive destination             use_db_recovery_file_dest 
Oldest online log sequence     1 
Next log sequence to archive   2 
Current log sequence&n bsp;          2 The exact location defined by the archive destination above, you can view the $oracle_home/dbs/ The value of the Db_recovery_file_dest parameter in the Spfile<dbname>.ora file.  
4, online Backup: Online backup is a backup method of hot backup, which is the process of backing up all data files and individual data files of a tablespace when the tablespace is in the online state. The advantage of using an online backup is that it does not affect all access to the user on the tablespace, but the disadvantage of online backup may produce more redo log files and archive log files. The following are the steps for online backup: <1> Log on as a DBA user or a privileged user to determine which data files the tablespace contains. By querying the data dictionary dba_data_files, you can get the correspondence between the data file and the table space:
sql&gt; Select file_name from dba_data_files where tablespace_name= ' USERS '; file_name
--------------------------------------------------------------------------------
/u02/oradata/db01/users01.dbf<2> set the tablespace to backup mode, you must set the tablespace to a backup mode before replicating the data files of the tablespace:sql&gt; Alter TABLESPACE users begin backup; Tablespace altered.<3> Copy the users data files to the backup directory: [[email protected] bak]$ cp/u02/oradata/db01/users01.dbf/bak<4>  The table space is not required to be set up as a backup mode, so it can be returned to normal mode:sql&gt; Alter TABLESPACE users end backup; Tablespace altered.
5, Offline Backup: Offline Backup is also a method of hot backup, which is the process of backing up all data files for a tablespace and a single data file when the tablespace is offline.        It has the advantage of producing fewer redo log files, with the disadvantage that the table space that is backed up when the user is making an offline backup is inaccessible because the system tablespace and the undo tablespace being used cannot be taken offline, so an offline backup does not apply to the system table space and the undo tablespace being used. <1> log in with a DBA user or a privileged user to determine which data file the tablespace contains. This is the same as the first step in online backup:
Sql&gt; Select file_name from Dba_data_files where tablespace_name= ' USERS '; file_name
--------------------------------------------------------------------------------
/u02/oradata/db01/users01.dbf<2> The table space is offline and the tablespace is set to offline, the user will not be able to access any objects on that tablespace, so you can also ensure that the data files for the offline tablespace are not changed. Sql&gt; Alter TABLESPACE users offline; Tablespace altered. Sql&gt; Select Tablespace_name,online_status from Dba_data_files; Tablespace_name Online_
------------------------------ -------
USERS OFFLINE
Sysaux ONLINE
UNDOTBS1 ONLINE
SYSTEM system<3> Copy the users data files to the backup directory: [[email protected] bak]$ CP/U02/ORADATA/DB01/USERS01.DBF/ Bak<4> The table space in the online state after the copy is finished:sql&gt; Alter tablespace users online; Tablespace altered. Sql&gt; Select Tablespace_name,online_status from Dba_data_files; Tablespace_name Online_
------------------------------ -------
USERS ONLINE
Sysaux ONLINE
UNDOTBS1 ONLINE
SYSTEM Syste

Oracle Basic physical backup cold and Hot backup (RPM)

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.