|
课程第58次:2016-07-24星期日晚上
【上完1Z0-053的第16章】资源计划
【上完1Z0-053的第18章】行链接和行迁移、压缩、SHRINK SPACE和SUSPEND TRIGGER
【上完1Z0-051】:共12章(0 1 2 3 4 5 6 7 8 9 10 11)
【上完1Z0-052】:共19章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
【上完1Z0-053】:共21章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)
表示已经上过的,表示还没上的。
参考别期的帖子:
https://www.botangdb.com/forum.php?mod=viewthread&tid=266&extra=page%3D1
rsrc.sql:
- select * from dba_users u
- where u.username in ('SYS','SYSTEM');
-
- select * from dba_rsrc_plans;
-
- select * from dba_rsrc_plan_directives r
- where r.plan='PLAN1';
-
- select * from dba_rsrc_plans rp
- where rp.plan='PLAN3';
-
- ---
-
- BEGIN
- dbms_resource_manager.clear_pending_area();
- dbms_resource_manager.create_pending_area();
- dbms_resource_manager.create_plan( plan => 'PLAN3',
- comment => 'PLAN3',cpu_mth => 'RATIO'
- );
- dbms_resource_manager.create_plan_directive(
- plan => 'PLAN3',
- group_or_subplan => 'OTHER_GROUPS',
- comment => 'OTHER_GROUPS',
-
- mgmt_p1 => 1
- );
- dbms_resource_manager.submit_pending_area();
- END;
- ---
- begin
- dbms_resource_manager.create_simple_plan(simple_plan => 'PLAN4',
- consumer_group1 => 'GROUP1',
- group1_cpu => 60,
- consumer_group2 => 'GROUP2',group2_cpu => 40 );
- end;
- ---
- select s.RESOURCE_CONSUMER_GROUP
- from v_$session s where s.TERMINAL='pts/5';
-
- select * from dba_rsrc_plan_directives r
- where r.plan='PLAN1';
-
- select s.RESOURCE_CONSUMER_GROUP, s.STATUS
- from v_$session s where s.TERMINAL='pts/5'
- and s.RESOURCE_CONSUMER_GROUP='GROUP1';
-
- select * from v$transaction;
-
- select s.RESOURCE_CONSUMER_GROUP, s.STATUS , s.TERMINAL
- from v_$session s where s.USERNAME='HR'
- and s.RESOURCE_CONSUMER_GROUP='GROUP1';
- ---
- select s.RESOURCE_CONSUMER_GROUP, s.STATUS
- from v_$session s where s.TERMINAL='pts/5' ;
-
-
复制代码
rsrc2.sql:
- SELECT begin_time, consumer_group_name, cpu_consumed_time, cpu_wait_time
- FROM v$rsrcmgrmetric_history
- ORDER BY begin_time;
- SELECT name, consumed_cpu_time, cpu_wait_time
- FROM v$rsrc_consumer_group;
- select s.RESOURCE_CONSUMER_GROUP
- from v_$session s where s.TERMINAL='pts/1';
-
- BEGIN
- dbms_resource_manager.clear_pending_area();
- dbms_resource_manager.create_pending_area();
- dbms_resource_manager.set_consumer_group_mapping_pri(explicit => 1,
- oracle_user => 8,service_name => 3,client_os_user => 2,client_program => 9,
- client_machine => 10,module_name => 5,module_name_action => 4,service_module => 6,
- service_module_action => 7
-
-
- );
- dbms_resource_manager.submit_pending_area();
- END;
复制代码
space.sql:
- create table
- t05318_chain(a varchar2(2000), b varchar2(2000), c varchar2(2000), d varchar2(2000));
-
-
- insert into t05318_chain(a) values('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
- select dbms_rowid.rowid_block_number ( rowid ) from t05318_chain;
- analyze table t05318_chain list chained rows;
-
- select * from CHAINED_ROWS;
-
- ----
-
- truncate table CHAINED_ROWS;
-
- alter system set memory_Target=0;
-
- alter system set db_cache_size=1G;
- alter system set db_16k_Cache_size=1M;
-
- create tablespace tbs16k datafile size 10M blocksize 16384;
-
- alter table hr.t05318_chain move tablespace tbs16k;
-
- ---
-
- create table t05318_migrate( a varchar2(2000)) pctfree 0;
-
- begin
- for i in 1..733
- loop
- insert into t05318_migrate values('A');
- end loop;
- commit;
- end;
-
- select dbms_rowid.rowid_block_number(rowid) , count(*) from t05318_migrate
- group by dbms_rowid.rowid_block_number(rowid);
-
-
- --
- analyze table t05318_migrate list chained rows;
-
- select * from CHAINED_ROWS;
-
- ---
- update t05318_migrate set a='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' where rownum=1;
-
- analyze table t05318_migrate list chained rows;
-
-
- alter table t05318_migrate pctfree 20;
-
- truncate table CHAINED_ROWS;
-
- alter table t05318_migrate move tablespace users ;
- ----
-
- create tablespace tbs_nocompression datafile size 10M autoextend on;
- create tablespace tbs_basic datafile size 10M autoextend on default compress basic;
- create tablespace tbs_oltp datafile size 10M autoextend on default compress for oltp;
- create tablespace tbs_query datafile size 10M autoextend on default compress for query;
- create tablespace tbs_archive datafile size 10M autoextend on default compress for archive;
- select t.tablespace_name, t.def_tab_compression, t.compress_for from dba_tablespaces t
- where t.tablespace_name in ('TBS_NOCOMPRESSION',
- 'TBS_BASIC', 'TBS_OLTP',
- 'TBS_QUERY',
- 'TBS_ARCHIVE');
-
- -----
- create table t_nocompression (a varchar2(200)) tablespace tbs_nocompression;
- create table t_basic (a varchar2(200)) tablespace tbs_basic;
- create table t_oltp (a varchar2(200)) tablespace tbs_oltp;
- ----
-
- begin
- for i in 1..400
- loop
- insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_basic values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_oltp values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- ---
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP');
-
- ---
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_oltp group by substr(rowid, 10, 6 );
- ----
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
- --sys--
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid)
- from hr.T_OLTP group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_OLTP',row_id => rowid);
- ---
- create table t_basic2 (a varchar2(200)) tablespace tbs_nocompression compress;
- create table t_oltp2 (a varchar2(200)) tablespace tbs_nocompression compress for oltp;
- ---
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP', 'T_BASIC2','T_OLTP2' );
- ---
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_basic2 values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --hr--
- begin
- for i in 1..400
- loop
- insert into t_oltp2 values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- --
- --hr--
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic2 group by substr(rowid, 10, 6 );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_oltp2 group by substr(rowid, 10, 6 );
-
- ---
- alter table t_nocompression compress for oltp;
- select t.TABLE_NAME, t.PCT_FREE , t.COMPRESSION , t.COMPRESS_FOR, t.TABLESPACE_NAME
- from user_tables t where t.TABLE_NAME in ('T_NOCOMPRESSION','T_BASIC','T_OLTP', 'T_BASIC2','T_OLTP2' );
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- begin
- for i in 1..400
- loop
- insert into t_nocompression values('AAAAAAAAAAAAAAAAAAAA');
- end loop;
- commit;
- end;
- alter table t_nocompression move tablespace tbs_nocompression;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_nocompression group by substr(rowid, 10, 6 );
- ---
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid)
- from hr.T_NOCOMPRESSION group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_NOCOMPRESSION',row_id => rowid);
- ---
- insert /*+ append */ into t_basic select * from t_basic;
- commit;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- ---
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
-
- ---
- alter table t_basic move tablespace TBS_NOCOMPRESSION;
- select count(*) , substr(rowid, 10, 6 ) from hr.t_basic group by substr(rowid, 10, 6 );
- ---
- select count(*) , dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid)
- from hr.T_BASIC group by dbms_compression.get_compression_type(ownname => 'HR',tabname => 'T_BASIC',row_id => rowid);
-
- alter tablespace users add datafile '/home/oracle/users2.dbf' size 100M;
-
- ---
- declare
- v_blkcnt_cmp number;
- v_blkcnt_uncmp number;
- v_row_cmp number;
- v_row_uncmp number;
- v_cmp_ratio number;
- v_comptype_str varchar2(200);
- BEGIN
- DBMS_COMPRESSION.GET_COMPRESSION_RATIO(scratchtbsname => 'USERS',
- ownname =>'HR',
- tabname =>'T_BASIC_BIG',
- partname =>null,
- comptype => 2,
- blkcnt_cmp => v_blkcnt_cmp,
- blkcnt_uncmp => v_blkcnt_uncmp,
- row_cmp =>v_row_cmp,
- row_uncmp => v_row_uncmp,
- cmp_ratio => v_cmp_ratio,
- comptype_str =>v_comptype_str);
- DBMS_OUTPUT.PUT_LINE('Blk count compressed = ' || v_blkcnt_cmp);
- DBMS_OUTPUT.PUT_LINE('Blk count uncompressed = ' || v_blkcnt_uncmp);
- DBMS_OUTPUT.PUT_LINE('Row count per block compressed = ' || v_row_cmp);
- DBMS_OUTPUT.PUT_LINE('Row count per block uncompressed = ' || v_row_uncmp);
- DBMS_OUTPUT.PUT_LINE('ratio: '||v_cmp_ratio);
- DBMS_OUTPUT.PUT_LINE('Compression type = ' || v_comptype_str);
- end;
- ---
- create table t_basic_col( a number , b varchar2(20)) compress ;
- insert into t_basic_col values ( 1,'A') ;
- commit;
- create table t_oltp_col( a number , b varchar2(20)) compress for oltp;
- insert into t_oltp_col values ( 1,'A') ;
- commit;
- select * from t_basic_col;
- select * from t_oltp_col;
- alter table t_basic_col drop column b;
- alter table t_basic_col drop ( b);
- alter table t_oltp_col drop column b;
- select * from t_oltp_col;
- ---
- create tablespace tbssmall datafile '/home/oracle/tbssmall.dbf' size 5M autoextend off;
- create table t04311_b( a number ) tablespace tbssmall storage ( initial 1M);
- CREATE OR REPLACE TRIGGER SYS.TRG_SUSPEND
- AFTER SUSPEND
- ON DATABASE
- declare
- v_size number;
- pragma AUTONOMOUS_TRANSACTION;
- begin
- select bytes into v_size from dba_data_files where file_name='/home/oracle/tbssmall.dbf';
- v_size := v_size + 5242880;
- execute immediate 'alter database datafile ''/home/oracle/tbssmall.dbf'' resize '||v_size;
- commit;
- end;
- select * from user_errors;
复制代码
随堂输出:
- [oracle@station90 admin]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 24 21:26:18 2016
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn hr/botang123
- Connected.
- SQL> @utlchain.sql
- Table created.
- SQL> create table hr.t_basic_big compress as select * from dba_source;
- create table hr.t_basic_big compress as select * from dba_source
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL> conn / as sysdba
- Connected.
- SQL> create table hr.t_basic_big compress as select * from dba_source;
- Table created.
- SQL> select bytes/1024/1024 from dba_segments where segment_name='T_BASIC_BIG';
- BYTES/1024/1024
- ---------------
- 57
- SQL> delete from t04209_uname ;
- delete from t04209_uname
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL> conn hr/botang123
- Connected.
- SQL> delete from t04209_uname ;
- 400000 rows deleted.
- SQL> commit;
- Commit complete.
- SQL> select bytes/1024/1024 from user_segments where segment_name='T04209_UNAME';
- BYTES/1024/1024
- ---------------
- 8
- SQL> alter table t04209_uname enable row movement ;
- Table altered.
- SQL> alter table t04209_uname shrink space compact;
- Table altered.
- SQL> select bytes/1024/1024 from user_segments where segment_name='T04209_UNAME';
- BYTES/1024/1024
- ---------------
- 8
- SQL> alter table t04209_uname shrink space ;
- Table altered.
- SQL> select bytes/1024/1024 from user_segments where segment_name='T04209_UNAME';
- BYTES/1024/1024
- ---------------
- .0625
- SQL> select bytes/1024/1024 from user_segments where segment_name='TBIG';
- BYTES/1024/1024
- ---------------
- 88
- SQL> delete from TBIG;
- 633207 rows deleted.
- SQL> SQL> SQL> SQL> commit;
- Commit complete.
- SQL> select bytes/1024/1024 from user_segments where segment_name='TBIG';
- BYTES/1024/1024
- ---------------
- 88
- SQL> select bytes/1024/1024 , tablespace_name from user_segments where segment_name='TBIG';
- BYTES/1024/1024 TABLESPACE_NAME
- --------------- ------------------------------
- 88 USERS
- SQL> alter table TBIG allocate extent (size 200M) ;
- alter table TBIG allocate extent (size 200M)
- *
- ERROR at line 1:
- ORA-01653: unable to extend table HR.TBIG by 1024 in tablespace USERS
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- You have new mail in /var/spool/mail/oracle
- [oracle@station90 admin]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 24 22:33:21 2016
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> alter database datafile '/home/oracle/users2.dbf' resize 300M;
- Database altered.
- SQL> conn hr/botang123
- Connected.
- SQL> alter table TBIG allocate extent (size 200M) ;
- Table altered.
- SQL> alter session enable resumable ;
- ERROR:
- ORA-01031: insufficient privileges
- SQL> alter session enable resumable ;
- Session altered.
- SQL> alter session enable resumable timeout 10 ;
- Session altered.
- SQL> create table t05318 ( a number ) storage ( inital 500M ) ;
- create table t05318 ( a number ) storage ( inital 500M )
- *
- ERROR at line 1:
- ORA-02143: invalid STORAGE option
- SQL> create table t05318 ( a number ) storage ( initial 500M ) ;
- Table created.
- SQL> insert into t05318 values (1) ;
- insert into t05318 values (1)
- *
- ERROR at line 1:
- ORA-30032: the suspended (resumable) statement has timed out
- ORA-01659: unable to allocate MINEXTENTS beyond 1 in tablespace USERS
- SQL> alter session enable resumable timeout 100 ;
- Session altered.
- SQL> create table t04311_b( a number ) tablespace tbssmall storage ( initial 6M);
- Table created.
- SQL> insert into t04311_b values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL>
- --------------------
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Sun Jul 24 22:37:54 2016
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> grant resumable to hr ;
- Grant succeeded.
- SQL>
- ------------------
复制代码
|
|