Oracle Controlfile 控制文件

oracle controlfile 控制文件

Oracle控制文件,管理数据库的状态及描述数据库的物理结构,是实现异步通信的重要手段之一,对保证Oracle实例的正常工作具有重要的作用。

查看控制文件信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SQL> select name from v$controlfile
SQL> select name from v$controlfile;

NAME
---------------------------------------------------------
+DATA/susu/controlfile/current.261.1029148979
+DATA/susu/controlfile/current.260.1029148979

SQL> show parameter control_files;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string +DATA/susu/controlfile/current
.261.1029148979, +DATA/susu/co
ntrolfile/current.260.10291489
79


SQL>select name,value from v$parameter where name='control_files';
SQL> select name,value from v$parameter where name='control_files';

NAME
---------------------------------------------------------
VALUE
---------------------------------------------------------
control_files
+DATA/susu/controlfile/current.261.1029148979, +DATA/susu/controlfile/current.260.1029148979

# 查看控制文件记录的内容
select * from v$controlfile_record_section;

查看控制文件的内容

1
2
3
4
5
6
7
8
9
SQL> alter session set events 'immediate trace name controlf level 8';

Session altered.

SQL> select value from v$diag_info where name='Default Trace File';

VALUE
---------------------------
/oracle/app/oracle/diag/rdbms/orcl/ORCL/trace/ORCL_ora_8575.trc

增加控制文件

1
2
3
4
5
6
7
8
9
10
SQL>alter system set control_files='/opt/oracle/data/orcl/control01.ctl','/opt/oracle/data/orcl/contorl02.ctl' scope=spfile

如果出现control file版本不一致的情况,那么把版本高的拷贝给版本低的

再执行:

SQL>alter database mount;

SQL>alter database open;

备份控制文件

1
2
3
4
5
6
7
8
9
10
# 归档模式下
alter database backup controlfile to '/opt/oracle/data/orcl/control2013.bak';

# 任何模式下
alter databae backup controlfile to trace as '';
alter database backup controlfile to trace as '/oracle/app/control180116.ora';

# rman备份
backup current controlfile;
backup database include current controlfile;