En cuissardes!

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.
Elles sont toutes belles , belles , belles, comme le jour !!!
Par exemple on exporte toutes les jours les schémas DDL oracle
et un utilisateur non averti modifie la structure de son schéma.
Il faut pouvoir être capable de voir à l'instant t la différence de structure.
Il est donc possible d'automatiser la vérification du DDL des schémas.
https://www.techrepublic.com/blog/linux-and-open-source/how-to-compare-the-content-of-two-or-more-directories-automatically/
1. First we need to identify which jobs are in NOT RUNNING status. For this, we need to use below query (basically we are getting this info from dba_datapump_jobs)
SET lines 200
SELECT owner_name, job_name, operation, job_mode,
state, attached_sessions
FROM dba_datapump_jobs
ORDER BY 1,2;
The above query will give the datapump jobs information and it will look like below
OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE ATTACHED
———- ——————- ——— ——— ———– ——–
SCOTT SYS_EXPORT_TABLE_01 EXPORT TABLE NOT RUNNING 0
SCOTT SYS_EXPORT_TABLE_02 EXPORT TABLE NOT RUNNING 0
SYSTEM SYS_EXPORT_FULL_01 EXPORT FULL NOT RUNNING 0
In the above output, you can see state is showing as NOT RUNNING and those jobs need to be removed.
Note: Please note that jobs state will be showing as NOT RUNNING even if a user wantedly stopped it. So before taking any action, consult the user and get confirmed
2. we need to now identify the master tables which are created for these jobs. It can be done as follows
SELECT o.status, o.object_id, o.object_type, o.owner||'.'||object_name "OWNER.OBJECT" FROM dba_objects o, dba_datapump_jobs j WHERE o.owner=j.owner_name AND o.object_name=j.job_name AND j.job_name NOT LIKE 'BIN$%' ORDER BY 4,2
STATUS OBJECT_ID OBJECT_TYPE OWNER.OBJECT
——- ———- ———— ————————-
VALID 85283 TABLE SCOTT.EXPDP_20051121
VALID 85215 TABLE SCOTT.SYS_EXPORT_TABLE_02
VALID 85162 TABLE SYSTEM.SYS_EXPORT_FULL_01
3. we need to now drop these master tables in order to cleanup the jobs
SQL> DROP TABLE SYSTEM.SYS_EXPORT_FULL_01;
SQL> DROP TABLE SCOTT.SYS_EXPORT_TABLE_02 ;
SQL> DROP TABLE SCOTT.EXPDP_20051121;
4. Re-run the query which is used in step 1 to check if still any jobs are showing up. If so, we need to stop the jobs once again using STOP_JOB parameter in expdp or DBMS_DATAPUMP.STOP_JOB package
Some imp points:
1. Datapump jobs that are not running doesn’t have any impact on currently executing ones.
2. When any datapump job (either export or import) is initiated, master and worker processes will be created.
3. When we terminate export datapump job, master and worker processes will get killed and it doesn’t lead to data courrption.
4. But when import datapump job is terminated, complete import might not have done as processes(master & worker) will be killed.
Il y a fort longtemps, et c’est ma première contribution relative à PostgreSQL, j’ai écrit un script de backup qui dump tout un serveur PostgreSQL avec pg_dump
et pg_dumpall
. Il s’agit de pg_back.
Cela peut paraître curieux de publier un simple script de sauvegarde que tout DBA PostgreSQL a écrit dans sa vie et sait écrire par cœur. Surtout qu’on le réécrit en permanence ce script, pour ajuster des chemins, des cas particuliers du serveur à sauvegarder et de l’environnement où l’on sauvegarde…
En bien justement, c’est parce qu’on le réécrit tout le temps que pg_back fait gagner du temps. Il est simple et court, facilement lisible, c’est du shell : tout ce qu’il faut pour en faire une bonne base pour créer un script de sauvegarde adapté. Quand on l’utilise comme patron pour en faire un outil plus évolué, on gagne du temps.
Justement rajouter du code pour l’adapter peut se faire au début. Si on n’a pas envie d’utiliser le fichier de configuration, on adapte la liste de variables au début du script, quitte à en rajouter.
L’autre endroit intéressant c’est tout à la fin, avant le exit
, on peut rajouter tout ce qu’il faut pour externaliser ses sauvegardes.
C’est par ici.
https://github.com/orgrim/pg_back
https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux
SQL> alter database datafile '/export/BD/ORACLE/oratbldev/DEV/temp02.dbf' offline drop;
alter database datafile '/export/BD/ORACLE/oratbldev/DEV/temp02.dbf' offline drop
*
ERREUR à la ligne 1 :
ORA-01516: le fichier journal, le fichier de données ou le fichier temporaire
"/export/BD/ORACLE/oratbldev/DEV/temp02.dbf" n'existe pas
SQL> drop tablespace TEMP2 including contents;
Tablespace supprimé.
a l’an que ven que se siam pas mai que siguem pas mens Prononciation ?
La table s'appelle DICO.
Il y a des doublons sur la clé primaire mais où?
La clé primaire est composée des champs : NOM_TABLE,ATTRIBUT
Pour trouver les doublons :
SELECT COUNT(*) AS nbr_doublon, NOM_TABLE,ATTRIBUT
FROM DICO
GROUP BY NOM_TABLE,ATTRIBUT
HAVING COUNT(*) > 1
alter table bref.FA_FAISCEAU add LOT_CHEMISE VARCHAR2(25 BYTE) CONSTRAINT FK13_FA_FAISCEAU REFERENCES bref.FA_CHEMISE (LOT);
alter table bref.FA_FAISCEAU add LOT_FILTRE_EVENT VARCHAR2(25 BYTE) CONSTRAINT FK14_FA_FAISCEAU REFERENCES bref.FA_FILTRE_EVENT (LOT);