1. 程式人生 > >在Oracle關閉的狀態下,如何修改引數檔案spfile

在Oracle關閉的狀態下,如何修改引數檔案spfile

因為一些記憶體大小設定的問題,搞不定,一上火,我直接重啟了整臺伺服器。

登入之後,啟動資料庫,還是出錯:

ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 2147483648 cannot be set to more than MEMORY_TARGET 1258291200.
ORA-01078: failure in processing system parameters

可是尼瑪,spfile是二進位制檔案,沒法修改啊,怎麼辦?

還好從網上找了些資料,還是有辦法。你碰到的問題,都會有人碰到的。

解決的辦法就是:

通過pfile啟動Oracle–>在Oracle中通過create pfile='' from spfile=''取出spfile的內容(pfile是可以手動修改的)–>修改新建的pfile–>以新的pfile啟動Oracle–>在Oracle中通過create spfile='' from pfile=''獲得修改後的spfile

具體實戰:

SQL> create pfile = '/opt/oracle/product/12.2.0/dbhome/dbs/initORCL.ora' from spfile = '/opt/oracle/product/12.2.0/dbhome/dbs/spfileORCL.ora';
File created.

SQL> startup mount pfile='/opt/oracle/product/12.2.0/dbhome/dbs/initORCL.ora';

此時,引數可能還有一些問題,但你可以開啟initORCL.ora修改了,搞定之後。

SQL> alter database open;
Database altered.


SQL> create spfile = '/opt/oracle/product/12.2.0/dbhome/dbs/spfileORCL.ora' from pfile = '/opt/oracle/product/12.2.0/dbhome/dbs/initORCL.ora';

File created.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.


Total System Global Area 1258291200 bytes
Fixed Size    8792200 bytes
Variable Size 1023412088 bytes
Database Buffers  201326592 bytes
Redo Buffers   24760320 bytes
Database mounted.
Database opened.