oracle 优化的一点体会
oracle 优化的一点体会大家可以参考下,提升运行效率。
关于oracle 优化的内容很多,概念庞杂,不过可以总结出一个大纲性的东西作为需要考虑的方向,然后再逐步细化。oracle优化按重要性需要考虑设计、开发、调整几个方面。首先是设计,这是最重要的部分,借用TOM的话:“性能是设计出来的,不是调整出来的”。设计分为逻辑设计和物理设计,逻辑设计一般要遵循3NF,同时也要根据应用的需要引入逆规范化的设计,应为NF设计虽然消除了数据冗余,但随着规范化越高需要连接的表可能越多,同样对性能有影响,所以需要平衡考虑,至于何时要3NF,何时要逆规范化,要是具体情况而定。
物理设计一个是存储,比如物理文件、联机日志文件、归档日志文件的磁盘布局,各种RAID的使用等(在这方面piner的分析比较全面细致),第二是要根据应用的特性,选择文件组织方式,灵活运用oracle的各种表和索引类型,例如交叉表可以考虑使用IOT、读密集型并且经常关联的字段使用cluster,还有全局临时表、外部表等等。除了普通的B树索引外,在低基数情况下考虑使用位图索引,使用函数时引入基于函数的索引等。
其次是开发阶段,比如老生常谈的使用绑定变量、外键加索引、使用bulk collect、分析函数、直接路径加载,在OLAP应用中使用partition、MV、位图索引、并行化操作等等。没种技术要深入研究都有很多内容。
最后才是调整,这是在出现性能问题时采用的手段。这已经形成了一个完整的方法论。
1)设立合理的性能优化目标。
2)测量并记录当前性能(STATSPACK、AWR等)。
3)确定当前Oracle性能瓶颈(从Oracle 等待接口v$system_event、v$session_event和v$session_wait中获得等待事件,进而找出影响性能的对象和sql语句
)。
4)把等待事件记入跟踪文件(autotrace、10046事件等)。
5)确定当前的OS瓶颈(sar、iostat、cpustat、mpstat、netstat、top、osview等)。
6)优化所需的成分(应用程序、数据库、I/O、争用、OS等)。
7)跟踪并实施更改控制过程。
8)测量并记录当前性能
9)重复步骤3到7,直到满足优化目标
以上是本人对Oracle优化的一些粗线条的体会,可以指出优化需要考虑的大的方向,而相关的技术细节非常多,每项都要仔细研究,正如piner总结的:多思考、多实践、多总结。
再记点题外话,公司节后要对技术部作人员调整,说白了就是裁人,这次除了要个网管保证能上网就不留技术的人了,假期准备简历,节后找工作。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The retention period of Oracle database logs depends on the log type and configuration, including: Redo logs: determined by the maximum size configured with the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

The Oracle database startup sequence is: 1. Check the preconditions; 2. Start the listener; 3. Start the database instance; 4. Wait for the database to open; 5. Connect to the database; 6. Verify the database status; 7. Enable the service (if necessary ); 8. Test the connection.

To find the number of occurrences of a character in Oracle, perform the following steps: Get the total length of a string; Get the length of the substring in which a character occurs; Count the number of occurrences of a character by subtracting the substring length from the total length.

Oracle database server hardware configuration requirements: Processor: multi-core, with a main frequency of at least 2.5 GHz. For large databases, 32 cores or more are recommended. Memory: At least 8GB for small databases, 16-64GB for medium sizes, up to 512GB or more for large databases or heavy workloads. Storage: SSD or NVMe disks, RAID arrays for redundancy and performance. Network: High-speed network (10GbE or higher), dedicated network card, low-latency network. Others: Stable power supply, redundant components, compatible operating system and software, heat dissipation and cooling system.

The amount of memory required by Oracle depends on database size, activity level, and required performance level: for storing data buffers, index buffers, executing SQL statements, and managing the data dictionary cache. The exact amount is affected by database size, activity level, and required performance level. Best practices include setting the appropriate SGA size, sizing SGA components, using AMM, and monitoring memory usage.

To create a scheduled task in Oracle that executes once a day, you need to perform the following three steps: Create a job. Add a subjob to the job and set its schedule expression to "INTERVAL 1 DAY". Enable the job.

The amount of memory required for an Oracle database depends on the database size, workload type, and number of concurrent users. General recommendations: Small databases: 16-32 GB, Medium databases: 32-64 GB, Large databases: 64 GB or more. Other factors to consider include database version, memory optimization options, virtualization, and best practices (monitor memory usage, adjust allocations).

Oracle can read dbf files through the following steps: create an external table and reference the dbf file; query the external table to retrieve data; import the data into the Oracle table.
