Skip to content

Instantly share code, notes, and snippets.

View Tracnac's full-sized avatar

Tracnac

View GitHub Profile
@Tracnac
Tracnac / Setting for DEX.md
Last active September 23, 2022 16:54
Setting for DEX #android

In the manifest :

android:resizeableActivity="true"
@Tracnac
Tracnac / DBA Datafile free space.md
Created September 23, 2022 16:55
DBA Datafile free space #oracle
set LINESIZE 85
set PAGESIZE 200
column tablespace_name FORMAT a18
column file_name FORMAT a25
column allocated_kb FORMAT 999,999,999
column free_kb FORMAT 999,999,999
column percent_free FORMAT 999
  SELECT df.tablespace_name,
 df.file_name,
@Tracnac
Tracnac / Diagnostic directory.md
Last active September 23, 2022 16:56
Diagnostic directory #oracle
set linesize 128
col name for a24
col value for a96
SELECT NAME, VALUE
FROM V$DIAG_INFO;


NAME                     VALUE
------------------------ ------------------------------------------------------------------------------------------------
@Tracnac
Tracnac / MsSQL quick fix.md
Created September 23, 2022 16:57
MsSQL quick fix (Suspect) #mssql
EXEC sp_resetstatus [DB_with_suspect_mode];

alter database [DB_with_suspect_mode] SET partner off

ALTER DATABASE [DB_with_suspect_mode] SET EMERGENCY

DBCC checkdb ([DB_with_suspect_mode])

ALTER DATABASE [DB_with_suspect_mode] SET ONLINEEXEC sp_resetstatus [DB_with_suspect_mode];
@Tracnac
Tracnac / Execute any sql from another session.md
Created September 23, 2022 16:57
Execute any sql from another session #oracle #sql
declare

nUid number;
vSqltext varchar2(100) := 'alter user <username> profile personal';
iCursor integer;
iResult integer;

begin
select user_id into nUid from all_users where username like 'SYS';
@Tracnac
Tracnac / Trace a specific ORA in alert.md
Created September 23, 2022 16:58
Trace a specific ORA in alert.log #oracle

For ORA-01476 for example

alter system set events '1476 trace name errorstack level 12';
@Tracnac
Tracnac / Flashback database.md
Last active September 23, 2022 17:00
Flashback database #oracle #rman

Création du snapshot :

alter system archive log current;
shutdown immediate;
startup mount exclusive;
alter database flashback on;
create restore point DB_SNAP01 guarantee flashback database;
alter database open;
alter system archive log current;
@Tracnac
Tracnac / Valeur d’essai pour optimizer_index_cost_adj.md
Last active September 23, 2022 17:01
Valeur d’essai pour optimizer_index_cost_adj #oracle #performance

Determining a starting value for optimizer_index_cost_adj

We can see that the optimal setting for optimizer_index_cost_adj is partially a function of the I/O waits for sequential reads vs. scattered reads:

select
a.average_wait c1,
b.average_wait c2,
a.total_waits /(a.total_waits + b.total_waits)*100 c3,
@Tracnac
Tracnac / Unix test in shell.md
Created September 23, 2022 17:02
Unix test in shell #shell #unix
if [ \( 1 -eq 1 \) -a \( 2 -eq 1 -o 1 -eq 1 \) ]
then
echo "OK";
else
echo "KO";
fi

Documentation :

@Tracnac
Tracnac / Undocumented datapump.md
Created September 23, 2022 17:02
Undocumented datapump #oracle #datapump

#Shell #SQL #Oracle

On 4 undocumented DataPump parameters In DBA, Oracle utilities on December 20, 2011 at 18:14 DataPump is probably the best free Oracle utility/tool ever developed. With the exception of SQL*Plus of course which is somehow naturally excluded. It is like SELECT being the most common command written/typed by DBAs and Developers. Guess which is the next one after SELECT? You might not want to believe it but it seems to be EXIT Now, 11g came with several new parameters: COMPRESSION, ENCRYPTION, TRANSPORTABLE, NETWORK_LINK, PARTITION_OPTIONS, DATA_OPTIONS, REUSE_DUMPFILES, REMAP_TABLE, etc. which are probably well-known but here are few undocumented ones you can have as an ace up your sleeve.

  1. METRICS You can use the parameter METRICS=Y to include additional logging information about the number of objects and the time it took to process them in the log file. With METRICS, additional information can be obtained about the number of objects that were processed and the time it took for processing