https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:7267435205059
Professionnel - Page 28
-
PRocédure pour envoi de mail après insertion dans une table oracle
-
Ajouter une image dans une base
procédure stockée pour ajouter une image de cul dans la table GONZO de ma base de données PORNO :
create or replace procedure ajoute_image_X
(
nom_fichier in VARCHAR2,
p_id_image in VARCHAR2,
p_nom_actrice in VARCHAR2,
p_no_film in VARCHAR2,
p_mensuration in INTEGER
)
IS
dest_secure BLOB;
file_dest BFILE;
blob_size INTEGER;
extension VARCHAR2(3);
BEGIN
BEGIN
file_loc := BFILENAME ('BFILE_DATA', nom_fichier);
DBMS_LOB.FILEOPEN (file_dest);
blob_size := DBMS_LOB.GETLENGTH (file_dest);
extension := substr(nom_fichier, -3, 3);
INSERT INTO GONZO (
ID_IMAGE,
NOM_FICHIER,
NOM_ACTRICE,
NO_FILM,
MENSURATION,
FSSIZE,
FSTYPE,
CONTENU)
VALUES (
p_id_image,
nom_fichier,
p_nom_actrice,
p_no_film,
p_mensuration,
blob_size,
extension,
EMPTY_BLOB())
RETURNING CONTENU INTO dest_secure;
DBMS_LOB.LOADFROMFILE (dest_secure, file_dest, blob_size);
DBMS_LOB.FILECLOSE (file_dest);
commit;
END;
END ajoute_image_X; -
Insérer plusieurs données bidon
SQL> set timing on
SQL> set autotrace traceonly
SQL> insert into rd
2 select
3 (dbms_random.value(1,1.99999999999999999999999999999999999999)) r_id,
4 dbms_random.string('U',20) r_string from dual
5 connect by level <=100000
6 /
source : https://community.oracle.com/thread/3696816
-
Library Cache Miss
Explaination of
- Misses in library cache during parse
- (Misses while looking for plan in library cache–Hard parse)
- Misses in library cache during execute
- (Misses while about to execute the plan and found it missing/invalid in library cache)
source : https://jonathanlewis.wordpress.com/2007/07/19/library-cache-miss/
- Misses in library cache during parse
-
Mise en trace oracle , Tuning avec TKPROF
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 :
/export/BD/ORACLE/oratrc/QUALIF/bdump/diag/rdbms/qualif/QUALIF/trace/
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.source : http://www.dbrev.com/dbBlog/2014/12/31/how-to-enable-various-level-of-trace-in-oracle-11g-database/
tuning avec tkprof : https://oracle.developpez.com/guide/tuning/tkprof/
-
oradebug
http://what-when-how.com/Tutorial/topic-16mglm7e/Secrets-of-the-Oracle-Database-520.html
-
Show replication status in PostgreSQL
https://www.niwi.nz/2013/02/16/replication-status-in-postgresql/
select client_addr, state, sent_location, write_location, flush_location, replay_location from pg_stat_replication;
This query can output can be like this:
postgres=# select client_addr, state, sent_location,write_location, flush_location, replay_location, sync_priority from pg_stat_replication;
-
Disable Streaming Replication without restarting either master or slave
I understand the way things work currently, but would it not be more
convenient to let the replication be stopped and started from SQL commands
like:On Master:
select pg_pause_streaming_replication(slave_fqdn);
select pg_resume_streaming_replication(slave_fqdn);On Slave:
select pg_pause_streaming_replication();
select pg_pause_streaming_replication();If Cascaded Streaming Replication is confugured, then
On Slave:
select pg_start_streaming_replication(cascaded_slave_fqdn);
select pg_stop_streaming_replication(cascaded_slave_fqdn);Or an OS executable [ either in the core or a contrib module] like
pg_replication -p primary_fqdn -s slave_fqdn -a pause
pg_replication -p primary_fqdn -s slave_fqdn -a resume
pg_replication -p primary_fqdn -s slave_fqdn -a setup[ the last one would awesome; and i do not think that it is impossible, and
would be loved by one and all ] -
[UNIX] convertir un paquage debian en rpm et vice versa
https://blog.packagecloud.io/eng/2015/10/26/use-alien-to-convert-deb-to-rpm-and-rpm-to-deb/
https://help.ubuntu.com/community/RPM/AlienHowto
-
[script] Backup