2.修改参数
spfile和pfile文件里面的参数:
ORCL.__db_cache_size=373293056
ORCL.__java_pool_size=33554432
ORCL.__large_pool_size=4194304
ORCL.__shared_pool_size=192937984
ORCL.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/ORCL/adump'
*.background_dump_dest='/u01/oracle/admin/ORCL/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/oracle/oradata/ORCL/control01.ctl','/u01/oracle/oradata/ORCL/control02.ctl','/u01/oracle/oradata/ORCL/control03.ctl'
*.core_dump_dest='/u01/oracle/admin/ORCL/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='ORCL'
*.db_recovery_file_dest='/u01/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
*.job_queue_processes=10
*.local_listener='ORCL'
*.open_cursors=300
*.pga_aggregate_target=201326592
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=605028352
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/oracle/admin/ORCL/udump'
2.1 通过命令修改参数
SQL> show parameter processes; --数据库允许的最大连接数
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
processes integer 150
SQL> alter system set processes=250 scope=spfile; --修改数据库允许的最大连接数
System altered.
scope解释:
spfile:将该参数的值写入到spfile文件,下次重启实例的生效
重新启动之后
SQL> show parameter processes;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
job_queue_processes integer 10
log_archive_max_processes integer 2
processes integer 250
memory:当前实例生效,重启的时候还原,但是这种方式修改的参数是必须是动态参数
SQL> alter system set processes=300 scope=memory;
alter system set processes=300 scope=memory
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified --此参数为静态参数,所以不能用memory的方式
both:结合上面两种方式
SQL> alter system set processes=300 scope=both;
alter system set processes=300 scope=both
*
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified
说明processes是静态参数,生效必须要重启实例
动态参数的案例:
SQL> show parameter cpu_count;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer 1
SQL> alter system set cpu_count=2 scope=memory; --动态参数
System altered.
SQL> show parameter cpu_count;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cpu_count integer 2
SQL> alter system set cpu_count=2 scope=both;
System altered.
怎样知道一个参数是静态还是动态的
在视图v$parameter中,ISINSTANCE_MODIFIABLE,如果这个值为false表示这个参数是静态参数,TRUE表示这个参数是动态参数
在session会话级别修改参数:
SQL> show parameter db_file_mu
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count integer 16
SQL> alter session set db_file_multiblock_read_count=32;
Session altered.
SQL> show parameter db_file_multiblock_read_count
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count integer 32
2.2 通过修改pfile文件--需要重启
(1) 反解spfile文件
SQL > create pfile from spfile;
(2) 打开initORCL.ora文件,修改参数
processes=300
(3)将新的pfile文件反解会spfile文件
SQL > shutdown immediate --注意,需要数据库处于关闭状态才能反解
SQL > create spfile from pfile;
SQL > startup
SQL > show parameter processes
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
processes integer 300
3. oracle参数文件分级搜索原理
A.找spfileORCL文件
B.找spfile文件
C.找pfile文件
操作:
(1)将参数文件改名,再打开数据库
[oracle@oracle3 dbs]$ mv spfileORCL.ora spfileORCL.ora-
[oracle@oracle3 dbs]$ mv initORCL.ora initORCL.ora-
SQL > startup
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/product/10.2.0/db_1/dbs/initORCL.ora'
转载于:https://blog.51cto.com/fengsonglin/1615212