Maintaining the Control File

来源:互联网 发布:锦纶 氨纶 涤纶 知乎 编辑:程序博客网 时间:2024/06/11 02:07

1.Control file 作用( small binary file , defines the current state of the physical database , server 自动修改,不能手动修改 )

  • 2进制文件 small 几十 MB
  • 没有control file 必须恢复数据库到有control file时
  • 在mount状态下读取( 跟之前的开启数据库是相关的 )
  • 是被需要的
  • 只能连接到唯一一个数据库上
  • 应该多几分control file(备份) 多路
  • 系统自动更新control file
  • 大小在 create database 时进行初始化
  • 最少需要1个control file , 可以被多路复用, 最多可以有8个.

MAXLOGFILES

MAXLOGMEMBERS

MAXLOGHISTORY

MAXDATAFILES

MAXINSTANCES

2.Control file 内容

  • Database name and identifier  ->  parameter DB_NAME or the name used in the create database statement.
  • Time stamp of database creation ( is also recorded at database creation )
  • Tablespace names ( is updated as tablespaces are added or dropped )
  • Names and locations of data files and redo log files ( are updated when a data file or redo log is added to , rename in , dropped from the database )
  • Redo log history is recorded during log switches .
  • Current redo log file sequence number ( is recorded when log switches occur )
  • Checkpoint information ( is recorded as checkpoints are made )
  • Begin and end of undo segments
  • Redo log archive information ( are recorded when archiving occurs )
  • Backup information ( are recorded by the Recovery Manager utility )
  • The control file consists of two types of sections : ( Reusable , Not reusable ) reusable为了备份准备的

3.多路技术 Multiplexing the Control File

ALTER SYSTEM SET control files = '$HOME/ORADATA/u01/ctrl01.ctl' , '$HOME/ORADATA/u02/ctrl02.ctl' SCOPE = SPFILE ;

最好是放在不同的磁盘上, 最多可以 8 路一起备份.

惫份control file : ALTER DATABASE BACKUP CONTROFILE TO 'FILENAME'

在parameter中的 CONTROL_FILES 维护 control files , CONTROL_FILES=$HOME/ORADATA/u01/ctrl01.ctl, $HOME/ORADATA/u02/ctrl02.ctl

如果想增加control  file,只需要关闭数据库,然后复制一份control file,保存在别的磁盘之后,在parameter file中添加。initSid.ora

位置 保存在参数 DB_CREATE_ONLINE_LOG_DEST_N, 名称可以在 alertSID.log文件中查看到.

写入 control file 时是同时写入,内容一样,并且推荐放到不同的物理磁盘上,但是从contrl file中读入到内存时,只是从第一个control file中读取

4.查询control file中的内容( 从 data dictionary )

V$CONTROLFILE , lists the name and status of all control files associated with the instance.

V$PARAMETER , lists status and location of all parameters.

V$CONTROLFILE_RECORD_SECTION , provides information about the control file record sections.

SHOW PARAMETERS CONTROL_FILES , list the name , status, and location of the control files.

 

v$backup

v$datafile

v$tempfile

v$tablespace

v$archive

v$log

v$logfile

v$loghist

v$archived_log

v$datebase

个人总结
control file 由于不能手动修改, 所以主要是做好多路复用就可以了.

另外, 就是要知道control file 中包含哪些内容

手动创建数据库时, 不需要 control file , 只需要在参数文件中指定 control file 的路径, 但是 好像不需要真正有control file在那, 而数据库创建过程中, 会自动创建 control file.

 

 

原创粉丝点击