Oracle管理控制文件

控制文件

一.控制文件

The control file is a binary file that defines thecurrent state of the physical database.控制文件是一个二进制文件,用于定义物理数据库的当前状态。

  • Loss of the control file requires recovery。 –控制文件丢失需要恢复
  • ls read at MOUNT stage。 –在MOUNT阶段读取
  • ls required to operate。 –需要操作
  • ls linked to a single database 。 –链接到单个数据库
  • Should be multiplexed。 –应多路传输
  • Maintains integrity of database 。 –维护数据库的完整性
  • Sized initially by CREATE DATABASE。 –最初由CREATE DATABASE确定大小

二.控制文件作用

加载数据库

三.控制文件内容

控制文件包含以下内容

  • Database name and identifier –数据库名称和标识符
  • Time stamp of database creation –数据库创建时间戳
  • Tablespace names –表空间名称
  • Names and locations of data files and redo log files --数据文件和重做日志文件的名称和位置
  • Current redo log file sequence number –当前重做日志文件序列号
  • Checkpoint information --检查点信息
  • Begin and end of undo segments –撤消段的开始和结束
  • Redo log archive information –恢复日志存档信息
  • Backup information –备份信息

四.查看控制文件内容

1.初始化参数查看

show parameter control_files;

2.数据字典查看

select  name from v$datafile

3.获取控制文件信息

Information about control file status and locationscan be retrieved by querying the data dictionary。通过查询数据字典可以检索有关控制文件状态和位置的信息。

  • V$CONTROLFILE: Lists the name and status of allcontrol files
    associated with the instance. —列出与实例关联的所有控制文件的名称和状态
  • V$PARAMETER: Lists status and location of allparameters. –列出所有参数的状态和位置
  • V$CONTROLFILE_RECORD_SECTION: Providesinformation about the control file record sections. –提供有关控制文件记录部分的信息
  • SHOW PARAMETERS CONTROL FILES: List thename, status, and location of the control files. –列出控制文件的名称、状态和位置。

4.通过Oradebug将控制文件转化为文本文件

lsnrctl start   ---数据库监听启用

sqlplus / as sysdba   --访问oracle数据库

startup    --启动数据库

Oradebug  help   --查看相应命令使用

Oradebug  setmypid   --设置当前进程

Oradebug  dump  controlf 3   --转储控制文件

Oradebug   tracefile_name  --查看转储控制文件路径地址

gedit  addr   --用文本编译器查看文件内容

五.多路复用控制文件

1.创建控制文件多路复用文件地址

mkdir  -p  /u01/demo/sales/controlfile

2.创建多路复用控制文件

alter system set control_files='/u01/app/oracle/pradata/sales/control01.ctl','/u01/app/oracle/fast_recovery_area/sales/control02.ctl','/u01/demo/sales/controlfile/control03.ctl' scop=spfile;

3.关闭数据库

shutdown   immediate

4.拷贝控制文件到复用地址

cp   /u01/app/oracle/fast_recovery_area/sales/control02.ctl   /u01/demo/sales/controlfile/control03.ctl

5.启动数据库

startup

6.查看控制文件确认是否创建

show parameter control_files

select  name from v$datafile

六.处理控制文件全部损坏问题

备份产生控制文件语句

alter database backup controlfile to trace as'/u01/demo/create_controlf.txt';

查看文件内容

cat  /u01/demo/create_controlf.txt

数据库启动

startup   nomount

创建控制文件语句

CREATE CONTROLFILE REUSE DATABASE "SALES" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 30
MAXINSTANCES 1
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/sales/redo01.log' SIZE 10M BLOCKSIZE 512,
GROUP 2 '/u01/app/oracle/oradata/sales/redo02.log' SIZE 10M BLOCKSIZE 512,
GROUP 3'/u01/app/oracle/oradata/sales/redo03.log'  SIZE 10M BLOCKSIZE 512
DATAFILE
'/u01/app/oracle/oradata/sales/system01.dbf',
'/u01/app/oracle/oradata/sales/sysaux01.dbf',
'/u01/app/oracle/oradata/sales/undotbs01.dbf',
'/u01/app/oracle/oradata/sales/users01.dbf',
CHARACTER SET US7ASCII;

查看数据库状态

select status from v$instance
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值