ITPub博客

首页 > 数据库 > Oracle > 添加控制文件(add control file)

添加控制文件(add control file)

原创 Oracle 作者:wwwwwwYL 时间:2018-09-15 14:01:37 0 删除 编辑

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.


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

上一篇: Database backup
请登录后发表评论 登录
全部评论

注册时间:2018-08-10

  • 博文量
    7
  • 访问量
    7649