Difference between revisions of "FAQ:NewInstanceOracle"

From Wiki_dbSQWare
Jump to: navigation, search
(Regenerate the reference files of SQWareCentral.)
(Schema copy using datapump)
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
Work in Progress
 
 
 
==Generalties==
 
==Generalties==
 
<br>
 
<br>
{{Warning |First of all, don't go any further if you haven't read the section [[General:Concepts|"General Concepts"]] !}}
+
{{Warning |First of all, don't go any further if you haven't read the section [[General:Concepts|"General Concepts"]]}}
 
In this chapter, we will consider that SQWareCentral has been installed on dbsqware@sqwarebox.
 
In this chapter, we will consider that SQWareCentral has been installed on dbsqware@sqwarebox.
  
 
===Limitations of this section===
 
===Limitations of this section===
 
This chapter only deals with adding a new instance to a base that is already configured and functional.<br>
 
This chapter only deals with adding a new instance to a base that is already configured and functional.<br>
Use the portions that apply to your environment, and choose either the match or manual method as desired<br>
+
Use the portions that apply to your environment, and choose either the automatic or manual method as desired<br>
  
 
===General operating procedure for integrating a new Oracle instance===
 
===General operating procedure for integrating a new Oracle instance===
Line 77: Line 75:
 
====Instance declaration in SQWareRepository with SQWareWeb====
 
====Instance declaration in SQWareRepository with SQWareWeb====
 
We will declare the new instance from the SQWareWeb administration interface.<br/>
 
