Mover arquivos de dados sem indisponibilidade

O Sybase ASE possui uma funcionalidade interna para espelhamento de devices, que são seus repositórios de dados.

Utilizando um pouco de criatividade, podemos utilizar esta funcionalidade para mover um device para outro filesystem, sem absolutamente nenhuma indisponibilidade. Basta executar o espelhamento para o filesystem desejado (com o comando disk mirror), e depois retirar o espelhamento (com o comando disk unmirror), mas mantendo o espelho ativo, e não o arquivo original (opção side = ‘primary’).

Como os devices do Sybase ASE podem ser discos brutos, esta técnica permite até a troca de discos rígidos onde estão os bancos de dados, sem indisponibilidade.

No exemplo abaixo, fiz este teste com o banco de dados master, o mais crítico do Sybase ASE.

[sybase@CentOS ~]$ isql -SCENTOS -Usa -PNerv2011 -w999
1> sp_helpdevice
2> go
device_name            physical_name                                                  description                                                                                                                                                                                                        status       cntrltype          vdevno       vpn_low        vpn_high
---------------------- -------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------ ------------------ ------------ -------------- ----------------
dbccdb                 /opt/sybase/data/dbccdb.dat                                    file system device, special, dsync on, directio off, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                        16386               0               5             0           51199
dbccdb_log             /opt/sybase/data/dbccdb_log.dat                                file system device, special, dsync on, directio off, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                        16386               0               6             0           51199
master                 /opt/sybase/data/master.dat                                    file system device, special, dsync on, directio off, default disk, physical disk, 60.00 MB, Free: 3.00 MB                                                                                                               3               0               0             0           30719
sybmgmtdev             /opt/sybase/data/sybmgmtdb.dat                                 file system device, special, dsync off, directio on, physical disk, 75.00 MB, Free: 0.00 MB                                                                                                                             2               0               4             0           38399
sysprocsdev            /opt/sybase/data/sysprocs.dat                                  file system device, special, dsync off, directio on, physical disk, 152.00 MB, Free: 0.00 MB                                                                                                                            2               0               1             0           77823
systemdbdev            /opt/sybase/data/sybsysdb.dat                                  file system device, special, dsync off, directio on, physical disk, 6.00 MB, Free: 0.00 MB                                                                                                                              2               0               2             0            3071
tapedump1              /dev/nst0                                                      unknown device type, disk, dump device                                                                                                                                                                                 16               2               0             0           20000
tapedump2              /dev/nst1                                                      unknown device type, tape,        625 MB, dump device                                                                                                                                                                  16               3               0             0           20000
tempdbdev              /opt/sybase/data/tempdbdev.dat                                 file system device, special, dsync off, directio on, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                            2               0               3             0           51199
(9 rows affected)
(return status = 0)
1> disk mirror name = master, mirror = '/home/sybase/master.dat'
2> go
Creating the physical file for the mirror...
00:00:00000:00023:2011/05/15 14:06:34.69 kernel  mirror for virtual device 0 started using asynchronous (with DIRECTIO) I/O
Starting Dynamic Mirroring of 15360 pages for logical device 'master'.
512 pages mirrored...
1024 pages mirrored...
1536 pages mirrored...
2048 pages mirrored...
2560 pages mirrored...
3072 pages mirrored...
3584 pages mirrored...
4096 pages mirrored...
4608 pages mirrored...
5120 pages mirrored...
5632 pages mirrored...
6144 pages mirrored...
6656 pages mirrored...
7168 pages mirrored...
7680 pages mirrored...
8192 pages mirrored...
8704 pages mirrored...
9216 pages mirrored...
9728 pages mirrored...
10240 pages mirrored...
10752 pages mirrored...
11264 pages mirrored...
11776 pages mirrored...
12288 pages mirrored...
12800 pages mirrored...
13312 pages mirrored...
13824 pages mirrored...
14336 pages mirrored...
14592 pages mirrored...
The remaining 768 pages are currently unallocated and will be mirrored as they are allocated.
1> disk unmirror name = 'master', side = 'primary', mode = 'remove'
2> go
00:00:00000:00023:2011/05/15 14:07:31.44 kernel  Closing the primary device for virtual device master
00:00:00000:00023:2011/05/15 14:07:31.45 kernel  The new primary device is now /home/sybase/master.dat
1> sp_helpdevice
2> go
device_name            physical_name                                                  description                                                                                                                                                                                                        status       cntrltype          vdevno       vpn_low        vpn_high
---------------------- -------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------ ------------------ ------------ -------------- ----------------
dbccdb                 /opt/sybase/data/dbccdb.dat                                    file system device, special, dsync on, directio off, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                        16386               0               5             0           51199
dbccdb_log             /opt/sybase/data/dbccdb_log.dat                                file system device, special, dsync on, directio off, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                        16386               0               6             0           51199
master                 /home/sybase/master.dat                                        file system device, special, dsync on, directio off, default disk, physical disk, 60.00 MB, Free: 3.00 MB                                                                                                               3               0               0             0           30719
sybmgmtdev             /opt/sybase/data/sybmgmtdb.dat                                 file system device, special, dsync off, directio on, physical disk, 75.00 MB, Free: 0.00 MB                                                                                                                             2               0               4             0           38399
sysprocsdev            /opt/sybase/data/sysprocs.dat                                  file system device, special, dsync off, directio on, physical disk, 152.00 MB, Free: 0.00 MB                                                                                                                            2               0               1             0           77823
systemdbdev            /opt/sybase/data/sybsysdb.dat                                  file system device, special, dsync off, directio on, physical disk, 6.00 MB, Free: 0.00 MB                                                                                                                              2               0               2             0            3071
tapedump1              /dev/nst0                                                      unknown device type, disk, dump device                                                                                                                                                                                 16               2               0             0           20000
tapedump2              /dev/nst1                                                      unknown device type, tape,        625 MB, dump device                                                                                                                                                                  16               3               0             0           20000
tempdbdev              /opt/sybase/data/tempdbdev.dat                                 file system device, special, dsync off, directio on, physical disk, 100.00 MB, Free: 0.00 MB                                                                                                                            2               0               3             0           51199
(9 rows affected)
(return status = 0)
1>

Leave a Reply

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Esse site utiliza o Akismet para reduzir spam. Aprenda como seus dados de comentários são processados.