背景:由於操作失誤,修改了參數,例如修改sga_target過小,導致數據庫重啓是無法啓動。而spfile無法直接修改,所以得先使用pfile取出spfile然後進行修改。操作過程在集羣的其中一個節點操作即可
1,找到oracle rac 的spfile,大概是這個路徑,具體可能不一致。
root@gsrzdb01 ~# su - grid
alias ls='ls --color=auto'
-bash: alias: =ls --color: not found
[grid@gsrzdb01 ~]$ asmcmd -p
ASMCMD [+] > cd D*
ASMCMD [+DATA] > cd *
ASMCMD [+DATA/GSRZDB] > ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilegsrzdb.ora
ASMCMD [+DATA/GSRZDB] > pwd
+DATA/GSRZDB
ASMCMD [+DATA/GSRZDB] >
2,創建pfile。
oracle@gsrzdb01 ~> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 7 16:00:21 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile='/home/oracle/newpfile.ora' from spfile='+DATA/GSRZDB/spfilegsrzdb.ora';
File created.
SQL>
3,修改pfile中的參數,並使用修改後的pfile啓動數據庫。
oracle@gsrzdb01 ~> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 7 16:06:25 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/home/oracle/newpfile.ora';
ORACLE instance started.
Total System Global Area 8.0171E+10 bytes
Fixed Size 2261848 bytes
Variable Size 1.3959E+10 bytes
Database Buffers 6.6035E+10 bytes
Redo Buffers 175083520 bytes
Database mounted.
Database opened.
SQL>
4,創建spfile.
oracle@gsrzdb01 ~> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 7 16:08:09 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> create spfile='+DATA/GSRZDB/spfilegsrzdb.ora' from pfile='/home/oracle/newpfile.ora';
File created.
SQL>
5,重啓數據庫。
oracle@gsrzdb01 ~> sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Aug 7 16:09:33 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 8.0171E+10 bytes
Fixed Size 2261848 bytes
Variable Size 1.3959E+10 bytes
Database Buffers 6.6035E+10 bytes
Redo Buffers 175083520 bytes
Database mounted.
Database opened.
SQL>