Difference between revisions of "FAQ:NewInstanceOracle"

From Wiki_dbSQWare
Jump to: navigation, search
(Limitations of this section)
Line 50: Line 50:
 
*All other statuses allow the instance to be displayed in the repository (especially "KEEP") but will not be taken into account by the automatic processes.<br/>
 
*All other statuses allow the instance to be displayed in the repository (especially "KEEP") but will not be taken into account by the automatic processes.<br/>
 
<br/>
 
<br/>
Résumé des statuts :<br/>
+
Resume of statuses :<br/>
 
{| align="center" {{Prettytable}}
 
{| align="center" {{Prettytable}}
 
|-
 
|-
| '''Statut'''  
+
| '''Status'''  
 
| '''Description'''  
 
| '''Description'''  
 
|-
 
|-
 
| ON
 
| ON
| gestion locale sous unix (le plus courant)
+
| locale sous unix (le plus courant)
 
|-
 
|-
 
| DIST
 
| DIST

Revision as of 15:29, 10 April 2025

Work in Progress

Contents

Generalties


Nuvola apps important.png
Warning:
First of all, don't go any further if you haven't read the section "General Concepts" !.

In this chapter, we will consider that SQWareCentral has been installed on dbsqware@sqwarebox.

Limitations of this section

This chapter only deals with adding a new instance to a base that is already configured and functional.
Use the portions that apply to your environment, and choose either the match or manual method as desired

General informations for integrating a new Oracle instance

There will potentially be 1 or 2 connection cases to process

  • "local" for Unix machines (or those with Cygwin) where a "/ as sysdba" will be performed on the machine hosting the instance (via SSH connection from dbsqware@sqwarebox)
  • "Distant", for generating AWRs (if needed), or in cases where SSH access to the machine is not available (Windows, RDS, etc.)

Classic steps:

  • Setting up the environment
  • Checking system prerequisites for the "local" part (bash + rsync)
  • Manual tests
  • Deployment of the instance

You will see that these steps can be handled one by one or in batches!

Integration of an Oracle instance

Setting up the environment

General

Explanation of "DbAlias" (the unique dbSQWare key)

The dbSQWare key must be unique and consistent with what has been configured for the gvsqw_DbAlias variable in sqwora_GlobalVar.cfg!
There are more or less 3 cases...

  • Your environment is "standalone" and your ORACLE_SID are unique across the entire environment => gvsqw_DbAlias='$ORACLE_SID'
  • Your environment is "standalone" but you have "duplicates" of ORACLE_SID => gvsqw_DbAlias='$ORACLE_SID:$(hostname|cut -d '.' -f1)'
  • You have RAC and/or DG => gvsqw_DbAlias='$gvsqw_DB_UNIQUE_NAME:$gvsqw_HOST_UNIQUE_NAME' (gvsqw_DB_UNIQUE_NAME, remove the node number!)

+ any other case that might occur or that "suits you"!

Explanation of statuses
  • An "open" instance will be handled in "local" mode, meaning we will connect via "/ as sysdba" locally on the machine hosting the instance (ssh access from dbsqware@sqwarebox), status "ON".
  • A "closed" instance, like dataguard, will be handled in "local" mode, meaning we will connect via "/ as sysdba" locally on the machine hosting the instance (ssh access from dbsqware@sqwarebox), status "DG".
  • An instance where we don’t have local unix access will be managed in "remote" mode (like Windows, RDS, ...), status "DIST".
  • The "OFF" status makes the instance "disappear" from the web view.
  • The "NEW" status is used as an intermediate status between the beginning and the end of setting up a new instance.
  • All other statuses allow the instance to be displayed in the repository (especially "KEEP") but will not be taken into account by the automatic processes.


Resume of statuses :

Status Description
ON locale sous unix (le plus courant)
DIST gestion uniquement à distance
KEEP statut temporaire, lors d'une maintenance par exemple ou avant suppression complète
NEW statut temporaire, lors du paramétrage
OFF suppression visuelle de l'instance (sans suppression de son paramétrage)
XXX non pris en charge ...

Déclaration de l'instance dans SQWareRepository avec SQWareWeb

Nous allons déclarer la nouvelle instance depuis l'interface d'administration de SQWareWeb.
|admin|Lien vers la console d'administration

Déclarez la nouvelle instance en statut "NEW" (Ajout ou Duplicate)
|admin|Ajout d'une instance |admin|Ajout par duplication d'une instance
adminOracle|Déclaration de la nouvelle instance Oracle

Explication des champs :

Champ Description
Db Alias Clé unique qui identifie l'instance dans dbSQWare (sera utilisée comme SERVICE_NAME pour la génération du tnsname.ora, pour sa partie avant le ":" si présent)
Dbms Name Type de SGBD
Virtual Host Host virtuel (meme que Host si pas cluster, sera utilisé pour la génération du tnsname.ora)
Host Name Hostname de l'instance
User Name User qui porte l'instance
Port Port d'écoute de l'instance (sera utilisé pour la génération du tnsname.ora)
Comments Une courte description de ce que porte l'instance
Status Instance statut (cf plus haut pour les explications)
Contact Un contact si besoin
Environnement Environnement de l'instance (PRD, PPR, REC, DEV, TST, ...)
Client Utilisé uniquement pour filtrer (mettre un nom de client et/ou de département et/ou service ...
GlobalHost Champ libre dans lequel on met souvent l'hôte de hyperviseur par exemple
Custom1 Champ libre 1
Custom2 Champ libre 2
Regénérer les fichiers de référence de SQWareCentral

Tapez la commande suivante qui va générer les fichiers de référence : <syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

gen_all </syntaxhighlight>

Procédure spécifique pour la partie "locale" (statut ON)

/!\ Uniquement que les instances qui seront en statut "ON" !

Vérification des prérequis système pour la partie "locale" (bash + rsync)

SQWareProduction étant écrit essentiellement en shell bash et étant synchronisé depuis SQWareCentral avec rsync, il nous faut donc "bash" et "rsync" installés !

Vérification

Adaptez à votre nom de user et nom de machine.

bash: <syntaxhighlight lang="sh" line>

  1. From : oracle@my_oracle_host

type bash

  1. ou

which bash </syntaxhighlight> rsync: <syntaxhighlight lang="sh" line>

  1. oracle@my_oracle_host

type rsync

  1. ou

which rsync </syntaxhighlight>

Installation

Adaptez à votre type de machine (sudo si vous n'êtes pas root).

RedHat / CentOS / ... : <syntaxhighlight lang="sh" line>

  1. From : root@my_oracle_host

yum install -y bash rsync

  1. ou

dnf install -y bash rsync </syntaxhighlight>

Ubuntu / Debian / ... : <syntaxhighlight lang="sh" line>

  1. From : root@my_oracle_host

apt install -y bash rsync </syntaxhighlight>

Déploiement de(s) clé(s) ssh de SQWareCentral vers la/les machine(s) cible(s)

Il existe deux manières de procéder :

  • Une automatique (depuis dbsqware@sqwarebox mais vous oblige à connaitre le mdp du compte unix oracle)
  • Une manuelle que vous appliquez sur chaque compte unix oracle

/!\ Le mdp de votre compte oracle unix doit avoir été initialisé, si non, la connexion par échange de clé ne fonctionnera pas !

Déploiement de(s) clé(s) ssh : méthode batch

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora GenDeplSshKeys_SQWareCentral GenLstInstanceNew </syntaxhighlight> Vérifiez que c'est bien la liste que vous souhaitez déployer, puis choix 1 ...
=> Entrez le mdp unix quand il vous est demandé !

Déploiement de(s) clé(s) ssh : méthode manuelle

<syntaxhighlight lang="sh" line>

  1. From : oracle@my_oracle_host

if [ ! -r $HOME/.ssh/id_rsa ] then ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa fi chmod go-w $HOME echo "ssh-rsa AAAAB......XSPpdV11 dbsqware@sqwarebox" >>$HOME/.ssh/authorized_keys chmod 700 $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys </syntaxhighlight> => Mettre la bonne clé dans le "echo" (celle de dbsqware@sqwarebox)

Test de connexion ssh depuis SQWareCentral

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora TestSshConnection GenLstInstanceNew </syntaxhighlight>

Test des prérequis sur l'hote cible (bash+rsync) ssh depuis SQWareCentral

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora TestSysPrerequisites GenLstInstanceNew </syntaxhighlight>

Déploiement de SQWareProduction

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox
  1. Si depl sur user "unique"

menu_ora DeplScripts GenLstUniqueNew

  1. Si depl sur user "de l'instance" celui spécifié dans SQWareRepository

menu_ora DeplScripts GenLstInstanceNew </syntaxhighlight>

Pour user "unique" c'est l'utilisateur "standard", par défaut nous le réglons sur "oracle", et il peut être modifié dans SQWareCentral.

Ajout de l'environnement dbSQWare dans ~/.profile ou ~/.bash_profile

Une nouvelle fois, il existe deux manières de procéder :

  • Une automatique (depuis dbsqware@sqwarebox)
  • Une manuelle que vous appliquez sur chaque compte unix oracle
Ajout de l'environnement dbSQWare : méthode batch

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora AdddbSQWareProfile GenLstInstanceNew </syntaxhighlight> Vérifiez que c'est bien la liste que vous souhaitez déployer, puis choix 1 ...
=> Dans ~/.profile ou ~/.bash_profile, changez la variable suivante avec la valeur adaptée : gvsqw_Env='XXX'

Ajout de l'environnement dbSQWare : méthode manuelle

Ajoutez les lignes suivantes dans le ~/.profile ou ~/.bash_profile <syntaxhighlight lang="sh" line>

  1. From : oracle@my_oracle_host
  1. dbSQWare

export gvsqw_OraBin=$HOME/SQWareProduction/oracle/bin export gvsqw_Env='PRD' lvsqw_IsTerminal=$(tty 2>&1 >/dev/null;echo $?) if [ "$lvsqw_IsTerminal" = "0" ] && [ -r $gvsqw_OraBin/../etc/.profile_confort ] then . $gvsqw_OraBin/../etc/.profile_confort fi </syntaxhighlight>

Test sendmail (non obligatoire)

<syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora TestSendmail GenLstInstanceNew </syntaxhighlight>

Tests de connexion "manuels" à l'instance Oracle

Le but étant de tester la ou les méthodes de connexion automatique à l'instance Oracle.

  • "locale", pour les instances qui seront en statut "ON"
  • "distante", pour générer les AWR (éventuellement) ou pour le cas où l'on n'a accès à la machine en ssh (Windows, RDS, etc, ...)
Test connexion "locale"

/!\ Uniquement que les instances qui seront en statut "ON" ! <syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora TestInstConnectionOnNoMail GenLstInstanceNew </syntaxhighlight>

Procédure spécifique pour la partie AWR ou RAC

Création d'un compte Oracle spécifique dbSQWare


Template:Note

Nuvola apps information.png
Note:
vous devez être SYS lors de la saisie des droits.


Exemple d'ordre de création (NON-CDB) : <syntaxhighlight lang="sql" line> CREATE USER DBSUSER IDENTIFIED BY "NePasMettreCePassword!" PROFILE DEFAULT ACCOUNT UNLOCK; GRANT RESOURCE TO DBSUSER; GRANT CONNECT TO DBSUSER; --GRANT DBA TO DBSUSER; ALTER USER DBSUSER DEFAULT ROLE ALL; GRANT SELECT ANY DICTIONARY TO DBSUSER; GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO DBSUSER; </syntaxhighlight>

Exemple d'ordre de création (CDB) : <syntaxhighlight lang="sql" line> CREATE USER C##DBSUSER IDENTIFIED BY "NePasMettreCePassword!" PROFILE DEFAULT ACCOUNT UNLOCK CONTAINER=ALL; GRANT RESOURCE TO C##DBSUSER CONTAINER=ALL; GRANT CONNECT TO C##DBSUSER CONTAINER=ALL; --GRANT DBA TO C##DBSUSER CONTAINER=ALL; --GRANT SYSDBA TO C##DBSUSER CONTAINER=ALL; ALTER USER C##DBSUSER DEFAULT ROLE ALL CONTAINER=ALL; GRANT SELECT ANY DICTIONARY TO C##DBSUSER CONTAINER=ALL; GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO C##DBSUSER CONTAINER=ALL; </syntaxhighlight>

Vous pouvez mettre le nom et le mot de passe que vous souhaitez !
Ce compte devra être déclaré sur le compte unix oracle@sqwarebox ...
Si une entrée spécifique est trouvée c'est elle qui est prise, si non, on prend l'entrée "DEFAULT".
<syntaxhighlight lang="sh" line> oracle@sqwarebox:/home/oracle (NoSID) $ cat .passwd_oracle DEFAULT;DBSUSER;NePasMettreCePassword! SPECIFIC_ORA;system;manager </syntaxhighlight>

Test connexion "distante"

/!\ Uniquement pour AWR et RAC <syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora TestInstConnectionDistNoMail GenLstInstanceNew </syntaxhighlight>

Mise en exploitation de l'instance

Génération de la configuration par défaut SQWareProduction

/!\ Uniquement que les instances qui seront en statut "ON" ! <syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox

menu_ora GenDefConf_SQWareProduction GenLstInstanceNew </syntaxhighlight>

Mise à jour de SQWareRepository

Dans le repository dbSQWare via la console d’administration, mettre à jour le statut de la nouvelle instance Oracle (à NEW actuellement) avec la valeur souhaitée (ON, DG, DIST)

Test de "reprise" des indicateurs

A ce moment là, vous pouvez tester la reprise des indicateurs manquants (en principe, uniquement les instances que vous venez d'intégrer !) <syntaxhighlight lang="sh" line>

  1. From : dbsqware@sqwarebox
    1. Pour les statuts "ON"

repind_ora

    1. Pour les statuts "DIST"

repind_ora_dist

    1. Pour les statuts "DG"

repind_ora_dg </syntaxhighlight>

Exploitation (backups, …) pour les instance "ON"

Génération des conf SQWareProduction

Si vous avez suivi la procédure d’insertion de l’instance, cette partie est déjà fait par l’étape "menu_ora GenDefConf_SQWareProduction GenLstInstanceNew".
Vous pouvez vérifier avec le chapitre suivant.

Se connecter à la machine qui porte l'instance « Oracle » et taper les commandes suivantes :
<syntaxhighlight lang="sh" line>

  1. From dbsqware@vorawarebox

c ORADBS </syntaxhighlight>

<syntaxhighlight lang="sh" line>

  1. Source de l'env si multi-instance (from oracle@my_oracle_host)

e ORADBS </syntaxhighlight>

<syntaxhighlight lang="sh" line> too ./sqwora_GenerateCreateInstance.ksh -dbsOnly </syntaxhighlight> Vérifier que ce qui est proposé est bon et tapez « y » si c’est le cas.
A ce moment, vous avez généré les fichiers de configuration par défaut de SQWareProduction.

Paramétrage RMAN

Si vous souhaitez mettre en place les backups RMAN, il faudra : - être en archivelog si vous voulez faire du backup à chaud - avoir paramétré la conf RMAN (dbSQWare se base sur la durée de rétention et le type DISK/SBT_TAPE configurés) - avoir paramétré $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg (qui détermine le comporte de sqwarchmon et si on utilise un catalogue ou pas)

Vérification de la conf : <syntaxhighlight lang="sh" line> vi $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg </syntaxhighlight>

Vérification de l'archivage : <syntaxhighlight lang="sh" line> sqlplus '/ as sysdba' </syntaxhighlight> <syntaxhighlight lang="sql" line> select log_mode from v$database; LOG_MODE


ARCHIVELOG

show parameters log_archive_format;

NAME TYPE VALUE


----------- ------------------------------

log_archive_format string ORADBS_redo_%t_%s_%r.arc

show parameters log_archive_dest_1;

NAME TYPE VALUE


----------- ------------------------------

log_archive_dest_1 string LOCATION=/orabackup/ORADBS/archive MANDATORY </syntaxhighlight>

Si besoin, changement des paramètres : <syntaxhighlight lang="sql" line> alter system set log_archive_format='ORADBS_redo_%t_%s_%r.arc' scope=spfile; alter system set log_archive_dest_1='LOCATION=/orabackup/ORADBS/archive/ MANDATORY'; </syntaxhighlight>

Si besoin, passer la base en ARCHIVELOG : <syntaxhighlight lang="sql" line> shutdown immediate; startup mount; alter database archivelog; alter database open; </syntaxhighlight>

Configuration "minimale" RMAN (en fonction de ce qui a été paramétré par défaut) : <syntaxhighlight lang="sh" line> too ./sqwora_RmanConfigure.ksh </syntaxhighlight>

Vérification de la configuration RMAN :

rman target /

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORADBS are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 6 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/orabackup/ORADBS/rman/autobackup/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/admin/ORADBS/sqwConfig/snapcf_ORADBS.f';

Si besoin, modification de paramètres RMAN :

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 6 DAYS;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
new RMAN configuration parameters are successfully stored

Explications

Les étapes précédentes ont créé certains fichiers par défaut. ($HOME/ORADBS/sqwConfig) <syntaxhighlight lang="sh" line>

  1. Entrez le nom de l’instance

e ORADBS cfg cat sqwora_Jobs.cfg </syntaxhighlight>

<syntaxhighlight lang="sh" line>

  1. IndicDba: Gather indicators DBAs

IndicDba:$gvsqw_OraBin/sqwora_GatherIndicators.ksh -I ORADBS

  1. RmanFull: Backup level 0 (full) with RMAN

RmanFull:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i0 -Exec

  1. RmanInc: Backup level 1 (incremental) with RMAN

RmanInc:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i1 -Exec

  1. PurgeAlert: Purge log/trace files

PurgeAlert:$gvsqw_OraBin/sqwora_PurgeAlert.ksh -I ORADBS

  1. GenAwr: Generate AWR reports

GenAwr:$gvsqw_OraBin/sqwora_GenerateAwr.ksh -I ORADBS

  1. ExpFull: export full of database

ExpFull:$gvsqw_OraBin/sqwora_Export.ksh -I ORADBS -T full -H 2 -Exec

  1. ExpdpFull: export full of database (expdp)

ExpdpFull:$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -H 2 -Exec </syntaxhighlight>

C’est un fichier de paramétrage qui est utilisé par le script sqwora_RunJob.ksh pour exécuter des actions.

Fichier pour une cron par défaut $HOME/CrontabRef_ORADBS : <syntaxhighlight lang="sh" line>

    1. mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command
    2. ORADBS
  1. Purge alert

00 08 * * 0 bash -c '. $HOME/.profile ORADBS;$gvsqw_OraBin/sqwora_RunJob.ksh -I ORADBS -A PurgeAlert > $HOME/tmp/PurgeAlert_ORADBS.log 2>&1'

  1. Datapump

00 22 * * 0-5 bash -c '. $HOME/.profile ORADBS;$gvsqw_OraBin/sqwora_RunJob.ksh -I ORADBS -A ExpdpFull > $HOME/tmp/ExpdpFull_ORADBS.log 2>&1'

  1. Backups

00 23 * * 6 bash -c '. $HOME/.profile ORADBS;$gvsqw_OraBin/sqwora_RunJob.ksh -I ORADBS -A RmanFull > $HOME/tmp/RmanFull_ORADBS.log 2>&1' 00 23 * * 0-5 bash -c '. $HOME/.profile ORADBS;$gvsqw_OraBin/sqwora_RunJob.ksh -I ORADBS -A RmanInc > $HOME/tmp/RmanInc_ORADBS.log 2>&1' </syntaxhighlight>

Mise en exploitation

Mise en place de la cron : <syntaxhighlight lang="sh" line> mv $HOME/CrontabRef_ORADBS $HOME/CrontabRef vi $HOME/CrontabRef crontab $HOME/CrontabRef crontab -l </syntaxhighlight>

Mise à jour du fichier CrontabRef  : <syntaxhighlight lang="sh" line> crontab -l > $HOME/CrontabRef cat $HOME/CrontabRef </syntaxhighlight>

Commandes utiles

alias intéressants :

e DBALIAS => source l'env pour l'instance
bin, etc, too ... => pour aller dans arbo SQWareProduction standard
cbin, cetc, ctoo ... => pour aller dans arbo SQWareProduction custom
log => logs SQWareProduction
rma => on va dans le chemin des backups RMAN
dmpdp => on va dans le chemin de datapump

Quelques options des scripts :

-h => aide en ligne
-s => exemples en ligne
-Exec => lorsque elle est présente, si non settée ne sort que les commandes sans les exécuter

Exemples :

oracle@my_oracle_host:$HOME/admin/ORADBS/logs/RmanBackup (ORADBS) $ bin
total 164
drwxr-x---  2 oracle dba  4096 Aug 16 15:50 .
drwxr-x--- 15 oracle dba   187 Aug 16 15:50 ..
-rwxr-x---  1 oracle dba 15773 Aug 16 15:50 sqwArchmon
-rwxr-x---  1 oracle dba 15773 Aug 16 15:50 sqwArchmon.ksh
-rwxr-x---  1 oracle dba  2673 Aug 16 15:50 sqwora_ActivateMonitoring.ksh
-rwxr-x---  1 oracle dba  4506 Aug 16 15:50 sqwora_CopyDmpdp.ksh
-rwxr-x---  1 oracle dba  3551 Aug 16 15:50 sqwora_DbmsStats.ksh
lrwxrwxrwx  1 oracle dba    36 Jan  2  2022 sqwora_ExecSQL.ksh -> ../../generic/bin/sqwgen_ExecSQL.ksh
-rwxr-x---  1 oracle dba  7284 Aug 16 15:50 sqwora_Expdp.ksh
-rwxr-x---  1 oracle dba  6861 Aug 16 15:50 sqwora_Export.ksh
-rwxr-x---  1 oracle dba  2652 Aug 16 15:50 sqwora_GatherDistantFsSize.ksh
-rwxr-x---  1 oracle dba  3609 Aug 16 15:50 sqwora_GatherIndicators.ksh
-rwxr-x---  1 oracle dba  2545 Aug 16 15:50 sqwora_GatherStructure.ksh
-rwxr-x---  1 oracle dba  3022 Aug 16 15:50 sqwora_GenerateAwr.ksh
-rwxr-x---  1 oracle dba  3812 Aug 16 15:50 sqwora_GenerateStatspack.ksh
-rwxr-x---  1 oracle dba  6120 Aug 16 15:50 sqwora_Impdp.ksh
-rwxr-x---  1 oracle dba  3199 Aug 16 15:50 sqwora_MonitorWithAwr.ksh
-rwxr-x---  1 oracle dba  2877 Aug 16 15:50 sqwora_MonitorWithAwrLastStat.ksh
-rwxr-x---  1 oracle dba  4117 Aug 16 15:50 sqwora_MonitorWithStatspack.ksh
lrwxrwxrwx  1 oracle dba    38 Jan  2  2022 sqwora_NetBackup.ksh -> ../../generic/bin/sqwgen_NetBackup.ksh
lrwxrwxrwx  1 oracle dba    40 Jan  2  2022 sqwora_ParallelRun.ksh -> ../../generic/bin/sqwgen_ParallelRun.ksh
-rwxr-x---  1 oracle dba  5041 Aug 16 15:50 sqwora_PartialRefresh.ksh
-rwxr-x---  1 oracle dba  2707 Aug 16 15:50 sqwora_PhysicalColdBackup.ksh
-rwxr-x---  1 oracle dba  2507 Aug 16 15:50 sqwora_PurgeAlert.ksh
-rwxr-x---  1 oracle dba  3666 Aug 16 15:50 sqwora_RmanBackup.ksh
-rwxr-x---  1 oracle dba  4790 Aug 16 15:50 sqwora_RmanClone.ksh
lrwxrwxrwx  1 oracle dba    40 Jan  2  2022 sqwora_RsyncBackup.ksh -> ../../generic/bin/sqwgen_RsyncBackup.ksh
lrwxrwxrwx  1 oracle dba    35 Jan  2  2022 sqwora_RunJob.ksh -> ../../generic/bin/sqwgen_RunJob.ksh
-rwxr-x---  1 oracle dba  6531 Aug 16 15:50 sqwora_SchemaRefreshExpdp.ksh
-rwxr-x---  1 oracle dba  4371 Aug 16 15:50 sqwora_SchemaRefresh.ksh
-rwxr-x---  1 oracle dba  7072 Aug 16 15:50 sqwora_SqwArchmon.ksh
oracle@my_oracle_host:$HOME/SQWareProduction/oracle/bin (ORADBS) $ 
./sqwora_RmanBackup.ksh -h

Sourcing sqwora_Global.lib v2023.06 SQWareProduction for Oracle (dbSQWare) ...

Usage: sqwora_RmanBackup.ksh [-h] -I <instance> -T <Type> [+ options]

DESCRIPTION
   sqwora_RmanBackup.ksh execute RMAN backup
SUPPORT
   Oracle supported versions: 9iR2 <= v <= 21c

PARAMETERS
     -I  instance       : Target instance to backup.
     -T  Type           : Backup type (i0, i1, log).
OPTIONS
     -h                 : Display the full usage.
     -s                 : Display samples of usage.
     -O  Type           : cold,hot (default hot).
     -DG                : For dataguard instances not open.
     -SRO               : Option 'skip readonly' (default backup all TBS).
     -OPT option        : Option to add to the RMAN command.
     -FRT return_code   : Force return code value on error.
     -AddMail email     : Email address to add at 'xxx'.
     -SendReport        : Send execution log report.
     -NoCumulative      : Disable cumulative incremental (default disable).
     -NoDelInput        : Disable 'delete input' when backup archivelog.
     -Cumulative        : Make cumulative incremental (default disable).
     -SkIna             : Add 'skip inaccessible' for archive backup.
     -Split             : Split backup directories by channel.
     -Force             : Bypass version check.
     -NoArc             : Disable backup of archivelog when type i[0-1] (to make 'section size xxG' option usefull for example).
     -NoZdlra           : Disable backup to ZDLRA (default Disable).
     -Zdlra             : Enable backup to ZDLRA (default Disable).
     -Freeze            : Freeze cluster resource when cold backup.
     -Blackout          : Blackout supervision when cold backup.
     -NoMail            : Deactivate sendmail on error to xxx (by default, send on error).
     -Locale   locale   : Force Locale for help display (fr,en).
     -Exec              : Run backup (default, display generated commands)

Exemple datapump (full ou schéma)

On considère que l’exploitation est aux normes voulues. Les options du script :

$gvsqw_OraBin/sqwora_Expdp.ksh –h

Exemple datapump full (gestion auto du nombre de version, modifiable par l'option –H) :

$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -Exec

Exemple datapump schéma (gestion auto du nombre de version, modifiable par l'option –H) :

$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T schema -FU MYSCHEMA -Exec

Les dumps sont dans /orabackup/$ORACLE_SID/expdp (par "type", alias pour y aller "dmpdp") :

oracle@my_oracle_host:/orabackup/ORADBS/expdp (ORADBS) $ dmpdp
total 597284
drwxr-xr-x 2 oracle oinstall      4096 Jan 27 16:09 .
drwxr-xr-x 3 oracle oinstall      4096 Jan 27 14:37 ..
-rw-r----- 1 oracle oinstall 255614976 Jan 27 16:08 ExpdpFull_ORADBS_20230127_160335_01_2.dump
-rw-r----- 1 oracle oinstall  28327936 Jan 27 16:08 ExpdpFull_ORADBS_20230127_160335_02_2.dump
-rw-r--r-- 1 oracle oinstall    218392 Jan 27 16:08 ExpdpFull_ORADBS_20230127_160335.log
-rw-r----- 1 oracle oinstall 159236096 Jan 27 16:10 ExpdpMYSCHEMA_ORADBS_20230127_160908_01_2.dump
-rw-r----- 1 oracle oinstall   4030464 Jan 27 16:10 ExpdpMYSCHEMA_ORADBS_20230127_160908_02_2.dump
-rw-r--r-- 1 oracle oinstall    122819 Jan 27 16:10 ExpdpMYSCHEMA_ORADBS_20230127_160908.log

Copie de schéma par datapump

On considère que l’exploitation est aux normes voulues.
La copie se fait en lançant la commande depuis la DEV/TST (la cible).
Le script se connecte en ssh vers la prod (la source), fait le datapump, copie sur fichier sur la DEV/TST (la cible), détruit tous les objets du schéma et le recharge par impdp.

Les options du script :

$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -h

Exemple:
Serveur source : my_oracle_hostprod / instance : MYORAPRD / schéma : MYSCHEMA
Vers
Serveur cible  : my_oracle_host / instance : MYORADEV / schéma : MYSCHEMA

La commande de copie sera (sur my_oracle_host) :

$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec

Il faut donc que la machine cible puisse faire du ssh vers la source :

# Recup de la cle de la cible
oracle@my_oracle_host:/home/oracle/.ssh (MYORADEV) $ cat /home/oracle/.ssh/id_rsa.pub
ssh-rsa ...+kgvQ== oracle@my_oracle_host

# Copie dans authorized_keys de la source
oracle@my_oracle_hostprod:/home/oracle/.ssh (MYORAPRD) $ vi /home/oracle/.ssh/authorized_keys

Il faut que le répertoire pour stocker le dmpdp existe :

#sur my_oracle_hostprod
mkdir /orabackup/MYORAPRD/expdp

#sur my_oracle_host
mkdir /orabackup/MYORADEV/expdp

Rajout du paramétrage du "job" (non obigatoire) :

#oracle@my_oracle_host
vi /home/oracle/admin/MYORADEV/sqwConfig/sqwora_Jobs.cfg

#CopieMYSCHEMA: copie le schéma MYSCHEMA de la prod à la DEV
CopieMYSCHEMA:$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec

Lancement par "job" (il faut que sqwora_Jobs.cfg soit paramétré) :

$gvsqw_OraBin/sqwora_RunJob.ksh -I MYORADEV -A CopieMYSCHEMA

Lancement direct en ligne:

$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec

Les dumps sont dans /orabackup/$ORACLE_SID/expdp :

-rw-r----- 1 oracle oinstall   4042752 Jan 27 15:06 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_20230127_150004_01_2.dump
-rw-r----- 1 oracle oinstall 159256576 Jan 27 15:06 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_20230127_150004_02_2.dump
-rw-r--r-- 1 oracle oinstall    122138 Jan 27 15:06 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_20230127_150004.log
-rw-r--r-- 1 oracle oinstall       241 Jan 27 15:00 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_expdp.par
-rw-r--r-- 1 oracle oinstall       241 Jan 27 15:00 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_impdp.par

Enjoy !