General:BaseInstallation
WIP
Contents
- 1 Generalty
- 2 Installation of central infrastructure
Generalty
Limits of this section
This section does not claim to cover all possible cases of installation and configuration of dbSQWare.
It should not be forgotten that this is a very flexible tool that is capable of adapting to a good number of architectures.
This section is for DBAs who are familiar with Linux/Unix. This is an installation guide for someone who is already comfortable with these parts.
Before you say "it doesn't work", read the error message carefully and think about what you need at the core level for the scripts to work. For example, if you can't do a sqlplus command line to connect to your Oracle instance, there's no reason why the scripts should be able to do it (there's no magic)
!
If one of the chapters does not work, do not go any further, you must first correct it before continuing !
We advise you to call upon a tool specialist to define with you the best installation architecture suited to your fleet and your work organization https://www.dbsqware.com. Training courses are also available from partners to explore the different parts and the different possible configurations in more depth.
This section is based on a Rocky Linux installation of the central point on a machine or virtual machine (2 vCPU and 4 GB RAM) with 100 GB disk (Allows you to keep 2 years of history for around a hundred instances). You can obviously install it on another type of Linux/Unix, you will then have to adapt the proposed system commands if necessary.
It only covers the installation of the central base, for other settings refer to the appropriate sections.
Reminder of the structure of the tool
dbSQWare is composed of four add-ons:
SQWareProduction => operating shell scripts (often local on the machine hosting the DBMS to be managed) SQWareRepository => reference and storage of indicators (database MySQL or MariaDB recommended) SQWareCentral => centralization of sources and launch of commands SQWareWeb => graphical restitution interface
Installation of central infrastructure
As a reminder, this document only presents one way to install the tool. There are multiple possible configurations.
This section presents a “compact” installation, in other words the installation of the SQWareCentral, SQWareRepository and SQWareWeb modules on the same machine, we will call it vmsqwarebox.
This machine will also host the SQWareProduction sources.
For the exploitation of MsSql, we will also install SQWareProduction MsSql (and FreeTds) on this same machine.
You can obviously install it on another type of Linux/Unix, in which case you will need to adapt the proposed system commands.
The installation can also be performed in "distributed" mode, i.e., each module on its own machine; in this case, you will need to adapt the configurations.
We will cover the installation for Oracle (Oracle), Sybase (Sybase), Sql-Server (MSSQL), MySQL (MySQL), and PostgreSQL (Postgres).
Only use the commands for the DBMS(s) you are interested in and/or adapt the commands for other DBMS.
VM Features
Rocky Linux release 9.x 64 bits.
Sizing for the virtual machine :
2 vCPU 4 GB RAM 2 GB swap 100 GB disk
Verification / implementation of prerequisites
Most of the commands in this chapter are run with the unix root user, either because it is necessary for "system" installations, or because we are using scripts that loop through all users.
Adjust the commands if you want to do the installation step by step, logging in with the correct user each time.
It is essential to follow the commands in order and to check each time that the expected result is present before moving on to the next step, otherwise, it risks blocking and you will have difficulty finding where.
Basically, all commands have been tested, so you can use the good old copy/paste method in most cases.
System checks
Checking the OS version :
[root@vmsqwarebox ~]# cat /etc/redhat-release Rocky Linux release 9.3 (Blue Onyx)
Disk configuration :
[root@vmsqwarebox ~]# vgs VG #PV #LV #SN Attr VSize VFree data_vg 1 5 0 wz--n- <60.91g 20.83g root_vg 1 4 0 wz--n- 37.50g <20.48g [root@vmsqwarebox ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.7M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/mapper/root_vg-root 10G 1.7G 8.4G 17% / /dev/sda2 1014M 245M 770M 25% /boot /dev/sda1 599M 5.8M 594M 1% /boot/efi /dev/mapper/root_vg-var 5.0G 379M 4.7G 8% /var /dev/mapper/data_vg-applis 5.0G 69M 5.0G 2% /applis /dev/mapper/data_vg-data 15G 140M 15G 1% /data /dev/mapper/data_vg-home 10G 105M 9.9G 2% /home /dev/mapper/data_vg-backups 10G 105M 9.9G 2% /backups tmpfs 374M 0 374M 0% /run/user/0 [root@vmsqwarebox ~]# free total used free shared buff/cache available Mem: 3825740 314080 1493080 8868 2018580 3237608 Swap: 2097148 0 2097148
Update the OS to the latest patch version:
[root@vmsqwarebox ~]# dnf update
Disabling the firewall and SELinux (optional but help for installation) :
# Disabling the firewall systemctl disable firewalld systemctl stop firewalld # Deactivate SELINUX #Check /usr/sbin/getenforce Enforcing vi /etc/sysconfig/selinux SELINUX=enforcing => SELINUX=disabled (reboot) shutdown -r now #Check again /usr/sbin/getenforce Disabled
Prefer a server set to English, it’s easier for error messages (instead of the classic fr_FR.UTF-8):
#If needed you can install or change the locale dnf install langpacks-en glibc-all-langpacks -y #A server set to English, it’s easier for read error messages ! localectl System Locale: LANG=fr_FR.UTF-8 VC Keymap: fr-oss X11 Layout: fr X11 Variant: oss localectl set-locale LANG=en_US.UTF-8 localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr-oss X11 Layout: fr X11 Variant: oss #Keyboard (temp) loadkeys en localectl status localectl list-keymaps | grep en localectl set-keymap en localectl set-x11-keymap en localectl status System Locale: LANG=en_US.UTF-8 VC Keymap: en X11 Layout: en #Vous pouvez vérifier si vous avez le bon fuseau horaire timedatectl Local time: Wed 2024-04-24 07:19:51 EDT Universal time: Wed 2024-04-24 11:19:51 UTC RTC time: Wed 2024-04-24 11:19:51 Time zone: America/New_York (EDT, -0400) System clock synchronized: yes NTP service: active RTC in local TZ: no #If you need to change it rm -rf /etc/localtime timedatectl set-timezone Europe/Paris timedatectl Local time: Wed 2024-04-24 13:20:44 CEST Universal time: Wed 2024-04-24 11:20:44 UTC RTC time: Wed 2024-04-24 11:20:44 Time zone: Europe/Paris (CEST, +0200) System clock synchronized: yes NTP service: active RTC in local TZ: no
Install et activation du NTP (on utilise Chrony):
#Install et activation de Chrony dnf install -y chrony #Check config of chronyd (old ntpd) cat /etc/chrony.conf #Utilisez un pool de serveurs proche, ex: pool 0.europe.pool.ntp.org iburst #Start et activation du démarrage auto systemctl enable --now chronyd #If Firewalld is running, allow NTP service. NTP uses [123/UDP]. firewall-cmd --add-service=ntp success firewall-cmd --runtime-to-permanent success #On relance le service systemctl restart chronyd #Vérifier le status du service systemctl is-enabled chronyd enabled systemctl status chronyd chronyd.service - NTP client/server Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled) ...
Installation de RPM qui vont servir par la suite !
Many EPEL packages require the CodeReady Builder (CRB) repository. It is recommended that you run /usr/bin/crb enable to enable the CRB repository. dnf install -y open-vm-tools dnf install -y nmap bind-utils ksh rsync openssh-server openssl-devel openssl dnf install -y epel-release binutils net-tools telnet control-center gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make sysstat s-nail postfix cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain cyrus-sasl-scram cyrus-sasl-md5 cyrus-sasl-ntlm ## Pour client Oracle 19c (mais pas que !) dnf install -y zip unzip git wget mlocate nano binutils.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 ## Pour la compil Python dnf install -y zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel findutils ncurses-devel
Un certain nombre de RPM sont nécessaires pour l’installation d’Oracle, il convient donc de vérifier leur présence et de les installer si nécessaire.
Exemple de commande de vérification :
$ rpm -q gcc gcc-11.4.1-2.1.el9.x86_64
Il peut être utile de connaitre l'architecture des RPM installés (x86_64 et i386 par exemple). Pour ce faire, il suffit de modifier le format d'affichage par défaut en éditant le fichier ~/.rpmmacros .
$ echo '%_query_all_fmt %%{name}-%%{version}-%%{release} (%%{arch})' >>~/.rpmmacros $ rpm -q gcc gcc-11.4.1-2.1.el9 (x86_64)
Ou directement dans la ligne de commande :
$ rpm -q gcc --queryformat '%{name}-%{release} %{version} (%{arch})\n' gcc-2.1.el9 11.4.1 (x86_64)
Exemple de sortie lorsqu’un RPM manque :
[root@vmsqwarebox /]# rpm -q libXpm-devel package libXpm-devel is not installed
Exemple d’installation d’un RPM manquant :
[root@vmsqwarebox /]# rpm -ivh libXpm-devel-3.5.5-3.x86_64.rpm warning: libXpm-devel-3.5.5-3.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:libXpm-devel ########################################### [100%]
Le plus simple, installation directe avec yum (nécessite un repo) :
[root@vmsqwarebox /]# dnf install libXpm-devel ksh binutils gcc gcc-c++ glibc glibc-common libstdc++ libstdc++-devel make sysstat ##Conf et activation du mail (modif relayhost) vi /etc/postfix/main.cf systemctl start postfix systemctl enable postfix systemctl status postfix
Gestion des users unix
Création des groups et users unix avec bash comme shell par défaut (à adapter si vous souhaitez par exemple fixer les uid et gid) :
groupadd dba useradd -g dba -s /bin/bash -d /home/dbsqware dbsqware useradd -g dba -s /bin/bash -d /home/oracle oracle useradd -g dba -s /bin/bash -d /home/sybase sybase useradd -g dba -s /bin/bash -d /home/mssql mssql useradd -g dba -s /bin/bash -d /home/mysql mysql useradd -g dba -s /bin/bash -d /home/postgres postgres
Affectation d’un mot de passe aux users :
passwd dbsqware passwd oracle passwd sybase passwd mssql passwd mysql passwd postgres
Exemple de sortie :
[root@vmsqwarebox /]# passwd dbsqware Changing password for user dbsqware. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@vmsqwarebox /]# passwd oracle Changing password for user oracle. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. ...
Modification des droits sur leur home directory :
cd /home chmod 750 dbsqware oracle sybase mssql mysql postgres
Vérification des home directories :
[root@vmsqwarebox /]# ls -l /home/ total 32 drwxr-x--- 3 dbsqware dba 4096 mai 13 21:54 dbsqware drwxr-x--- 3 mssql dba 4096 mai 13 21:54 mssql drwxr-x--- 3 mysql dba 4096 mai 13 21:54 mysql drwxr-x--- 3 oracle dba 4096 mai 13 21:54 oracle drwxr-x--- 3 postgres dba 4096 mai 13 21:54 postgres drwxr-x--- 3 sybase dba 4096 mai 13 21:54 sybase
Mettre le user dbsqware en 'sudo ALL' pour faciliter la mise en œuvre et l'exploitation :
## Add sudo cp -p /etc/sudoers /etc/sudoers.back chmod 700 /etc/sudoers vi /etc/sudoers root@vmsqwarebox:/root # grep wheel /etc/sudoers ## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL %wheel ALL=(ALL) NOPASSWD: ALL chmod 440 /etc/sudoers id dbsqware uid=1000(dbsqware) gid=1000(dba) groups=1000(dba) usermod -a -G wheel dbsqware id dbsqware uid=1000(dbsqware) gid=1000(dba) groups=1000(dba),10(wheel)
Mise en place des arborescences
Préparation des arborescences /applis pour installation des binaires applicatifs (si nécessaire) :
mkdir -p /applis/oracle chown oracle:dba /applis/oracle mkdir -p /applis/sybase chown sybase:dba /applis/sybase mkdir -p /applis/mssql chown mssql:dba /applis/mssql mkdir -p /applis/mysql chown mysql:dba /applis/mysql mkdir -p /applis/dbsqware chown dbsqware:dba /applis/dbsqware mkdir -p /applis/postgres chown postgres:dba /applis/postgres
Préparation des arborescences /data pour stocker les données (si nécessaire) :
mkdir -p /data/oracle chown oracle:dba /data/oracle mkdir -p /data/sybase chown sybase:dba /data/sybase mkdir -p /data/mssql chown mssql:dba /data/mssql mkdir -p /data/mysql chown mysql:dba /data/mysql mkdir -p /data/dbsqware chown dbsqware:dba /data/dbsqware mkdir -p /data/postgres chown postgres:dba /data/postgres mkdir -p /data/dbsqware/admin/AsynchronousFiles /data/dbsqware/admin/AsynchronousFilesTmp /data/dbsqware/admin/AsynchronousFilesArch chown -R dbsqware:dba /data/dbsqware/admin # Spécifique pour les rapports AWR et/ou Statspack mkdir -p /data/oracle/awr chown oracle:dba /data/oracle/awr # Spécifique pour les slow query files mkdir -p /data/mysql/SlowQuery chown mysql:dba /data/mysql/SlowQuery
Préparation des arborescences /backups pour stocker les backups (si nécessaire) :
mkdir -p /backups/oracle chown oracle:dba /backups/oracle mkdir -p /backups/sybase chown sybase:dba /backups/sybase mkdir -p /backups/mssql chown mssql:dba /backups/mssql mkdir -p /backups/mysql chown mysql:dba /backups/mysql mkdir -p /backups/dbsqware chown dbsqware:dba /backups/dbsqware mkdir -p /backups/postgres chown postgres:dba /backups/postgres
Vérification des arborescences :
[root@vmsqwarebox /]# ls -l /applis total 40 drwxr-xr-x 2 dbsqware dba 4096 mai 14 04:06 dbsqware drwxr-xr-x 2 mssql dba 4096 mai 14 04:06 mssql drwxr-xr-x 2 mysql dba 4096 mai 14 04:06 mysql drwxr-xr-x 2 oracle dba 4096 mai 14 04:06 oracle drwxr-xr-x 2 sybase dba 4096 mai 14 04:06 sybase drwxr-xr-x 2 postgres dba 4096 mai 14 04:06 postgres [root@vmsqwarebox /]# ls -l /data total 40 drwxr-xr-x 2 dbsqware dba 4096 mai 14 04:06 dbsqware drwxr-xr-x 2 mssql dba 4096 mai 14 04:06 mssql drwxr-xr-x 2 mysql dba 4096 mai 14 04:06 mysql drwxr-xr-x 2 oracle dba 4096 mai 14 04:06 oracle drwxr-xr-x 2 sybase dba 4096 mai 14 04:06 sybase drwxr-xr-x 2 postgres dba 4096 mai 14 04:06 postgres [root@vmsqwarebox /]# ls -l /backups total 32 drwxr-xr-x 2 dbsqware dba 4096 mai 14 04:06 dbsqware drwxr-xr-x 2 mssql dba 4096 mai 14 04:06 mssql drwxr-xr-x 2 mysql dba 4096 mai 14 04:06 mysql drwxr-xr-x 2 oracle dba 4096 mai 14 04:06 oracle drwxr-xr-x 2 sybase dba 4096 mai 14 04:06 sybase drwxr-xr-x 2 postgres dba 4096 mai 14 04:06 postgres
Clés ssh
Préparation des clés ssh pour dbsqware
Directement depuis le user root :
su - dbsqware -c " ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa chmod go-w \$HOME cat \$HOME/.ssh/id_rsa.pub >>\$HOME/.ssh/authorized_keys chmod 700 \$HOME/.ssh chmod 600 \$HOME/.ssh/authorized_keys"
Si tout a fonctionné correctement, le user dbsqware doit être capable de se connecter en ssh sur lui-même (ceci pour plus de souplesse dans certains cas de paramétrages).
Test si cela fonctionne :
[root@vmsqwarebox home]# su - dbsqware $ ssh dbsqware@vmsqwarebox The authenticity of host 'vmsqwarebox (85.31.222.135)' can't be established. RSA key fingerprint is bd:e1:d0:d3:c5:2d:94:8f:df:f0:a2:50:42:8d:ad:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added ' vmsqwarebox,bbb.xx.aaa.yyy' (RSA) to the list of known hosts. Last login: Mon May 14 04:33:25 2012 from vmsqwarebox $ exit Connection to vmsqwarebox closed.
Pour chacun des users unix que vous avez créés précédemment, vous devez répéter la même opération mais en autorisant également le user dbsqware à se connecter sur eux (pour lancer les scripts en automatique).
De la même façon que tout à l’heure, soit vous le faites sur chaque user à la main, soit vous utilisez le bout de script suivant en tant que root :
lvsqw_SshKey_dbsqware=$(cat /home/dbsqware/.ssh/id_rsa.pub) for lvsqw_User in `echo 'oracle sybase mssql mysql postgres'` do su - $lvsqw_User -c " ssh-keygen -t rsa -N '' -f \$HOME/.ssh/id_rsa chmod go-w \$HOME cat \$HOME/.ssh/id_rsa.pub >>\$HOME/.ssh/authorized_keys echo '$lvsqw_SshKey_dbsqware' >>\$HOME/.ssh/authorized_keys chmod 700 \$HOME/.ssh chmod 600 \$HOME/.ssh/authorized_keys" done ssh-keygen -t rsa -N '' -f $HOME/.ssh/id_rsa chmod go-w $HOME echo "$lvsqw_SshKey_dbsqware" >>$HOME/.ssh/authorized_keys chmod 700 $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys
Test si cela fonctionne (exemple pour le user oracle à répéter pour tous les users) :
[root@vmsqwarebox home]# su - dbsqware $ id uid=1000(dbsqware) gid=1000(dba) groupes=1000(dba),10(wheel) $ ssh oracle@vmsqwarebox $ id uid=1001(oracle) gid=1000(dba) groupes=1000(dba) $ ssh oracle@vmsqwarebox The authenticity of host 'vmsqwarebox (85.31.222.135)' can't be established. RSA key fingerprint is bd:e1:d0:d3:c5:2d:94:8f:df:f0:a2:50:42:8d:ad:1d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'vmsqwarebox,bbb.xx.aaa.yyy' (RSA) to the list of known hosts. Last login: Mon May 14 05:07:47 2012 from vmsqwarebox $ id uid=1001(oracle) gid=1000(dba) groupes=1000(dba) $ exit Connection to vmsqwarebox closed. $ exit Connection to vmsqwarebox closed.
Les fichiers d’environnement
Mise en place d'un .bash_profile et .bashrc pour tous les users :
cat <<EOFCAT >/tmp/.vimrc syntax off set mouse-=a set noai EOFCAT cat <<EOFCAT >/tmp/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/ccs/bin:/usr/local/sbin:/usr/openwin/bin EOFCAT cat <<EOFCAT >/tmp/.bashrc # Source global definitions # if [ -f /etc/bashrc ] && [ \$(ps -p \$\$|grep -c 'bash') -ne 0 ] ; then # . /etc/bashrc # fi unalias ls 2>/dev/null alias ll='ls -al' alias lt='ls -alrt' set -o vi EOFCAT chmod 777 /tmp/.bash_profile /tmp/.bashrc /tmp/.vimrc for lvsqw_User in `echo 'dbsqware oracle sybase mssql mysql postgres root'` do su - $lvsqw_User -c " cp /tmp/.vimrc \$HOME/. cp /tmp/.bash_profile \$HOME/. cp /tmp/.bashrc \$HOME/. cd ln -s .bash_profile .profile chmod 640 \$HOME/.vimrc chmod 640 \$HOME/.bash_profile chmod 640 \$HOME/.bashrc" done rm -f /tmp/.bash_profile /tmp/.bashrc cat <<EOCAT >> $HOME/.bashrc export PS1="\`id| cut -d')' -f1| cut -d'(' -f2\`@\$(hostname|cut -d '.' -f1):"'\$PWD # ' EOCAT for lvsqw_User in `echo 'oracle sybase mssql mysql postgres'` do su - $lvsqw_User -c " ln -s /home/dbsqware/dbSQWare/SQWareProduction \$HOME/SQWareProduction" done
Vérification que tous les fichiers ont été créés :
[root@vmsqwarebox ~]# ls -al /home/* /home/dbsqware: total 56 drwxr-x--- 3 dbsqware dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 dbsqware dba 48 May 14 05:30 .bashrc -rw-r----- 1 dbsqware dba 13 May 14 05:30 .bash_profile -rw------- 1 dbsqware dba 746 May 14 05:26 .sh_history drwx------ 2 dbsqware dba 4096 May 14 04:37 .ssh -rw------- 1 dbsqware dba 922 May 14 05:23 .viminfo /home/mssql: total 40 drwxr-x--- 3 mssql dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 mssql dba 48 May 14 05:30 .bashrc -rw-r----- 1 mssql dba 13 May 14 05:30 .bash_profile drwx------ 2 mssql dba 4096 May 14 05:16 .ssh /home/mysql: total 40 drwxr-x--- 3 mysql dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 mysql dba 48 May 14 05:30 .bashrc -rw-r----- 1 mysql dba 13 May 14 05:30 .bash_profile drwx------ 2 mysql dba 4096 May 14 05:16 .ssh /home/oracle: total 48 drwxr-x--- 3 oracle dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 oracle dba 48 May 14 05:30 .bashrc -rw-r----- 1 oracle dba 13 May 14 05:30 .bash_profile -rw------- 1 oracle dba 76 May 14 05:12 .sh_history drwx------ 2 oracle dba 4096 May 14 05:16 .ssh /home/sybase: total 40 drwxr-x--- 3 sybase dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 sybase dba 48 May 14 05:30 .bashrc -rw-r----- 1 sybase dba 13 May 14 05:30 .bash_profile drwx------ 2 sybase dba 4096 May 14 05:16 .ssh /home/postgres: total 40 drwxr-x--- 3 sybase dba 4096 May 14 05:30 . drwxr-xr-x 7 root root 4096 May 14 03:57 .. -rw-r----- 1 sybase dba 48 May 14 05:30 .bashrc -rw-r----- 1 sybase dba 13 May 14 05:30 .bash_profile drwx------ 2 sybase dba 4096 May 14 05:16 .ssh
Ajout de la partie source de l’environnement SQWareProduction dans le .profile de tous les users :
for lvsqw_Sgbd in `echo 'oracle sybase mssql mysql postgres'` do lvsqw_tmp=$(echo "$lvsqw_Sgbd"|sed 's,\([a-z][a-z][a-z]\)[a-z]*,\1,') lvsqw_tmp1=$(echo "$lvsqw_tmp"|sed 's,\([a-z]\)[a-z]*,\1,'|tr '[a-z]' '[A-Z]') lvsqw_tmp2=$(echo "$lvsqw_tmp"|sed 's,[a-z]\([a-z][a-z]\)[a-z]*,\1,') TrigrammeSgbd="${lvsqw_tmp1}$lvsqw_tmp2" if [ "$TrigrammeSgbd" = "Mss" ] then TrigrammeSgbd="Msq" lvsqw_tmp="msq" elif [ "$TrigrammeSgbd" = "Pos" ] then TrigrammeSgbd="Pg" lvsqw_tmp="pg" fi echo "Traitement du SGBD: '$lvsqw_Sgbd', '$TrigrammeSgbd'" cat <<EOFCAT >> /home/$lvsqw_Sgbd/.bash_profile # env dbSQWare pour $lvsqw_Sgbd, must stay at end of .bash_profile export gvsqw_Env='PRD' export gvsqw_${TrigrammeSgbd}Bin=\$HOME/SQWareProduction/$lvsqw_Sgbd/bin lvsqw_IsTerminal=\$(tty 2>&1 >/dev/null;echo \$?) if [ "\$lvsqw_IsTerminal" = "0" ] && [ -r \$gvsqw_${TrigrammeSgbd}Bin/../etc/.profile_confort ] then . \$gvsqw_${TrigrammeSgbd}Bin/../etc/.profile_confort fi EOFCAT done
Installation des sources sur vmsqwarebox
La majorité des commandes de ce chapitre sont passées avec le user unix dbsqware.
Il est primordial de suivre les commandes dans l’ordre et de vérifier à chaque fois que le résultat attendu est bien présent avant de passer à l’étape suivante, sinon, cela risque de bloquer et vous allez avoir du mal à trouver où. Vérifiez également que tous les points précédents ont été exécutés sans erreur.
Nous allons dans cette partie déployer l’ensemble des scripts de dbSQWare.
Il y aura :
- SQWareCentral, qui servira notamment à l’exécution automatique de scripts sur l’ensemble du parc.
- SQWareProduction, il s’agit en fait du référentiel de source de ce module. Il faudra le paramétrer aux normes de votre parc pour ensuite le déployer.
- SQWareRepository, il s’agit des scripts sql vous permettant de créer le repository.
- SQWareWeb, c’est la partie de restitution graphique fonctionnant avec apache et PHP, à déployer sur la même machine que SQWareCentral où à déplacer sur une autre, c’est au choix.
Extraction de l’archive
Récupérez les sources et placez-les dans /tmp :
[root@vmsqwarebox ~]# su - dbsqware $ cd $ tar zxvf /tmp/dbSQWare_full_latest.tgz dbSQWare/ dbSQWare/SQWareProduction/ dbSQWare/SQWareProduction/ingres/ dbSQWare/SQWareProduction/ingres/tools/ ... dbSQWare/SQWareProduction/oracle/ dbSQWare/SQWareProduction/oracle/tools/ dbSQWare/SQWareProduction/oracle/tools/sqwora_RmanConfigure.ksh ... dbSQWare/SQWareCentral/ dbSQWare/SQWareCentral/lib/ dbSQWare/SQWareCentral/lib/sqwctl_MenuAction.lib ... dbSQWare/SQWareWeb/custom_ref/ dbSQWare/SQWareWeb/custom_ref/ingres/ ... <br> Vérification que l’on a bien l'ensemble des modules installés : <pre> $ ls -l ~dbsqware/dbSQWare total 12 lrwxrwxrwx 1 dbsqware dba 24 Jan 2 2022 generic -> SQWareProduction/generic drwxr-x--- 3 dbsqware dba 56 Feb 23 14:51 SQWareAdmin drwxr-x--- 16 dbsqware dba 4096 Feb 23 14:51 SQWareCentral drwxr-x--- 4 dbsqware dba 33 Feb 23 14:51 SQWarePredict drwxr-x--- 15 dbsqware dba 192 Feb 23 14:51 SQWareProduction drwxr-x--- 17 dbsqware dba 4096 Feb 23 14:51 SQWareRepository drwxr-x--- 11 dbsqware dba 185 Feb 23 14:51 SQWareWeb -rwxr-x--- 1 dbsqware dba 9 Feb 23 14:51 SQW_VERSION
Configuration du profile du user dbsqware pour SQWareCentral
Mise en place des conf par defaut:
cat <<EOFCAT >/home/dbsqware/dbSQWare/SQWareCentral/etc_cust/sqwctl_GlobalVar.cfg export gvsqw_AsynchronousFilesDir="/data/dbsqware/admin/AsynchronousFiles" export gvsqw_AsynchronousFilesDirTmp="/data/dbsqware/admin/AsynchronousFilesTmp" export gvsqw_AsynchronousFilesDirArch="/data/dbsqware/admin/AsynchronousFilesArch" EOFCAT chmod 750 /home/dbsqware/dbSQWare/SQWareCentral/etc_cust/sqwctl_GlobalVar.cfg #Mettre la bonne adresse mail ! cat <<EOFCAT >/home/dbsqware/dbSQWare/SQWareProduction/generic/etc_cust/sqwgen_GlobalVar.cfg #Put NoNail in gvsqw_GlobalMail if you don't want to send mail on error export gvsqw_GlobalMail='dba@mydomane.com' #for SQWareWeb export gvsqw_WebDbaURL="https://$(hostname)" export gvsqw_WebDbaUser='dbsqware@$(hostname)' EOFCAT chmod 750 /home/dbsqware/dbSQWare/SQWareProduction/generic/etc_cust/sqwgen_GlobalVar.cfg ln -s /data/dbsqware/admin/AsynchronousFilesArch /home/dbsqware/dbSQWare/SQWareWeb/sqw_logdir ln -s /data/mysql/SlowQuery /home/dbsqware/dbSQWare/SQWareWeb/sqw_mysql_slow ln -s /data/oracle/awr /home/dbsqware/dbSQWare/SQWareWeb/sqw_oracle_awr
Ajoutez les lignes suivantes dans le .bash_profile du user unix dbsqware afin qu’il source l’environnement de SQWareCentral.
dbsqware@vmsqwarebox:/home/dbsqware $ vi .bash_profile ## SQWareCentral export gvsqw_Env='PRD' export gvsqw_SQWareCentralPath=$HOME/dbSQWare/SQWareCentral export gvsqw_SQWareProductionPath=$HOME/dbSQWare/SQWareProduction . $gvsqw_SQWareCentralPath/etc/.profile
Pour vérifier si tout est OK, sourcez le .bash_profile du user et vous devez avoir un résultat de ce type:
dbsqware@vmsqwarebox:/home/dbsqware $ . ~/.bash_profile _ _ ____ _____ __ __| | |__/ ___| / _ \ \ / /_ _ _ __ ___ / _` | '_ \___ \| | | \ \ /\ / / _` | '__/ _ \ | (_| | |_) |__) | |_| |\ V V / (_| | | | __/ \__,_|_.__/____/ \__\_\ \_/\_/ \__,_|_| \___| ################################################################### # SQWareCentral module of dbSQWare # Copyright (C) 2010-2024, dbSQWare (www.dbsqware.com) # dbSQWare is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # CGU/CGA for more details. # You should have received a copy of the CGU/CGA # along with this program. If not, see <https://www.dbsqware.com/licenses/>. # For information : contact@dbsqware.com or www.dbsqware.com ################################################################### # SqwVersion=2024.03 # For help type 'show <-h|-help|--help>'
Installation/configuration de SQWareRepository
Ce chapitre présente la création du référentiel, il s’agit d’une database MariaDB>=10.1 ... (MariaDB 10.11 recommandé et sur la sqwarebox fournie)
La volumétrie va dépendre du nombre d’instances traitées, et de certains autres paramétrages comme la profondeur d’historique ou le nombre de lignes de logs remonté en base. Dans la majorité des cas, pour une centaine d’instances gérées et les paramètres par défaut de dbSQWare, la volumétrie ne devrait pas excéder 15 Go en pleine charge (données purement indicatives).
Les installations vont se faire à partir des scripts sql se trouvant dans :
~dbsqware/dbSQWare/SQWareRepository/$TypeSgbd/sql/*.sql
Installation de la database MariaDB
Ce chapitre part du principe que vous avez déjà un client MySQL/MariaDB installé sous le user mysql. Ce client servira également au module SQWareCentral pour se connecter à SQWareRepository et générer les listes d’instances à traiter, par exemple.
Pour exemple, vous pouvez regarder l'annexe « Installation rapide d’une instance MariaDB » afin de créer l’instance qui hébergera le référentiel sur le point central. Attention, il ne s’agit que d’un exemple, celui-ci peut être créé n’importe où.
On part du principe que nous sommes connectés sous unix avec le user mysql pour ce chapitre.
Création de la database et des users (exemple) :
[root@vmsqwarebox ~]# su - mysql $ mysql -uroot -pPassMys Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 10.6.12-MariaDB-log MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. (root@localhost) [(none)]> create database dbsqware_db; Query OK, 1 row affected (0.00 sec) (root@localhost) [(none)]> GRANT ALL PRIVILEGES ON dbsqware_db.* TO 'dbsqware_user'@'localhost' IDENTIFIED BY 'PassMys'; Query OK, 0 rows affected (0.01 sec) (root@localhost) [(none)]> exit Bye mysql@vmsqwarebox:/home/mysql () $ exit logout [root@vmsqwarebox ~]# exit logout
Création des objets
La création des objets va se faire à partir du user unix dbsqware. Pour cela, il faut tout d’abord créer le fichier de paramétrage pour l’accès à MariaDB/MySQL.
Voici le contenu que doit avoir le fichier (adaptez-le avec vos credentials) :
dbsqware@vmsqwarebox:/home/dbsqware $ vi /home/dbsqware/dbSQWare/SQWareCentral/etc_cust/.my_SQWareRepository.cnf [client] host = localhost port = 3306 database = dbsqware_db user = dbsqware_user password = PassMys chmod 640 /home/dbsqware/dbSQWare/SQWareCentral/etc_cust/.my_SQWareRepository.cnf
Test de connexion au référentiel (avec le fichier) :
dbsqware@vmsqwarebox:/home/dbsqware $ mysql --defaults-file='/home/dbsqware/dbSQWare/SQWareCentral/etc_cust/.my_SQWareRepository.cnf' Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 11.4.2-MariaDB-log MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [dbsqware_db]> show databases; +--------------------+ | Database | +--------------------+ | dbsqware_db | | information_schema | +--------------------+ 2 rows in set (0.001 sec) MariaDB [dbsqware_db]> exit Bye
Installation du référentiel :
dbsqware@vmsqwarebox:/home/dbsqware $ dbspatch _ _ ____ _____ __ __| | |__/ ___| / _ \ \ / /_ _ _ __ ___ / _` | '_ \___ \| | | \ \ /\ / / _` | '__/ _ \ | (_| | |_) |__) | |_| |\ V V / (_| | | | __/ \__,_|_.__/____/ \__\_\ \_/\_/ \__,_|_| \___| ################################################################### # SQWareCentral module of dbSQWare # Copyright (C) 2010-2024, dbSQWare (www.dbsqware.com) # dbSQWare is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # CGU/CGA for more details. # You should have received a copy of the CGU/CGA # along with this program. If not, see <http://www.dbsqware.com/licenses/>. # For information : contact@dbsqware.com or www.dbsqware.com ################################################################### # SqwVersion=2024.08 # For help type 'show <-h|-help|--help>' Create tree for custom dir ... create directory /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom create directory /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom/images Copy ref files to custom if not exists ... copy /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom_ref/authentication_custom.php on /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom/authentication_custom.php copy /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom_ref/GlobalHead.html on /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom/GlobalHead.html copy /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom_ref/images/client.png on /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom/images/client.png copy /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom_ref/sqwareweb.ini on /home/dbsqware/dbSQWare/SQWareCentral/../SQWareWeb/exploit/bin/../../custom/sqwareweb.ini Sourcing sqwctl_Global.lib v2024.08 SQWareCentral (dbSQWare) ... eval global vars: gvsqw_RsyncDefaultUser="$gvsqw_UserExec@RsyncHost" => gvsqw_RsyncDefaultUser=dbsqware@RsyncHost Checks before install: SQWareRepository source to install: /home/dbsqware/dbSQWare/SQWareRepository Connect string to repository: MySQL_Command="mysql --defaults-file='/home/dbsqware/dbSQWare/SQWareCentral/etc_cust/.my_SQWareRepository.cnf'" [client] host = localhost port = 3306 database = dbsqware_db user = dbsqware_user 10.11.11-MariaDB-log Major version of Repository, 1011, 10.11.11 Checks for install mode (full or patch): You will make a full install. Do you want to full install SQWareRepository [y-Y-o-O-n-N]?
Ici tapez y, l'installation du référentiel va prendre un certain temps.
... ... ... END_TRT Code: 0 --> Update_06_MenuY.sql executed successfully. END_TRT Code: 0 --> Update_07_MenuY.sql executed successfully. END_TRT Code: 0 --> Update_08_MenuY.sql executed successfully. END_TRT Code: 0 --> Update_09_MenuY.sql executed successfully. Job Install SQWareRepository proceeded successfully Begining : 2024-04-15 12:13:31 End : 2024-04-15 12:15:04 Duration : 00:01:33
Installation/configuration de SQWareWeb
Ce chapitre présente l’installation et la configuration de SQWareWeb.
Nous partons du principe que apache et PHP 8.2 sont installés et opérationnels pour se connecter à MariaDB/MySQL (PHP >= 7.4 et 8.x fonctionnent également en principe).
Pour déployer apache et PHP 8.2, vous pouvez regarder l'annexe « Installation rapide de apache et PHP 8.2 ». Attention, il ne s’agit que d’un exemple, reportez-vous aux sites officiels des outils pour plus d’information https://httpd.apache.org/ et https://www.php.net/.
On part du principe que nous sommes connectés sous unix avec le user dbsqware pour ce chapitre. Nous allons voir une installation de SQWareWeb sur la même machine que SQWareCentral, mais ceci n’est pas une obligation.
Mise en place
Nous avons vu lorsque nous avons déployé les sources de dbSQWare que nous possédions l’arborescence /home/dbsqware/dbSQWare/SQWareWeb. Celle-ci contient les sources du site que nous allons mettre en place.
Vérification des arborescences :
$ cd /home/dbsqware/dbSQWare/SQWareWeb $ ls -l total 24 drwxr-x--- 2 dbsqware dba 70 Nov 29 19:46 css drwxr-xr-x 3 dbsqware dba 64 Dec 8 14:50 custom drwxr-x--- 3 dbsqware dba 64 Nov 29 19:46 custom_ref drwxr-x--- 6 dbsqware dba 60 Nov 29 19:46 exploit drwxr-x--- 19 dbsqware dba 322 Nov 29 19:46 htdocs drwxr-x--- 2 dbsqware dba 8192 Nov 29 19:46 images drwxr-x--- 14 dbsqware dba 177 Nov 29 19:46 jobs_help drwxr-x--- 5 dbsqware dba 239 Nov 29 19:46 js drwxr-x--- 3 dbsqware dba 4096 Nov 29 19:46 lib -rwxr-x--- 1 dbsqware dba 22 Nov 29 19:46 phpinfo.php lrwxrwxrwx 1 dbsqware dba 42 Dec 8 14:54 sqw_logdir -> /data/dbsqware/admin/AsynchronousFilesArch lrwxrwxrwx 1 dbsqware dba 21 Dec 8 14:54 sqw_mysql_slow -> /data/mysql/SlowQuery lrwxrwxrwx 1 dbsqware dba 16 Dec 8 14:54 sqw_oracle_awr -> /data/oracle/awr drwxr-x--- 2 dbsqware dba 214 Nov 29 19:46 templates -rwxr-x--- 1 dbsqware dba 1274 Nov 29 19:46 test.php
Conf http
Mettez en place le VirtualHost apache pour le site (si vous ne tournez qu'en http). Encore une fois, il ne s’agit ici que d’un exemple que vous pouvez customiser (avec le user root, adaptez si besoin).
$ vi /etc/httpd/conf.d/httpd-vhosts.conf <Directory "/home/dbsqware/dbSQWare/SQWareWeb"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <Directory "/data/oracle/awr"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <VirtualHost *:80> DocumentRoot /home/dbsqware/dbSQWare/SQWareWeb ServerName vmsqwarebox ServerAlias vmsqwarebox vmsqwareboxRocky9 webdba </VirtualHost> [root@vmsqwarebox ~]# systemctl restart httpd
Conf https (attention, vous devez mettre un certificat ssl en place)
Mettez en place le VirtualHost apache pour le site (si vous souhaitez ne tournez qu'en https). Encore une fois, il ne s’agit ici que d’un exemple que vous pouvez customiser (avec le user root, adaptez si besoin).
## Generate SSL Certificate : To generate a new self-signed certificate with 365 days expiry, run: [root@vmsqwarebox ~]# openssl req -newkey rsa:2048 -nodes -keyout /etc/pki/tls/private/dbsqware_selfsigned.key -x509 -days 3650 -out /etc/pki/tls/certs/dbsqware_selfsigned.crt Generating a RSA private key ........................................................................................................................................+++++ ...............................+++++ writing new private key to '/etc/pki/tls/private/dbsqware_selfsigned.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- # Country Name (2 letter code) [XX]:Fr # State or Province Name (full name) []:France # Locality Name (eg, city) [Default City]:Gardanne # Organization Name (eg, company) [Default Company Ltd]:dbSQWare - self-signed # Organizational Unit Name (eg, section) []:SQWareWeb SSL # Common Name (eg, your name or your server's hostname) []:webdba # Email Address []:myadress@mydomain [root@vmsqwarebox ~]# ls -l /etc/pki/tls/private/dbsqware_selfsigned.key /etc/pki/tls/certs/dbsqware_selfsigned.crt -rw-r--r--. 1 root root 1497 Apr 19 15:32 /etc/pki/tls/certs/dbsqware_selfsigned.crt -rw-------. 1 root root 1704 Apr 19 15:31 /etc/pki/tls/private/dbsqware_selfsigned.key ## Installation de mod_ssl [root@vmsqwarebox ~]# dnf install mod_ssl ## activation du module 'mod_ssl' module [root@vmsqwarebox ~]# systemctl restart httpd ## verification [root@vmsqwarebox ~]# httpd -t -D DUMP_MODULES| grep ssl ssl_module (shared) ## To Redirect All HTTP Traffic To HTTPS [root@vmsqwarebox ~]# cat /etc/httpd/conf.d/redirect_http.conf <VirtualHost _default_:80> ServerName vmsqwarebox ServerAlias vmsqwarebox vmsqwareboxRocky9 webdba Redirect permanent / https://webdba/ </VirtualHost> ## vhost https [root@vmsqwarebox ~]# vi /etc/httpd/conf.d/httpd-vhosts.conf <Directory "/home/dbsqware/dbSQWare/SQWareWeb"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <Directory "/data/oracle/awr"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> <VirtualHost *:443> DocumentRoot /home/dbsqware/dbSQWare/SQWareWeb ServerName vmsqwarebox ServerAlias vmsqwarebox VMsqwareboxRockyLinux9 webdba SSLEngine on SSLCertificateFile /etc/pki/tls/certs/dbsqware_selfsigned.crt SSLCertificateKeyFile /etc/pki/tls/private/dbsqware_selfsigned.key </VirtualHost> [root@vmsqwarebox ~]# systemctl reload httpd
Personnalisation
Paramétrez l’accès au référentiel (SQWareRepository) pour SQWareWeb dans le fichier suivant :
vi /home/dbsqware/dbSQWare/SQWareWeb/custom/sqwareweb.ini [db] MysqlHost="localhost" MysqlUser="dbsqware_user" MysqlPass="PassMys"
Remplacez le fichier suivant par votre logo :
/home/dbsqware/dbSQWare/SQWareWeb/custom/images/client.png
Vous devez maintenant pouvoir afficher la page web suivante https://vmsqwarebox (avec votre logo) :
Un compte d’admin est créé par défaut à l’installation :
User = default_admin Pass = YBHim9Ty_PSOvahtSxAU_5SX3QSoNFaC
Fichier:SQWareWeb.png
Cet affichage vous permet de valider si le socle est paramétré correctement pour le web.
En cas d’erreur, vous pouvez jouer avec les paramètres de « debug » du sqwareweb.ini afin de tenter de trouver le problème :
;debug=true ;debug_before_connectdb=true ;debug_connectdb_error=true
Paramétrages spécifiques
Pour Oracle
Si vous mettez en place la génération des rapports AWR avec SQWareProduction (attention aux licences), vous devez créer un lien symbolique à la racine du site vers le répertoire contenant les rapports statiques (paramétré dans SQWareProduction pour Oracle).
$ cd /home/dbsqware/dbSQWare/SQWareWeb $ ln -s /data/oracle/awr sqw_oracle_awr $ ls -l sqw_oracle_awr lrwxrwxrwx 1 dbsqware dba 16 jun 12 19:01 sqw_oracle_awr -> /data/oracle/awr
Pour MySql
Si vous mettez en place la rotation des fichiers SlowQuery avec SQWareProduction (uniquement disponible sous unix), vous devez créer un lien symbolique à la racine du site vers le répertoire contenant les rapports statiques (paramétré dans SQWareProduction pour MySql).
$ cd /home/dbsqware/dbSQWare/SQWareWeb $ ln -s /data/mysql/SlowQuery sqw_mysql_slow $ ls -l sqw_mysql_slow lrwxrwxrwx 1 dbsqware dba 21 jun 12 19:05 sqw_mysql_slow -> /data/mysql/SlowQuery
Droits d’accès à SQWareWeb
Pour accéder à la console SQWareWeb, vous devez paramétrer les droits d’accès.
Il existe trois niveaux d’accès :
- En lecture (accès uniquement aux indicateurs)
- En admin (accès avec droits de modification du paramétrage SQWareRepository)
- En lecture/admin (accès en lecture seule au paramétrage SQWareRepository)
Vous avez deux façons de gérer les droits, par l’interface d’admin de SQWareWeb avec un user possédant le droit admin ou directement par ordres sql en database.
Par la console d’admin
Allez dans la console d’admin, soit directement :
https://vmsqwarebox/admin/all/access/adminAccessLogins_general.html
Soit en cliquant sur l'icône « admin » :
Fichier:AdminConsole.png
Puis « Access » et « Login » …
Directement en sql
Suppression du user d’admin par défaut :
delete from tsqw_AdminLoginsPrivs where id_usr_grantee=1; delete from tsqw_AdminLogins where username='default_admin';
Création d’un user de visu :
insert into tsqw_AdminLogins (username,lastname,firstname,passwd, cre_date, upd_date, pwd_date, dbaname, authentication_type, is_forweb) values ('viewer', 'Viewer', 'Viewer', SHA1('View!Sec@'), now(), now(), now(), 'init', 'internal','1');
Création d’un user d’admin :
insert into tsqw_AdminLogins (username,lastname,firstname,passwd, cre_date, upd_date, pwd_date, dbaname, authentication_type, is_forweb) values ('myadmin', 'Adm', 'My', SHA1('P@dm!n'), now(), now(), now(), 'init', 'internal','1') ; insert into tsqw_AdminLoginsPrivs (id_usr_grantee,id_grp_granted,dbaname,comments,upd_date) select id_usr_grantee, id_grp_granted, dbaname, comments, upd_date from (select id_usr as id_usr_grantee from tsqw_AdminLogins where username='myadmin') gadm, (select id_grp as id_grp_granted from tsqw_AdminGroups where groupname='DBA') gdba, (select 'myadmin' as dbaname, 'Init dbSQWare' as comments, now() as upd_date from dual) com ;
Crontab du user dbsqware unix pour SQWareCentral
Voir le contenu du fichier suivant :
/home/dbsqware/dbSQWare/SQWareCentral/etc/CrontabRef.cfg
Voici la cron classique que l’on met en place sur le user dbsqware :
########################### ## mm(0-59) hh(0-23) dd(1-31) MM(0-12) DAY(0-sunday, 1-monday, ...) command ## Generic cron for SQWareCentral (dbSQWare) ############ # Generate all ref files (RefFileInstances,RefFileDb,RefFileCMDB,...) 00 02,08 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_GenRef_AllFiles.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_GenRef_AllFiles.log' # Check indicators 00 07 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_CheckIndicators.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_CheckIndicators.log' # Gather indicators 00 03 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_GatherIndicators.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_GatherIndicators.log' # Retry gather indicators if not exists 00 09,12,17 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_GatherIndicators.ksh -Repind -NoMail 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_GatherIndicators_Repind.log' ############ # Retrieve async files from a dir (configure sqwctl_LoopRetrieveAsynchronousFilesGlobal.cfg in cetc) 20 * * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_LoopRetrieveAsynchronousFilesGlobal.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_LoopRetrieveAsynchronousFilesGlobal.log' # Retrieve async files from all instances 15 * * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_LoopRetrieveAsynchronousFiles.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_LoopRetrieveAsynchronousFiles.log' 45 07,08,09,10,11,12,13,14,15,16,17,18 * * * ksh -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_LoopRetrieveAsynchronousFiles.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_LoopRetrieveAsynchronousFiles.log' # Exec async files from all instances 30 * * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_LoopExecAsynchronousFiles.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_LoopExecAsynchronousFiles.log' 10,50 07,08,09,10,11,12,13,14,15,16,17,18 * * * ksh -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_LoopExecAsynchronousFiles.ksh 2>&1 >$HOME/admin/SQWareCentral/logs/sqwctl_LoopExecAsynchronousFiles.log' ######################################################################################################################## ### Gather Structures (dbSQWare) ############ ## Structures Oracle #00 05 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="Structure";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A GatherStructureOn -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/GatherStructureOracle.log' ## Structures MySQL #15 05 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="Structure";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mysql -A GatherStructureOn -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/GatherStructureMySQL.log' ## Structures PostgreSQL #30 05 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="Structure";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T postgres -A GatherStructureOn -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/GatherStructurePostgreSQL.log' ## Structures MsSql #45 05 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="Structure";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mssql -A GatherStructureOn -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/GatherStructureMsSql.log' ## Structures Sybase #00 06 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="Structure";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T sybase -A GatherStructureOn -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/GatherStructureSybase.log' ######################################################################################################################## ### Specific cron for Oracle (dbSQWare) ############ ## Check started instances Oracle #00 06 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A sqwora_StartedInstancesOn.ksh -F GenLstUniqueOn -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/StartedInstancesOracle.log' ## Generate Awr reports in distant mode #10 09 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A sqwora_GenerateAwrDist.ksh -F sqwora_GenLstInstanceAwrAll.sql -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/ind_ora_awr_dist.log' ## Monitor Awr reports in distant mode #05 * * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A sqwora_MonitorHourlyAwrDist.ksh -F sqwora_GenLstInstanceAwrAll.sql -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/ind_ora_awr_monitor_dist.log' ## Generate Statspack reports in distant mode #10 09 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A sqwora_GenerateStatspackOld.ksh -F Liste9iStatspack.sql -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/ind_Statspack_awr_old.log' ## Monitor Statspack reports in distant mode #05 * * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T oracle -A sqwora_MonitorStatspackOld.ksh -F Liste9iStatspack.sql -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/ind_ora_Statspack_monitor_old.log' ######################################################################################################################## ### Specific cron for MySql (dbSQWare) ############ ## Rotate slow query #00 07 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mysql -A sqwmys_SlowQuery.ksh -F GenLstInstanceOn -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/mysql_slowquery.log' ## Async Rotate slow query #00 07 * * * bash -c '. ~/.profile 2>&1 >/dev/null;export gvsqw_JobName="AsyncRotateLog";$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mysql -A sqwmys_SlowQueryAsync.ksh -F GenLstInstanceOn_SpecJob -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/mysql_Async_slowquery.log' ## Rotate error log #00 08 * * 6 bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mysql -A sqwmys_PurgeAlert.ksh -F GenLstInstanceOn -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/mysql_errorlog.log' ######################################################################################################################## ### Specific cron for MsSql (dbSQWare) ############ ## Rotate errorlog #01 23 * * * bash -c '. ~/.profile 2>&1 >/dev/null;$gvsqw_SQWareCentralPath/bin/sqwctl_TrtAuto.ksh -T mssql -A sqwmsq_RotateLog.ksh -F GenLstInstanceOn -Exec 2>&1 >$HOME/admin/SQWareCentral/logs/MssqlRotateLog.log' ######################################################################################################################## ### Specific cron for update GLPI (dbSQWare) ############ ## Update GLPI MYS_GLPI_PRD #10 10 * * * bash -c '. ~/.profile 2>&1 >/dev/null;/home/dbsqware/dbSQWare/SQWareProduction/mysql/tools/sqwmys_UpdateGLPI.ksh -I MYS_GLPI_PRD -D glpi -F /home/dbsqware/dbSQWare/SQWareCentral/etc_cust/RefFileCMDB.csv -Dist 2>&1 >$HOME/admin/SQWareCentral/logs/MajGLPI_PRD_PRD'