Modifica sga_max_size - ORA-00844: Parameter not taking MEMORY_TARGET into account ORA-00851: SGA_MAX_SIZE ******* cannot be set to more than MEMORY_TARGET ******
Il seguente post è stato effettuato su Oracle versione 11.2.0.4.0.
L'obiettivo del post è aumentare il parametro sga. Ci sono due strade.
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1472M
sga_target big integer 0
1) Il database all'avvio legge spfile
Verificare se il db parte leggendo spfile oppure init.
SQL> show parameters spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/spfileS11TEST1
.ora
Nella versione Oracle 9i invece
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string ?/dbs/spfile@.ora
Dove @ sta per sid, cioè il db all'avvio legge il file spfie<sid>.ora.
Se legge spfile allora è possibile modificare la sga con il comando alter system senza mettere "scope=both" perché, essendo un parametro di memoria, deve essere riavviato il db.
Come prima cosa farsi un backup di spfile.
SQL> CREATE PFILE='/tmp/init_S11TEST1.ora' from SPFILE;
SQL> alter system set sga_max_size=1500M scope=spfile;
System altered.
SQL> shutdown immediate;
SQL> startup;
2) Il database all'avvio legge init
Se invece il db legge il file "init" allora occorre spegnere il db e modificare con il parametro sga nel file init e poi riavviarre il db.
***************** ORA - *****************************
Ritorniamo al nostro esempio dove si è presentato un errore ORA- su memory target in fase di avvio del db.
SQL> startup;
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 1577058304 cannot be set to more than MEMORY_TARGET 1543503872.
Il file "spfile" così modificato non va più bene e quindi occorre creare un file di "init" e modificarlo come segue.
Creare un file di testo pfile.
SQL> CREATE PFILE='/tmp/init_S11TEST1.ora' from SPFILE;
Modificare nel file testo appena creato il parametro sga_max_size
$ vi /tmp/init_S11TEST1.ora
Riavviare il database facendogli leggere il file pfile.
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 23 08:23:25 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/init_S11TEST1.ora';
ORACLE instance started.
Total System Global Area 1469792256 bytes
Fixed Size 2253344 bytes
Variable Size 805309920 bytes
Database Buffers 654311424 bytes
Redo Buffers 7917568 bytes
Ricreare nuovamente il file binario spfile<sid>.ora e spegnere e riavviare il database, così che il db allo start legge il suddetto file.
SQL> create spfile='/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfileS11TEST1.ora' from pfile='/tmp/init_S11TEST1.ora';
File created.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1469792256 bytes
Fixed Size 2253344 bytes
Variable Size 805309920 bytes
Database Buffers 654311424 bytes
Redo Buffers 7917568 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
Verifica che legge spfile
SQL> show parameters spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/spfileS11TEST1
.ora
Verifica che il parametro sga è cambiato.
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1408M
sga_target big integer 0
L'obiettivo del post è aumentare il parametro sga. Ci sono due strade.
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1472M
sga_target big integer 0
1) Il database all'avvio legge spfile
Verificare se il db parte leggendo spfile oppure init.
SQL> show parameters spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/spfileS11TEST1
.ora
Nella versione Oracle 9i invece
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string ?/dbs/spfile@.ora
Dove @ sta per sid, cioè il db all'avvio legge il file spfie<sid>.ora.
Se legge spfile allora è possibile modificare la sga con il comando alter system senza mettere "scope=both" perché, essendo un parametro di memoria, deve essere riavviato il db.
Come prima cosa farsi un backup di spfile.
SQL> CREATE PFILE='/tmp/init_S11TEST1.ora' from SPFILE;
SQL> alter system set sga_max_size=1500M scope=spfile;
System altered.
SQL> shutdown immediate;
SQL> startup;
2) Il database all'avvio legge init
Se invece il db legge il file "init" allora occorre spegnere il db e modificare con il parametro sga nel file init e poi riavviarre il db.
***************** ORA - *****************************
Ritorniamo al nostro esempio dove si è presentato un errore ORA- su memory target in fase di avvio del db.
SQL> startup;
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 1577058304 cannot be set to more than MEMORY_TARGET 1543503872.
Il file "spfile" così modificato non va più bene e quindi occorre creare un file di "init" e modificarlo come segue.
Creare un file di testo pfile.
SQL> CREATE PFILE='/tmp/init_S11TEST1.ora' from SPFILE;
Modificare nel file testo appena creato il parametro sga_max_size
$ vi /tmp/init_S11TEST1.ora
Riavviare il database facendogli leggere il file pfile.
$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 23 08:23:25 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/init_S11TEST1.ora';
ORACLE instance started.
Total System Global Area 1469792256 bytes
Fixed Size 2253344 bytes
Variable Size 805309920 bytes
Database Buffers 654311424 bytes
Redo Buffers 7917568 bytes
Ricreare nuovamente il file binario spfile<sid>.ora e spegnere e riavviare il database, così che il db allo start legge il suddetto file.
SQL> create spfile='/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfileS11TEST1.ora' from pfile='/tmp/init_S11TEST1.ora';
File created.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1469792256 bytes
Fixed Size 2253344 bytes
Variable Size 805309920 bytes
Database Buffers 654311424 bytes
Redo Buffers 7917568 bytes
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
Verifica che legge spfile
SQL> show parameters spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
.4/dbhome_1/dbs/spfileS11TEST1
.ora
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
lock_sga boolean FALSE
pre_page_sga boolean FALSE
sga_max_size big integer 1408M
sga_target big integer 0