To understand the role of each file, you must master the basic concepts of Oracle.
I. backup and recovery of Oracle basic files
1. logfile diversification and Backup Recovery
Log query
Select * from v $ logfile;
Select * from v $ log;
Manually switch logs
Alter system switch logfile;
Manual checkpoint
Alter system checkpoint;
Alarm Log File
Show paramter dump
$ ORACLE_BASE/admin/orcl/bdump
Tail-f alert *. log
Diversified log files
Alter database add logfile member '/opt/ora10g/oradata/orcl/redo01B. log' to group 1;
Alter database add logfile member '/opt/ora10g/oradata/orcl/redo02B. log' to group 2;
Alter database add logfile member '/opt/ora10g/oradata/orcl/redo03B. log' to group 3;
The log file is broken, and the log file is repaired (this can be used to restore the file if it is lost)
Alter database clear logfile group 1;
If not
Alter database clear unarchived logfile group 2;
Add Member
Alter database add logfile group 4;
Alter database add logfile member '/opt/ora10g/oradata/orcl/redo04.log' to group 4;
Delete a log Group
Alter database drop logfile group 4;
Delete a Member from a log Group
Alter database drop logfile member '/opt/ora10g/oradata/orcl/redo01B. log ';
2. parameter file backup and recovery
Use pfile to back up binary startup parameter files
Create pfile from spfile;
If the spfile file is lost or damaged
Startup pfile = '... INIT <ORACLE_SID>. ora'
Create spfile from pfile
Startup force
Show parameter spfile
3. Control File Backup Recovery
Diversified Control Files
The control file records and maintains the physical structure of the database, and also records the backup and recovery information. If the database only has one control file,
When the media fails and the control file is damaged, the database cannot be loaded. If the file backup is not controlled, it will be a disaster,
Therefore, you need to diversify the control files and distribute them on different disks.
Query existing control files:
SQL> select name from v $ controlfile;
Initialization parameter control_files:
Alter system set control_files = '/disk1/ora10g/oradata/orcl/control01.ctl', '/disk1/ora10g/oradata/orcl/control02.ctl ', '/disk1/ora10g/oradata/orcl/control03.ctl', '/disk1/ora10g/control01.ctl' scope = spfile;
Close the database:
SQL> shutdown immediate;
Copy control file:
SQL> host cp/disk1/ora10g/oradata/orcl/control01.ctl/disk1/ora10g/control01.ctl
Start the database:
SQL> startup
Backup Control File
A. Back up the control file as a binary file
SQL> alter database backup controlfile to 'I: \ oracle \ backup \ control. bkp ';
In this way, you can directly go back to cp.
B. Back up the control file as a text file (back up it to the tracking file under the oracle \ base \ admin \ sid \ udump directory, and generate an SQL script in the tracking file)
Recovery is also very easy. Find the trace file and open it and find something similar to the following:
STARTUP NOMOUNT
Create controlfile reuse database "ORCL" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
# MAXLOGHISTORY 292
LOGFILE
GROUP 1 (
'/Disk1/ora10g/oradata/orcl/redo01.log ',
'/Disk1/ora10g/oradata/orcl/redo01B. Log'
) SIZE 50 M,
GROUP 2 (
'/Disk1/ora10g/oradata/orcl/redo02.log ',
'/Disk1/ora10g/oradata/orcl/redo02B. Log'
) SIZE 50 M,
GROUP 3 (
'/Disk1/ora10g/oradata/orcl/redo03.log ',
'/Disk1/ora10g/oradata/orcl/redo03B. Log'
) SIZE 50 M
-- STANDBY LOGFILE
DATAFILE
'/Disk1/ora10g/oradata/orcl/system01.dbf ',
'/Disk1/ora10g/oradata/orcl/undotbs01.dbf ',
'/Disk1/ora10g/oradata/orcl/sysaux01.dbf ',
'/Disk1/ora10g/oradata/orcl/users01.dbf ',
'/Disk1/ora10g/oradata/orcl/example01.dbf'
Character set WE8ISO8859P1
;
Directly create an SQL file and call it through.
Then alter database open rsetlogs;
For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12