有时候修改过SGA,导致 ORACLE 启动不了,这需要手动 修改 MEMORY_TARGET

1.内存减小导致ORACLE启动不了
Last login: Sun Nov  4 15:09:06 2012 from 192.168.5.222 
[oracle@h1 ~]$ sqlplus "/as SYSDBA"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 4 15:26:59 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup pfile=/app/oracle/admin/orcl/pfile/init.ora.103201271612 
ORA-00845: MEMORY_TARGET not supported on this system 
SQL> shutdown abort      
ORACLE instance shut down. 
SQL> startup pfile=/app/oracle/admin/orcl/pfile/init.ora.103201271612 force 
ORA-00845: MEMORY_TARGET not supported on this system 
SQL> exit 
Disconnected
#---------解决:扩展内存
#-------- pfile位置:$ORACLE_BASE/admin/[$ORACLE_SID]/pfile/init.ora.*
2.扩展内存后,按pfile启动,但sfile修改不了
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 4 16:00:25 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup pfile=/app/oracle/admin/orcl/pfile/init.ora.103201271612 force 
ORACLE instance started.
#---------- 按ORACLE PFILE 启动
Total System Global Area 1219260416 bytes 
Fixed Size                  2212856 bytes 
Variable Size             738200584 bytes 
Database Buffers          469762048 bytes 
Redo Buffers                9084928 bytes 
Database mounted. 
Database opened. 
SQL> alter system set memory_max_target=1258200M scope=both; 
alter system set memory_max_target=1258200M scope=both 
                 * 
ERROR at line 1: 
ORA-02095: specified initialization parameter cannot be modified

SQL> alter system set memory_max_target=1258200M scope=spfile; 
alter system set memory_max_target=1258200M scope=spfile 

ERROR at line 1: 
ORA-32001: write to SPFILE requested but no SPFILE is in use//spfile文件可能不存在
#-------------/app/oracle/product/11.2.0/dbhome_2/dbs/----------------存放spfile
3.临时建立SPFILE
[oracle@h1 dbs]$ ls 
hc_orcl.dat  init.ora  lkORCL  orapworcl
 
SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down
SQL> startup nomount 
ORA-01078: failure in processing system parameters 
LRM-00109: could not open parameter file '/app/oracle/product/11.2.0/dbhome_2/dbs/initorcl.ora'
#------------------------------spfile不存在
#-----------------------------spfile位置:$ORACLE_HOME/dbs/init[ORACLE_SID].ora
#-----------------------------名字格式为:initORACLE_SID.ora
[oracle@h1 dbhome_2]$ cd /app/oracle/admin/orcl/pfile/ 
[oracle@h1 pfile]$ ls 
init.ora.103201271612
 
[oracle@h1 pfile]$echo $ORACLE_SID
orcl
#-------------------查看环境变量$ORACLE_SID
[oracle@h1 pfile]$ cp init.ora.103201271612 /app/oracle/product/11.2.0/dbhome_2/dbs
[oracle@h1 pfile]$ cd /app/oracle/product/11.2.0/dbhome_2/dbs
[oracle@h1 dbs]$ mv init.ora.103201271612   initorcl.ora
#------------------------------更改名字格式为:initORACLE_SID.ora
 
4.mount数据库
 
[oracle@h1 dbs]$ sqlplus "/as SYSDBA"
SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 4 16:59:09 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup mount 
ORACLE instance started.
Total System Global Area 1219260416 bytes 
Fixed Size                  2212856 bytes 
Variable Size             738200584 bytes 
Database Buffers          469762048 bytes 
Redo Buffers                9084928 bytes 
Database mounted. 
SQL>
 
SQL> show parameter memory_target;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
memory_target                        big integer 1168M 
SQL> show parameter memory_max_target;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
memory_max_target                    big integer 1168M 
SQL>         
SQL>  alter system set memory_max_target=1G scope=spfile; 
alter system set memory_max_target=1G scope=spfile 

