Ok

En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies. Ces derniers assurent le bon fonctionnement de nos services. En savoir plus.

Oracle12C,19C - Page 7

  • Flashback database

    3 manières de faire :

     

    SQL> flashback database to TIMESTAMP(sysdate - 2/24); --> flash back to 2 hr
    SQL> FLASHBACK DATABASE TO TIMESTAMP SYSDATE-(1/24/12); --> Flashback 5 minutes.
    SQL> flashback database to timestamp to_date('27-JUN-2016 19:50:00','DD-MON-YYYY HH24:MI:SS'); --> flash bakc to a specific time period

     

    source : https://www.c-sharpcorner.com/article/flashback-database-in-oracle2/

  • Corruption de données - ORA-26040: Data block was loaded using the NOLOGGING option

    https://chenguangblog.wordpress.com/2011/02/11/ora-26040-data-block-was-loaded-using-the-nologging-option/

     

    et pour trouver l'objet du bloc corrompu :

     

    SELECT segment_type, segment_name
    FROM dba_extents
    WHERE file_id = <numero du datafile>
    AND block_id < <numero du bloc>
    AND block_id + blocks >= <numero du bloc>;

  • Table partitionnement

    https://www.oracle-dba-online.com/sql/oracle_table_partition.htm

  • Déterminer la taille d'un LOB

    https://nguyentichthanh.wordpress.com/how-to-determine-the-actual-size-of-the-lob-segments-and-how-to-free-the-deletedunused-space-abovebelow-the-hwm-doc-id-386341-1/

  • Tracer sql query dans base oracle

    •    Pour tracer les requêtes SQL dans une base Oracle il faut passer la commande :
     
    execute dbms_monitor.database_trace_enable(waits=>TRUE,binds=>TRUE,instance_name=>'QUALIF');
     
    •    Pour stopper la trace :
    execute dbms_monitor.database_trace_disable(instance_name=>'QUALIF');
     
    •    La trace sera stockée sous :
     
    select
       value
    from
       v$diag_info
    where
       name ='Default Trace File';
     
    Exemple :
    /export/BD/ORACLE/oratrc/QUALIF/bdump/diag/rdbms/qualif/QUALIF/trace/QUALIF_ora_58689.trc
     
    Elle pourra être lisible avec tkprof  :
     
    Syntaxe : tkprof <nom_de_la_trace> <nom_du_fichier_texte_lisible> sys=no  
     
    Exemple:             
    $tkprof QUALIF_ora_7767.trc QUALIF_ora_7767.txt sys=no  
     
    L’option sys = no ne garde pas les requêtes lancées par l’utilisateur sys.

  • Trouver les clés étrangères qui font référence à un champ dans une table x

    --donne la liste des clés étrangères
    select owner,constraint_name,constraint_type,table_name,r_owner,r_constraint_name
      from all_constraints
     where constraint_type='R' and R_OWNER='nom_du_schéma'
       and r_constraint_name in (select constraint_name
                                   from all_constraints
                                  where constraint_type in ('P','U')
                                    and table_name='nom_de_la_table');