Great minds have purpose,others have wishes.
杰出的人有着目标,其他人只有愿望
控制文件是小型二进制文件,只能在mount阶段新建
1,重做控制文件
alter database backup controlfile to trace as '/home/oracle/controlfile.sql';
vim /home/oracle/controlfile.sql #删除注释,保留参数
shutdown immediate
rm -rf control0*.ctl
@/home/oracle/controlfile.sql #执行完毕后自动启动到mount状态
重做日志文件至少要有两个组成员,日志文件写满时LGWR切换
2,维护重做日志文件
select group#,status,member from v$log;
select member from v$logfile;
select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#; #多表关联查询
shutdown immediate; #只有关闭数据库才能移动日志文件
mv redo02.log
startup
tail -f $ORACLE_BASE/diag/rdbms/orcl/orcl/trace/alert_orcl.log
3,新建多磁盘日志文件
mkdir orcl
startup force mount; #控制文件中记录日志文件位置,所以加日志文件要mount状态
alter database add logfile member '/data/orcl/redo01.log' to group 1;
alter database add logfile member '/data/orcl/redo02.log' to group 2;
alter database add logfile member '/data/orcl/redo03.log' to group 3;
mv redo02a.log ../ #缺少一个日志文件后,检查能否open数据库
starup force #只能启动到mount状态
alter system switch logfile; #可以手动切换LGWR写入日志组
alter database add logfile group 4 '/data/orcl/redo04.log' size 100M; #新增日志组
alter database drop logfile group 1; #只能删除非current日志组
总结:管理重做日志文件常用的两个动态视图v$log、v$logfile
4,管理表空间跟数据文件