ERROR at line 1: 
ORA-32001: write to SPFILE requested but no SPFILE is in use

SQL> show parameter spfile;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
spfile                               string
#------------------重建spfile  
SQL> create spfile from pfile;
File created.

SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL>  startup 
ORACLE instance started.
Total System Global Area 1219260416 bytes 
Fixed Size                  2212856 bytes 
Variable Size             738200584 bytes 
Database Buffers          469762048 bytes 
Redo Buffers                9084928 bytes 
Database mounted. 
Database opened. 
SQL> show parameter spfile;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
spfile                               string      /app/oracle/product/11.2.0/dbh 
                                                 ome_2/dbs/spfileorcl.ora
 
SQL> alter system set memory_max_target=1G scope=spfile;
System altered.
 
SQL> alter system set memory_target=1G scope=both;
System altered.
 
SQL> alter system set memory_max_target=1332M scope=both; 
alter system set memory_max_target=1332M scope=both 
                 * 
ERROR at line 1: 
ORA-02095: specified initialization parameter cannot be modified
 
SQL> alter system set memory_max_target=1332M scope=spfile;
 
System altered.
-------------------------------
SQL> shutdown immediate 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL> startup 
ORACLE instance started.
Total System Global Area 1402982400 bytes 
Fixed Size                  2213296 bytes 
Variable Size             922749520 bytes 
Database Buffers          469762048 bytes 
Redo Buffers                8257536 bytes 
Database mounted. 
Database opened. 
SQL> show parameter memory_max_target;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
memory_max_target                    big integer 1344M 

SQL> show parameter memory_target;
NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
memory_target                        big integer 1G 
SQL>
-----------------------finish

本文出自 “nest” 博客,请务必保留此出处http://cswggod.blog.51cto.com/4569505/1050039

这个错误是在使用 Oracle 数据库时出现的,它表示你尝试将 SGA_MAX_SIZE 参数设置为比 MEMORY_TARGET 参数更大的值,这是不允许的。SGA_MAX_SIZE 是指定 SGA(System Global Area)最大大小的参数,而 MEMORY_TARGET 是指定 SGA 和 PGA(Process Global Area)总大小的参数。 在 Oracle 11g 及更高版本中,Oracle 推荐使用 MEMORY_TARGET 参数来管理 SGA 和 PGA 的大小,而不是手动设置 SGA_MAX_SIZE 和 PGA_AGGREGATE_TARGET 参数。这是因为使用 MEMORY_TARGET 可以更好地优化内存使用,提高系统性能。 因此,要解决这个错误,你需要调整 SGA_MAX_SIZE 和 MEMORY_TARGET 参数的值,使它们保持一致或者 MEMORY_TARGET 的值更大。你可以通过修改 Oracle 数据库的参数文件(init.ora 或 spfile)来更改这些参数的值。具体操作步骤如下: 1. 使用 SQLPLUS 连接到 Oracle 数据库,以 SYSDBA 用户身份登录: ``` sqlplus / as sysdba ``` 2. 查看当前 SGA 和 PGA 的大小: ``` SHOW SGA; SHOW PARAMETER PGA_AGGREGATE_TARGET; ``` 3. 关闭数据库实例: ``` SHUTDOWN IMMEDIATE; ``` 4. 编辑参数文件(init.ora 或 spfile),将 MEMORY_TARGETSGA_MAX_SIZE 参数设置为相同的值,或者 MEMORY_TARGET 的值更大。例如: ``` MEMORY_TARGET=3G SGA_MAX_SIZE=3G ``` 5. 启动数据库实例: ``` STARTUP ``` 6. 再次查看 SGA 和 PGA 的大小,确认修改成功: ``` SHOW SGA; SHOW PARAMETER PGA_AGGREGATE_TARGET; ``` 这样就可以避免 SGA_MAX_SIZE 和 MEMORY_TARGET 值不一致的错误了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值