$ nohup sqlplus system/sys @hwm2.sql>hwm2.txt 2>&1 &
nohup sqlplus '/ as sysdba' @stats.sql &
cat stats.sql
spool stats.spool
set time on timing on
alter session set nls_date_format='dd-mm-yyyy hh24:mi';
prompt dbms_stats.gather_dictionary_stats
EXECUTE dbms_stats.gather_dictionary_stats;
prompt DBMS_STATS.GATHER_FIXED_OBJECTS_STATS
EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;
spool off
exit
============
-- stats1.sql
spool stats1.spool
alter session set nls_date_format='dd-MON-YYYY hh24:mi';
set time on timing on feedback on
select sysdate from dual;
set echo on feedback on time on timing on verify on
-- show con_name;
set pages 300 lines 350
col open_mode for a10
col host_name for a10
col database_role for a15
col db_unique_name for a10
col controlfile_type for a10
col database_role for a17
col host_name for a35
col open_mode for a20
select name,db_unique_name,instance_name,host_name,open_mode,log_mode,database_status,database_role,switchover_status,protection_mode,protection_level,controlfile_type,status,logins,force_logging,to_char(startup_time,'dd-mon-yyyy hh24:mi:ss') "db up time" from v$database,gv$instance;
SET VERIFY OFF
select sysdate from dual;
prompt ========================================
prompt DBMS_STATS.GATHER_FIXED_OBJECTS_STATS ()
prompt ========================================
EXEC DBMS_STATS.GATHER_FIXED_OBJECTS_STATS ();
prompt ========================================
prompt DBMS_STATS.GATHER_SCHEMA_STATS('SYSTEM')
prompt ========================================
EXEC DBMS_STATS.GATHER_SCHEMA_STATS('SYSTEM');
prompt ========================================
prompt DBMS_STATS.GATHER_SCHEMA_STATS('SYS')
prompt ========================================
EXEC DBMS_STATS.GATHER_SCHEMA_STATS('SYS');
prompt ========================================
prompt DBMS_STATS.GATHER_DICTIONARY_STATS
prompt ========================================
EXEC DBMS_STATS.GATHER_DICTIONARY_STATS ();
select sysdate from dual;
spool off