1 . 修改进程数量 默认150 2 . redo 默认50M, 改成100M或更大,具体根据redo的量来设置 3 . redo每组默认3组每组一个成员,建议每组两个成员以上 4 . 设置sga pga大小 oltp系统通常(要设置好,防止内存抖动) 5 . undo_retention 参数默认是900s 是15分钟,推荐设置为设置为10800,即3个小时 6 . 11g以后默认是开启审计功能的,安装后如果不需要可以关闭,需要的话 把aud$表迁移到一个自定义表空间里面. 防止该表将systen表空间占大,影响数据库的性能问题。步骤略。 7 . Flash_Recovery_Area 如果开闪回了, 默认大小4G,建议增大到5~10G(具体视情况而定)步骤略 8 . 临时表空间 和 undo表空间的大小设置,20~30G(具体看实际业务而定) 9 . 安装的时候要选好字符集 , 默认的不推荐 utf-8 或 gbk 10 .开启归档模式 11 . 控制文件默认2个,增加一个 ------------------------------------------------------------------------- 1. 修改进程数量 默认150 SQL> show parameter process; NAME TYPE VALUE --------------------------------------------------------------- aq_tm_processes integer 1 cell_offload_processing boolean TRUE db_writer_processes integer 1 gcs_server_processes integer 0 global_txn_processes integer 1 job_queue_processes integer 1000 log_archive_max_processes integer 4 processes integer 150 processor_group_name string 1.1 修改进程数量为1500 SQL> alter system set processes=1500 scope=spfile; System altered. 1.2 重启才能生效 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 534462464 bytes Fixed Size 2230072 bytes Variable Size 327157960 bytes Database Buffers 197132288 bytes Redo Buffers 7942144 bytes Database mounted. Database opened. 1.3 查看修改后的进程数量 SQL> show parameter process; NAME TYPE VALUE --------------------------------------------------------------- aq_tm_processes integer 1 cell_offload_processing boolean TRUE db_writer_processes integer 1 gcs_server_processes integer 0 global_txn_processes integer 1 job_queue_processes integer 1000 log_archive_max_processes integer 4 processes integer 1500 processor_group_name string --------------------------------------------------------------- 2. redo 默认50M, 改成100M或更大,具体根据redo的量来设置; 2.1 查看当前日志组成员 SQL> select member from v$logfile; MEMBER ---------------------------------------------------------------- /home/u01/app/oracle/oradata/ytzx/redo01.log /home/u01/app/oracle/oradata/ytzx/redo02.log /home/u01/app/oracle/oradata/ytzx/redo03.log 2.2 查看当前日志组状态: SQL> select group#,members,bytes/1024/1024,status from v$log; GROUP# MEMBERS BYTES/1024/1024 STATUS ---------- ---------- --------------- ---------------------------- 1 1 50 CURRENT 2 1 50 INACTIVE 3 1 50 INACTIVE 现在有三个日志成员,大小为50M,欲更改为100M 2.3增加日志组 SQL>alter database add logfile group 4 ('/home/u01/app/oracle/oradata/ytzx/redo04.log') size 100M; SQL>alter database add logfile group 5 ('/home/u01/app/oracle/oradata/ytzx/redo05.log') size 100M; SQL>alter database add logfile group 6 ('/home/u01/app/oracle/oradata/ytzx/redo06.log') size 100M; SQL> select group#,members,bytes/1024/1024,status from v$log; GROUP# MEMBERS BYTES/1024/1024 STATUS ---------- ---------- --------------- --------------------------- 1 1 50 CURRENT 2 1 50 INACTIVE 3 1 50 INACTIVE 4 1 100 UNUSED 5 1 100 UNUSED 6 1 100 UNUSED 6 rows selected. 2.4 切换日志 SQL> alter system switch logfile; 2.5 查看current状态的日志再那个日志组 SQL> select group#,members,bytes/1024/1024,status from v$log; GROUP# MEMBERS BYTES/1024/1024 STATUS ---------- ---------- --------------- -------------------------- 1 1 50 ACTIVE 2 1 50 INACTIVE 3 1 50 INACTIVE 4 1 100 ACTIVE 5 1 100 ACTIVE 6 1 100 CURRENT 2.6 删除之前小的日志组 SQL> alter database drop logfile group 1; SQL> alter database drop logfile group 2; SQL> alter database drop logfile group 3; SQL> select group#,members,bytes/1024/1024,status from v$log; GROUP# MEMBERS BYTES/1024/1024 STATUS ---------- ---------- --------------- ------------------------------ 4 1 100 INACTIVE 5 1 100 ACTIVE 6 1 100 CURRENT 现在 三组日志都是100m了 3 . redo每组默认3组每组一个成员,建议每组两个成员以上 3.1 给组添加成员: SQL> alter database add logfile member '/home/u01/app/oracle/oradata/ytzx/redo04_2.log' to group 4; Database altered. SQL> alter database add logfile member '/home/u01/app/oracle/oradata/ytzx/redo05_2.log' to group 5; Database altered. SQL> alter database add logfile member '/home/u01/app/oracle/oradata/ytzx/redo06_2.log' to group 6; Database altered. 删成员:alter database drop logfile member '/u01/app/oracle/oradata/orcl/redo04b.log' 删除组:alter database drop logfile group 9 ; 只是删除了ctl文件,物理文件没删 所以添加的时候 加 reuse 3.2 查看日志信息 SQL> select group#,members,bytes/1024/1024,status from v$log; GROUP# MEMBERS BYTES/1024/1024 STATUS ------------------------------------------ 4 2 100 INACTIVE 5 2 100 INACTIVE 6 2 100 CURRENT 现在每组2个成员了 ------------------------------------------ 4. 设置sga pga大小 oltp系统通常(要设置好,防止内存抖动) sga=内存*80%*80% pga=内存*80%*20% SQL> show parameter memory NAME TYPE VALUE ------------------------------------------------- hi_shared_memory_address integer 0 memory_max_target big integer 0 memory_target big integer 0 shared_memory_address integer 0 SQL> show parameter sga; NAME TYPE VALUE --------------------------------------------- lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 512M sga_target big integer 512M SQL> show parameter pga; NAME TYPE VALUE ------------------------------------------------------- pga_aggregate_target big integer 2592M SQL> alter system set memory_target=4096m scope=spfile; System altered. SQL> alter system set memory_max_target=4096m scope=spfile; System altered. SQL> alter system set sga_target=3027m scope=spfile; System altered. SQL> alter system set sga_max_size=3027m scope=spfile; System altered. SQL> alter system set pga_aggregate_target=3027m scope=spfile; System altered. SQL> alter system set pga_aggregate_target=1024m scope=spfile; System altered. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 3173429248 bytes Fixed Size 2232552 bytes Variable Size 469765912 bytes Database Buffers 2684354560 bytes Redo Buffers 17076224 bytes Database mounted. Database opened. SQL> show parameter memory NAME TYPE VALUE ------------------------------------------------------- hi_shared_memory_address integer 0 memory_max_target big integer 4G memory_target big integer 4G shared_memory_address integer 0 SQL> show parameter sga NAME TYPE VALUE ------------------------------------------------------- lock_sga boolean FALSE pre_page_sga boolean FALSE sga_max_size big integer 3040M sga_target big integer 3040M SQL> show parameter pga NAME TYPE VALUE ------------------------------------------------------- pga_aggregate_target big integer 1G 现在内存已经固定了,方式高并发情况下的内存抖动 5. undo_retention 参数默认是900s 是15分钟,推荐设置为设置为10800,即3个小时 SQL> show parameter undo_retention NAME TYPE VALUE -------------------------------------------------------------- undo_retention integer 900 --默认900 SQL> alter system set undo_retention=10800 scope=spfile; System altered. SQL> show parameter undo_retention NAME TYPE VALUE -------------------------------------------------------------- undo_retention integer 900 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 3173429248 bytes Fixed Size 2232552 bytes Variable Size 486543128 bytes Database Buffers 2667577344 bytes Redo Buffers 17076224 bytes Database mounted. Database opened. SQL> show parameter undo_retention NAME TYPE VALUE --------------------------------------- undo_retention integer 10800 SQL> 6. 11g以后默认是开启审计功能的,安装后如果不需要可以关闭,需要的话 把aud$表迁移到一个自定义表空间里面. 防止该表将systen表空间占大,影响数据库的性能问题。步骤略。 7.Flash_Recovery_Area 如果开闪回了, 默认大小4G,建议增大到5~10G(具体视情况而定)步骤略 8.临时表空间 和 undo表空间的大小设置,20~30G 8.1 设置临时表空间大小 8.1.1 检查oracle系统临时表空间大小: SQL> select sum(bytes)/1024/1024 "temp size(M)" from dba_temp_files where tablespace_name='DATATALKTEMP'; temp size(M) ------------ 60 --默认60M 8.1.2 查看临时表空间大小、是否自动扩展 SQL> select file_name,bytes/1024/1024 "MB",autoextensible,tablespace_name from dba_temp_files; FILE_NAME MB AUT TABLESPACE_NAME ---------- --- ------------------------------------------------------------------------- /u01/app/oracle/oradata/ytzx/temp01.dbf 60 YES TEMP /u01/app/oracle/oradata/ytzx/datatalktemp01.dbf 10240 YES DATATALKTEMP 8.1.3 增大临时表空间文件的大小,把20M 缩小成10240 M SQL> alter database tempfile '/u01/app/oracle/oradata/ytzx/temp01.dbf' resize 10240M autoextend on next 100M maxsize 10G; 8.1.4 增加临时文件 alter tablespace temp add tempfile '/u01/app/oracle/oradata/ytzx/temp02.dbf' size 10240M aitpextemd pm mext 100M maxsize 10G; 8.2 undo表空间大小设置 8.2.1 查询undo表空间大小 SQL> select sum(bytes)/1024/1024 "current undo size(M)" from dba_data_files where tablespace_name='UNDOTBS1'; current undo size(M) -------------------- 575 --默认570M 8.2.2 增大undo表空间文件大小 SQL> alter database datafile '/home/u01/app/oracle/oradata/ytzx/undotbs01.dbf' resize 10240M; 8.2.3 给undo表空间增加数据文件 SQL> alter tablespace UNDOTBS1 add datafile '/home/u01/app/oracle/oradata/ytzx/undotbs2.dbf' size 10240M autoextend on; 8.2.4 查看现在undo表空间大小 SQL> select sum(bytes)/1024/1024 "current undo size(M)" from dba_data_files where tablespace_name='UNDOTBS1'; current undo size(M) -------------------- 20480 --现在为20G 9.安装的时候要选好字符集 , 默认的不推荐 utf-8 或 gbk 10.开启归档模式 10.1 查看是否为归档模式 SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination /home/u01/app/oracle/product/11.2.0.3/db_1/dbs/arch Oldest online log sequence 54 Current log sequence 56 默认是disable 状态,没有开启归档 10.2 修改归档路径 SQL> alter system set log_archive_dest_1='location=/home/u01/oradata/arch' scope=spfile; System altered. 10.3 修改为归档模式 SQL> alter database archivelog; Database altered. 10.4 查看是否为归档模式 SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination /home/u01/oradata/arch Oldest online log sequence 54 Next log sequence to archive 56 Current log sequence 56 11. 控制文件默认2个,增加一个 11.1 查看控制文件的路径和状态 SQL> show parameter control NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string /home/u01/app/oracle/oradata/ytzx/control01.ctl, /home/u01/app/oracle/oradata/ytzx/control02.ctl control_management_pack_access string DIAGNOSTIC+TUNING 11.2 关闭数据库 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 11.3 拷贝控制文件 cp /home/u01/app/oracle/oradata/ytzx/control01.ctl /home/u01/app/oracle/oradata/ytzx/control03.ctl 然后如果用的spfile就用alter system 如果是用的pfile直接修改文件,我使用的spfile 11.4 启动数据库为nomount状态 SQL> startup nomount; ORACLE instance started. Total System Global Area 3173429248 bytes Fixed Size 2232552 bytes Variable Size 486543128 bytes Database Buffers 2667577344 bytes Redo Buffers 17076224 bytes 11.5 修改spfile里面控制文件的路径 alter system set control_files='/home/u01/app/oracle/oradata/ytzx/control01.ctl', '/home/u01/app/oracle/oradata/ytzx/control02.ctl', '/home/u01/app/oracle/oradata/ytzx/control03.ctl' sope=spfile; 11.6 关闭数据库 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup; ORACLE instance started. Total System Global Area 3173429248 bytes Fixed Size 2232552 bytes Variable Size 486543128 bytes Database Buffers 2667577344 bytes Redo Buffers 17076224 bytes Database mounted. Database opened. 11.7 查看控制文件 SQL> show parameter control NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ control_file_record_keep_time integer 7 control_files string /home/u01/app/oracle/oradata/ytzx/control01.ctl, /home/u01/app/oracle/oradata/ytzx/control02.ctl /home/u01/app/oracle/oradata/ytzx/control03.ctl control_management_pack_access string DIAGNOSTIC+TUNING 现在有3个控制文件了。