参数文件备份恢复
用pfile文件备份二进制的启动参数文件create pfile from spfile;
create pfile = '/home/oracle/tmp_init.ora' from spfile; ####可以指定pfile 的路径
startup pfile='...INIT<ORACLE_SID>.ora'
create spfile from pfile
startup force
show parameter spfile控制文件备份恢复
多元化控制文件控制文件记录和维护数据库的物理结构,而且还记录了备份和恢复有关的信息,如果数据库只有一个控制文件,
那么当出现介质失败同时控制文件也损坏的时候,将导致无法装载数据库,此时如果没有控制文件备份,那会是一场灾难,
所以要多元化控制文件,而且最好分布在不同的磁盘上。
SQL>select name from v$controlfile;
初始化参数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;
关闭数据库:
SQL>shutdown immediate;
复制控制文件:
SQL>host cp /disk1/ora10g/oradata/orcl/control01.ctl /disk1/ora10g/control01.ctl
启动数据库:
SQL>startup
备份控制文件
a、将控制文件备份为二进制文件
SQL>alter database backup controlfile to 'i:\oracle\backup\control.bkp';
这种方式直接cp回去就ok www.2cto.com
b、将控制文件备份为文本文件(备份到oracle\base\admin\sid\udump目录下的跟踪文件中,将在跟踪文件中生成一个SQL脚本)
恢复也很简单,找到trace文件,打开找到类似下面内容的:
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 50M,
GROUP 2 (
'/disk1/ora10g/oradata/orcl/redo02.log',
'/disk1/ora10g/oradata/orcl/redo02B.log'
) SIZE 50M,
GROUP 3 (
'/disk1/ora10g/oradata/orcl/redo03.log',
'/disk1/ora10g/oradata/orcl/redo03B.log'
) SIZE 50M www.2cto.com
-- 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
;
直接创建为sql文件,然后通过@调用。
然后alter database open rsetlogs;
logfile多元化和备份恢复
日志查询select * from v$logfile;
select * from v$log;
手工切换日志
alter system switch logfile;
手工检查点
alter system checkpoint;
告警日志文件 www.2cto.com
show paramter dump
$ORACLE_BASE/admin/orcl/bdump
tail -f alert*.log
多元化日志文件
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;
日志文件坏了,修复日志文件(丢失了,也可以用这个恢复)
alter database clear logfile group 1;
如果未归当
alter database clear unarchived logfile group 2;
添加成员
alter database add logfile group 4;
alter database add logfile member '/opt/ora10g/oradata/orcl/redo04.log' to group 4;
删除日志组
alter database drop logfile group 4;
删除日志组成员 www.2cto.com
alter database drop logfile member '/opt/ora10g/oradata/orcl/redo01B.log';