|
第三阶段New Feature/OCM Exam Preparation(31-41)- select * from dba_indexes i
- where i.table_owner='SH' and i.table_name='SALES';
-
- select tp.partition_name ,tp.compression ,
- tp.compress_for from dba_tab_partitions tp
- where tp.table_owner='SH' and tp.table_name='SALES';
- select i.index_name , ip.partition_name , decode(ip.status , null,i.status, ip.status)
- , ip.tablespace_name
- from dba_indexes i , dba_ind_partitions ip
- where i.index_name=ip.index_name(+)
- and i.table_name='SALES' and i.owner='SH'
- order by 1,2;
-
- select c.constraint_name, c.constraint_type,
- c.status, c.validated, c.deferrable, c.deferred,c.rely
- from dba_constraints c
- where c.owner='SH' and c.table_name <>'SALES';
- -------
-
- select t.compression , t.compress_for from dba_tables t
- where t.owner='SH' and t.table_name='SALES_DELTA';
-
-
-
复制代码
- SQL> conn sh/oracle_4U
- Connected.
- ALTER TABLE sales SPLIT PARTITION sales_q1_2007
- AT (TO_DATE('01-APR-2007','DD-MON-YYYY'))
- 3 INTO (PARTITION sales_q1_2007, PARTITION sales_beyond_q1_2007);
- Table altered.
- SELECT COUNT(*) FROM sales PARTITION (sales_beyond_q1_2007);007);
- COUNT(*)
- ----------
- 0
- SQL> SQL> ALTER TABLE sales DROP PARTITION sales_beyond_q1_2007 update global indexes ;
- Table altered.
- SQL> alter table sales add partition sales_q2_2007 values less than ( to_date('2007-07-01','YYYY-MM-DD')) ;
- Table altered.
- SQL> alter table sales drop partition sales_q2_2007 ;
- Table altered.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station17 ~]$ dwworkshop/lab
- lab1/ lab2/ lab3/ lab4/ lab5/ lab6/ lab7/
- [oracle@station17 ~]$ dwworkshop/labs2
- -bash: dwworkshop/labs2: No such file or directory
- [oracle@station17 ~]$ cd dwworkshop/labs2
- -bash: cd: dwworkshop/labs2: No such file or directory
- [oracle@station17 ~]$ cd dwworkshop/lab2/
- [oracle@station17 lab2]$ ls
- create_constraints_old.sql csbs.sql ldsalesupdate.sql salesq107.dat
- create_constraints.sql csbsu.sql load_stage_table2.sql salesQ1.dat
- create_ndx.sql csbt.sql mark_index_unusable.sql show_sales_idx_status.sql
- create_partition_for_sales_etl.sql csd.sql modify_constraints.sql sh_sales.bad
- create_static_bitmap_index.sql fast_split_sales.sql rebuild_indexes.sql sh_sales.log_xt
- [oracle@station17 lab2]$ vim create_ndx.sql
- [oracle@station17 lab2]$ ls
- create_constraints_old.sql csbs.sql ldsalesupdate.sql salesq107.dat
- create_constraints.sql csbsu.sql load_stage_table2.sql salesQ1.dat
- create_ndx.sql csbt.sql mark_index_unusable.sql show_sales_idx_status.sql
- create_partition_for_sales_etl.sql csd.sql modify_constraints.sql sh_sales.bad
- create_static_bitmap_index.sql fast_split_sales.sql rebuild_indexes.sql sh_sales.log_xt
- [oracle@station17 lab2]$ cd ..
- [oracle@station17 dwworkshop]$ ls
- fix lab1 lab2 lab3 lab4 lab5 lab6 lab7 tuning_Workshop_Labs.pdf
- [oracle@station17 dwworkshop]$ cd lab3
- [oracle@station17 lab3]$ ls
- add_salestemp_pk.sql create_global_index.sql lab2.zip see_split2.sql
- cleanup_labs123.sql exchange_partition_w_gim.sql prep4_global_index.sql see_split.sql
- cleanup_split_q1.sql exchange_partition_wo_gim2.sql run_select.sql show_sales_idx_status.sql
- count_mar_sales.sql first_split_q1.sql second_split_q1.sql use_global_index.sql
- [oracle@station17 lab3]$ vim first_split_q1.sql
- [oracle@station17 lab3]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 11 21:29:18 2017
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn sh/oracle_4U
- Connected.
- SQL> @first_split_q1.sql
- We now want to leverage the new functionality and break down the existing
- quarter partition into monthly ones
- Table altered.
- SQL> @second_split_q1.sql
- (PARTITION sales_JAN_2007 TABLESPACE sysaux COMPRESS for otlp ,
- *
- ERROR at line 4:
- ORA-14464: Compression Type not specified
- SQL> @second_split_q1.sql
- Table altered.
- ALTER TABLE sales MOVE PARTITION sales_JAN_2007 TABLESPACE example
- UPDATE INDEXES (sales_time_bix (PARTITION sales_jan_2007 TABLESPACE example),
- sales_cust_bix (PARTITION sales_jan_2007 TABLESPACE example),
- sales_channel_bix (PARTITION sales_jan_2007 TABLESPACE example),
- sales_prod_bix (PARTITION sales_jan_2007 TABLESPACE example),
- 6 sales_promo_bix (PARTITION sales_jan_2007 TABLESPACE example));
- Table altered.
- SQL> /
- Table altered.
- SQL> ALTER INDEX sales_time_bix
- 2 REBUILD PARTITION FEB_07 TABLESPACE example;
- Index altered.
- CREATE TABLE sales_mar_2007_temp
- NOLOGGING AS SELECT * FROM sales
- 3 PARTITION (sales_MAR_2007);
- Table created.
- SQL> select count(*) from sales_mar_2007_temp;
- COUNT(*)
- ----------
- 99326
- CREATE BITMAP INDEX sales_prod_mar_2007_bix
- ON sales_mar_2007_temp (prod_id)
- NOLOGGING COMPUTE STATISTICS ;ICS ;
- CREATE BITMAP INDEX sales_cust_mar_2007_bix
- ON sales_mar_2007_temp (cust_id)
- NOLOGGING COMPUTE STATISTICS ;
- CREATE BITMAP INDEX sales_time_mar_2007_bix
- ON sales_mar_2007_temp (time_id)
- NOLOGGING COMPUTE STATISTICS ;
- CREATE BITMAP INDEX sales_channel_mar_2007_bix
- ON sales_mar_2007_temp (channel_id)
- NOLOGGING COMPUTE STATISTICS ;
- CREATE BITMAP INDEX sales_promo_mar_2007_bix
- ON sales_mar_2007_temp (promo_id)
- NOLOGGING COMPUTE STATISTICS ;
- Index created.
- SQL> SQL> 2 3
- Index created.
- SQL> SQL> 2 3
- Index created.
- SQL> SQL> 2 3
- Index created.
- SQL> SQL> 2 3
- Index created.
- SQL>
- SQL>
复制代码
|
|