Restaurando uma Tabelas pelo ARCHECKER no Informix
Vamos restaurar uma tabela de um backup ontape (dá para restaurar de um onbar), primeiro vamos fazer um backup da instancia;
[s357:informix]$/export/home/informix> ontape -s -L 0
10 percent done.
20 percent done.
30 percent done.
40 percent done.
100 percent done.
File created: /export/home/informix/backup_banco/s357.ms_97_L0
Please label this tape as number 1 in the arc tape sequence.
This tape contains the following logical logs:
242
Program over.
[s357:informix]$/export/home/informix>
No banco fronteiras (instancia teste) vamos pegar esta tabela para restaurar
INFO - 'dba'.cep: Columns Indexes Privileges References Status cOnstraints triGgers Table Fragments Exit
Display status information for a table.
----------------------- fronteiras@teste ------- Press CTRL-W for Help --------
Table Name cep
Owner dba
Row Size 72
Number of Rows 576989
Number of Columns 4
Date Created 05/03/2012
Vamos simular um truncate (por engano) nesta tabela
SQL: New Run Modify Use-editor Output Choose Save Info Drop Exit
Run the current SQL statements.
----------------------- fronteiras@teste ------- Press CTRL-W for Help
truncate table cep
Ficou sem registros - vamos restaurar
INFO - 'dba'.cep: Columns Indexes Privileges References Status cOnstraints triGgers Table Fragments Exit
Display status information for a table.
----------------------- fronteiras@teste ------- Press CTRL-W for Help --------
Table Name cep
Owner dba
Row Size 72
Number of Rows 0
Number of Columns 4
Date Created 05/03/2012
Vamos pegar o esquema dessa tabela
dbschema -d fronteiras -t cep
Anote pois você vai precisarcreate table "dba".cep
(
cep_numero char(8) not null ,
mun_nome varchar(60,1) not null ,
ufe_codigo char(2) not null ,
cep_situacao char(1),
primary key (cep_numero)
);
Vamos criar um arquivo chamado restore_cep.sql e colocar as definições dessa tabela - para poder rodar o archecker vi restore_cep.sql
chmod 777 restore_cep.sql
Arquivo ficou assimdatabase fronteiras;
--
-- Tabela que vou restarar
--
CREATE TABLE 'dba'.cep
(
cep_numero char(8) not null ,
mun_nome varchar(60,1) not null ,
ufe_codigo char(2) not null ,
cep_situacao char(1),
primary key (cep_numero)
);
INSERT INTO cep SELECT * FROM cep;
restore to current with no log ;
Vou dar o comando para limpar o diretório AC_STORAGE e apagar as tabelas sysutils:acu_* (esta é 3 vez que rodo hoje o archecker para documentar) archecker -DX
Rodando a restauração de uma tabela[s357:informix]$/export/home/informix> archecker -tvdsX -l phys -f restore_cep.sql
IBM Informix Dynamic Server Version 11.70.FC2
Program Name: archecker
Version: 8.0
Released: 2011-03-15 22:07:51
CSDK: IBM Informix CSDK Version 3.50
ESQL: IBM Informix-ESQL Version 3.50.FN672
Compiled: 03/15/11 22:08 on Linux 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008
AC_STORAGE /tmp
AC_MSGPATH /tmp/ac_msg.log
AC_VERBOSE on
AC_TAPEDEV /export/home/informix/backup_banco/
AC_TAPEBLOCK 32 KB
AC_LTAPEDEV /dev/null
AC_LTAPEBLOCK 32 KB
Dropping old log control tables
Command line is overriding command file RESTORE option
Extracting table fronteiras:cep into fronteiras:cep
Archive file /export/home/informix/backup_banco/s357.ms_97_L0
Tape type: Archive Backup Tape
OnLine version: IBM Informix Dynamic Server Version 11.70.FC2
Archive date: Thu Mar 29 10:39:22 2012
Archive level: 0
Tape blocksize: 32768
Tape size: 2147483647
Tape number in series: 1
.............................
Scan PASSED
Control page checks PASSED
Table checks PASSED
Table extraction commands 1
Tables found on archive 1
LOADED: fronteiras:cep produced 576989 rows.
Oldest logid needed for logical restore: 242
Depois que terminou fui observar a tabela e ela foi restauradaINFO - 'dba'.cep: Columns Indexes Privileges References Status cOnstraints triGgers Table Fragments Exit
Display status information for a table.
----------------------- fronteiras@teste ------- Press CTRL-W for Help --------
Table Name cep
Owner dba
Row Size 80
Number of Rows 576989
Number of Columns 6
Date Created 29/03/2012
0 comentários:
Enviar um comentário