Skip to content

Instantly share code, notes, and snippets.

View Tracnac's full-sized avatar

Tracnac

View GitHub Profile
@Tracnac
Tracnac / Installation WSL.md
Created September 23, 2022 16:17
Installation WSL #windows

Powershell admin :

  • Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
  • reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowAllTrustedApps" /d "1"

reboot

Powershell admin :

@Tracnac
Tracnac / slow expdp impdp.md
Last active September 23, 2022 16:19
Slow expdp/impdp #oracle
SQL> show parameter stream

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_disable_streams_pool_auto_tuning    boolean     TRUE
streams_pool_size                    big integer 256M

select shrink_phase_knlasg from x$knlasg;
-- if
@Tracnac
Tracnac / Rman partial restore.md
Last active September 23, 2022 16:21
Rman partial restore #oracle #rman

define rmanowner= -- Datafiles list -- Input Owner -- Base select df.file# from v$tablespace ts, v$datafile df where ts.ts#=df.ts# and ( ts.name in ('SYSTEM','SYSAUX') or ts.name in (select tablespace_name from dba_tablespaces where contents = 'UNDO')) union -- Owner

@Tracnac
Tracnac / Rman until.md
Created September 23, 2022 16:21
Rman until #oracle #rman

NLS_LANG="AMERICAN_AMERICA.US7ASCII" NLS_DATE_FORMAT="Mon DD YYYY HH24:MI:SS"

rman target /

RUN { SET UNTIL TIME 'Sep 03 2013 20:00:00'; RESTORE DATABASE PREVIEW; }

@Tracnac
Tracnac / Force PLAN_HASH_VALUE.md
Created September 23, 2022 16:22
Force PLAN_HASH_VALUE #oracle #sql
/* Formatted on 15/10/2018 11:44:53 (QP5 v5.256.13226.35538) */
SELECT *
 FROM dba_sql_plan_baselines
 WHERE signature IN (SELECT exact_matching_signature
                       FROM v$sql
                      WHERE sql_id = '&SQL_ID');
BEGIN
   DBMS_OUTPUT.put_line (
      DBMS_SPM.load_plans_from_cursor_cache (sql_id => '2dwnbhkh8r7g8'));
@Tracnac
Tracnac / Flashback database.md
Created September 23, 2022 16:23
Flashback database #oracle #sql
-- Sqlplus

alter system set db_flashback_retention_target=1440 scope=both sid='*';
alter system set db_recovery_file_dest_size=64G scope=both sid='*';
alter system archive log current;

ALTER DATABASE FLASHBACK ON;
CREATE RESTORE POINT 120714_1139 GUARANTEE FLASHBACK DATABASE;
@Tracnac
Tracnac / Migration Oracle 11gR2.03 to 11gR2.04.md
Last active September 23, 2022 16:27
Migration Oracle 11gR2.03 to 11gR2.04 (Inclus DST) #oracle

11.2.0.3 -> 11.2.0.4:

@/opt/oracle/rdbms/11.2.0.4/rdbms/admin/utlu112i.sql

EXECUTE dbms_stats.gather_dictionary_stats;
shutdown immediate
@Tracnac
Tracnac / Extract Authy TOTP Code.md
Created September 23, 2022 16:28
Extract Authy TOTP Code #js #security
console.clear();
        console.warn('Heres Your Authy TOTP Secrets');
        console.warn('Click Any Group To Expand / Collapse It');
        console.warn('If Nothing Shows Make Sure To Login To Authy & Enter Your Password');
        appManager.getModel().forEach(function(i){
            if(i.markedForDeletion === false){
                console.groupCollapsed(i.name);
                console.log('TOTP Secret:',i.markedForDeletion === false ? i.decryptedSeed : hex_to_b32(i.secretSeed));
 console.log('TOTP URI:','otpauth://totp/'+encodeURIComponent(i.name)+'?secret='+i.decryptedSeed+'&issuer='+i.accountType);
@Tracnac
Tracnac / Flush sqlid from cache.md
Last active September 23, 2022 16:31
Flush sqlid from cache #oracle #sql

If you already know the SQL_ID of the statement you want to purge, you can look up the cursor info you need to build the name parameter value using the following query:

select address, hash_value from v$sqlarea where sql_id like '97y7vc8x7jhmc';

ADDRESS          HASH_VALUE
---------------- ----------

00000000A9F34F98 1682024353
@Tracnac
Tracnac / Stop SGA MEMORY target
Created September 23, 2022 16:31
Stop SGA MEMORY target #oracle
*.memory_target=0
*.sga_target=0
*.java_pool_size=64M
*.large_pool_size=256M
*.db_cache_size=2G
*.shared_pool_size=6G
*.streams_pool_size=256M
*.pga_aggregate_target=4G