--开启强制归档ALTERDATABASEFORCE LOGGING;--设置 30分钟 强制归档ALTER SYSTEM SET ARCHIVE_LAG_TARGET=1800 SCOPE=BOTH SID='*';--设置期望undo保持时间3hALTER SYSTEM SET UNDO_RETENTION=21600 SCOPE=BOTH SID='*';--关闭UNDO_RETENTION的自动调整ALTER SYSTEM SET"_undo_autotune"=FALSE SCOPE=BOTH SID='*';--调整session最大打开cursor数量ALTER SYSTEM SET OPEN_CURSORS=2000 SCOPE=BOTH SID='*';--调整trace、alert日志最大为2048mALTER SYSTEM SET MAX_DUMP_FILE_SIZE='2048m' SCOPE=BOTH SID='*';--设置standby file自动管理,DG环境用处大ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO SCOPE=BOTH SID='*';--db_cache_advice,建议采用手工内存管理,避免系统性能下降ALTER SYSTEM SET DB_CACHE_ADVICE='off' SCOPE=BOTH SID='*';--关闭初始化extent的延迟创建功能ALTER SYSTEM SET DEFERRED_SEGMENT_CREATION=FALSE SCOPE=BOTH SID='*';--将DDL操作写入alert文件ALTER SYSTEM SET ENABLE_DDL_LOGGING=TRUE SCOPE=BOTH SID='*';--db_block_checksum 是对 block 做物理性检查,用于 DBWn 和 direct loader 数据块写入到磁盘时,基于块内的所有字节计算得出一个校验值并将其写入块头.ALTER SYSTEM SET DB_BLOCK_CHECKSUM=FULL SCOPE=BOTH SID='*';--启用profile 的 RESOURCE_LIMITALTER SYSTEM SET RESOURCE_LIMIT=TRUE SCOPE=BOTH SID='*';--禁用资源计划resource_manager_planALTER SYSTEM SET RESOURCE_MANAGER_PLAN='force:' SCOPE=BOTH SID='*';ALTER SYSTEM SET"_resource_manager_always_off"=TRUE SCOPE=SPFILE SID='*';--设置控制文件保留1个月信息ALTER SYSTEM SET CONTROL_FILE_RECORD_KEEP_TIME=31 SCOPE=BOTH SID='*';--调整job作业能够使用的总进程数ALTER SYSTEM SET JOB_QUEUE_PROCESSES=100 SCOPE=BOTH SID='*';--关闭merge join connectionALTER SYSTEM SET"_optimizer_mjc_enabled"=FALSE SCOPE=BOTH SID='*';--关闭result_cache查询结果缓存,场景更适用OLAT环境ALTER SYSTEM SET RESULT_CACHE_MAX_SIZE=0 SCOPE=BOTH SID='*';--关闭result cache功能启用情况下优化器自适应功能ALTER SYSTEM SET"_optimizer_ads_use_result_cache"=FALSE SCOPE=BOTH SID='*';ALTER SYSTEM SET"_optimizer_cartesian_enabled"=FALSE SCOPE=BOTH SID='*';-- 关闭自适应游标共享参数,12c版本的自适应游标共享(隐藏参数)会带来过多子游标和ORA-04031的问题,为了避免19c遇到同样问题,建议先将其关闭(重启库后生效)。整合考虑建议保持默认值,即:开启自适应游标(默认也开启绑定变量窥探及cursor_sharing=EXACT)--ALTER SYSTEM SET "_optimizer_adaptive_cursor_sharing"=FALSE SID='*' SCOPE=BOTH;--ALTER SYSTEM SET "_optimizer_extended_cursor_sharing"=NONE SID='*' SCOPE=BOTH;--ALTER SYSTEM SET "_optimizer_extended_cursor_sharing_rel"=NONE SID='*' SCOPE=BOTH;--关闭RAC隐藏参数"_gc_bypass_reader"和 "_gc_read_mostly_lock",为了避免RAC的用户进程卡死在"gc current request"这个数据库内部等待,大多与隐藏参数"_gc_bypass_reader"和 "_gc_read_mostly_lock", 在参数关闭后会发现RAC稳定性提升明显(不会影响性能),同时还发现这两个参数也有其他不少bug,因此建议关闭:ALTER SYSTEM SET"_gc_bypass_readers"=FALSE SCOPE=BOTH SID='*';ALTER SYSTEM SET"_gc_read_mostly_locking"=FALSE SCOPE=SPFILE SID='*';--关闭RAC全局事务支持隐藏参数ALTER SYSTEM SET"_clusterwide_global_transactions"=FALSE SID='*' SCOPE=SPFILE;--关闭跨实例并行参数ALTER SYSTEM SET PARALLEL_FORCE_LOCAL=TRUE SCOPE=BOTH SID='*';--关闭Cardinality feedback,12c版本的Cardinality feedback可能会导致执行计划的不稳定,为了避免19c发生,建议关闭ALTER SYSTEM SET"_optimizer_use_feedback"=FALSE SCOPE=BOTH SID='*';ALTER SYSTEM SET"_partition_large_extents"=FALSE SCOPE=BOTH SID='*';--alter system set "_optimizer_adaptive_plans"=FALSE scope=spfile sid='*';ALTER SYSTEM SET OPTIMIZER_ADAPTIVE_PLANS=FALSE SCOPE=BOTH SID='*';--禁止polling模式和post/wait切换,只使用post/wait模式,否则可能造成CPU占用高ALTER SYSTEM SET"_use_adaptive_log_file_sync"=FALSE SCOPE=BOTH SID='*';--加快回滚速度ALTER SYSTEM SET"_cleanup_rollback_entries"=5000 SCOPE=SPFILE SID='*';ALTER SYSTEM SET"_rollback_segment_count"=4000 SCOPE=BOTH SID='*';ALTER SYSTEM SET"_cursor_obsolete_threshold"=1024 SCOPE=SPFILE SID='*';ALTER SYSTEM SET"_keep_remote_column_size"=TRUE SCOPE=SPFILE SID='*';--建议启用大池(Large Pool)分配并行进程内存,减少对共享池(Shared Pool)的争用。ALTER SYSTEM SET"_PX_use_large_pool"=TRUE SCOPE=SPFILE SID='*';--适当增加shared pool保留比率 5 --> 20ALTER SYSTEM SET"_shared_pool_reserved_pct"=20 SCOPE=SPFILE SID='*';--设置审计日志级别,记录SQL语句,禁用设置为none,启用设置为DB或'db,extended'-- ALTER SYSTEM SET AUDIT_TRAIL=NONE SCOPE=SPFILE SID='*';-- alter system set audit_trail=db,extended scope=spfile;--调大数据文件数量上线--RAC要求必须所有节点参数设置一致ALTER SYSTEM SET DB_FILES=2000 SCOPE=SPFILE SID='*';-- 28401:使用错误密码登陆尝试会导致很高的Library Cache Locks或row cache lock。-- 10949:事件用于关闭11g的自动serial direct path read特性,避免出现过多的直接路径读,消耗过多的IO资源。-- 19823:With Oracle 11.2 and onwards, Oracle will start to purge the files in the FRA when the SPACE_USED reaches 80% of SPACE_LIMIT as specified by the db_recovery_file_dest_size parameter,快速恢复区空间使用率达到90%以后开始删除文件(归档日志),默认80%,调大延迟Oracle删除归档日志ALTER SYSTEM SET EVENT='10949 trace name context forever, level 1:28401 trace name context forever, level 1:10849 trace name context forever, level 1:19823 trace name context forever, level 90:60025 trace name context forever:10943 trace name context level 2097152' SCOPE=SPFILE SID='*';--指定并行执行 (并行查询、PDML、并行恢复和复制) 消息的大小,RAC要求必须所有节点参数设置一致ALTER SYSTEM SET PARALLEL_EXECUTION_MESSAGE_SIZE=32768 SCOPE=SPFILE SID='*';--调整会话进程上限ALTER SYSTEM SET PROCESSES=8000 SCOPE=SPFILE SID='*';--调整每个session 最多可以缓存关闭掉的 cursor 数量ALTER SYSTEM SET SESSION_CACHED_CURSORS=500 SCOPE=SPFILE SID='*';--设置异步IO,存在IO性能时建议启用,重启生效ALTER SYSTEM SET FILESYSTEMIO_OPTIONS=SETALL SCOPE=SPFILE SID='*';--关闭RAC的DRM(dynamic remastering)特性,避免频繁的DRM使系统性能不稳定、严重的时候使数据库挂起。同时也关闭关闭集群 Undo Affinity,降低集群交互,Read-mostly Locking新特性,这个特性目前会触发大量的BUG,严重时使数据库实例宕掉ALTER SYSTEM SET"_gc_undo_affinity"=FALSE SCOPE=SPFILE SID='*';ALTER SYSTEM SET"_gc_policy_time"=0 SCOPE=SPFILE SID='*';--调整归档日志文件格式ALTER SYSTEM SET LOG_ARCHIVE_FORMAT ='arch_%t_%s_%r.arc' SCOPE=SPFILE SID='*';alter system set"_serial_direct_read"=never scope=both sid='*';--启用块跟踪,优化增量备份速度ALTERDATABASEENABLE BLOCK CHANGE TRACKING USINGFILE'+DATA' REUSE;--回退命令alter system set"_cleanup_rollback_entries"=100 scope=spfile sid='*';alter system set"_cursor_obsolete_threshold"=8192 scope=spfile sid='*';alter system set"_keep_remote_column_size"=true scope=spfile sid='*';alter system set"_PX_use_large_pool"=FALSE scope=spfile sid='*';alter system set"_shared_pool_reserved_pct"=5 scope=SPFILE sid='*';alter system set audit_trail=DB scope=SPFILE sid='*';ALTER SYSTEM RESET EVENT SCOPE=SPFILE SID='*';alter system set parallel_execution_message_size=16384 scope=spfile sid='*';alter system set db_files=200 scope=spfile sid='*';alter system set processes=6400 scope=spfile sid='*';alter system set sec_max_failed_login_attempts=3 scope=spfile sid='*';alter system set session_cached_cursors=50 scope=SPFILE sid='*';alter system set"_resource_manager_always_off"=FALSE scope=spfile sid='*';alter system set filesystemio_options=none scope=spfile sid='*';alter system set LOG_ARCHIVE_FORMAT ='%t_%s_%r.dbf' scope=spfile sid='*';alter system set"_gc_undo_affinity"=TRUE scope=spfile sid='*';alter system set"_gc_policy_time"=20 scope=spfile sid='*';