1. Backup and restore
Backups can be offline and online, and restores can be complete or incomplete.
2. User-managed database backup
1. Non-archive mode
It can only be closed consistently, and then back up the files. The files that need to be backed up include:
select name from v$controlfile,
select name from v$datafile
select name from v$tempfile
select member from v$logfile;
2. Archive mode
Backup of control files: alter database backup controlfile to filename;
alter database backup controlfile to trace as file name
Backup data files: Prevent backups when LGWR writes
alter database begin backup ;
alter database end backup;
or
alter tablespace xxx begin backup;
alter tablespace XXX end backup;
During execution, redolog will increase a lot.
3. Backup password file and parameter file
Parameter file: create pfile from spfile.
Password file orapwd file=$ORACLE_HOMS/dba/orapwd<SID> password=password users=5 (unix)
orapwd file=$ORACLE_HOMS/database/pwd<SID>.ora password=password users=5 (windows)
4. Media recovery without affecting data files (non-data files)
1. Control file: After the copy is damaged, the database database will be down immediately.
Copy the parameter file using the operating system copy command, or edit the control_files parameter. Care must be taken not to copy the corrupted one over the complete one.
2. The redo log cannot be in the active state or the current state. If it is, it needs to be switched. The log file can be rebuilt or cleared.
select status, group# member from v$logfile. --status is invalid for problematic logs.
SQL>alter database clear logfile group 1;
3. Recovery of temporary files
alter tablespace temp add tempfile ‘/XXX.dbf’ size 1000M;
alter tablespace temp drop tempfile ‘/XXX.dbf’
5. Recovery of data files
1. In non-archive mode: You can only restore and lose the database.
2. Non-critical data in archive mode: (1) offline; (2) restore (3) recover (4) on line
3. Key data in archive mode: (1) mount status; (2) restore (3) recover (4) open
6. Incomplete recovery of user management
1) In mount state;
2)restore database。
3) recover database until time ‘’;或 recover database until change XXX;recover database until cancel;
4) Use resetlog to open the database