数据库中怎么添加控制文件

这篇文章主要讲解了“数据库中怎么添加控制文件”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“数据库中怎么添加控制文件”吧!

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.

感谢各位的阅读,以上就是“数据库中怎么添加控制文件”的内容了,经过本文的学习后,相信大家对数据库中怎么添加控制文件这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!