<返回更多

Oracle基础参数配置和调整

2022-06-14    JencyChen
加入收藏

说明:

调整sga_max_size、processes、sessions、transactions大小。

SQL> select * from v$parameter t where t.name in ('sga_max_size','sga_target','memory_max_target','memory_target','pga_aggregate_target', 'db_block_buffers','db_block_size','shared_pool_size','log_buffer','JAVA_pool_size','large_pool_size','processes','sessions','transactions','workarea_size_policy');

Oracle基础参数配置和调整

 

a) sga_max_size:调整成内存的40%-50%;memory_target值= sga_max_size值(命令行执行)

SQL> alter system set sga_max_size=900M scope=spfile;

b) processes默认150,可以先调整成1000个,后续可以根据业务请求量调整。

SQL> alter system set processes=1000 scope=spfile;

c) sessions值根据sessions=(1.5*processes)+22调整。

SQL> alter system set sessions=1522 scope=spfile;

d) transactions 值根据transactions=1.1*sessions调整。

SQL> alter system set transactions=1675 scope=spfile;

Oracle基础参数配置和调整

 

Oracle基础参数配置和调整

 

打开归档模式。

SQL>archive log list

SQL>shutdown immediate

SQL>startup mount

SQL>alter database archivelog

SQL> alter system set log_archive_dest_1='location=/data/oradata/arch';

SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;

SQL> shutdown immediate;

SQL>startup;

Oracle基础参数配置和调整

 


Oracle基础参数配置和调整

 

Oracle基础参数配置和调整

 


Oracle基础参数配置和调整

 


Oracle基础参数配置和调整

 

打开闪回。

Oracle基础参数配置和调整

 

SQL>alter system set db_recovery_file_dest_size=2G;

SQL> alter system set db_recovery_file_dest='/opt/App/oracle/fast_recovery_area';

SQL>alter system set db_flashback_retention_target=10080;

SQL>alter system set undo_retention=10800;

SQL>shutdown immediate;

SQL>startup mount

SQL>alter database flashback on;

SQL>alter database open;

Oracle基础参数配置和调整

 


Oracle基础参数配置和调整

 

新建业务用户表空间、业务用户,调整表空间。

SQL> create tablespace BUSIDATA datafile '/data/oradata/orcl/BUSIDATA01.dbf' size 1G autoextend on;

SQL> create tablespace BUSIIDX datafile '/data/oradata/orcl/BUSIIDX01.dbf' size 200M autoextend on;

Oracle基础参数配置和调整

 

SQL>create temporary tablespace tmp01 tempfile '/data/oradata/orcl/tmp01.dbf' size 50M autoextend on;

SQL>create temporary tablespace tmp02 tempfile '/data/oradata/orcl/tmp02.dbf' size 50M autoextend on;

SQL>create temporary tablespace tmp03 tempfile '/data/oradata/orcl/tmp03.dbf' size 50M autoextend on;

SQL>alter tablespace tmp01 tablespace group tempgrp;

SQL>alter tablespace tmp02 tablespace group tempgrp;

SQL>alter tablespace tmp03 tablespace group tempgrp;

SQL>alter database default temporary tablespace tempgrp;

Oracle基础参数配置和调整

 

SQL>create user busi identified by "busi123" default tablespace BUSIDATA temporary tablespace tempgrp;

Oracle基础参数配置和调整

 

以下sql中带“<>”根据实际情况改写:

SQL>alter table <tablename> move tablespace <newtbs>;

SQL>select * from user_indexes t where t.table_name=' <tablename> ' and t.status<>'VALID';

SQL>alter index <idx_name> rebuild tablespace <new_tab_space_name>;

SQL>select dbf.tablespace_name, dbf.totalspace "总量(M)", dbf.totalblocks as 总块数,

dfs.freespace "剩余总量(M)", dfs.freeblocks "剩余块数", (dfs.freespace / dbf.totalspace) * 100 "空闲比例"

from (select t.tablespace_name, sum(t.bytes) / 1024 / 1024 totalspace, sum(t.blocks) totalblocks

from dba_data_files t group by t.tablespace_name) dbf,

(select tt.tablespace_name, sum(tt.bytes) / 1024 / 1024 freespace, sum(tt.blocks) freeblocks

from dba_free_space tt group by tt.tablespace_name) dfs

where trim(dbf.tablespace_name) = trim(dfs.tablespace_name);

a) 修改已存在数据文件的大小

SQL>alter database datafile '/data/oradata/orcl/SYSTEM01.DBF' resize 4096m;

b) 增加数据文件

SQL>ALTER TABLESPACE USERS ADD DATAFILE '/data/oradata/orcl/ USERS01.DBF' SIZE 20480M [AUTOEXTEND ON] [NEXT 100M MAXSIZE UNLIMITED];

声明:本站部分内容来自互联网,如有版权侵犯或其他问题请与我们联系,我们将立即删除或处理。
▍相关推荐
更多资讯 >>>