【测试】自行建表并演示append+nologging,并描述数据写入后产生的效果
摘要:①创建表: ②设置t4处于nologging: ③开启autotrace查看执行计划: ④插入数据: ⑤使用append插入数据: 比较一下普通插入和append插入生成的redo大小,明显append插入时生成的redo小很多。 SQL> insert /*+ append */ into t4
阅读全文
posted @
2016-10-17 20:04
Tomatoes
阅读(281)
推荐(0)
【测试】在hr用户下自行创建T1和T2表写一条SQL语句,(NL连接)
摘要:SQL> select t1.* from t1,t2 where t1.object_id=t2.object_id; 99 rows selected. Execution Plan ---------------------------------------------------------- Plan hash value: 1506669289 --------------...
阅读全文
posted @
2016-10-17 19:56
Tomatoes
阅读(752)
推荐(0)
【测试】使用hr用户下的employees和departments表写一条SQL语句,(MG连接)
摘要:SQL> select * from employees d, departments t where d.department_id=t.department_id; 106 rows selected. Execution Plan ---------------------------------------------------------- Plan hash value: 1...
阅读全文
posted @
2016-10-17 19:54
Tomatoes
阅读(989)
推荐(0)
【测试】使用hr用户下的employees表写一条SQL语句,执行计划走索引全扫描
摘要:SQL> select count(*) from employees; COUNT(*) ---------- 107 Execution Plan ---------------------------------------------------------- Plan hash value: 3580537945 -----------------------...
阅读全文
posted @
2016-10-17 19:48
Tomatoes
阅读(489)
推荐(0)
【测试】并使用scott用户下的emp表写一条SQL语句,执行计划走唯一索引
摘要:SQL>set autotrace onSQL>select sal from emp where empno=7902; SAL ---------- 3000 Execution Plan ---------------------------------------------------------- Plan hash value: 2949544139 ...
阅读全文
posted @
2016-10-17 19:44
Tomatoes
阅读(549)
推荐(0)
【测试】通过SYS用户,对SCOTT用户的会话进行跟踪,并分析此会话中性能消耗较高的SQL,分析并给出优化建议。
摘要:①连接到scott下,查询scott对应的sid,serial# ②开启对scott用户的跟踪: ③在scott下进行操作 ④关闭对scott用户的跟踪: ⑤查询trace文件的位置: ⑥查看生成的trace文件目录: ⑦用tkporf查看生成的trace文件:
阅读全文
posted @
2016-10-17 19:34
Tomatoes
阅读(192)
推荐(0)
【测试】模拟一个全表扫描的sql,对其进行优化走索引,并且将执行计划稳定到baseLine。
摘要:①创建表t3: ②开启自动捕获并修改时间格式: ③查询sql ④创建索引: ⑤再次执行相同的sql语句: ⑥演进执行计划: ⑦再次查看: ⑧查看现在查询所用的执行计划:
阅读全文
posted @
2016-10-17 19:27
Tomatoes
阅读(576)
推荐(0)
【练习】手工生成awr报告
摘要:①首先进入$ORACLE_HOME/rdbms/admin目录 该目录下 以SYSDBA身份登录运行@awrrpt
阅读全文
posted @
2016-10-15 19:13
Tomatoes
阅读(494)
推荐(0)
【练习】ORACLE统计信息--直方图
摘要:①创建表tSQL> create table t as select * from dba_objects; Table created. --收集直方图 SQL> exec dbms_stats.gather_table_stats(user,'T'); PL/SQL procedure successfully completed. --此时数据库为表上的所有字段收集了缺省的统计信息,每...
阅读全文
posted @
2016-10-12 21:19
Tomatoes
阅读(1755)
推荐(0)
【测试】大表改分区(交换分区+分区分离)
摘要:将大表分割成较小的分区可以改善表的维护、备份、恢复、事务及查询性能。 ①建表:test 创建test表的索引: ②建表test_p: 创建test_p索引: ③交换分区: ④锁定表(将新的数据库导入): ⑤分区分裂: ⑥重建索引和主键(交换分区后索引和主键已失效):
阅读全文
posted @
2016-10-12 14:22
Tomatoes
阅读(381)
推荐(0)