We will declare the new instance from the SQWareWeb administration interface.<br/>
[[Fichier:Admin_dbSQWare.png||admin|Lien vers la console d'administration]]<br/>
+
[[File:Admin dbSQWare.png||admin|Admin dbSQWare]]
 +
 
 +
<br/>
  
 
Declare the new instance with the status "NEW" (Add or Duplicate).<br/>
 
Declare the new instance with the status "NEW" (Add or Duplicate).<br/>
[[Fichier:AjoutInstance.png||admin|Ajout d'une instance]]
+
[[File:AjoutInstance.png||admin|Ajout d'une instance]]
[[Fichier:DuplicateInstance.png||admin|Ajout par duplication d'une instance]]<br/>
+
[[File:DuplicateInstance.png||admin|Ajout par duplication d'une instance]]<br/>
[[Fichier:DeclarationInstanceOracle.png|adminOracle|Déclaration de la nouvelle instance Oracle]]
+
[[File:DeclarationInstanceOracle.png||admin|Ajout par duplication d'une instance]]<br/>
 
 
 
Explanation of the fields :<br/>
 
Explanation of the fields :<br/>
 
{| align="center" {{Prettytable}}
 
{| align="center" {{Prettytable}}
Line 135: Line 134:
 
Type the following command which will generate the reference files:
 
Type the following command which will generate the reference files:
 
<pre># From : dbsqware@sqwarebox
 
<pre># From : dbsqware@sqwarebox
gen_all
+
gen_all</pre>
  
 
===Specific procedure for the "local" part (status ON)===
 
===Specific procedure for the "local" part (status ON)===
/!\ Uniquement que les instances qui seront en statut "ON" !<br/>
+
/!\ Only instances that will be in the "ON" status !<br/>
  
====Vérification des prérequis système pour la partie "locale" (bash + rsync)====
+
====Verification of system prerequisites for the "local" part (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 !
+
Since SQWareProduction is mainly written in bash shell and synchronized from SQWareCentral using rsync, we therefore need "bash" and "rsync" to be installed !
  
=====Vérification=====
+
=====Verification=====
Adaptez à votre nom de user et nom de machine.<br>
+
Adapt to your username and machine name.<br>
 
<br>
 
<br>
 
bash:
 
bash:
# From : oracle@my_oracle_host
+
<pre># From : oracle@my_oracle_host
 
type bash
 
type bash
 
#ou
 
#ou
 
which bash
 
which bash
 
+
</pre>
 
rsync:
 
rsync:
# oracle@my_oracle_host
+
<pre># oracle@my_oracle_host
 
type rsync
 
type rsync
 
#ou
 
#ou
which rsync
+
which rsync</pre>
 
 
  
 
=====Installation=====
 
=====Installation=====
Adaptez à votre type de machine (sudo si vous n'êtes pas root).<br/>
+
Adapt to your machine type (use sudo if you are not root).<br/>
 
<br>
 
<br>
 
RedHat / CentOS / ... :
 
RedHat / CentOS / ... :
# From : root@my_oracle_host
+
<pre># From : root@my_oracle_host
 
yum install -y bash rsync
 
yum install -y bash rsync
 
#ou
 
#ou
dnf install -y bash rsync
+
dnf install -y bash rsync</pre>
 
+
</pre>
 
+
<pre>
 
Ubuntu / Debian / ... :
 
Ubuntu / Debian / ... :
# From : root@my_oracle_host
+
<pre># From : root@my_oracle_host
apt install -y bash rsync
+
apt install -y bash rsync<pre/>
 +
</pre>
 +
====Deployment of SSH key(s) from SQWareCentral to the target machine(s)====
 +
There are two ways to proceed:
 +
*An automatic one (from dbsqware@sqwarebox, but it requires you to know the password of the oracle Unix account)
 +
*A manual one that you apply on each oracle Unix account
 +
/!\ The password of your oracle Unix account must have been initialized, otherwise key-based authentication will not work!
  
====Déploiement de(s) clé(s) ssh de SQWareCentral vers la/les machine(s) cible(s)====
+
=====Deployment of SSH key(s): batch method=====
Il existe deux manières de procéder :
+
<pre># From : dbsqware@sqwarebox
*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=====
 
# From : dbsqware@sqwarebox
 
 
menu_ora GenDeplSshKeys_SQWareCentral GenLstInstanceNew
 
menu_ora GenDeplSshKeys_SQWareCentral GenLstInstanceNew
 +
</pre>
 +
Verify that this is indeed the list you want to deploy, then choose option 1 ...<br/>
 +
=> Enter the Unix password when prompted !
  
Vérifiez que c'est bien la liste que vous souhaitez déployer, puis choix 1 ...<br/>
+
=====Deployment of SSH key(s): manual method=====
=> Entrez le mdp unix quand il vous est demandé !
+
<pre># From : oracle@my_oracle_host
 
 
=====Déploiement de(s) clé(s) ssh : méthode manuelle=====
 
# From : oracle@my_oracle_host
 
 
if [ ! -r $HOME/.ssh/id_rsa ]
 
if [ ! -r $HOME/.ssh/id_rsa ]
 
then
 
then
Line 196: Line 194:
 
chmod 700 $HOME/.ssh
 
chmod 700 $HOME/.ssh
 
chmod 600 $HOME/.ssh/authorized_keys
 
chmod 600 $HOME/.ssh/authorized_keys
 +
</pre>
 +
=> Put the correct key in the "echo" (the one from dbsqware@sqwarebox)
  
=> Mettre la bonne clé dans le "echo" (celle de dbsqware@sqwarebox)
+
====SSH connection test from SQWareCentral====
 
+
<pre># From : dbsqware@sqwarebox
====Test de connexion ssh depuis SQWareCentral====
 
# From : dbsqware@sqwarebox
 
 
menu_ora TestSshConnection GenLstInstanceNew
 
menu_ora TestSshConnection GenLstInstanceNew
 +
</pre>
  
 
+
====Test of prerequisites on the target host (bash+rsync) via SSH from SQWareCentral====
====Test des prérequis sur l'hote cible (bash+rsync) ssh depuis SQWareCentral====
+
<pre># From : dbsqware@sqwarebox
# From : dbsqware@sqwarebox
 
 
menu_ora TestSysPrerequisites GenLstInstanceNew
 
menu_ora TestSysPrerequisites GenLstInstanceNew
 +
</pre>
  
 +
====Deployment of SQWareProduction====
 +
<pre># From : dbsqware@sqwarebox
  
====Déploiement de SQWareProduction====
+
#If deployment on "unique" user
# From : dbsqware@sqwarebox
 
 
 
#Si depl sur user "unique"
 
 
menu_ora DeplScripts GenLstUniqueNew
 
menu_ora DeplScripts GenLstUniqueNew
  
#Si depl sur user "de l'instance" celui spécifié dans SQWareRepository
+
#If deployment on "instance" user, the one specified in SQWareRepository
 
menu_ora DeplScripts GenLstInstanceNew
 
menu_ora DeplScripts GenLstInstanceNew
 +
</pre>
  
 +
For "unique" user, it is the "standard" user. By default, we set it to "oracle", and it can be modified in SQWareCentral.
  
Pour user "unique" c'est l'utilisateur "standard", par défaut nous le réglons sur "oracle", et il peut être modifié dans SQWareCentral.
+
====Adding the dbSQWare environment to ~/.profile or ~/.bash_profile====
 +
Once again, there are two ways to proceed:
  
====Ajout de l'environnement dbSQWare dans ~/.profile ou ~/.bash_profile====
+
*An automatic one (from dbsqware@sqwarebox)
Une nouvelle fois, il existe deux manières de procéder :
+
*A manual one that you apply on each oracle Unix account
*Une automatique (depuis dbsqware@sqwarebox)
 
*Une manuelle que vous appliquez sur chaque compte unix oracle
 
  
=====Ajout de l'environnement dbSQWare : méthode batch=====
+
=====Adding the dbSQWare environment: batch method=====
# From : dbsqware@sqwarebox
+
<pre># From : dbsqware@sqwarebox
 
menu_ora AdddbSQWareProfile GenLstInstanceNew
 
menu_ora AdddbSQWareProfile GenLstInstanceNew
 +
</pre>
 +
Check that this is indeed the list you want to deploy, then choose 1 ...<br/>
 +
=> In ~/.profile or ~/.bash_profile, change the following variable with the appropriate value: gvsqw_Env='XXX'
  
Vérifiez que c'est bien la liste que vous souhaitez déployer, puis choix 1 ...<br/>
+
=====Adding the dbSQWare environment: manual method=====  
=> Dans ~/.profile ou ~/.bash_profile, changez la variable suivante avec la valeur adaptée : gvsqw_Env='XXX'
+
Add the following lines to ~/.profile or ~/.bash_profile
 
+
<pre># From : oracle@my_oracle_host
=====Ajout de l'environnement dbSQWare : méthode manuelle=====
 
Ajoutez les lignes suivantes dans le ~/.profile ou ~/.bash_profile
 
# From : oracle@my_oracle_host
 
  
 
#dbSQWare
 
#dbSQWare
Line 245: Line 244:
 
. $gvsqw_OraBin/../etc/.profile_confort
 
. $gvsqw_OraBin/../etc/.profile_confort
 
fi
 
fi
 +
</pre>
  
 +
====Test sendmail (Non mandatory)====
 +
<pre># From : dbsqware@sqwarebox
 +
menu_ora TestSendmail GenLstInstanceNew
 +
</pre>
  
====Test sendmail (non obligatoire)====
+
====Manual connection tests to the Oracle instance====
# From : dbsqware@sqwarebox
+
The goal is to test the automatic connection methods to the Oracle instance.
menu_ora TestSendmail GenLstInstanceNew
+
* "local", for instances that will be in "ON" status
 +
* "remote", to generate AWR (possibly) or for cases where there is no SSH access to the machine (Windows, RDS, etc...)
  
====Tests de connexion "manuels" à l'instance Oracle====
+
=====Test connection "local"=====
Le but étant de tester la ou les méthodes de connexion automatique à l'instance Oracle.
+
/!\ Only instances that will be in "ON" status!
* "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"=====
+
<pre># From : dbsqware@sqwarebox
/!\ Uniquement que les instances qui seront en statut "ON" !
 
# From : dbsqware@sqwarebox
 
 
menu_ora TestInstConnectionOnNoMail GenLstInstanceNew
 
menu_ora TestInstConnectionOnNoMail GenLstInstanceNew
 +
</pre>
  
===Procédure spécifique pour la partie AWR ou RAC===
+
===Specific procedure for the AWR or RAC part===
  
====Création d'un compte Oracle spécifique dbSQWare====
+
====Creation of a specific dbSQWare Oracle account====
 
<br>
 
<br>
{{Note| Uniquement les instances sur lesquelles vous voulez générer des AWR !}}
+
{{Warning| Only the instances on which you want to generate AWR}}
  
{{Information|vous devez être SYS lors de la saisie des droits}}
+
{{Information|You must be SYS when entering the privileges}}
  
Exemple d'ordre de création (NON-CDB) :
+
Example of creation order (NON-CDB) :
CREATE USER DBSUSER
+
<pre>CREATE USER DBSUSER
IDENTIFIED BY "NePasMettreCePassword!"
+
IDENTIFIED BY "DoNotSetThisPassword!"
 
PROFILE DEFAULT
 
PROFILE DEFAULT
 
ACCOUNT UNLOCK;
 
ACCOUNT UNLOCK;
Line 280: Line 282:
 
GRANT SELECT ANY DICTIONARY TO DBSUSER;
 
GRANT SELECT ANY DICTIONARY TO DBSUSER;
 
GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO DBSUSER;
 
GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO DBSUSER;
 
+
</pre>
Exemple d'ordre de création (CDB) :
+
Example of creation order (CDB) :
CREATE USER C##DBSUSER
+
<pre>CREATE USER C##DBSUSER
IDENTIFIED BY "NePasMettreCePassword!"
+
IDENTIFIED BY "DoNotSetThisPassword!"
 
PROFILE DEFAULT
 
PROFILE DEFAULT
 
ACCOUNT UNLOCK CONTAINER=ALL;
 
ACCOUNT UNLOCK CONTAINER=ALL;
Line 293: Line 295:
 
GRANT SELECT ANY DICTIONARY TO C##DBSUSER CONTAINER=ALL;
 
GRANT SELECT ANY DICTIONARY TO C##DBSUSER CONTAINER=ALL;
 
GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO C##DBSUSER CONTAINER=ALL;
 
GRANT EXECUTE ON DBMS_WORKLOAD_REPOSITORY TO C##DBSUSER CONTAINER=ALL;
 
+
</pre>
Vous pouvez mettre le nom et le mot de passe que vous souhaitez !<br/>
+
You can set the username and password you want!<br/>  
Ce compte devra être déclaré sur le compte unix oracle@sqwarebox ...<br/>
+
This account must be declared on the unix account oracle@sqwarebox ...<br/>
Si une entrée spécifique est trouvée c'est elle qui est prise, si non, on prend l'entrée "DEFAULT".<br/>
+
If a specific entry is found, it will be used; otherwise, the "DEFAULT" entry will be used.<br/>
oracle@sqwarebox:/home/oracle (NoSID) $ cat .passwd_oracle
+
<pre>oracle@sqwarebox:/home/oracle (NoSID) $ cat .passwd_oracle
DEFAULT;DBSUSER;NePasMettreCePassword!
+
DEFAULT;DBSUSER;DoNotSetThisPassword!
 
SPECIFIC_ORA;system;manager
 
SPECIFIC_ORA;system;manager
 +
</pre>
  
====Test connexion "distante"====
+
====Test "remote" connection====  
/!\ Uniquement pour AWR et RAC
+
/!\ Only for AWR and RAC
# From : dbsqware@sqwarebox
+
<pre># From : dbsqware@sqwarebox
 
menu_ora TestInstConnectionDistNoMail GenLstInstanceNew
 
menu_ora TestInstConnectionDistNoMail GenLstInstanceNew
 
+
</pre>
==Mise en exploitation de l'instance==
+
==Deployment of the instance==
===Génération de la configuration par défaut SQWareProduction===
+
===Generation of the default SQWareProduction configuration===
/!\ Uniquement que les instances qui seront en statut "ON" !
+
/!\ Only instances that are in "ON" status!
# From : dbsqware@sqwarebox
+
<pre># From : dbsqware@sqwarebox
 
menu_ora GenDefConf_SQWareProduction GenLstInstanceNew
 
menu_ora GenDefConf_SQWareProduction GenLstInstanceNew
 +
</pre>
 +
===Update of SQWareRepository===
 +
In the dbSQWare repository via the administration console, update the status of the new Oracle instance (currently set to NEW) with the desired value (ON, DG, DIST)
  
===Mise à jour de SQWareRepository===
+
===Test of "recovery" of indicators===
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)
+
At this point, you can test the recovery of missing indicators (in principle, only the instances you have just integrated!)
 
+
<pre># From : dbsqware@sqwarebox
===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 !)
 
# From : dbsqware@sqwarebox
 
 
## Pour les statuts "ON"
 
## Pour les statuts "ON"
 
repind_ora
 
repind_ora
Line 324: Line 327:
 
## Pour les statuts "DG"
 
## Pour les statuts "DG"
 
repind_ora_dg
 
repind_ora_dg
 
+
</pre>
===Exploitation (backups, …) pour les instance "ON"===
+
===Exploitation (backups, …) for "ON" instances===
====Génération des conf SQWareProduction====
+
====Generation of SQWareProduction configs====
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".<br/>
+
If you followed the procedure for inserting the instance, this part has already been done by the "menu_ora GenDefConf_SQWareProduction GenLstInstanceNew" step.<br/>
Vous pouvez vérifier avec le chapitre suivant.<br/>
+
You can verify with the following chapter.<br/>
 
<br/>
 
<br/>
Se connecter à la machine qui porte l'instance « Oracle » et taper les commandes suivantes :<br/>
+
Connect to the machine hosting the "Oracle" instance and type the following commands:<br/>
# From dbsqware@vorawarebox
+
<pre># From dbsqware@vorawarebox
 
c ORADBS
 
c ORADBS
  
Line 338: Line 341:
 
too
 
too
 
./sqwora_GenerateCreateInstance.ksh -dbsOnly
 
./sqwora_GenerateCreateInstance.ksh -dbsOnly
 +
</pre>
 +
Verify that the proposed configuration is correct and type "y" if it is.<br/>
 +
At this point, you have generated the default configuration files for SQWareProduction.
  
Vérifier que ce qui est proposé est bon et tapez « y » si c’est le cas.<br/>
+
====RMAN Configuration====
A ce moment, vous avez généré les fichiers de configuration par défaut de SQWareProduction.
+
If you wish to set up RMAN backups, you will need to:
  
====Paramétrage RMAN====
+
Be in archivelog mode if you want to perform hot backups
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 :
+
Have configured the RMAN settings (dbSQWare is based on the retention period and the DISK/SBT_TAPE type configured)
  
vi $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg
+
Have configured $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg (which determines the behavior of sqwarchmon and whether or not a catalog is used)
  
 +
Configuration verification:
  
Vérification de l'archivage :
+
<pre>vi $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg
 +
</pre>
  
 +
Verification of archiving:
 +
<pre>
 
sqlplus '/ as sysdba'
 
sqlplus '/ as sysdba'
 
+
</pre>
 
+
<pre>
 
select log_mode from v$database;
 
select log_mode from v$database;
 
LOG_MODE
 
LOG_MODE
Line 373: Line 379:
 
NAME                                TYPE        VALUE
 
NAME                                TYPE        VALUE
 
------------------------------------ ----------- ------------------------------
 
------------------------------------ ----------- ------------------------------
log_archive_dest_1                  string      LOCATION=/orabackup/ORADBS/archive MANDATORY
+
log_archive_dest_1                  string      LOCATION=/orabackup/ORADBS/archive MANDATORY</pre>
 
 
 
 
Si besoin, changement des paramètres :
 
  
 +
If needed, change the settings:
 +
<pre>
 
alter system set log_archive_format='ORADBS_redo_%t_%s_%r.arc' scope=spfile;
 
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';
 
alter system set log_archive_dest_1='LOCATION=/orabackup/ORADBS/archive/ MANDATORY';
 +
</pre>
  
 +
If needed, set the database to ARCHIVELOG:
  
Si besoin, passer la base en ARCHIVELOG :
+
<pre>shutdown immediate;
 
 
shutdown immediate;
 
 
startup mount;
 
startup mount;
 
alter database archivelog;
 
alter database archivelog;
 
alter database open;
 
alter database open;
 +
</pre>
  
 
+
"Minimal" RMAN configuration (based on the default settings) :
Configuration "minimale" RMAN (en fonction de ce qui a été paramétré par défaut) :
+
<pre>
 
 
 
too
 
too
 
./sqwora_RmanConfigure.ksh
 
./sqwora_RmanConfigure.ksh
 +
</pre>
  
 
+
Verification of RMAN configuration :
Vérification de la configuration RMAN :
 
 
  rman target /
 
  rman target /
 
   
 
   
Line 419: Line 424:
 
  CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/admin/ORADBS/sqwConfig/snapcf_ORADBS.f';
 
  CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/home/oracle/admin/ORADBS/sqwConfig/snapcf_ORADBS.f';
  
Si besoin, modification de paramètres RMAN :
+
If needed, modify RMAN settings :
 
  RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
 
  RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
 
   
 
   
Line 428: Line 433:
 
  new RMAN configuration parameters are successfully stored
 
  new RMAN configuration parameters are successfully stored
  
====Explications====
+
====Explanations====
Les étapes précédentes ont créé certains fichiers par défaut. ($HOME/ORADBS/sqwConfig)
+
The previous steps have created certain default files. ($HOME/ORADBS/sqwConfig)
  
#Entrez le nom de l’instance
+
<pre>#Enter the instance name
 
e ORADBS
 
e ORADBS
 
cfg
 
cfg
 
cat sqwora_Jobs.cfg
 
cat sqwora_Jobs.cfg
 +
</pre>
  
 
+
<pre>
 
 
 
#IndicDba: Gather indicators DBAs
 
#IndicDba: Gather indicators DBAs
 
IndicDba:$gvsqw_OraBin/sqwora_GatherIndicators.ksh -I ORADBS
 
IndicDba:$gvsqw_OraBin/sqwora_GatherIndicators.ksh -I ORADBS
Line 458: Line 463:
 
#ExpdpFull: export full of database (expdp)
 
#ExpdpFull: export full of database (expdp)
 
ExpdpFull:$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -H 2 -Exec
 
ExpdpFull:$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -H 2 -Exec
 +
</pre>
  
 
+
It is a configuration file used by the script sqwora_RunJob.ksh to execute actions.<br/>
C’est un fichier de paramétrage qui est utilisé par le script sqwora_RunJob.ksh pour exécuter des actions.<br/>
 
 
<br/>
 
<br/>
Fichier pour une cron par défaut $HOME/CrontabRef_ORADBS :
+
File for a default cron $HOME/CrontabRef_ORADBS :
  
###########################
+
<pre>###########################
 
## mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command
 
## mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command
 
## ORADBS
 
## ORADBS
Line 474: Line 479:
 
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 * * 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'
 
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'
 +
</pre>
  
 
+
====Deployment====
====Mise en exploitation====
+
Setting up the cron :
Mise en place de la cron :
 
  
 
mv $HOME/CrontabRef_ORADBS $HOME/CrontabRef
 
mv $HOME/CrontabRef_ORADBS $HOME/CrontabRef
Line 485: Line 490:
  
  
Mise à jour du fichier CrontabRef :
+
Updating the CrontabRef file :
  
 
crontab -l > $HOME/CrontabRef
 
crontab -l > $HOME/CrontabRef
Line 491: Line 496:
  
  
====Commandes utiles====
+
====Useful commands====
alias intéressants :
+
Interesting aliases :
  e DBALIAS => source l'env pour l'instance
+
  e DBALIAS => Source the environment for the instance
  bin, etc, too ... => pour aller dans arbo SQWareProduction standard
+
  bin, etc, too ... => To navigate to the standard SQWareProduction directory
  cbin, cetc, ctoo ... => pour aller dans arbo SQWareProduction custom
+
  cbin, cetc, ctoo ... => To navigate to the custom SQWareProduction directory
 
  log => logs SQWareProduction
 
  log => logs SQWareProduction
  rma => on va dans le chemin des backups RMAN
+
  rma => Go to the RMAN backup directory
  dmpdp => on va dans le chemin de datapump
+
  dmpdp => Go to the datapump directory
  
Quelques options des scripts :
+
Some script options:
-h => aide en ligne
+
-h => online help
-s => exemples en ligne
+
-s => online examples
-Exec => lorsque elle est présente, si non settée ne sort que les commandes sans les exécuter
+
-Exec => when present, executes the commands; if not set, only shows the commands without executing them.
  
 
Exemples :
 
Exemples :
Line 580: Line 585:
 
       -Exec              : Run backup (default, display generated commands)
 
       -Exec              : Run backup (default, display generated commands)
  
====Exemple datapump (full ou schéma)====
+
====Exemple datapump (full or schema)====
  
On considère que l’exploitation est aux normes voulues.
+
We assume that the deployment is up to the required standards.
Les options du script :
+
The script options:
$gvsqw_OraBin/sqwora_Expdp.ksh –h
+
$gvsqw_OraBin/sqwora_Expdp.ksh –h
  
Exemple datapump full (gestion auto du nombre de version, modifiable par l'option –H) :
+
Example of datapump full (automatic management of the number of versions, adjustable by the –H option):
 
  $gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -Exec
 
  $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) :
+
Example of datapump schema (automatic management of the number of versions, adjustable by the –H option):
 
  $gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T schema -FU MYSCHEMA -Exec
 
  $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") :
+
The dumps are in /orabackup/$ORACLE_SID/expdp (by "type", alias to go there is "dmpdp") :
 
  oracle@my_oracle_host:/orabackup/ORADBS/expdp (ORADBS) $ dmpdp
 
  oracle@my_oracle_host:/orabackup/ORADBS/expdp (ORADBS) $ dmpdp
 
  total 597284
 
  total 597284
Line 604: Line 609:
 
  -rw-r--r-- 1 oracle oinstall    122819 Jan 27 16:10 ExpdpMYSCHEMA_ORADBS_20230127_160908.log
 
  -rw-r--r-- 1 oracle oinstall    122819 Jan 27 16:10 ExpdpMYSCHEMA_ORADBS_20230127_160908.log
  
====Copie de schéma par datapump====
+
====Schema copy using datapump====
  
On considère que l’exploitation est aux normes voulues.<br>
+
We assume that the deployment is up to the required standards.<br>
La copie se fait en lançant la commande depuis la DEV/TST (la cible).<br>
+
The copy is done by running the command from the DEV/TST (the target).<br>
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.<br>
+
The script connects via SSH to the production (the source), performs the datapump, copies the file to DEV/TST (the target), deletes all schema objects, and reloads them using impdp.<br>
  
Les options du script :
+
The script options :
 
  $gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -h
 
  $gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -h
  
 
Exemple:<br>
 
Exemple:<br>
Serveur source : my_oracle_hostprod / instance : MYORAPRD / schéma : MYSCHEMA<br>
+
Source server : my_oracle_hostprod / instance : MYORAPRD / schéma : MYSCHEMA<br>
Vers<br>
+
To<br>
Serveur cible : my_oracle_host / instance : MYORADEV / schéma : MYSCHEMA<br>
+
Target server : my_oracle_host / instance : MYORADEV / schéma : MYSCHEMA<br>
 
<br>
 
<br>
La commande de copie sera (sur my_oracle_host) :
+
The copy command will be (on my_oracle_host) :
 
  $gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec
 
  $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 :
+
The target machine must be able to SSH into the source system:
  # Recup de la cle de la cible
+
  # Retrieve the target machine's key.
 
  oracle@my_oracle_host:/home/oracle/.ssh (MYORADEV) $ cat /home/oracle/.ssh/id_rsa.pub
 
  oracle@my_oracle_host:/home/oracle/.ssh (MYORADEV) $ cat /home/oracle/.ssh/id_rsa.pub
 
  ssh-rsa ...+kgvQ== oracle@my_oracle_host
 
  ssh-rsa ...+kgvQ== oracle@my_oracle_host
 
   
 
   
  # Copie dans authorized_keys de la source
+
  # Copy into the authorized_keys of the source
 
  oracle@my_oracle_hostprod:/home/oracle/.ssh (MYORAPRD) $ vi /home/oracle/.ssh/authorized_keys
 
  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 :
+
The directory to store the dmpdp must exist:
  #sur my_oracle_hostprod
+
  #On my_oracle_hostprod
 
  mkdir /orabackup/MYORAPRD/expdp
 
  mkdir /orabackup/MYORAPRD/expdp
 
   
 
   
  #sur my_oracle_host
+
  #On my_oracle_host
 
  mkdir /orabackup/MYORADEV/expdp
 
  mkdir /orabackup/MYORADEV/expdp
  
Rajout du paramétrage du "job" (non obigatoire) :
+
Addition of the "job" configuration (optional) :
 
  #oracle@my_oracle_host
 
  #oracle@my_oracle_host
 
  vi /home/oracle/admin/MYORADEV/sqwConfig/sqwora_Jobs.cfg
 
  vi /home/oracle/admin/MYORADEV/sqwConfig/sqwora_Jobs.cfg
 
   
 
   
  #CopieMYSCHEMA: copie le schéma MYSCHEMA de la prod à la DEV
+
  #CopyMYSCHEMA: Copy the MYSCHEMA schema from PROD to DEV:
 
  CopieMYSCHEMA:$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec
 
  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é) :
+
Launch via "job" (the sqwora_Jobs.cfg file must be configured):
 
  $gvsqw_OraBin/sqwora_RunJob.ksh -I MYORADEV -A CopieMYSCHEMA
 
  $gvsqw_OraBin/sqwora_RunJob.ksh -I MYORADEV -A CopieMYSCHEMA
  
Lancement direct en ligne:
+
Direct launch from command line:
 
  $gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec
 
  $gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec
  
Les dumps sont dans /orabackup/$ORACLE_SID/expdp :
+
Dumps are in /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  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----- 1 oracle oinstall 159256576 Jan 27 15:06 SchemaRefreshExpdp_MYSCHEMA_MYORAPRD_20230127_150004_02_2.dump

Revision as of 16:09, 11 April 2025

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 automatic or manual method as desired

General operating procedure 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 under Unix (the most common)
DIST remote-only management
KEEP temporary status, during maintenance for example or before complete deletion
NEW temporary status, during configuration
OFF visual removal of the instance (without deleting its configuration)
XXX not supported...

Instance declaration in SQWareRepository with SQWareWeb

We will declare the new instance from the SQWareWeb administration interface.
Admin dbSQWare


Declare the new instance with the status "NEW" (Add or Duplicate).
Ajout d'une instance Ajout par duplication d'une instance
Ajout par duplication d'une instance
Explanation of the fields :

Fields Description
Db Alias Unique key that identifies the instance in dbSQWare (will be used as SERVICE_NAME for generating the tnsname.ora, for the part before the ":" if present).
Dbms Name Type of SGBD
Virtual Host Virtual host (same as Host if not a cluster, will be used for generating the tnsname.ora).
Host Name Hostname of the instance
User Name User associated with the instance
Port Listening port of the instance (will be used for generating the tnsname.ora).
Comments A brief description of what the instance hosts
Status Instance status (see above for explanations).
Contact A contact if needed
Environnement Instance environment (PRD, PPR, REC, DEV, TST, ...)
Client Used only for filtering (enter a client name and/or department and/or service...)
GlobalHost Free field in which the hypervisor host is often entered, for example.
Custom1 Free field 1
Custom2 Free field 2
Regenerate the reference files of SQWareCentral.

Type the following command which will generate the reference files:

# From : dbsqware@sqwarebox
gen_all

Specific procedure for the "local" part (status ON)

/!\ Only instances that will be in the "ON" status !

Verification of system prerequisites for the "local" part (bash + rsync)

Since SQWareProduction is mainly written in bash shell and synchronized from SQWareCentral using rsync, we therefore need "bash" and "rsync" to be installed !

Verification

Adapt to your username and machine name.

bash:

# From : oracle@my_oracle_host
type bash
#ou
which bash

rsync:

# oracle@my_oracle_host
type rsync
#ou
which rsync
Installation

Adapt to your machine type (use sudo if you are not root).

RedHat / CentOS / ... :

# From : root@my_oracle_host
yum install -y bash rsync
#ou
dnf install -y bash rsync
Ubuntu / Debian / ... :
<pre># From : root@my_oracle_host
apt install -y bash rsync<pre/>

Deployment of SSH key(s) from SQWareCentral to the target machine(s)

There are two ways to proceed:

  • An automatic one (from dbsqware@sqwarebox, but it requires you to know the password of the oracle Unix account)
  • A manual one that you apply on each oracle Unix account

/!\ The password of your oracle Unix account must have been initialized, otherwise key-based authentication will not work!

Deployment of SSH key(s): batch method
# From : dbsqware@sqwarebox
menu_ora GenDeplSshKeys_SQWareCentral GenLstInstanceNew

Verify that this is indeed the list you want to deploy, then choose option 1 ...
=> Enter the Unix password when prompted !

Deployment of SSH key(s): manual method
# 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

=> Put the correct key in the "echo" (the one from dbsqware@sqwarebox)

SSH connection test from SQWareCentral

# From : dbsqware@sqwarebox
menu_ora TestSshConnection GenLstInstanceNew

Test of prerequisites on the target host (bash+rsync) via SSH from SQWareCentral

# From : dbsqware@sqwarebox
menu_ora TestSysPrerequisites GenLstInstanceNew

Deployment of SQWareProduction

# From : dbsqware@sqwarebox

#If deployment on "unique" user
menu_ora DeplScripts GenLstUniqueNew

#If deployment on "instance" user, the one specified in SQWareRepository
menu_ora DeplScripts GenLstInstanceNew

For "unique" user, it is the "standard" user. By default, we set it to "oracle", and it can be modified in SQWareCentral.

Adding the dbSQWare environment to ~/.profile or ~/.bash_profile

Once again, there are two ways to proceed:

  • An automatic one (from dbsqware@sqwarebox)
  • A manual one that you apply on each oracle Unix account
Adding the dbSQWare environment: batch method
# From : dbsqware@sqwarebox
menu_ora AdddbSQWareProfile GenLstInstanceNew

Check that this is indeed the list you want to deploy, then choose 1 ...
=> In ~/.profile or ~/.bash_profile, change the following variable with the appropriate value: gvsqw_Env='XXX'

Adding the dbSQWare environment: manual method

Add the following lines to ~/.profile or ~/.bash_profile

# From : oracle@my_oracle_host

#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

Test sendmail (Non mandatory)

# From : dbsqware@sqwarebox
menu_ora TestSendmail GenLstInstanceNew

Manual connection tests to the Oracle instance

The goal is to test the automatic connection methods to the Oracle instance.

  • "local", for instances that will be in "ON" status
  • "remote", to generate AWR (possibly) or for cases where there is no SSH access to the machine (Windows, RDS, etc...)
Test connection "local"

/!\ Only instances that will be in "ON" status!

# From : dbsqware@sqwarebox
menu_ora TestInstConnectionOnNoMail GenLstInstanceNew

Specific procedure for the AWR or RAC part

Creation of a specific dbSQWare Oracle account


Nuvola apps important.png
Warning:
Only the instances on which you want to generate AWR.
Nuvola apps information.png
Note:
You must be SYS when entering the privileges.


Example of creation order (NON-CDB) :

CREATE USER DBSUSER
IDENTIFIED BY "DoNotSetThisPassword!"
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;

Example of creation order (CDB) :

CREATE USER C##DBSUSER
IDENTIFIED BY "DoNotSetThisPassword!"
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;

You can set the username and password you want!
This account must be declared on the unix account oracle@sqwarebox ...
If a specific entry is found, it will be used; otherwise, the "DEFAULT" entry will be used.

oracle@sqwarebox:/home/oracle (NoSID) $ cat .passwd_oracle
DEFAULT;DBSUSER;DoNotSetThisPassword!
SPECIFIC_ORA;system;manager

Test "remote" connection

/!\ Only for AWR and RAC

# From : dbsqware@sqwarebox
menu_ora TestInstConnectionDistNoMail GenLstInstanceNew

Deployment of the instance

Generation of the default SQWareProduction configuration

/!\ Only instances that are in "ON" status!

# From : dbsqware@sqwarebox
menu_ora GenDefConf_SQWareProduction GenLstInstanceNew

Update of SQWareRepository

In the dbSQWare repository via the administration console, update the status of the new Oracle instance (currently set to NEW) with the desired value (ON, DG, DIST)

Test of "recovery" of indicators

At this point, you can test the recovery of missing indicators (in principle, only the instances you have just integrated!)

# From : dbsqware@sqwarebox
## Pour les statuts "ON"
repind_ora
## Pour les statuts "DIST"
repind_ora_dist
## Pour les statuts "DG"
repind_ora_dg

Exploitation (backups, …) for "ON" instances

Generation of SQWareProduction configs

If you followed the procedure for inserting the instance, this part has already been done by the "menu_ora GenDefConf_SQWareProduction GenLstInstanceNew" step.
You can verify with the following chapter.

Connect to the machine hosting the "Oracle" instance and type the following commands:

# From dbsqware@vorawarebox
c ORADBS

#Source de l'env si multi-instance (from oracle@my_oracle_host)
e ORADBS
too
./sqwora_GenerateCreateInstance.ksh -dbsOnly

Verify that the proposed configuration is correct and type "y" if it is.
At this point, you have generated the default configuration files for SQWareProduction.

RMAN Configuration

If you wish to set up RMAN backups, you will need to:

Be in archivelog mode if you want to perform hot backups

Have configured the RMAN settings (dbSQWare is based on the retention period and the DISK/SBT_TAPE type configured)

Have configured $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg (which determines the behavior of sqwarchmon and whether or not a catalog is used)

Configuration verification:

vi $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg

Verification of archiving:

sqlplus '/ as sysdba'
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

If needed, change the settings:

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';

If needed, set the database to ARCHIVELOG:

shutdown immediate;
startup mount;
alter database archivelog;
alter database open;

"Minimal" RMAN configuration (based on the default settings) :

too
./sqwora_RmanConfigure.ksh

Verification of RMAN configuration :

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';

If needed, modify RMAN settings :

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

Explanations

The previous steps have created certain default files. ($HOME/ORADBS/sqwConfig)

#Enter the instance name
e ORADBS
cfg
cat sqwora_Jobs.cfg
#IndicDba: Gather indicators DBAs
IndicDba:$gvsqw_OraBin/sqwora_GatherIndicators.ksh -I ORADBS

#RmanFull: Backup level 0 (full) with RMAN
RmanFull:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i0 -Exec

#RmanInc: Backup level 1 (incremental) with RMAN
RmanInc:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i1 -Exec

#PurgeAlert: Purge log/trace files
PurgeAlert:$gvsqw_OraBin/sqwora_PurgeAlert.ksh -I ORADBS

#GenAwr: Generate AWR reports
GenAwr:$gvsqw_OraBin/sqwora_GenerateAwr.ksh -I ORADBS

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

#ExpdpFull: export full of database (expdp)
ExpdpFull:$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -H 2 -Exec

It is a configuration file used by the script sqwora_RunJob.ksh to execute actions.

File for a default cron $HOME/CrontabRef_ORADBS :

###########################
## mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command
## ORADBS
#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'
#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'
#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'

Deployment

Setting up the cron :

mv $HOME/CrontabRef_ORADBS $HOME/CrontabRef vi $HOME/CrontabRef crontab $HOME/CrontabRef crontab -l


Updating the CrontabRef file :

crontab -l > $HOME/CrontabRef cat $HOME/CrontabRef


Useful commands

Interesting aliases :

e DBALIAS => Source the environment for the instance
bin, etc, too ... => To navigate to the standard SQWareProduction directory
cbin, cetc, ctoo ... => To navigate to the custom SQWareProduction directory
log => logs SQWareProduction
rma => Go to the RMAN backup directory
dmpdp => Go to the datapump directory

Some script options: -h => online help -s => online examples -Exec => when present, executes the commands; if not set, only shows the commands without executing them.

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 or schema)

We assume that the deployment is up to the required standards. The script options: $gvsqw_OraBin/sqwora_Expdp.ksh –h

Example of datapump full (automatic management of the number of versions, adjustable by the –H option):

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

Example of datapump schema (automatic management of the number of versions, adjustable by the –H option):

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

The dumps are in /orabackup/$ORACLE_SID/expdp (by "type", alias to go there is "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

Schema copy using datapump

We assume that the deployment is up to the required standards.
The copy is done by running the command from the DEV/TST (the target).
The script connects via SSH to the production (the source), performs the datapump, copies the file to DEV/TST (the target), deletes all schema objects, and reloads them using impdp.

The script options :

$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -h

Exemple:
Source server : my_oracle_hostprod / instance : MYORAPRD / schéma : MYSCHEMA
To
Target server  : my_oracle_host / instance : MYORADEV / schéma : MYSCHEMA

The copy command will be (on my_oracle_host) :

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

The target machine must be able to SSH into the source system:

# Retrieve the target machine's key.
oracle@my_oracle_host:/home/oracle/.ssh (MYORADEV) $ cat /home/oracle/.ssh/id_rsa.pub
ssh-rsa ...+kgvQ== oracle@my_oracle_host

# Copy into the authorized_keys of the source
oracle@my_oracle_hostprod:/home/oracle/.ssh (MYORAPRD) $ vi /home/oracle/.ssh/authorized_keys

The directory to store the dmpdp must exist:

#On my_oracle_hostprod
mkdir /orabackup/MYORAPRD/expdp

#On my_oracle_host
mkdir /orabackup/MYORADEV/expdp

Addition of the "job" configuration (optional) :

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

#CopyMYSCHEMA: Copy the MYSCHEMA schema from PROD to DEV:
CopieMYSCHEMA:$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -I MYORADEV -IS MYORAPRD -US my_oracle_hostprod -O MYSCHEMA -Exec

Launch via "job" (the sqwora_Jobs.cfg file must be configured):

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

Direct launch from command line:

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

Dumps are in /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 !