控制文件:记录数据库的名字,数据库的数据文件存放的位置。
日志文件:存放数据库中数据变化的操作日志。
1.控制文件。
结构:desc v$controlfile;
结构:desc v$controlfile;
路径:select * from v$controlfile;
2.日志文件。
结构:desc v$logfile;
路径:select * from v$logfile;
3.数据字典。
结构:desc v$database;
查看数据库名称和模式:select name,log_mode from v$database;
一、控制文件。
多路复用控制文件:
select * from v$controlfile;
alter system set control_files=
'/opt/app/oracle/oradata/orcl/control01.ctl','/opt/app/oracle/fast_recovery_area/orcl/control02.ctl','/home/oracle/control03.ctl'scope=SPFILE;
cp 旧文件 新文件
create spfile from pfile;
shutdown immediate
select * from v$controlfile;
重做控制文件:
shutdown immediate
startup nomount
alter database backup controlfile to trace as '/home/oracle/control_trace.txt';
执行sql重建语句,在control_trace.txt中可以找到。
select * from v$controlfile;
alter system set control_files=
'/opt/app/oracle/oradata/orcl/CONTROL01.CTL',
'/opt/app/oracle/fast_recovery_area/orcl/CONTROL02.CTL',
'/home/oracle/CONTROL03.CTL'
scope=SPFILE;
shutdown immediate
startup
二、日志文件。
新建日志组:
ALTER DATABASE ADD LOGFILE GROUP 7 ('/opt/app/oracle/oradata/orcl/redo05.log') SIZE 15M;
新建日志文件:
ALTER DATABASE ADD LOGFILE MEMBER '/opt/app/oracle/oradata/orcl/redo06.log' TO GROUP 7;
删除日志组:
ALTER DATABASE DROP LOGFILE GROUP 7;
删除日志:
ALTER DATABASE DROP LOGFILE MEMBER '/opt/app/oracle/oradata/orcl/redo04.log';
查看日志:
SELECT * FROM v$logfile;
SELECT group#,members,status FROM v$log;
切换日志:
alter system switch logfile;
评论回复