添加控制文件(add control file)

来源:这里教程网 时间:2026-03-03 11:59:52 作者:

1.     一致性关闭数据库

      shutdown immediate

2.     通过 spfile 创建 pfile

     create pfile from spfile ;

3.     修改 pfile ,增加一个控制文件

   vi pfile

4.     在操作系统上通过已有控制文件复制出新控制文件

    cp new control file from control file that already exist

控制文件路径是 /u01/app/oracle/product/fast_recovery_area

Pfile 中的 <ORACLE_BASE> 必须改成绝对路径,否则报错

<ORACLE_BASE> from pfile must be absolute path

ORA48140 the specified ADR Base directory does not exist [u01/app/oracle]  ORA48187 specified  directory does not exist

cd /u01/app/oracle/product/fast_recovery_area/sales

cp control02.ctl control03.ctl

5.     pfile 内容刷到 spfile

      create spfile from pfile;

     

6.     启动数据库到 nomount

      SQL>  startup nomount

  ORA-09925:Unable to create audit trail file

  Linux-x86_64 Error:2: No such file or directory

  Additional information: 9925

发现 audit 文件路径不存在, admin 下没有 orcl/adump,  创建此文件,就可解决

audit file does extist, create orcl/adump under admin to solve

 touch /u01/app/oracle/product/admin/orcl/adump

7.     启动数据库到 mount

     startup nomount

  alter database mount;

  startup

    

 

 

 

 

重建 control file (慎用,会重置 redo

recreate control file(be careful, it will reset redo log)

. SQL> alter database backup controlfile to trace as '/u01/controlfile';   database altered 

SQL> CREATE CONTROLFILE REUSE DATABASE "SALES" RESETLOGS  NOARCHIVELOG

  2      MAXLOGFILES 16

  3      MAXLOGMEMBERS 3

  4      MAXDATAFILES 100

  5      MAXINSTANCES 8

  6      MAXLOGHISTORY 292

  7  LOGFILE

  8    GROUP 1 '/u01/base/sales/redo01.log'  SIZE 50M BLOCKSIZE 512,

  9    GROUP 2 '/u01/base/sales/redo02.log'  SIZE 50M BLOCKSIZE 512,

 10    GROUP 3 '/u01/base/sales/redo03.log'  SIZE 50M BLOCKSIZE 512

 11  -- STANDBY LOGFILE

 12  DATAFILE

 13    '/u01/base/sales/system01.dbf',

 14    '/u01/base/sales/sysaux01.dbf',

 15    '/u01/base/sales/undotbs01.dbf',

 16    '/u01/base/sales/users01.dbf',

 17    '/u01/base/sales/example01.dbf'

 18  CHARACTER SET WE8MSWIN1252

 19  ;

 

Control file created.

相关推荐