我们知道数据库启动到nomount状态需要参数文件,那么参数文件丢了该怎么办呢?博主来奉上解决方法~~

创建文本文件,让数据库启动到nomount状态:

1、环境变量

[oracle@ocp dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs 
[oracle@ocp dbs]$ vi initbibi.ora
[oracle@ocp dbs]$ cat initbibi.ora
db_name=bibi    #数据库名称

[oracle@ocp ~]$ export ORACLE_SID=bibi
[oracle@ocp ~]$ echo $ORACLE_SID
bibi
[oracle@ocp ~]$ huahua

SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 25 17:35:18 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@bibi> startup
ORACLE instance started.

Total System Global Area  217157632 bytes
Fixed Size		    2251816 bytes
Variable Size		  159384536 bytes
Database Buffers	   50331648 bytes
Redo Buffers		    5189632 bytes
ORA-00205: error in identifying control file, check alert log for more info

如上报错是因为我们模拟了一个数据库,并没有创建控制文件。

不过该方法的其他值都是默认的,不实用。

2、用模板写

[oracle@ocp dbs]$ cat init.ora | grep -v ^#|grep -v ^$ >initqq.ora
[oracle@ocp dbs]$ vi initqq.ora
[oracle@ocp dbs]$ cat initqq.ora 
db_name='qq'        #数据库名称
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/qq/adump'    #告警文件路径
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'    #数据库恢复文件路径
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300 
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/qq/control1, /u01/app/oracle/oradata/qq/control2)    #控制文件
compatible ='11.2.0'

注意要去另一个终端查看以上文件夹是否存在,不存在的用mkdir -p 创建。

[oracle@ocp qq]$ export ORACLE_SID=qq
[oracle@ocp qq]$ echo $ORACLE_SID
qq
[oracle@ocp qq]$ huahua

SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 25 17:52:31 2019

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SYS@qq> startup nomount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size		    2260088 bytes
Variable Size		  671089544 bytes
Database Buffers	  390070272 bytes
Redo Buffers		    5517312 bytes

SYS@qq> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info

如上错误也是因为没有控制文件,控制文件故障怎么恢复呢?看博主的其他博客叭。

(能启动到nomount阶段,就说明参数文件没有问题。)