This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH TableList AS | |
| (SELECT object_id, | |
| OWNER, | |
| object_name | |
| FROM dba_objects | |
| WHERE object_type='TABLE' | |
| AND object_name = UPPER(:TNAME) ) , | |
| HistTableInfo AS | |
| (SELECT TableList.OWNER, | |
| OBJECT_NAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use rand::Rng; | |
| use std::io; | |
| use std::cmp::Ordering; | |
| //Main code | |
| fn main() { | |
| // Generate random number, create premise | |
| println!("Guess the number!"); | |
| let mut breaking_choice = false; | |
| while !breaking_choice { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::path::Path; | |
| use std::ffi::OsStr; | |
| fn main() { | |
| fn get_extension_from_filename(filename: &str) -> Option<&str> { | |
| Path::new(filename) | |
| .extension() | |
| .and_then(OsStr::to_str)} | |
| assert_eq!(get_extension_from_filename("abc.gz"), Some("gz")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Decompiled with CFR 0_115. | |
| * | |
| * Could not load the following classes: | |
| * number.NJFrame$1 | |
| * number.NJFrame$2 | |
| * number.NJFrame$3 | |
| * number.NJFrame$4 | |
| * number.NJFrame$5 | |
| * number.NJFrame$6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Set up a SQL Baseline using known-good plan, sourced from AWR snapshots | |
| https://rnm1978.wordpress.com/ | |
| In this example, sql_id is 939abmqmvcc4d and the plan_hash_value of the good plan that we want to force is 1239572551 | |
| */ | |
| -- Drop SQL Tuning Set (STS) | |
| BEGIN | |
| DBMS_SQLTUNE.DROP_SQLSET( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set markup html on spool on | |
| spool db_info.html | |
| set echo on | |
| <<<<<<<Query >>>>>>>>>> | |
| spool off | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select case wait_rank when 1 then inst_id end "Inst Num", | |
| case wait_rank when 1 then snap_id end "Snap Id", | |
| case wait_rank when 1 then begin_snap end "Begin Snap", | |
| case wait_rank when 1 then end_snap end "End Snap", | |
| event_name "Event", | |
| total_waits "Waits", | |
| time_waited "Time(s)", | |
| round((time_waited/total_waits)*1000) "Avg wait(ms)", | |
| round((time_waited/db_time)*100, 2) "% DB time", | |
| substr(wait_class, 1, 15) "Wait Class" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| DSQL.SNAP_ID, | |
| DSQL.INSTANCE_NUMBER INST, --DSQL.PLAN_HASH_VALUE PLANH, | |
| to_char((select END_INTERVAL_TIME from DBA_HIST_SNAPSHOT where SNAP_ID=DSQL.SNAP_ID and rownum <2),'DD/MON HH24:MI') "DATE", | |
| ROUND((ELAPSED_TIME_DELTA/1000000)/DECODE(EXECUTIONS_DELTA,0,1,EXECUTIONS_DELTA),5) AVG_EXEC_TIME, DSQL.EXECUTIONS_DELTA EXD, | |
| (DSQL.CPU_TIME_DELTA / (1000000)) CPU_TIME, DSQL.SQL_ID , BUFFER_GETS_DELTA | |
| FROM DBA_HIST_SQLSTAT DSQL | |
| WHERE DSQL.SQL_ID IN ('') | |
| AND DSQL.SNAP_ID BETWEEN AND | |
| ORDER BY 2,7,3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from ( | |
| SELECT SQL_ID, MODULE, ACTION, RANK () OVER (ORDER BY avgt DESC) AS ELAPSED_RANK,avgt as "execution time(sec)" from | |
| ( | |
| select SQL_ID, MODULE, ACTION,ROUND(SUM(ELAPSED_TIME_DELTA)/SUM(decode(executions_delta,0,1,executions_delta))/1000000,5) avgt | |
| FROM DBA_HIST_SQLSTAT | |
| where SNAP_ID between and | |
| group by SQL_ID, MODULE, ACTION | |
| )) | |
| WHERE ELAPSED_RANK <= 15; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| INSTANCE_NUMBER,event, | |
| time_waited "time_waited(s)", | |
| case when time_waited = 0 then | |
| 0 | |
| else | |
| round(time_waited*100 / sum(time_waited) Over(), 2) | |
| end "percentage" | |
| from | |
| ( |
NewerOlder