User-defined database backup
Backup type
Backup method
Example
data files
Operating system command or tool
C: / copy datafile1.ora datafile.bak
Archive redo log file
Operating system command or tool
C: / copy log_01_23.arc log_01_23.bak
Control file
SQL command
SQL> ALTER DATABASE BACKUP ControlFile To Confile.bak;
Initialization parameter file
SQL command
SQL> CREATE PFILE = SIDINIT.ORA from SPFILE;
Network configuration and password file
Operating system command
C: / copy tnsnames.ora tnsnames.bak
Database logic objects (table, index, stored procedure, etc.)
Export Tool
C: / export system / manager table
= hr.employees file = Emp.dmp
If the database runs in the non-archive mode, the database can be inconsistent with a fully backed up, or a separate backup of a table space or data file.
If the database runs in the non-archive mode, only the database can be consistently completely backed up in the off state.
First, offline backup of table space or data file
If the database runs in archiving mode, you can back up a table space or data file in a dartest state in the database in the open state. Other tablespaces or data files in the database during backups can still be used by users.
SQL> ALTER TABLESPACE OFFLINE NORMAL;
C: / copy e: /oracle/oradata/Users01.dbf f: /backup/Users01.bak
SQL> ALTER TABLESPACE USERS Online;
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Second, online backup of table space or data file
If the database runs in archive mode, you can back up a table space or data file in the database in the database. These table spaces or data files can still be used by users during backups.
SQL> ALTER TABLESPACE USERS BEGIN BACKUP;
C: / copy e: /oracle/oradata/Users01.dbf f: /backup/Users01.bak
SQL> ALTER TABLESPACE END BACKUP;
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
Third, handle backup failure
If a fault occurs during the backup process, the backup suddenly interrupts, then the data file in the backup table space will still be in the backup mode when the next started database, so Oracle will request a database recovery.
1. Use the ALTER DATABASE END Backup statement to exit the backup mode
SQL> Startup Mount
SQL> SELECT * FROM V $ backup where status = 'Active'
(What data files are in backup mode)
SQL> ALTER DATABASE End Backup;
SQL> ALTABASE OPEN;
2. Use the recover command to exit the backup mode
SQL> Startup Mount
SQL> Recover Database
SQL> ALTABASE OPEN;
Fourth, the control file backup is binary file
SQL> ALTER DATABASE Backup ControlFile To
'E: / backup/cfile.bak' reuse;
V. Control file backup to the trace file SQL> ALTER DATABASE BACKUP ControlFile to TRACE;
(When the database is loaded, the control file can be backed up to the tracking file using the above statement)