ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 有关控制文件的学习(一):

有关控制文件的学习(一):

原创 Linux操作系统 作者:orchidllh 时间:2005-04-15 00:00:00 0 删除 编辑

试验环境:SunOS 5.7 ORACLE 8.1.7.0
首先试验的是丢失单个控制文件的情况:

察看控制文件的情况:
SQL> show parameter control_files

NAME                                 TYPE    VALUE                        
------------------------------------ --------------------------------   ------------------------------
control_files                        string    /home2/oracle/oradata/SID/control01.ctl, /home3/oracle/oradata/SID/control02.ctl

有两个控制文件,分别在home2和home3上面,然后将home3上面的那个挪走了。


# mv control02.ctl ../.

sqlplus 的操作没有发现什么问题,shutdown数据库:
SQL> shutdown immediate
ORA-24323: value not allowed
ORA-03113: end-of-file on communication channel

再登陆:
$ sqlplus "/as sysdba"

SQL*Plus: Release 8.1.7.0.0 - Production on Fri Apr 15 17:04:22 2005

(c) Copyright 2000 Oracle Corporation.  All rights reserved.

Connected to an idle instance.

察看bdump目录下的日志文件:
$ cat ckpt_7205.trc
/home2/oracle/SIDin/SID/bdump/ckpt_7205.trc
Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
With the Partitioning option
JServer Release 8.1.7.0.0 - Production
ORACLE_HOME = /home2/oracle/product/817
System name:    SunOS
Node name:      oraad.163.com
Release:        5.7
Version:        Generic_106542-23
Machine:        i86pc
Instance name: SID
Redo thread mounted by this instance: 1
Oracle process number: 5
Unix process pid: 7205, image:
oracle@oraad.163.com (CKPT)

*** 2005-04-15 17:04:11.265
*** SESSION ID:(4.1) 2005-04-15 17:04:11.235
ORA-00206: error in writing (block 19, # blocks 1) of controlfile
ORA-00202: controlfile: '/home3/oracle/oradata/SID/control02.ctl'
ORA-27041: unable to open file
Intel SVR4 UNIX Error: 2: No such file or directory
Additional information: 3
error 221 detected in background process

$ tail -50 alert_SID.log
....
Fri Apr 15 17:04:11 2005
Errors in file /home2/oracle/SIDin/SID/bdump/ckpt_7205.trc:
ORA-00206: error in writing (block 19, # blocks 1) of controlfile
ORA-00202: controlfile: '/home3/oracle/oradata/SID/control02.ctl'
ORA-27041: unable to open file
Intel SVR4 UNIX Error: 2: No such file or directory
Additional information: 3
Fri Apr 15 17:04:11 2005
CKPT: terminating instance due to error 221
Instance terminated by CKPT, pid = 7205

修改$ORACLE_HOME/dbs/initSID.ora
control_files = ("/home2/oracle/oradata/SID/control01.ctl", "/home3/oracle/oradata/SID/control02.ctl")
改成:
control_files = ("/home2/oracle/oradata/SID/control01.ctl")

启动数据库:
SQL> startup pfile = $ORACLE_HOME/dbs/initSID.ora
ORACLE instance started.

Total System Global Area  548925600 bytes
Fixed Size                    73888 bytes
Variable Size             260485120 bytes
Database Buffers          286720000 bytes
Redo Buffers                1646592 bytes
Database mounted.
Database opened.

察看参数:
SQL> show parameter control_files

NAME                                 TYPE    VALUE                        
------------------------------------ --------------------------------   ------------------------------
control_files                        string    /home2/oracle/oradata/SID/control01.ctl

已经可以重新启动了。

将挪出的控制文件挪回去:
# mv ../control02.ctl .

把参数文件修改回原来的样子

重启数据库:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup    
ORACLE instance started.

Total System Global Area  548925600 bytes
Fixed Size                    73888 bytes
Variable Size             260485120 bytes
Database Buffers          286720000 bytes
Redo Buffers                1646592 bytes
ORA-00214: controlfile '/home2/oracle/oradata/SID/control01.ctl' version 2069
inconsistent with file '/home3/oracle/oradata/SID/control02.ctl' version 2061

提示两个控制文件的版本不同。
呵呵,原来这个已经不好使了。
将home2的控制文件拷贝到home3:
$ cp /home2/oracle/oradata/SID/control01.ctl /home3/oracle/oradata/SID/control02.ctl

再重启数据库:
SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area  548925600 bytes
Fixed Size                    73888 bytes
Variable Size             260485120 bytes
Database Buffers          286720000 bytes
Redo Buffers                1646592 bytes
Database mounted.
Database opened.

启动成功。
察看初始化参数:
SQL> show parameter control_files

NAME                                 TYPE    VALUE                        
------------------------------------ --------------------------------   ------------------------------
control_files                        string    /home2/oracle/oradata/SID/control01.ctl, /home3/oracle/oradata/SID/control02.ctl

所以,在有控制文件的情况下,增加一个控制文件是很简单的:
shutdown数据库->cp control01.ctl control03.ctl->修改init.ora->startup->ok

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/51862/viewspace-180633/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-21

  • 博文量
    180
  • 访问量
    882780