如果错误的修改了参数文件导致数据库不能启动,由于spfile是采用的二进制文件,不能直接修改。
可以通过spfile创建pfile,手动修改pfile,利用pfile启动数据库,然后再通过pfile创建spfile:
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 113249576 bytes
Database Buffers 50331648 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter sga_t
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_target big integer 160M
SQL> alter system set sga_target=0m scope=spfile;
系统已更改。
SQL> shutdown abort
ORACLE 例程已经关闭。
SQL> startup
ORA-00371: not enough shared pool memory, should be atleast 72265318 bytes
SQL> create pfile from spfile;
文件已创建。
--这里手动打开pfile文件看见里面的*.sga_target=0,我把它修改为:*.sga_target=167772160然后保存。
--167772160=160*1024*1024,可以看出我的sga_target为160M
SQL> startup pfile = '/u01/app/oracle/product/10.2.0/db_1/dbs/initorcl.ora'
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 113249576 bytes
Database Buffers 50331648 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。
SQL> create spfile from pfile;
文件已创建。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 113249576 bytes
Database Buffers 50331648 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。
如果不是采用的文件系统,而是采用的asm,可以看见dbs目录下面有个initorcl.ora
[oracle@linux dbs]$ cat initorcl.ora
SPFILE='+DATADG/orcl/spfileorcl.ora'
真正的参数文件也是使用的spfile,而且是保存在asm磁盘组的,下面还有一种解决参数文件错误的思路:
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 83889448 bytes
Database Buffers 79691776 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter sga_t
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_target big integer 160M
SQL> alter system set sga_target=0m scope=spfile;
系统已更改。
SQL> shutdown abort
ORACLE 例程已经关闭。
SQL> startup
ORA-00371: not enough shared pool memory, should be atleast 72265318 bytes
SQL> !
[oracle@linux dbs]$ vi initorcl.ora
SPFILE='+DATADG/orcl/spfileorcl.ora'
*.sga_target=167772160
"initorcl.ora" 2L, 60C 已写入
[oracle@linux dbs]$ exit
exit
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 83889448 bytes
Database Buffers 79691776 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。
SQL> alter system set sga_target=160m scope=spfile;
系统已更改。
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> !
[oracle@linux dbs]$ vi initorcl.ora
SPFILE='+DATADG/orcl/spfileorcl.ora'
"initorcl.ora" 1L, 37C 已写入
[oracle@linux dbs]$ exit
exit
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 167772160 bytes
Fixed Size 1266392 bytes
Variable Size 83889448 bytes
Database Buffers 79691776 bytes
Redo Buffers 2924544 bytes
数据库装载完毕。
数据库已经打开。