天天看點

Oracle pfile和spfile啟動

 PFILE是文本檔案的,而SPFILE是二進制格式的。PFILE檔案可以用文本編輯器打開手工配置、而SPFILE不行,隻能通過SQL指令線上修改。從作業系統上可以看到這兩者的差別,初始化參數檔案為ASCII文本檔案,SPFILE為資料檔案。

Oracle pfile和spfile啟動
Oracle pfile和spfile啟動

在此期間隻能pfile啟動:

Oracle pfile和spfile啟動

[email protected]>startup pfile='/opt/oracle/admin/orcl/pfile/init.ora.421201433344';

ORACLE instance started.

Total System Global Area  413372416 bytes

Fixed Size                  2253784 bytes

Variable Size             327158824 bytes

Database Buffers           79691776 bytes

Redo Buffers                4268032 bytes

Database mounted.

Database opened.

在建立spfile:

create spfile from pfile;

Oracle pfile和spfile啟動

在關閉資料庫:

[email protected]>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

Oracle pfile和spfile啟動

再啟動資料庫:

Oracle pfile和spfile啟動

[email protected]>startup

ORA-48108: invalid value given for the diagnostic_dest init.ora parameter

ORA-48140: the specified ADR Base directory does not exist [/opt/oracle/product/OraHome/dbs/<ORACLE_BASE>]

ORA-48187: specified directory does not exist

Linux-x86_64 Error: 2: No such file or directory

Additional information: 1

用pfile就可以啟動為啥建立了spfile還是不能用呢?

後來發現問題了:

啟動的pfile并不是預設路徑的pfile,而oracle預設路徑的pfile在$ORACLE_HOME/dbs下。

于是,當你create spfile from pfile的時候,spfile其實是根據預設路徑下的pfile建立出來的。

而很有可能,你預設路徑下的pfile參數設定時有問題的,是以我用下面這個方法建立spfile:

Oracle pfile和spfile啟動

[email protected]>create spfile from pfile='/opt/oracle/admin/orcl/pfile/init.ora.421201433344';

File created.

再次啟動資料庫就可以了:

Oracle pfile和spfile啟動

[email protected]>startup

ORACLE instance started.

Total System Global Area  413372416 bytes

Fixed Size                  2253784 bytes

Variable Size             327158824 bytes

Database Buffers           79691776 bytes

Redo Buffers                4268032 bytes

Database mounted.

Database opened.

是以在使用create pfile / spfile  from spfile / spfile 時都是建立預設路徑