oracle optimization scheme notes

1. Current situation

1.1 The table space is not properly planned, causing all tables under all users to be created under the default table space

During the use of oracle, no specific table space planning is carried out for specific data tables, resulting in that all database tables in the current instance are stored in the default table space file (dbf). The disk usage rate is 100%, and other disks are empty and there is no IO request, resulting in a waste of resources. (flood to flood to death, drought to drought to death)

1.2 Queries with high IO demand are executed during peak hours

From the statistical analysis of oracke's own performance monitoring program, it can be concluded that the peak period of query volume is from 7:00 to 10:00 in the morning, and at this time, some SQL queries bring a large number of IO reads. For example, select * does not add any paging function (guessing that it is data synchronization), so it is necessary to analyze the performance of oracle to exclude the query with a large amount of io and try to modify it to execute in off-peak hours.

2. Optimization plan

2.1 Improve disk utilization

2.1.1 RAID / LVM

Using raid or LVM solutions can combine multiple disks into one disk for use, and related IO requests will eventually be distributed to multiple disks according to specific logic to improve the overall IO.
http://www.itpub.net/thread-787910-2-1.html This post said that LVM hardly affects IO, but IO can be improved because of the addition of multiple disks.

2.1.2 ORACLE comes with table space expansion

This blog lists four ways to increase the size of a tablespace, one of which is:

ALTER TABLESPACE app_data ADD DATAFILE
'put dbf file path here' SIZE 500G
AUTOEXTEND ON NEXT 1G MAXSIZE 2048G;

The situation mentioned above is to create a dbf file on other disks to directly expand the current table space size, but whether oracle will automatically balance the data after the expansion needs to refer to the official documentation:
oracle dba doc

2.2 Solve the current disk hot spot phenomenon

If it can perfectly solve the problem mentioned in 2.1, the current problem may also be solved by the way. The current state is that all existing data is on one disk, and all query IO still goes to this disk. Can the automatic expansion of oracle's table space automatically balance the data? If not, how to solve the problem that the current query pressure is all on this disk.

2.2.1 partition migration

Oracle partition migration This blog talks about how to migrate a specified oracle partition to other tablespaces. With reference to this article, you can try to create corresponding tablespaces on other disks and then migrate the partitions to this tablespace to disperse data. General operation:

ALTER TABLE [tableName] MOVE PARTITION [partitionId] TABLESPACE [tableSpaceName];

ORACLE: Moving Table Partitions

2.2.2 Direct whole table migration

If you want to migrate the entire table, you can do this:

-- 迁移 alter table [tableName] move tablespace [spaceName] -- 重建索引 alter index [index_name] rebuild tablespace [tablespace_name];

3. In summary

Decided to use oracle's 整表迁移own for data migration.

3.1 Specific operation

3.1.1 Use LVM or raid to consolidate multiple free disks into a single disk

LVM:

pvcreate /dev/sda{1,2,3,4}
vgcreate ORCL /dev/sda{1}
vgextend ORCL /dev/sda{2,3,4}
lvcreate ...

3.1.2 Creating Tablespaces

grammar

-- 创建  
create tablespace ts_zzg datafile 'dbf file path' size 200M;
-- 授权  
grant create session,create table,create view,create sequence,unlimited tablespace to user;  

3.1.3 Migrating database tables (full table migration)

move table

-- 迁移  
alter table [tableName] move tablespace [spaceName]
-- 重建索引  
alter index [index_name] rebuild tablespace [tablespace_name];

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324928649&siteId=291194637