Difference between revisions of "FAQ:NewInstancePostgreSQL"

From Wiki_dbSQWare
Jump to: navigation, search
Line 1: Line 1:
 
==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 | Before anything, don't go further if you don't have read the first section [[General:Concepts|"dbSQWare 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===
+
===Limits 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 automatic 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 MySQL/MariaDB instance===
There will potentially be 1 or 2 connection cases to process
+
There will potentially be one or two connection cases to handle.
* <span style="color: red">"local" </span> 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)
+
* "local" for Unix machines (or those with Cygwin) where you'll be running MySQL on the machine hosting the instance (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.)
+
* "remote" for cases where you don't have SSH access to the machine (Windows, RDS, etc.).
  
 
Classic steps:
 
Classic steps:
Line 25: Line 26:
 
You will see that these steps can be handled one by one or in batches!
 
You will see that these steps can be handled one by one or in batches!
  
==Integration of an Oracle instance==
+
==Integration of an MySQL/MariaDBinstance==
  
 
===Setting up the environment===
 
===Setting up the environment===
Line 32: Line 33:
  
 
=====Explanation of "DbAlias" (the unique dbSQWare key)=====
 
=====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!<br/>
+
The dbSQWare key must be unique and consistent with what has been configured for the gvsqw_DbAlias variable in sqwmys_GlobalVar.cfg!<br/>
There are more or less 3 cases...<br/>
+
We'll use a variable, MYSQL_SID, which has no value for MySQL/MariaDB but will identify the instance in dbSQWare.<br/>
*Your environment is "standalone" and your ORACLE_SID are unique across the entire environment => gvsqw_DbAlias='$ORACLE_SID'
+
By convention, we often use MYS "_" APPLI "_" ENV.<br/>
*Your environment is "standalone" but you have "duplicates" of ORACLE_SID => gvsqw_DbAlias='$ORACLE_SID:$(hostname|cut -d '.' -f1)'
+
Example: MYS_THISAPPS_PRD or MYS_THISOTHERAPPS_DEV ...<br/>
*You have RAC and/or DG => gvsqw_DbAlias='$gvsqw_DB_UNIQUE_NAME:$gvsqw_HOST_UNIQUE_NAME' (gvsqw_DB_UNIQUE_NAME, remove the node number!)
+
But nothing is imposed; you choose what "suits you"! You just need to set the MYSQL_SID variable in the MySQL account profile with the desired value.<br/>
 
 
+ any other case that might occur or that "suits you"!<br/>
 
  
 
=====Explanation of statuses=====
 
=====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".<br/>
+
*An "open" instance will be handled in "local" mode, meaning we will connect with mysql locally on the machine hosting the instance (ssh access from dbsqware@sqwarebox), status "ON".<br/>
*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".<br/>
 
 
*An instance where we don’t have local unix access will be managed in "remote" mode (like Windows, RDS, ...), status "DIST".<br/>
 
*An instance where we don’t have local unix access will be managed in "remote" mode (like Windows, RDS, ...), status "DIST".<br/>
 
*The "OFF" status makes the instance "disappear" from the web view.<br/>
 
*The "OFF" status makes the instance "disappear" from the web view.<br/>
Line 82: Line 80:
 
[[File:AjoutInstance.png||admin|Ajout d'une instance]]
 
[[File:AjoutInstance.png||admin|Ajout d'une instance]]
 
[[File:DuplicateInstance.png||admin|Ajout par duplication d'une instance]]<br/>
 
[[File:DuplicateInstance.png||admin|Ajout par duplication d'une instance]]<br/>
[[File:DeclarationInstanceOracle.png||admin|Ajout par duplication d'une instance]]<br/>
+
[[File:DeclarationInstanceMySQL.png|admin|Add a new instance by duplicate an other one.]]
 
Explanation of the fields :<br/>
 
Explanation of the fields :<br/>
 
{| align="center" {{Prettytable}}
 
{| align="center" {{Prettytable}}
Line 90: Line 88:
 
|-
 
|-
 
| Db Alias
 
| 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).
+
| Unique key that identifies the instance in dbSQWare (no value for MySQL/MariaDB).
 
|-
 
|-
 
| Dbms Name
 
| Dbms Name
Line 96: Line 94:
 
|-
 
|-
 
| Virtual Host
 
| Virtual Host
| Virtual host (same as Host if not a cluster, will be used for generating the tnsname.ora).
+
| Virtual Host (same as Host if not clustered)
 +
.
 
|-
 
|-
 
| Host Name
 
| Host Name
Line 105: Line 104:
 
|-
 
|-
 
| Port
 
| Port
| Listening port of the instance (will be used for generating the tnsname.ora).
+
| Listening port of the instance.
 
|-
 
|-
 
| Comments
 
| Comments
Line 150: Line 149:
 
bash:
 
bash:
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
# From : oracle@my_oracle_host
+
# From : mysql@my_mysql_host
 
type bash
 
type bash
 
#or
 
#or
Line 157: Line 156:
 
rsync:
 
rsync:
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
# From : oracle@my_oracle_host
+
# From : mysql@my_mysql_host
 
type rsync
 
type rsync
 
#or
 
#or
Line 167: Line 166:
 
<br>
 
<br>
 
RedHat / CentOS / ... :
 
RedHat / CentOS / ... :
<syntaxhighlight lang="sh" line># From : root@my_oracle_host
+
<syntaxhighlight lang="sh" line># From : root@my_mysql_host
 
yum install -y bash rsync
 
yum install -y bash rsync
 
#or
 
#or
Line 174: Line 173:
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
  
# From : root@my_oracle_host
+
# From : root@my_mysql_host
 
apt install -y bash rsync
 
apt install -y bash rsync
 +
</syntaxhighlight>
 +
 +
====Unix user modification====
 +
Adapt to your machine type (sudo if you're not root).
 +
Modify the homedir (not mandatory, but avoids ending up in /var/lib/mysql):
 +
<syntaxhighlight lang="sh" line>
 +
# From : root@my_mysql_host
 +
mkdir -p /home/mysql
 +
chown mysql:mysql /home/mysql
 +
chmod 750 /home/mysql
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang="sh" line>
 +
##Stop instance (service mysql/mariadb stop -- or -- systemctl stop mysql/mariadb)
 +
usermod -d /home/mysql mysql -s /bin/bash
 +
##Start instance (service mysql/mariadb start -- or -- systemctl start mysql/mariadb)
 +
 +
#Or directly vi /etc/passwd !
 +
example : mysql:x:1004:989::/home/mysql:/bin/bash
 +
</syntaxhighlight>
 +
 +
Assign a passwd to the mysql user (otherwise the key exchange connection will not work!):<syntaxhighlight lang="sh" line>
 +
# From : root@my_mysql_host
 +
passwd mysql
 +
</syntaxhighlight>
 +
 +
====Creating a specific MySQL/MariaDB account for dbSQWare (for local connection)====
 +
Adapt to your needs depending on what you want to do...<br/>
 +
 +
Example for local connection :
 +
<syntaxhighlight lang="sql" line>
 +
grant all privileges on *.* to 'DBSDBA'@'localhost' IDENTIFIED BY 'DoNotSetThisPassword!' with grant option;
 +
 +
/* or */
 +
create user 'DBSDBA'@'localhost' IDENTIFIED BY 'DoNotSetThisPassword!';
 +
grant all privileges on *.* to 'DBSDBA'@'localhost' with grant option;
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang="sh" line>
 +
# From : mysql@my_mysql_host
 +
#Then, create the .my.cnf file to allow connection without using passwd
 +
echo "[client]
 +
password = DoNotSetThisPassword!
 +
" >> $HOME/.my.cnf
 +
chmod 600 $HOME/.my.cnf
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
====Deployment of SSH key(s) from SQWareCentral to the target machine(s)====
 
====Deployment of SSH key(s) from SQWareCentral to the target machine(s)====
 
There are two ways to proceed:
 
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)
+
*An automatic one (from dbsqware@sqwarebox, but it requires you to know the password of the mysql Unix account)
*A manual one that you apply on each oracle Unix account
+
*A manual one that you apply on each mysql Unix account
/!\ The password of your oracle Unix account must have been initialized, otherwise key-based authentication will not work!
+
/!\ The password of your mysql Unix account must have been initialized, otherwise key-based authentication will not work!
  
 
=====Deployment of SSH key(s): batch method=====
 
=====Deployment of SSH key(s): batch method=====
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora GenDeplSshKeys_SQWareCentral GenLstInstanceNew
+
menu_mys GenDeplSshKeys_SQWareCentral GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Verify that this is indeed the list you want to deploy, then choose option 1 ...<br/>
 
Verify that this is indeed the list you want to deploy, then choose option 1 ...<br/>
Line 192: Line 236:
  
 
=====Deployment of SSH key(s): manual method=====
 
=====Deployment of SSH key(s): manual method=====
<syntaxhighlight lang="sh" line># From : oracle@my_oracle_host
+
<syntaxhighlight lang="sh" line># From : mysql@my_mysql_host
 
if [ ! -r $HOME/.ssh/id_rsa ]
 
if [ ! -r $HOME/.ssh/id_rsa ]
 
then
 
then
Line 206: Line 250:
 
====SSH connection test from SQWareCentral====
 
====SSH connection test from SQWareCentral====
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora TestSshConnection GenLstInstanceNew
+
menu_mys TestSshConnection GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
====Test of prerequisites on the target host (bash+rsync) via SSH from SQWareCentral====
 
====Test of prerequisites on the target host (bash+rsync) via SSH from SQWareCentral====
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora TestSysPrerequisites GenLstInstanceNew
+
menu_mys TestSysPrerequisites GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 218: Line 262:
  
 
#If deployment on "unique" user
 
#If deployment on "unique" user
menu_ora DeplScripts GenLstUniqueNew
+
menu_mys DeplScripts GenLstUniqueNew
  
 
#If deployment on "instance" user, the one specified in SQWareRepository
 
#If deployment on "instance" user, the one specified in SQWareRepository
menu_ora DeplScripts GenLstInstanceNew
+
menu_mys DeplScripts GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
For "unique" user, it is the "standard" user. By default, we set it to "oracle", and it can be modified in SQWareCentral.
+
For "unique" user, it is the "standard" user. By default, we set it to "mysql", and it can be modified in SQWareCentral.
  
 
====Adding the dbSQWare environment to ~/.profile or ~/.bash_profile====
 
====Adding the dbSQWare environment to ~/.profile or ~/.bash_profile====
Line 230: Line 274:
  
 
*An automatic one (from dbsqware@sqwarebox)
 
*An automatic one (from dbsqware@sqwarebox)
*A manual one that you apply on each oracle Unix account
+
*A manual one that you apply on each mysql Unix account
  
 
=====Adding the dbSQWare environment: batch method=====
 
=====Adding the dbSQWare environment: batch method=====
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora AdddbSQWareProfile GenLstInstanceNew
+
menu_mys AdddbSQWareProfile GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
 
Check that this is indeed the list you want to deploy, then choose 1 ...<br/>  
 
Check that this is indeed the list you want to deploy, then choose 1 ...<br/>  
Line 241: Line 285:
 
=====Adding the dbSQWare environment: manual method=====  
 
=====Adding the dbSQWare environment: manual method=====  
 
Add the following lines to ~/.profile or ~/.bash_profile
 
Add the following lines to ~/.profile or ~/.bash_profile
<syntaxhighlight lang="sh" line># From : oracle@my_oracle_host
+
<syntaxhighlight lang="sh" line># From : mysql@my_mysql_host
  
 
#dbSQWare
 
#dbSQWare
export gvsqw_OraBin=$HOME/SQWareProduction/oracle/bin
+
export gvsqw_MysBin=$HOME/SQWareProduction/mysql/bin
 
export gvsqw_Env='PRD'
 
export gvsqw_Env='PRD'
 
lvsqw_IsTerminal=$(tty 2>&1 >/dev/null;echo $?)
 
lvsqw_IsTerminal=$(tty 2>&1 >/dev/null;echo $?)
if [ "$lvsqw_IsTerminal" = "0" ] && [ -r $gvsqw_OraBin/../etc/.profile_confort ]
+
if [ "$lvsqw_IsTerminal" = "0" ] && [ -r $gvsqw_MysBin/../etc/.profile_confort ]
 
then
 
then
. $gvsqw_OraBin/../etc/.profile_confort
+
. $gvsqw_MysBin/../etc/.profile_confort
 
fi
 
fi
 +
</syntaxhighlight>
 +
 +
=====Adding the variable MYSQL_SID=====
 +
Add the MYSQL_SID variable in the ~/.profile or ~/.bash_profile
 +
<syntaxhighlight lang="sh" line>
 +
# From : mysql@my_mysql_host
 +
export MYSQL_SID=MYS_INST_PRD
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
====Test sendmail (Non mandatory)====
 
====Test sendmail (Non mandatory)====
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora TestSendmail GenLstInstanceNew
+
menu_mys TestSendmail GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
====Manual connection test to the Oracle instance====
+
===="Manual" connection test to the MySQL/MariaDB instance ("local" connection)====
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!
 
/!\ Only instances that will be in "ON" status!
 
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
 
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
menu_ora TestInstConnectionOnNoMail GenLstInstanceNew
+
menu_mys TestInstConnectionOnNoMail GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Specific procedure for the AWR or RAC part===
+
===Specific Procedure for the "Remote" Port (DIST Status)===
  
====Creation of a specific dbSQWare Oracle account====
+
====Creating a Specific MySQL/MariaDB Account (dbSQWare) (For Remote Connections)====
<br>
+
Example for a "Remote" Connection
{{Warning| Only the instances on which you want to generate AWR}}
+
<syntaxhighlight lang="sql" line>
<br>
+
grant all privileges on *.* to 'DBSDBA'@'%' IDENTIFIED BY 'DoNotSetThisPassword!' with grant option;
{{Information|You must be SYS when entering the privileges}}
 
  
Example of creation order (NON-CDB) :
+
/* or */
<syntaxhighlight lang="sh" line>CREATE USER DBSUSER
+
create user 'DBSDBA'@'%' IDENTIFIED BY 'DoNotSetThisPassword!';
IDENTIFIED BY "DoNotSetThisPassword!"
+
grant all privileges on *.* to 'DBSDBA'@'%' with grant option;
PROFILE DEFAULT
+
flush privileges;
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>
 
</syntaxhighlight>
Example of creation order (CDB) :
+
 
<syntaxhighlight lang="sh" line>CREATE USER C##DBSUSER
+
You can enter any username and password you like!<br/>
IDENTIFIED BY "DoNotSetThisPassword!"
+
This account must be registered under the Unix account mysql@sqwarebox...<br/>
PROFILE DEFAULT
+
<syntaxhighlight lang="sh" line>
ACCOUNT UNLOCK CONTAINER=ALL;
+
vi /home/mysql/.passwd_mysql
GRANT RESOURCE TO C##DBSUSER CONTAINER=ALL;
+
DbAlias;UserName;Passwd;HostName;Port
GRANT CONNECT TO C##DBSUSER CONTAINER=ALL;
+
MYS_INST_PRD;DBSDBA;DoNotSetThisPassword!;srvdbmys01;3306
--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>
 
You can set the username and password you want!<br/>  
 
This account must be declared on the unix account oracle@sqwarebox ...<br/>
 
If a specific entry is found, it will be used; otherwise, the "DEFAULT" entry will be used.<br/>
 
<syntaxhighlight lang="sh" line>oracle@sqwarebox:/home/oracle (NoSID) $ cat .passwd_oracle
 
DEFAULT;DBSUSER;DoNotSetThisPassword!
 
SPECIFIC_ORA;system;manager
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
====Test "remote" connection====  
+
====Test "remote" connection====
/!\ Only for AWR and RAC
+
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
+
# From : dbsqware@sqwarebox
menu_ora TestInstConnectionDistNoMail GenLstInstanceNew
+
menu_mys TestInstConnectionDistNoMail GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
==Deployment of the instance==
+
==Starting the Instance==
===Generation of the default SQWareProduction configuration===
+
===Generating the Default SQWareProduction Configuration===
 
/!\ Only instances that will be in "ON" status!
 
/!\ Only instances that will be in "ON" status!
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
+
<syntaxhighlight lang="sh" line>
menu_ora GenDefConf_SQWareProduction GenLstInstanceNew
+
# From : dbsqware@sqwarebox
 +
menu_mys GenDefConf_SQWareProduction GenLstInstanceNew
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Update of SQWareRepository===
+
===Update SQWare Repository===
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)
+
In the dbSQWare repository via the administration console, update the status of the new MySQL/MariaDB instance (currently NEW) to the desired value (ON, DIST).
  
===Test of "recovery" of indicators===
+
===Testing the "Recovery" of Indicators===
At this point, you can test the recovery of missing indicators (in principle, only the instances you have just integrated!)
+
At this point, you can test the recovery of missing indicators (in principle, only the instances you have just integrated!).
<syntaxhighlight lang="sh" line># From : dbsqware@sqwarebox
+
<syntaxhighlight lang="sh" line>
## Only for status "ON"
+
# From : dbsqware@sqwarebox
repind_ora
+
## for those with status "ON"
## Only for status "DIST"
+
repind_mys
repind_ora_dist
+
## for those with status "DIST"
## Only for status "DG"
+
repind_mys_dist
repind_ora_dg
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
===Exploitation (backups, ) for "ON" instances===
+
===Operation (stats, backups, etc.) for "ON" instances===
====Generation of SQWareProduction configs====
+
====Generating 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.<br/>
+
If you followed the instance insertion procedure, this part is already done by step "menu_mys GenDefConf_SQWareProduction GenLstInstanceNew".<br/>
You can verify with the following chapter.<br/>
+
You can check with the next chapter.<br/>
 
<br/>
 
<br/>
Connect to the machine hosting the "Oracle" instance and type the following commands:<br/>
+
Connect to the machine that has the “MySQL/MariaDB” instance and type the following commands: <br/>
<syntaxhighlight lang="sh" line># From dbsqware@vorawarebox
 
c ORADBS
 
 
 
#Load the environment if running in multi-instance mode (from oracle@my_oracle_host)
 
e ORADBS
 
</syntaxhighlight>
 
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
too
+
# From dbsqware@vmyswarebox
./sqwora_GenerateCreateInstance.ksh -dbsOnly
+
c MYS_INST_PRD
 
</syntaxhighlight>
 
</syntaxhighlight>
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.
 
  
====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:
 
 
<syntaxhighlight lang="sh" line>vi $HOME/admin/ORADBS/sqwConfig/sqwora_Rman.cfg
 
</syntaxhighlight>
 
 
Verification of archiving:
 
<syntaxhighlight lang="sh" line>
 
sqlplus '/ as sysdba'
 
</syntaxhighlight>
 
<syntaxhighlight lang="sh" 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>
 
 
If needed, change the settings:
 
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
alter system set log_archive_format='ORADBS_redo_%t_%s_%r.arc' scope=spfile;
+
#Source de l'env si multi-instance (from mysql@my_mysql_host)
alter system set log_archive_dest_1='LOCATION=/orabackup/ORADBS/archive/ MANDATORY';
+
e MYS_INST_PRD
</syntaxhighlight>
 
 
 
If needed, set the database to ARCHIVELOG:
 
 
 
<syntaxhighlight lang="sh" line>shutdown immediate;
 
startup mount;
 
alter database archivelog;
 
alter database open;
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
"Minimal" RMAN configuration (based on the default settings) :
 
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
 
too
 
too
./sqwora_RmanConfigure.ksh
+
./sqwmys_GenerateCreateInstance.ksh -dbsOnly
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
Vérifier que ce qui est proposé est bon et tapez « y » si c’est le cas.<br/>
Verification of RMAN configuration :
+
A ce moment, vous avez généré les fichiers de configuration par défaut de SQWareProduction.
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====
 
====Explanations====
The previous steps have created certain default files. ($HOME/ORADBS/sqwConfig)
+
The previous steps created some default files. ($HOME/MYS_INST_PRD/sqwConfig)
 
+
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>#Enter the instance name
+
#Enter the instance name
e ORADBS
+
e MYS_INST_PRD
 
cfg
 
cfg
cat sqwora_Jobs.cfg
+
cat sqwmys_Jobs.cfg
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
#IndicDba: Gather indicators DBAs
+
#############################################
IndicDba:$gvsqw_OraBin/sqwora_GatherIndicators.ksh -I ORADBS
+
#IndicDba: Gather DBAs indicators
 +
IndicDba:$gvsqw_MysBin/sqwmys_GatherIndicators.ksh -I MYS_INST_PRD
  
#RmanFull: Backup level 0 (full) with RMAN
+
#Dump: backup all databases with mysqlDump
RmanFull:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i0 -Exec
+
Dump:$gvsqw_MysBin/sqwmys_DumpAllDatabases.ksh -I MYS_INST_PRD -Exec
  
#RmanInc: Backup level 1 (incremental) with RMAN
+
#Optimize : optimize tables for all databases
RmanInc:$gvsqw_OraBin/sqwora_RmanBackup.ksh -I ORADBS -T i1 -Exec
+
Optimize:$gvsqw_MysBin/sqwmys_OptimizeAllDatabases.ksh -I MYS_INST_PRD -Exec
  
#PurgeAlert: Purge log/trace files
+
#Analyse : analyze tables for all databases
PurgeAlert:$gvsqw_OraBin/sqwora_PurgeAlert.ksh -I ORADBS
+
Analyze:$gvsqw_MysBin/sqwmys_AnalyzeAllDatabases.ksh -I MYS_INST_PRD -Exec
  
#GenAwr: Generate AWR reports
+
#XtraFull: Backup full with XtraBackup
GenAwr:$gvsqw_OraBin/sqwora_GenerateAwr.ksh -I ORADBS
+
XtraFull:$gvsqw_MysBin/sqwmys_XtraBackup.ksh -I MYS_INST_PRD -Type full -Exec
  
#ExpFull: export full of database
+
#XtraInc: Backup incremental with XtraBackup
ExpFull:$gvsqw_OraBin/sqwora_Export.ksh -I ORADBS -T full -H 2 -Exec
+
XtraInc:$gvsqw_MysBin/sqwmys_XtraBackup.ksh -I MYS_INST_PRD -Type inc -Exec
  
#ExpdpFull: export full of database (expdp)
+
#MariaFull: Backup full with MariaBackup
ExpdpFull:$gvsqw_OraBin/sqwora_Expdp.ksh -I ORADBS -T full -H 2 -Exec
+
MariaFull:$gvsqw_MysBin/sqwmys_MariaBackup.ksh -I MYS_INST_PRD -Type full -Exec
 +
 
 +
#MariaInc: Backup incremental with MariaBackup
 +
MariaInc:$gvsqw_MysBin/sqwmys_MariaBackup.ksh -I MYS_INST_PRD -Type inc -Exec
 +
 
 +
#PurgeAlert: Rotate error log
 +
PurgeAlert:$gvsqw_MysBin/sqwmys_PurgeAlert.ksh -I MYS_INST_PRD
 
</syntaxhighlight>
 
</syntaxhighlight>
  
It is a configuration file used by the script sqwora_RunJob.ksh to execute actions.<br/>
+
This is a configuration file used by the sqwmys_RunJob.ksh script to execute actions.<br/>
 
<br/>
 
<br/>
File for a default cron $HOME/CrontabRef_ORADBS :
+
File for a default cron job $HOME/CrontabRef_MYS_INST_PRD:
 
+
<syntaxhighlight lang="sh" line>
<syntaxhighlight lang="sh" line>###########################
 
 
## 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
+
## MYS_INST_PRD
 
#Purge alert
 
#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'
+
00 08 * * 0 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A PurgeAlert > $HOME/tmp/PurgeAlert_MYS_INST_PRD.log 2>&1'
#Datapump
+
# Dump
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'
+
00 20 * * * bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Dump > $HOME/tmp/Dump_MYS_INST_PRD.log 2>&1'
#Backups
+
# Optimize
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 04 * * 6 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Optimize > $HOME/tmp/Optimize_MYS_INST_PRD.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'
+
# Analyze
 +
00 05 * * 6 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Analyze > $HOME/tmp/Analyze_MYS_INST_PRD.log 2>&1'
 +
# XtraBackup
 +
#00 21 * * 6  bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A XtraFull > $HOME/tmp/XtraFull_MYS_INST_PRD.log 2>&1'
 +
#00 21 * * 1-5 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A XtraInc > $HOME/tmp/XtraInc_MYS_INST_PRD.log 2>&1'
 +
# MariaBackup
 +
#00 21 * * 6  bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A MariaFull > $HOME/tmp/MariaFull_MYS_INST_PRD.log 2>&1'
 +
#00 21 * * 1-5 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A MariaInc > $HOME/tmp/MariaInc_MYS_INST_PRD.log 2>&1'
 
</syntaxhighlight>
 
</syntaxhighlight>
  
====Deployment====
+
====Startup====
Setting up the cron :
+
Setting up cron:
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
mv $HOME/CrontabRef_ORADBS $HOME/CrontabRef
+
mv $HOME/CrontabRef_MYS_INST_PRD $HOME/CrontabRef
 
vi $HOME/CrontabRef
 
vi $HOME/CrontabRef
 
crontab $HOME/CrontabRef
 
crontab $HOME/CrontabRef
Line 502: Line 456:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Updating the CrontabRef file :
+
Update the file CrontabRef :
 
<syntaxhighlight lang="sh" line>
 
<syntaxhighlight lang="sh" line>
 
crontab -l > $HOME/CrontabRef
 
crontab -l > $HOME/CrontabRef
Line 509: Line 463:
  
 
====Useful commands====
 
====Useful commands====
Interesting aliases :
+
alias :
e DBALIAS => Load the environment for the instance
+
e DBALIAS => source env for the instance
bin, etc, too ... => To navigate to the standard SQWareProduction directory
+
bin, etc, too ... => to go to the standard SQWareProduction tree
cbin, cetc, ctoo ... => To navigate to the custom SQWareProduction directory
+
cbin, cetc, ctoo ... => to go to the custom SQWareProduction tree
log => logs SQWareProduction
+
log => SQWareProduction logs
rma => Go to the RMAN backup directory
+
dmp => go to the backup paths
dmpdp => Go to the datapump directory
 
  
 
Some script options:
 
Some script options:
 
-h => online help
 
-h => online help
 
-s => online examples
 
-s => online examples
-Exec => when present, executes the commands; if not set, only shows the commands without executing them.
+
-Exec => when present; if not set, only outputs commands without executing them.
  
Exemples :
+
Examples :
  oracle@my_oracle_host:$HOME/admin/ORADBS/logs/RmanBackup (ORADBS) $ bin
+
  mysql@my_mysql_host:$HOME/admin/MYS_INST_PRD/logs/DumpAllDatabases (MYS_DBA_PRD) $ bin
  total 164
+
  total 100
  drwxr-x---  2 oracle dba  4096 Aug 16 15:50 .
+
  drwxr-x---  2 dbsqware dba 4096 Sep 6 14:09 .
  drwxr-x--- 15 oracle dba   187 Aug 16 15:50 ..
+
  drwxr-x--- 15 dbsqware dba 187 Aug 16 15:50 ..
  -rwxr-x---  1 oracle dba 15773 Aug 16 15:50 sqwArchmon
+
  -rwxr-x---  1 dbsqware dba 2957 Aug 16 15:50 sqwmys_AnalyzeAllDatabases.ksh
  -rwxr-x---  1 oracle dba 15773 Aug 16 15:50 sqwArchmon.ksh
+
  -rwxr-x---  1 dbsqware dba 2514 Aug 16 15:50 sqwmys_AnalyzeDatabase.ksh
  -rwxr-x---  1 oracle dba 2673 Aug 16 15:50 sqwora_ActivateMonitoring.ksh
+
  -rwxr-x---  1 dbsqware dba 2608 Aug 16 15:50 sqwmys_CheckAllDatabases.ksh
  -rwxr-x---  1 oracle dba 4506 Aug 16 15:50 sqwora_CopyDmpdp.ksh
+
  -rwxr-x---  1 dbsqware dba 2257 Aug 16 15:50 sqwmys_CheckDatabase.ksh
  -rwxr-x---  1 oracle dba 3551 Aug 16 15:50 sqwora_DbmsStats.ksh
+
  -rwxr-x---  1 dbsqware dba 5418 Aug 16 15:50 sqwmys_CopyDumpAllDatabases.ksh
lrwxrwxrwx  1 oracle dba    36 Jan  2  2022 sqwora_ExecSQL.ksh -> ../../generic/bin/sqwgen_ExecSQL.ksh
+
  -rwxr-x---  1 dbsqware dba 5324 Aug 16 15:50 sqwmys_CopyDumpDatabase.ksh
  -rwxr-x---  1 oracle dba 7284 Aug 16 15:50 sqwora_Expdp.ksh
+
  -rwxr-x---  1 dbsqware dba 5610 Sep 6 10:45 sqwmys_CopyMariaBackup.ksh
  -rwxr-x---  1 oracle dba  6861 Aug 16 15:50 sqwora_Export.ksh
+
  -rwxr-x---  1 dbsqware dba 5594 Sep 6 14:08 sqwmys_CopyXtraBackup.ksh
  -rwxr-x---  1 oracle dba  2652 Aug 16 15:50 sqwora_GatherDistantFsSize.ksh
+
  -rwxr-x---  1 dbsqware dba 3248 Aug 16 15:50 sqwmys_DumpAllDatabases.ksh
  -rwxr-x---  1 oracle dba 3609 Aug 16 15:50 sqwora_GatherIndicators.ksh
+
  -rwxr-x---  1 dbsqware dba 3541 Aug 16 15:50 sqwmys_DumpDatabase.ksh
  -rwxr-x---  1 oracle dba 2545 Aug 16 15:50 sqwora_GatherStructure.ksh
+
lrwxrwxrwx  1 dbsqware dba  36 Jan  2  2022 sqwmys_ExecSQL.ksh -> ../../generic/bin/sqwgen_ExecSQL.ksh
  -rwxr-x---  1 oracle dba 3022 Aug 16 15:50 sqwora_GenerateAwr.ksh
+
  -rwxr-x---  1 dbsqware dba 2455 Aug 16 15:50 sqwmys_GatherIndicators.ksh
  -rwxr-x---  1 oracle dba 3812 Aug 16 15:50 sqwora_GenerateStatspack.ksh
+
  -rwxr-x---  1 dbsqware dba 2454 Aug 16 15:50 sqwmys_GatherStructure.ksh
  -rwxr-x---  1 oracle dba 6120 Aug 16 15:50 sqwora_Impdp.ksh
+
  -rwxr-x---  1 dbsqware dba 3043 Aug 16 15:50 sqwmys_MariaBackup.ksh
  -rwxr-x--- 1 oracle dba  3199 Aug 16 15:50 sqwora_MonitorWithAwr.ksh
+
  lrwxrwxrwx 1 dbsqware dba   38 Jan 2  2022 sqwmys_NetBackup.ksh -> ../../generic/bin/sqwgen_NetBackup.ksh
  -rwxr-x---  1 oracle dba 2877 Aug 16 15:50 sqwora_MonitorWithAwrLastStat.ksh
+
  -rwxr-x---  1 dbsqware dba 2959 Aug 16 15:50 sqwmys_OptimizeAllDatabases.ksh
  -rwxr-x---  1 oracle dba 4117 Aug 16 15:50 sqwora_MonitorWithStatspack.ksh
+
  -rwxr-x---  1 dbsqware dba 2522 Aug 16 15:50 sqwmys_OptimizeDatabase.ksh
  lrwxrwxrwx  1 oracle dba   38 Jan  2  2022 sqwora_NetBackup.ksh -> ../../generic/bin/sqwgen_NetBackup.ksh
+
  lrwxrwxrwx  1 dbsqware dba   40 Jan  2  2022 sqwmys_ParallelRun.ksh -> ../../generic/bin/sqwgen_ParallelRun.ksh
lrwxrwxrwx  1 oracle dba    40 Jan  2  2022 sqwora_ParallelRun.ksh -> ../../generic/bin/sqwgen_ParallelRun.ksh
+
  -rwxr-x---  1 dbsqware dba 2252 Aug 16 15:50 sqwmys_PurgeAlert.ksh
  -rwxr-x---  1 oracle dba 5041 Aug 16 15:50 sqwora_PartialRefresh.ksh
+
  -rwxr-x---  1 dbsqware dba 3855 Aug 16 15:50 sqwmys_RestoreAllDatabases.ksh
  -rwxr-x---  1 oracle dba 2707 Aug 16 15:50 sqwora_PhysicalColdBackup.ksh
+
  -rwxr-x---  1 dbsqware dba 3463 Aug 16 15:50 sqwmys_RestoreDatabase.ksh
  -rwxr-x---  1 oracle dba 2507 Aug 16 15:50 sqwora_PurgeAlert.ksh
+
  -rwxr-x---  1 dbsqware dba 3825 Aug 16 15:50 sqwmys_RotateLogSlowQuery.ksh
  -rwxr-x---  1 oracle dba 3666 Aug 16 15:50 sqwora_RmanBackup.ksh
+
  lrwxrwxrwx  1 dbsqware dba   40 Jan  2  2022 sqwmys_RsyncBackup.ksh -> ../../generic/bin/sqwgen_RsyncBackup.ksh
-rwxr-x---  1 oracle dba  4790 Aug 16 15:50 sqwora_RmanClone.ksh
+
  lrwxrwxrwx  1 dbsqware dba   35 Jan  2  2022 sqwmys_RunJob.ksh -> ../../generic/bin/sqwgen_RunJob.ksh
  lrwxrwxrwx  1 oracle dba   40 Jan  2  2022 sqwora_RsyncBackup.ksh -> ../../generic/bin/sqwgen_RsyncBackup.ksh
+
  -rwxr-x---  1 dbsqware dba 3025 Aug 16 15:50 sqwmys_XtraBackup.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) $  
+
  mysql@my_mysql_host:$HOME/SQWareProduction/mysql/bin (MYS_INST_PRD) $  
  ./sqwora_RmanBackup.ksh -h
+
  ./sqwmys_DumpAllDatabases.ksh -h
 
   
 
   
  Sourcing sqwora_Global.lib v2023.06 SQWareProduction for Oracle (dbSQWare) ...
+
  Sourcing sqwmys_Global.lib v2023.06 SQWareProduction for MySQL (dbSQWare) ...
 
   
 
   
  Usage: sqwora_RmanBackup.ksh [-h] -I <instance> -T <Type> [+ options]
+
  Usage: sqwmys_DumpAllDatabases.ksh [-h] -I instance [+ options]
 
   
 
   
 
  DESCRIPTION
 
  DESCRIPTION
     sqwora_RmanBackup.ksh execute RMAN backup
+
     sqwmys_DumpAllDatabases.ksh dump databases in parallel
 
  SUPPORT
 
  SUPPORT
     Oracle supported versions: 9iR2 <= v <= 21c
+
     MySql  supported versions: 5.0 <= v <= 8
 +
    MariaDB supported versions: 5.5 <= v <= 11.6
 
   
 
   
 
  PARAMETERS
 
  PARAMETERS
       -I  instance      : Target instance to backup.
+
       -I  instance      : Target instance to mysqldump.
      -T  Type          : Backup type (i0, i1, log).
 
 
  OPTIONS
 
  OPTIONS
       -h                 : Display the full usage.
+
       -h help          : Display the full usage.
 
       -s                : Display samples of usage.
 
       -s                : Display samples of usage.
       -O Type          : cold,hot (default hot).
+
       -P Nb threads    : Number of threads in parallel (by default 2).
       -DG                : For dataguard instances not open.
+
       -RD directory      : Directory to write dump file (default /backups/mysql/$MYSQL_SID).
       -SRO              : Option 'skip readonly' (default backup all TBS).
+
      -ID listdb        : List of databases to be dumped (by default all).
       -OPT option        : Option to add to the RMAN command.
+
      -ED listdb        : List of databases to exclude from dump.
       -FRT return_code   : Force return code value on error.
+
      -IL likeclause    : Like clause to generate databases list (example: 'db%').
 +
       -EL likeclause    : Like clause to exclude databases (example: 'nodb%').
 +
      -HI Nb_Generations : Number of generations to keep (by default 2).
 +
       -WCD  whereclause  : Where clause to generate databases list.
 +
      -AGR  Nb sec      : Nb of seconds between two runs (by default 1s).
 +
      -AGE  Nb sec      : Nb of seconds between two checks of end (by default 10s).
 +
       -FRT return_code : Force return code value on error.
 +
      -Opt  option      : Additional options for mysqldump.
 +
      -Dist              : For distant connection to database (change $gvsqw_ConnectString to $gvsqw_DistConnectString ).
 
       -AddMail email    : Email address to add at 'xxx'.
 
       -AddMail email    : Email address to add at 'xxx'.
 
       -SendReport        : Send execution log report.
 
       -SendReport        : Send execution log report.
      -NoCumulative      : Disable cumulative incremental (default disable).
+
       -NoMail            : Deactivate sendmail on error xxx (by default, send on error).
      -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).
 
       -Locale  locale  : Force Locale for help display (fr,en).
       -Exec              : Run backup (default, display generated commands)
+
       -Consistent        : Lock for consistent mode (by default, no lock).
 
+
      -Exec             : Execute commands (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.<br>
 
The copy is done by running the command from the DEV/TST (the target).<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>
 
 
 
The script options :
 
$gvsqw_OraBin/sqwora_SchemaRefreshExpdp.ksh -h
 
 
 
Exemple:<br>
 
Source server : my_oracle_hostprod / instance : MYORAPRD / schema : MYSCHEMA<br>
 
To<br>
 
Target server  : my_oracle_host / instance : MYORADEV / schema : MYSCHEMA<br>
 
<br>
 
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 !
 
Enjoy !

Revision as of 13:38, 28 April 2025

Contents

Generalties


Nuvola apps important.png
Warning:
Before anything, don't go further if you don't have read the first section "dbSQWare Concepts " !.

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

Limits 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 MySQL/MariaDB instance

There will potentially be one or two connection cases to handle.

  • "local" for Unix machines (or those with Cygwin) where you'll be running MySQL on the machine hosting the instance (SSH connection from dbsqware@sqwarebox).
  • "remote" for cases where you don't have SSH access to the machine (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 MySQL/MariaDBinstance

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 sqwmys_GlobalVar.cfg!
We'll use a variable, MYSQL_SID, which has no value for MySQL/MariaDB but will identify the instance in dbSQWare.
By convention, we often use MYS "_" APPLI "_" ENV.
Example: MYS_THISAPPS_PRD or MYS_THISOTHERAPPS_DEV ...
But nothing is imposed; you choose what "suits you"! You just need to set the MYSQL_SID variable in the MySQL account profile with the desired value.

Explanation of statuses
  • An "open" instance will be handled in "local" mode, meaning we will connect with mysql locally on the machine hosting the instance (ssh access from dbsqware@sqwarebox), status "ON".
  • 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
Add a new instance by duplicate an other one. Explanation of the fields :

Fields Description
Db Alias Unique key that identifies the instance in dbSQWare (no value for MySQL/MariaDB).
Dbms Name Type of SGBD
Virtual Host Virtual Host (same as Host if not clustered)

.

Host Name Hostname of the instance
User Name User associated with the instance
Port Listening port of the instance.
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:

1 # From : dbsqware@sqwarebox
2 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:

1 # From : mysql@my_mysql_host
2 type bash
3 #or
4 which bash

rsync:

1 # From : mysql@my_mysql_host
2 type rsync
3 #or
4 which rsync
Installation

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

RedHat / CentOS / ... :

1 # From : root@my_mysql_host
2 yum install -y bash rsync
3 #or
4 dnf install -y bash rsync

Ubuntu / Debian / ... :

1 # From : root@my_mysql_host
2 apt install -y bash rsync

Unix user modification

Adapt to your machine type (sudo if you're not root). Modify the homedir (not mandatory, but avoids ending up in /var/lib/mysql):

1 # From : root@my_mysql_host
2 mkdir -p /home/mysql
3 chown mysql:mysql /home/mysql
4 chmod 750 /home/mysql
1 ##Stop instance (service mysql/mariadb stop -- or -- systemctl stop mysql/mariadb)
2 usermod -d /home/mysql mysql -s /bin/bash
3 ##Start instance (service mysql/mariadb start -- or -- systemctl start mysql/mariadb)
4 
5 #Or directly vi /etc/passwd !
6 example : mysql:x:1004:989::/home/mysql:/bin/bash

Assign a passwd to the mysql user (otherwise the key exchange connection will not work!):

1 # From : root@my_mysql_host
2 passwd mysql

Creating a specific MySQL/MariaDB account for dbSQWare (for local connection)

Adapt to your needs depending on what you want to do...

Example for local connection :

1 grant all privileges on *.* to 'DBSDBA'@'localhost' IDENTIFIED BY 'DoNotSetThisPassword!' with grant option;
2 
3 /* or */
4 create user 'DBSDBA'@'localhost' IDENTIFIED BY 'DoNotSetThisPassword!';
5 grant all privileges on *.* to 'DBSDBA'@'localhost' with grant option;
1 # From : mysql@my_mysql_host
2 #Then, create the .my.cnf file to allow connection without using passwd
3 echo "[client]
4 password = DoNotSetThisPassword!
5 " >> $HOME/.my.cnf
6 chmod 600 $HOME/.my.cnf

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 mysql Unix account)
  • A manual one that you apply on each mysql Unix account

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

Deployment of SSH key(s): batch method
1 # From : dbsqware@sqwarebox
2 menu_mys 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
1 # From : mysql@my_mysql_host
2 if [ ! -r $HOME/.ssh/id_rsa ]
3 then
4 ssh-keygen -t rsa -N ''''''' -f $HOME/.ssh/id_rsa
5 fi
6 chmod go-w $HOME
7 echo "ssh-rsa AAAAB......XSPpdV11 dbsqware@sqwarebox" >>$HOME/.ssh/authorized_keys
8 chmod 700 $HOME/.ssh
9 chmod 600 $HOME/.ssh/authorized_keys

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

SSH connection test from SQWareCentral

1 # From : dbsqware@sqwarebox
2 menu_mys TestSshConnection GenLstInstanceNew

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

1 # From : dbsqware@sqwarebox
2 menu_mys TestSysPrerequisites GenLstInstanceNew

Deployment of SQWareProduction

1 # From : dbsqware@sqwarebox
2 
3 #If deployment on "unique" user
4 menu_mys DeplScripts GenLstUniqueNew
5 
6 #If deployment on "instance" user, the one specified in SQWareRepository
7 menu_mys DeplScripts GenLstInstanceNew

For "unique" user, it is the "standard" user. By default, we set it to "mysql", 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 mysql Unix account
Adding the dbSQWare environment: batch method
1 # From : dbsqware@sqwarebox
2 menu_mys 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

 1 # From : mysql@my_mysql_host
 2 
 3 #dbSQWare
 4 export gvsqw_MysBin=$HOME/SQWareProduction/mysql/bin
 5 export gvsqw_Env='PRD'
 6 lvsqw_IsTerminal=$(tty 2>&1 >/dev/null;echo $?)
 7 if [ "$lvsqw_IsTerminal" = "0" ] && [ -r $gvsqw_MysBin/../etc/.profile_confort ]
 8 then
 9 . $gvsqw_MysBin/../etc/.profile_confort
10 fi
Adding the variable MYSQL_SID

Add the MYSQL_SID variable in the ~/.profile or ~/.bash_profile

1 # From : mysql@my_mysql_host
2 export MYSQL_SID=MYS_INST_PRD

Test sendmail (Non mandatory)

1 # From : dbsqware@sqwarebox
2 menu_mys TestSendmail GenLstInstanceNew

"Manual" connection test to the MySQL/MariaDB instance ("local" connection)

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

1 # From : dbsqware@sqwarebox
2 menu_mys TestInstConnectionOnNoMail GenLstInstanceNew

Specific Procedure for the "Remote" Port (DIST Status)

Creating a Specific MySQL/MariaDB Account (dbSQWare) (For Remote Connections)

Example for a "Remote" Connection

1 grant all privileges on *.* to 'DBSDBA'@'%' IDENTIFIED BY 'DoNotSetThisPassword!' with grant option;
2 
3 /* or */
4 create user 'DBSDBA'@'%' IDENTIFIED BY 'DoNotSetThisPassword!';
5 grant all privileges on *.* to 'DBSDBA'@'%' with grant option;
6 flush privileges;

You can enter any username and password you like!
This account must be registered under the Unix account mysql@sqwarebox...

1  vi /home/mysql/.passwd_mysql
2  DbAlias;UserName;Passwd;HostName;Port
3  MYS_INST_PRD;DBSDBA;DoNotSetThisPassword!;srvdbmys01;3306

Test "remote" connection

1 # From : dbsqware@sqwarebox
2 menu_mys TestInstConnectionDistNoMail GenLstInstanceNew

Starting the Instance

Generating the Default SQWareProduction Configuration

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

1 # From : dbsqware@sqwarebox
2 menu_mys GenDefConf_SQWareProduction GenLstInstanceNew

Update SQWare Repository

In the dbSQWare repository via the administration console, update the status of the new MySQL/MariaDB instance (currently NEW) to the desired value (ON, DIST).

Testing the "Recovery" of Indicators

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

1 # From : dbsqware@sqwarebox
2 ## for those with status "ON"
3 repind_mys
4 ## for those with status "DIST"
5 repind_mys_dist

Operation (stats, backups, etc.) for "ON" instances

Generating SQWareProduction configs

If you followed the instance insertion procedure, this part is already done by step "menu_mys GenDefConf_SQWareProduction GenLstInstanceNew".
You can check with the next chapter.

Connect to the machine that has the “MySQL/MariaDB” instance and type the following commands:

1 # From dbsqware@vmyswarebox
2 c MYS_INST_PRD
1 #Source de l'env si multi-instance (from mysql@my_mysql_host)
2 e MYS_INST_PRD
1 too
2 ./sqwmys_GenerateCreateInstance.ksh -dbsOnly

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.

Explanations

The previous steps created some default files. ($HOME/MYS_INST_PRD/sqwConfig)

1 #Enter the instance name
2 e MYS_INST_PRD
3 cfg
4 cat sqwmys_Jobs.cfg
 1 #############################################
 2 #IndicDba: Gather DBAs indicators
 3 IndicDba:$gvsqw_MysBin/sqwmys_GatherIndicators.ksh -I MYS_INST_PRD
 4 
 5 #Dump: backup all databases with mysqlDump
 6 Dump:$gvsqw_MysBin/sqwmys_DumpAllDatabases.ksh -I MYS_INST_PRD -Exec
 7 
 8 #Optimize : optimize tables for all databases
 9 Optimize:$gvsqw_MysBin/sqwmys_OptimizeAllDatabases.ksh -I MYS_INST_PRD -Exec
10 
11 #Analyse : analyze tables for all databases
12 Analyze:$gvsqw_MysBin/sqwmys_AnalyzeAllDatabases.ksh -I MYS_INST_PRD -Exec
13 
14 #XtraFull: Backup full with XtraBackup
15 XtraFull:$gvsqw_MysBin/sqwmys_XtraBackup.ksh -I MYS_INST_PRD -Type full -Exec
16 
17 #XtraInc: Backup incremental with XtraBackup
18 XtraInc:$gvsqw_MysBin/sqwmys_XtraBackup.ksh -I MYS_INST_PRD -Type inc -Exec
19 
20 #MariaFull: Backup full with MariaBackup
21 MariaFull:$gvsqw_MysBin/sqwmys_MariaBackup.ksh -I MYS_INST_PRD -Type full -Exec
22 
23 #MariaInc: Backup incremental with MariaBackup
24 MariaInc:$gvsqw_MysBin/sqwmys_MariaBackup.ksh -I MYS_INST_PRD -Type inc -Exec
25 
26 #PurgeAlert: Rotate error log
27 PurgeAlert:$gvsqw_MysBin/sqwmys_PurgeAlert.ksh -I MYS_INST_PRD

This is a configuration file used by the sqwmys_RunJob.ksh script to execute actions.

File for a default cron job $HOME/CrontabRef_MYS_INST_PRD:

 1 ## mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command
 2 ## MYS_INST_PRD
 3 #Purge alert
 4 00 08 * * 0 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A PurgeAlert > $HOME/tmp/PurgeAlert_MYS_INST_PRD.log 2>&1'
 5 # Dump
 6 00 20 * * * bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Dump > $HOME/tmp/Dump_MYS_INST_PRD.log 2>&1'
 7 # Optimize
 8 00 04 * * 6 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Optimize > $HOME/tmp/Optimize_MYS_INST_PRD.log 2>&1'
 9 # Analyze
10 00 05 * * 6 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A Analyze > $HOME/tmp/Analyze_MYS_INST_PRD.log 2>&1'
11 # XtraBackup
12 #00 21 * * 6   bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A XtraFull > $HOME/tmp/XtraFull_MYS_INST_PRD.log 2>&1'
13 #00 21 * * 1-5 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A XtraInc > $HOME/tmp/XtraInc_MYS_INST_PRD.log 2>&1'
14 # MariaBackup
15 #00 21 * * 6   bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A MariaFull > $HOME/tmp/MariaFull_MYS_INST_PRD.log 2>&1'
16 #00 21 * * 1-5 bash -c '. $HOME/.profile MYS_INST_PRD;$gvsqw_MysBin/sqwmys_RunJob.ksh -I MYS_INST_PRD -A MariaInc > $HOME/tmp/MariaInc_MYS_INST_PRD.log 2>&1'

Startup

Setting up cron:

1 mv $HOME/CrontabRef_MYS_INST_PRD $HOME/CrontabRef
2 vi $HOME/CrontabRef
3 crontab $HOME/CrontabRef
4 crontab -l

Update the file CrontabRef  :

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

Useful commands

alias : e DBALIAS => source env for the instance bin, etc, too ... => to go to the standard SQWareProduction tree cbin, cetc, ctoo ... => to go to the custom SQWareProduction tree log => SQWareProduction logs dmp => go to the backup paths

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

Examples :

mysql@my_mysql_host:$HOME/admin/MYS_INST_PRD/logs/DumpAllDatabases (MYS_DBA_PRD) $ bin
total 100
drwxr-x---  2 dbsqware dba 4096 Sep  6 14:09 .
drwxr-x--- 15 dbsqware dba  187 Aug 16 15:50 ..
-rwxr-x---  1 dbsqware dba 2957 Aug 16 15:50 sqwmys_AnalyzeAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 2514 Aug 16 15:50 sqwmys_AnalyzeDatabase.ksh
-rwxr-x---  1 dbsqware dba 2608 Aug 16 15:50 sqwmys_CheckAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 2257 Aug 16 15:50 sqwmys_CheckDatabase.ksh
-rwxr-x---  1 dbsqware dba 5418 Aug 16 15:50 sqwmys_CopyDumpAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 5324 Aug 16 15:50 sqwmys_CopyDumpDatabase.ksh
-rwxr-x---  1 dbsqware dba 5610 Sep  6 10:45 sqwmys_CopyMariaBackup.ksh
-rwxr-x---  1 dbsqware dba 5594 Sep  6 14:08 sqwmys_CopyXtraBackup.ksh
-rwxr-x---  1 dbsqware dba 3248 Aug 16 15:50 sqwmys_DumpAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 3541 Aug 16 15:50 sqwmys_DumpDatabase.ksh
lrwxrwxrwx  1 dbsqware dba   36 Jan  2  2022 sqwmys_ExecSQL.ksh -> ../../generic/bin/sqwgen_ExecSQL.ksh
-rwxr-x---  1 dbsqware dba 2455 Aug 16 15:50 sqwmys_GatherIndicators.ksh
-rwxr-x---  1 dbsqware dba 2454 Aug 16 15:50 sqwmys_GatherStructure.ksh
-rwxr-x---  1 dbsqware dba 3043 Aug 16 15:50 sqwmys_MariaBackup.ksh
lrwxrwxrwx  1 dbsqware dba   38 Jan  2  2022 sqwmys_NetBackup.ksh -> ../../generic/bin/sqwgen_NetBackup.ksh
-rwxr-x---  1 dbsqware dba 2959 Aug 16 15:50 sqwmys_OptimizeAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 2522 Aug 16 15:50 sqwmys_OptimizeDatabase.ksh
lrwxrwxrwx  1 dbsqware dba   40 Jan  2  2022 sqwmys_ParallelRun.ksh -> ../../generic/bin/sqwgen_ParallelRun.ksh
-rwxr-x---  1 dbsqware dba 2252 Aug 16 15:50 sqwmys_PurgeAlert.ksh
-rwxr-x---  1 dbsqware dba 3855 Aug 16 15:50 sqwmys_RestoreAllDatabases.ksh
-rwxr-x---  1 dbsqware dba 3463 Aug 16 15:50 sqwmys_RestoreDatabase.ksh
-rwxr-x---  1 dbsqware dba 3825 Aug 16 15:50 sqwmys_RotateLogSlowQuery.ksh
lrwxrwxrwx  1 dbsqware dba   40 Jan  2  2022 sqwmys_RsyncBackup.ksh -> ../../generic/bin/sqwgen_RsyncBackup.ksh
lrwxrwxrwx  1 dbsqware dba   35 Jan  2  2022 sqwmys_RunJob.ksh -> ../../generic/bin/sqwgen_RunJob.ksh
-rwxr-x---  1 dbsqware dba 3025 Aug 16 15:50 sqwmys_XtraBackup.ksh
mysql@my_mysql_host:$HOME/SQWareProduction/mysql/bin (MYS_INST_PRD) $ 
./sqwmys_DumpAllDatabases.ksh -h

Sourcing sqwmys_Global.lib v2023.06 SQWareProduction for MySQL (dbSQWare) ...

Usage: sqwmys_DumpAllDatabases.ksh [-h] -I instance [+ options]

DESCRIPTION
   sqwmys_DumpAllDatabases.ksh dump databases in parallel
SUPPORT
   MySql   supported versions: 5.0 <= v <= 8
   MariaDB supported versions: 5.5 <= v <= 11.6

PARAMETERS
     -I  instance       : Target instance to mysqldump.
OPTIONS
     -h  help           : Display the full usage.
     -s                 : Display samples of usage.
     -P  Nb threads     : Number of threads in parallel (by default 2).
     -RD directory      : Directory to write dump file (default /backups/mysql/$MYSQL_SID).
     -ID listdb         : List of databases to be dumped (by default all).
     -ED listdb         : List of databases to exclude from dump.
     -IL likeclause     : Like clause to generate databases list (example: 'db%').
     -EL likeclause     : Like clause to exclude databases (example: 'nodb%').
     -HI Nb_Generations : Number of generations to keep (by default 2).
     -WCD  whereclause  : Where clause to generate databases list.
     -AGR  Nb sec       : Nb of seconds between two runs (by default 1s).
     -AGE  Nb sec       : Nb of seconds between two checks of end (by default 10s).
     -FRT  return_code  : Force return code value on error.
     -Opt  option       : Additional options for mysqldump.
     -Dist              : For distant connection to database (change $gvsqw_ConnectString to $gvsqw_DistConnectString ).
     -AddMail email     : Email address to add at 'xxx'.
     -SendReport        : Send execution log report.
     -NoMail            : Deactivate sendmail on error xxx (by default, send on error).
     -Locale   locale   : Force Locale for help display (fr,en).
     -Consistent        : Lock for consistent mode (by default, no lock).
     -Exec              : Execute commands (default, display generated commands)


Enjoy !