create pluggable database NIHILUS admin user NIHILUS$OWNER identified by secret;
alter pluggable database NIHILUS open;
alter pluggable database NIHILUS save state;


alter session set container=NIHILUS;

create tablespace USERS datafile size 32M autoextend ON next 32M;
alter database default tablespace USERS;

create user adm identified by "secret";
grant sysdba to adm;

create user usr identified by "secret";
grant CONNECT,RESOURCE to usr;
grant alter session to usr;
alter user usr quota unlimited on USERS;

alias adm_NIHILUS='rlwrap sqlplus adm/"secret"@bakura:1521/NIHILUS as sysdba'
alias usr_NIHILUS='rlwrap sqlplus usr/"secret"@bakura:1521/NIHILUS'




create table USR.T1 as select * from dba_extents;
create index USR.IDX_T1_BLOCKS on USR.T1(blocks);
exec dbms_stats.gather_table_stats('USR','T1', method_opt=>'for all columns size AUTO');

insert into USR.T1 select * from USR.T1;
commit;
exec dbms_stats.gather_table_stats('USR','T1', method_opt=>'for all columns size AUTO');


insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
commit;
exec dbms_stats.gather_table_stats('USR','T1', method_opt=>'for all columns size AUTO');


insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
insert into USR.T1 select * from USR.T1;
commit;
exec dbms_stats.gather_table_stats('USR','T1', method_opt=>'for all columns size AUTO');


-- @stats_history.sql USR <owner> <object_name> <partition_name> <object_type> 

-- stats history for table and index
@stats_history.sql USR T1 % % 
@stats_history.sql USR IDX_T1_BLOCKS % INDEX 

-- display gather stats operations and details
@stats_opls.sql sysdate-1/24 sysdate BASIC TEXT
@stats_opdet.sql 1083 TYPICAL


-- see also Metalink note: How to View Table Statistics History (Doc ID 761554.1)
