When doing Database In-Memory experiments, it often happens that the memory parameters are set incorrectly, causing the database to fail to start. For example, the inmemory_size is set too large, or there is no unit when setting. At this point you need to restore the spfile. This article discusses the recovery process when the spfile is in ASM.
The error when starting the database is:
[oracle@bigt01 dbim]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 02:18:19 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-00600: internal error code, arguments: [ktsima_get_poolsize-1], [13421770], [16777216], [], [], [], [], [], [], [], [], []
SQL>
Get the current spfile location from srvctl:
# 获取数据库名
$ srvctl config
DB0410_nrt1pv
# 获取数据库配置,其中有spfile的位置
$ srvctl config database -d DB0410_nrt1pv
Database unique name: DB0410_nrt1pv
Database name: DB0410
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/DB0410_NRT1PV/PARAMETERFILE/spfile.262.1133756061
Password file:
Domain: sub07290808380.training.oraclevcn.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECO,DATA
Mount point paths: /opt/oracle/dcs/commonstore
Services: DB0410_orclpdb1.paas.oracle.com
Type: SINGLE
OSDBA group: dba
OSOPER group: dbaoper
Database instance: DB0410
Configured nodes: bigt02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
Of course, running asmcmd as the grid user can also get its location:
$ asmcmd
ASMCMD> lsdg
State Type Rebal Sector Logical_Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 512 4096 4194304 1048576 706888 0 706888 0 Y DATA/
MOUNTED EXTERN N 512 512 4096 4194304 524288 520956 0 520956 0 N RECO/
ASMCMD> cd DATA/
ASMCMD> cd DB0410_NRT1PV/
ASMCMD> cd PARAMETERFILE/
ASMCMD> ls -l
Type Redund Striped Time Sys Name
PARAMETERFILE UNPROT COARSE APR 26 02:00:00 Y spfile.262.1133756061
Once you know its location, you can create a pfile based on it:
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 11:45:43 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile from spfile='&1';
Enter value for 1: +DATA/DB0410_NRT1PV/PARAMETERFILE/spfile.262.1133756061
old 1: create pfile from spfile='&1'
new 1: create pfile from spfile='+DATA/DB0410_NRT1PV/PARAMETERFILE/spfile.262.1133756061'
File created.
The default location of pfile is in $ORACLE_HOME/dbs, obviously this example is initDB0410.ora
:
$ date
Wed Apr 26 11:47:44 UTC 2023
[oracle@bigt02 bigtable]$ ll $ORACLE_HOME/dbs
total 16
-rw-rw---- 1 oracle asmadmin 1544 Apr 25 23:59 hc_DB0410.dat
-rw-r--r-- 1 oracle asmadmin 2408 Apr 26 11:46 initDB0410.ora
-rw-r--r-- 1 oracle oinstall 3079 May 14 2015 init.ora
-rw-r----- 1 oracle oinstall 2048 Apr 10 04:07 orapwDB0410
Let's take a look at this file:
$ cat $ORACLE_HOME/dbs/initDB0410.ora
DB0410.__data_transfer_cache_size=0
DB0410.__db_cache_size=13153337344
DB0410.__inmemory_ext_roarea=0
DB0410.__inmemory_ext_rwarea=0
DB0410.__java_pool_size=0
DB0410.__large_pool_size=167772160
DB0410.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DB0410.__pga_aggregate_target=12482248704
DB0410.__sga_target=49928994816
DB0410.__shared_io_pool_size=134217728
DB0410.__shared_pool_size=1946157056
DB0410.__streams_pool_size=0
DB0410.__unified_pga_pool_size=0
*._datafile_write_errors_crash_instance=false
*._db_writer_coalesce_area_size=16777216
*._disable_interface_checking=TRUE
*._enable_numa_support=FALSE
*._file_size_increase_increment=2143289344
*._fix_control='18960760:on'
*._gc_policy_time=20
*._gc_undo_affinity=TRUE
*.audit_file_dest='/u01/app/oracle/admin/DB0410_nrt1pv/adump'
*.audit_sys_operations=TRUE
*.audit_trail='db'
*.compatible='19.0.0.0'
*.control_files='+RECO/DB0410_NRT1PV/CONTROLFILE/current.256.1133755633'
*.control_management_pack_access='DIAGNOSTIC+TUNING'
*.cpu_count=0
*.cursor_sharing='EXACT'
*.db_block_checking='OFF'
*.db_block_checksum='TYPICAL'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_create_online_log_dest_1='+RECO'
*.db_domain='sub07290808380.training.oraclevcn.com'
*.db_files=1024
*.db_lost_write_protect='TYPICAL'
*.db_name='DB0410'
*.db_recovery_file_dest='+RECO'
*.db_recovery_file_dest_size=511g
*.db_unique_name='DB0410_nrt1pv'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DB0410XDB)'
*.enable_ddl_logging=TRUE
*.enable_pluggable_database=true
*.encrypt_new_tablespaces='ALWAYS'
*.fast_start_mttr_target=300
*.filesystemio_options='setall'
*.global_names=TRUE
*.inmemory_size=51539607552
*.local_listener='LISTENER_DB0410'
*.log_archive_format='%t_%s_%r.dbf'
*.log_buffer=134217728
*.memory_target=0
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=1000
*.os_authent_prefix='ops$'
*.parallel_execution_message_size=16384
*.parallel_threads_per_cpu=2
*.pga_aggregate_limit=24964497408
*.pga_aggregate_target=12482248704
*.processes=1200
*.remote_login_passwordfile='EXCLUSIVE'
*.session_cached_cursors=100
*.sga_target=49928994816
*.spatial_vector_acceleration=TRUE
*.sql92_security=TRUE
*.tde_configuration='keystore_configuration=FILE'
*.undo_retention=900
*.undo_tablespace='UNDOTBS1'
*.use_large_pages='only'
*.wallet_root='/opt/oracle/dcs/commonstore/wallets/DB0410_nrt1pv'
The culprit is here, the previously set 50G is too large:
*.inmemory_size=51539607552
Adjust its value to a small value, in this example set to 42G:
*.inmemory_size=42G
The pfile is correct, and now the database can be started with pfile:
startup pfile='initDB0410.ora';
create spfile='+DATA' from memory;
shutdown immediate;
We can see that the location of the spfile has changed:
$ srvctl config database -d DB0410_nrt1pv
Database unique name: DB0410_nrt1pv
Database name: DB0410
Oracle home: /u01/app/oracle/product/19.0.0.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/DB0410_NRT1PV/PARAMETERFILE/spfile.290.1135166043
Password file:
Domain: sub07290808380.training.oraclevcn.com
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools:
Disk Groups: RECO,DATA
Mount point paths: /opt/oracle/dcs/commonstore
Services: DB0410_orclpdb1.paas.oracle.com
Type: SINGLE
OSDBA group: dba
OSOPER group: dbaoper
Database instance: DB0410
Configured nodes: bigt02
CSS critical: no
CPU count: 0
Memory target: 0
Maximum memory: 0
Default network number for database services:
Database is administrator managed
Everything works fine, now the database is ready to start:
$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 26 11:56:31 2023
Version 19.18.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 4.9929E+10 bytes
Fixed Size 9304376 bytes
Variable Size 922746880 bytes
Database Buffers 3758096384 bytes
Redo Buffers 141688832 bytes
In-Memory Area 4.5097E+10 bytes
Database mounted.
Database opened.
reference: