Clonar Banco via Ontape - Informix
Clonar um banco informix usando o utilitário ontape, temos duas instâncias para realizar este teste:
C051 - Produção
C099 - Restaurada
As duas instâncias estão iguais com os dbspaces:
Dbspaces na instância produção
[C051:informix]$/export/home/informix> onstat -d
IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 71 days 23:24:40 -- 1657132 Kbytes
Dbspaces
address number flags fchunk nchunks pgsize flags owner name
54143028 1 0x40001 1 1 2048 N BA informix rootdbs
54143d70 2 0x42001 2 1 2048 N TBA informix tmp1dbs
5427a450 3 0x42001 3 1 2048 N TBA informix tmp2dbs
5427a5f8 4 0x40001 4 1 2048 N BA informix phydbs
5427a7a0 5 0x40001 5 1 16384 N BA informix data
5427a948 6 0x40001 6 1 2048 N BA informix logdbs
6 active, 2047 maximum
Chunks
address chunk/dbs offset size free bpages flags pathname
541431d0 1 1 0 2097152 1439162 PO-B-- /dev/informix/rootdbs
5427aaf0 2 2 0 524288 524235 PO-B-- /dev/informix/tmp1dbs
5427acf0 3 3 0 524288 524235 PO-B-- /dev/informix/tmp2dbs
5622e028 4 4 0 524288 524235 PO-B-- /dev/informix/phydbs
5622e228 5 5 0 1906210 1420859 PO-B-- /dev/informix/datadbs
5622e428 6 6 0 524288 12235 PO-B-- /dev/informix/logdbs
6 active, 32766 maximum
NOTE: The values in the "size" and "free" columns for DBspace chunks are
displayed in terms of "pgsize" of the DBspace to which they belong.
Dbspaces na instância onde vamos restaurar - Tem o mesmo tamanho as dbspace[C099:informix]$/export/home/informix> onstat -d
IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 00:00:31 -- 1127008 Kbytes
Dbspaces
address number flags fchunk nchunks pgsize flags owner name
82fa9028 1 0x60001 1 1 2048 N BA informix rootdbs
830e78e8 2 0x42001 2 1 2048 N TBA informix tmp1dbs
8506f028 3 0x42001 3 1 2048 N TBA informix tmp2dbs
850db850 4 0x60001 4 1 2048 N BA informix phydbs
850db588 5 0x60001 5 1 16384 N BA informix data
850f0c58 6 0x60001 6 1 2048 N BA informix logdbs
6 active, 2047 maximum
Chunks
address chunk/dbs offset size free bpages flags pathname
82fa91d0 1 1 0 2097152 2010361 PO-B-D /dev/informix/rootdbs
830e7a90 2 2 0 524288 524235 PO-B-- /dev/informix/tmp1dbs
8506f1d0 3 3 0 524288 524235 PO-B-- /dev/informix/tmp2dbs
850db9f8 4 4 0 524288 524235 PO-B-D /dev/informix/phydbs
8506b8e0 5 5 0 1906210 1906157 PO-B-D /dev/informix/datadbs
850f1d28 6 6 0 524288 12235 PO-B-D /dev/informix/logdbs
6 active, 32766 maximum
NOTE: The values in the "size" and "free" columns for DBspace chunks are
displayed in terms of "pgsize" of the DBspace to which they belong.
Instancia Restaurada - Criando o arquivo das Variáveis
Na instância restaurada vamos criar o arquivo com as variáveis de ambiente e o comando para restaurar, o nome do arquivo vai ser /export/home/informix/define_C099.txt
# variavies de ambiente da instancia C099 - restaurada
export INFORMIXDIR
INFORMIXSQLHOSTS=/opt/informix64/etc/sqlhosts.teste
export INFORMIXSQLHOSTS
INFORMIXSERVER=teste
export INFORMIXSERVER
ONCONFIG=onconfig.teste
export ONCONFIG
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/opt/informix64/bin
export PATH
# comando do ontape de restauracao stdout/stderr redirection
ontape -p -t STDIO
Instancia Restaurada - Tirando o Banco do Ar
Retirando o banco da instância onde vamos restaurar
[C099:informix]$/export/home/informix> onmode -ky
Instancia Produção - Iniciando o Backup e Restore
Iniciando o backup da C051 e a restauração na C099 - repare que estamos usando o arquivo com as variáveis e criados na C099 - a senha é do usuário informix da C099
[C051:informix]$/export/home/informix> ontape -s -L 0 -t STDIO | ssh informix@C099.ms "/export/home/informix/define_C099.txt"
Password:
Instancia Produção - Terminou o Backup/Restore Ontape
Log do começou e do termino;
[C051:informix]$/export/home/informix> onstat -m | grep Archive
IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 71 days 09:10:35 -- 1657132 Kbytes
05/23/14 18:11:04 Level 0 Archive started on rootdbs, phydbs, data, logdbs
05/23/14 18:15:52 Archive on rootdbs, phydbs, data, logdbs Completed.
[C051:informix]$/export/home/informix>
Instancia Restaurada - Checando o Restore
O banco deve ficar em modo Fast Recovery
[C099:informix]$/export/home/informix> onstat -
IBM Informix Dynamic Server Version 11.70.FC2 -- Fast Recovery -- Up 00:05:15 -- 1127008 Kbytes
Instancia Restaurada - Colocando a Instância Online
Colocando online
[C099:informix]$/export/home/informix> onmode -m
[C099:informix]$/export/home/informix> onstat -m
IBM Informix Dynamic Server Version 11.70.FC2 -- Fast Recovery -- Up 00:05:09 -- 1127008 Kbytes
Depois de alguns segundos ficou online[C099:informix]$/export/home/informix> onstat -
IBM Informix Dynamic Server Version 11.70.FC2 -- On-Line -- Up 00:09:52 -- 1127008 Kbytes
Instancia Restaurada - Log da Restore Ontape
Inicio da restauração o banco entra em fast recovery, no fim quando acabou o restauração o banco encontreu online (onmode -m)
18:15:54 Physical Restore of rootdbs, phydbs, data, logdbs Completed.
18:15:54 Checkpoint Completed: duration was 0 seconds.
18:15:54 Fri May 23 - loguniq 455, logpos 0x8dfb678, timestamp: 0x57a5c0cf Interval: 526
18:15:54 Maximum server connections 0
18:16:24 No logical log restore will be performed.
18:16:24 Clearing the physical and logical logs has started
18:16:36 Cleared 2178 MB of the physical and logical logs in 11 seconds
18:16:36 Physical Recovery Started at Page (1:106615).
18:16:36 Physical Recovery Complete: 0 Pages Examined, 0 Pages Restored.
18:16:36 Logical Recovery Started.
18:16:36 5 recovery worker threads will be started.
18:16:36 Logical Recovery has reached the transaction cleanup phase.
18:16:36 Logical Recovery Complete.
0 Committed, 0 Rolled Back, 0 Open, 0 Bad Locks
18:16:37 Bringing system to On-Line Mode with no Logical Restore.
18:16:38 On-Line Mode
Instancia Restaurada - Checando Tabelas
Checando algumas tabelas;
[C099:informix]$/export/home/informix> echo "select count(*) from contribuinte;" | dbaccess fronteiras
Database selected.
(count(*))
429671
1 row(s) retrieved.
Database closed.
Checando outra tabela;[C099:informix]$/export/home/informix> echo "select count(*) from nfe_eletronica;" | dbaccess nfeletronica
Database selected.
(count(*))
435248
1 row(s) retrieved.
Database closed
0 comentários:
Enviar um comentário