千家信息网

分析Oracle Nologging

发表于:2025-02-02 作者:千家信息网编辑
千家信息网最后更新 2025年02月02日,这篇文章主要介绍"分析Oracle Nologging",在日常操作中,相信很多人在分析Oracle Nologging问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"分
千家信息网最后更新 2025年02月02日分析Oracle Nologging

这篇文章主要介绍"分析Oracle Nologging",在日常操作中,相信很多人在分析Oracle Nologging问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答"分析Oracle Nologging"的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

Nologging:

在对大表插入数据的时候,经常会用到nologging选项。Nologging并不是不产生redo,

Nologging+append 只是不会对数据产生redo(但依然有其他的redo,例如数据字典变化产生的redo)。

同理 logging+append下undo也是大大地减少,减少的是数据的undo,是数据本身的undo,就如同redo的减少也一样,是数据本身的redo。

这和数据库是否产生redo和undo是不同的概念,比如空间分配的redo和undo,这就不是数据本身的变化。

Nologging 主要影响:

sql loader 直接路径加载

直接路径的insert(append hint)

create table as select

alter table move

创建和重建索引

在非归档模式下, 对于nologging 和 logging模式,使用 append,都不会对数据生成redo。

在归档模式下,只有将表置于nologging 模式,并且使用append 才不会对数据生成redo.

通过v$mystat视图来显示出当前会话产生的redo来进行显示效果:

select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

测试:

测试前一定要确定是否开始force_logging功能:

如果开启force_logging功能,那么nologging是不生效的。

SYS@prod>select force_logging from v$database;

FOR

---

NO

如果结果是YES,那么进行关闭

Alter database no force logging;

归档模式下的测试:

SYS@prod>archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination /u01/app/oracle/arch/pridb

Oldest online log sequence 230

Next log sequence to archive 232

Current log sequence 232

Create table 测试:

查看当前会话产生的redo值:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

Nologging测试:

SYS@prod>create table test nologging as select * from dba_objects;

Table created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 54928

产生redo大小为54928。

SYS@prod>drop table test;

Table dropped.

Logging测试:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>create table test logging as select * from dba_objects;

Table created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 10262796

产生redo数量为10262796.

结论:用nologging 创建表,不会对数据生成redo,仅对数据字典生成redo.

DML测试:

Insert update delete

Delete:

表logging:

SYS@prod>delete from test;

86978 rows deleted.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 32996412

表nologging:

SYS@prod>delete from test;

86978 rows deleted.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 32991352

Insert 与 update测试就省略了,与delete效果一样。

结论:

对于 INSERT/UPDATE/DELETE的DML 操作, nologging 和 logging 模式没有什么区别。

使用直接路径append对insert测试:

表logging 使用 append插入:

SYS@prod>create table test logging as select * from dba_objects;

Table created.

为了测试效果明显,重新启动一个会话。

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>insert /*+APPEND*/ into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 10239296

表nologging使用append插入:

SYS@prod>create table test nologging as select * from dba_objects;

Table created.

为了测试效果明显,重新启动一个会话。

SYS@prod>insert /*+APPEND*/ into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 13884

结论:

对于logging 模式, 使用append hint 在生成redo 上没有什么变化

对于nologging模式,使用append hint 对数据没有生成redo,仅对数据字典生成了redo.

Alter table move测试:

表Logging模式下进行移动:

SYS@prod>create table test logging as select * from dba_objects;

Table created.

重启一个会话

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>alter table test move tablespace example

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 10330784

表nologging模式下进行移动:

SYS@prod>create table test nologging as select * from dba_objects;

Table created.

重启一个会话

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>alter table test move tablespace example;

Table altered.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 71712

结论:表在nologging模式下进行移动,不会记录数据redo,仅会记录数据字典变化的redo。

非归档模式下的测试:

SYS@prod>archive log list;

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination /u01/app/oracle/arch/pridb

Oldest online log sequence 250

Current log sequence 252

1.create table测试

Logging建表:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>create table test logging as select * from dba_objects;

Table created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 54476

Nologging建表:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>create table test nologging as select * from dba_objects;

Table created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 53700

结论:在非归档模式下,nologging和logging方式建表差距不大。

2.DML测试:(仅测试insert)

Insert:

表Nologging

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>insert into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 10153240

表Logging:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>insert into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 10162700

结论:

对于 INSERT/UPDATE/DELETE的DML 操作, nologging 和 logging 模式没有什么区别

3.Insert+Append测试:

Logging:

SYS@prod>create table test logging as select * from dba_objects;

Table created.

重启一个会话

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>insert /*+APPEND*/ into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 13752

Nologging:

SYS@prod>create table test nologging as select * from dba_objects;

Table created.

重启一个会话:

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 0

SYS@prod>insert /*+APPEND*/ into test select * from test;

86980 rows created.

SYS@prod>select a.name,b.value from v$statname a,v$mystat b where a.statistic# = b.statistic# and a.name='redo size';

NAME VALUE

---------------------------------------------------------------- ----------

redo size 13884

总结: 对于非归档模式,对于nologging 和 logging模式,使用 append,都不会对数据生成redo。

对于归档模式,只有nologging+Append,才不会对数据生成redo,仅对数据字典生成redo

两种模式下的测试结论:

归档模式下:

用nologging 创建表,不会对数据生成redo,仅对数据字典生成redo.

insert/update/delete 的DML 操作,在logging和nologging上没有区别

对于logging 模式, 使用append hint 在生成redo 上没有什么变化

对于nologging模式,使用append hint 对数据没有生成redo,仅对数据字典生成了redo。

非归档模式:

在非归档模式下,create table 在nologging 和 logging 模式差别不大。

对于 INSERT/UPDATE/DELETE的DML 操作, nologging 和 logging 上没有区别。

对于nologging 和 logging模式,使用 append,都不会对数据生成redo。

到此,关于"分析Oracle Nologging"的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注网站,小编会继续努力为大家带来更多实用的文章!

模式 数据 测试 生成 字典 结论 变化 分析 效果 学习 路径 移动 明显 不大 功能 只有 效果明显 更多 帮助 不同 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 服务器配置多个bond 华三服务器带外管理地址 网络安全隐患排查整改新闻 网络安全法治宣传教育观后感 学校可能存在的网络安全隐患 只复制表格看到的数据库 云服务器安全组放行 软件开发与测试课程设计 放心的财务软件开发商 电脑偶尔连不上服务器是怎么回事 魔兽世界西欧服务器 软件开发者能看到手机信息吗 虎牙tv电视版服务器关闭了 企业实时数据库多少钱 服务器安全管理 安全策略配置 桓台物料开单软件开发公司 服务器B1OS的启动模式有哪些 免安装的mysql数据库 构成数据库的单元有哪些 怀柔区正规软件开发推广 数据库技术的发展现状 mssql 跨数据库同步 小米无法连接到服务器 数据库图片扫描软件 自动化测试用例放数据库 win732安装数据库 cnki会议论文数据库 部队个人网络安全学习体会 宁津有软件开发培训班吗 软件开发的转行做什么好
0