Oracle服务器重启时,Oracle无法正常启动,经过一番学习,总算解决问题,在这里做个笔记,备用!
问题如下:
使用Oracle用户登录:
>sqlplus /nolog
然后,
>connect /as sysdba
--提示连接上。
>startup
启动Oracle提示错误如下:
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/opt/oracle/product/10g/dbs/initorc1.ora'
因为ORACLE在启动的时候会首先去找spfile文件,如果没有则会去找pfile,但是2个文件都没有,所有报错。
可使用默认的init.ora文件,然后重新配置。
>cd /opt/oracle/product/10g/dbs
>cp init.ora initorc1.ora
再尝试启动Oracle
又出现新的错误,如下:
ORA-00371: not enough shared pool memory, should be atleast 62198988 bytes
因为startup的 时候是从pfile里读取shared pool memory值,所以手动修改为大于62198988的值。
>vi initorcl.ora
shared_pool_size = 70000000
再尝试启动,发现又报错:
SQL> startup;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1217932 bytes
Variable Size 96471668 bytes
Database Buffers 4194304 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
我的理解是默认的控制文件出问题,所以,手工重建一个。把数据库startup到nomount状态,重建一个新的控制文件:
>startup nomount
ORACLE instance started.
>create controlfile reuse database 'orcl' noresetlogs noarchivelog
2 maxlogfiles 16
3 maxlogmembers 3
4 maxdatafiles 100
5 maxinstances 8
6 maxloghistory 292
7 logfile
8 group 1 '/opt/oracle/oradata/orcl/redo01.log' size 50M,
9 group 2 '/opt/oracle/oradata/orcl/redo02.log' size 50M,
10 group 3 '/opt/oracle/oradata/orcl/redo03.log' size 50M
11 datafile
12 '/opt/oracle/oradata/orcl/system01.dbf',
13 '/opt/oracle/oradata/orcl/undotbs01.dbf',
14 '/opt/oracle/oradata/orcl/sysaux01.dbf',
15 '/opt/oracle/oradata/orcl/users01.dbf',
16 '/opt/oracle/oradata/orcl/example01.dbf'
17 character set we8iso8859p1
18 ;
Control file created.
SQL> alter database open;
Database altered.
此时,再启动Oracle。可以成功启动,接着启动Listener,发现我的数据库(DESC=***)没有注册到listener上,所以我连接上去出现以下错误:
ORA-12505,TNS:listener does not currently know of SID given in connect descriptor
再次使用Oracle用户登录,
>lsnrctl status
发现我知道SID确实没有注册到listener,接着打开listener.ora文件,修改
>cd /opt/oracle/product/10.2.0/db/network/admin
>vi listener.ora
在SID_LIST增加
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /opt/oracle/product/10.2.0/db)
(SID_NAME = orcl)
)
保存,重启listener,数据库可以正常连上。