quarta-feira, outubro 21, 2015

NATUNLD / NATLOAD - Backup e Restore de Programas Natural

O utilitário NATUNLD/NATLOAD faz backup/restaura programas Natural armazenados na (FUSER), Na FUSER estão todos os programa que os usuários criaram, o banco de dados Adabas tem um utilitário chamado ADASAV que faz backup de todos os arquivos do banco, imagina uma situação de um desenvolvedor excluiu um programa Natural muito importante sem querer, se for restaurar o file (FUSER) usando o ADASAV você vai restaurar este programa especifico mais quem tiver feito uma alteração (ou criou novos programa) vão perder pois a restauração volta na situação que estava no momento do backup, usando o NATUNLD/NATLOAD você consegue fazer backup de uma determinada biblioteca e na hora que precisar restaurar você pode restaurar toda a biblioteca ou somente um programa especifico isso sem afetar programas que não estavam no momento do backup.

NATUNLD - Backup dos Programas Natural

Rodando um Backup;
MEMBER=@LAS8    000012 REC SAVE:13.10.2015 18:25 BY   USERID 9981055  R=00000001
DSN=ADABAS.DBA.JCLS                                LIB=S3 VOL=PRL303 UNIT=1126
....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
//AAFSNATB JOB (AAFS,DIBD),CLAU,CLASS=S,MSGCLASS=A TYPRUN=HOLD
//*UQ ALLOW
//* ----------------------------------------------------------------
//*                BACKUP DE TODA BIBLIOTECA FONTES
//* ----------------------------------------------------------------
//* CAT * --> SALVA OS OBJETOS
//* SA  * --> SALVA OS FONTES
//* ----------------------------------------------------------------
//UNLD1   EXEC NATPR,
//    PARM1='MT=0,SYS=W,MADIO=0,IM=D,INTENS=1,MAXCL=0,OBJIN=N',
//    PARM2='STACK=(LOGON SYSTEM)'
//* ---------------------------------------------------------------
//CMWKF01 DD DSN=AAF.C.OBJECTS.FONTES.DB010,
//        DISP=(NEW,KEEP),UNIT=CVRT,LABEL=(1,SL)
//SYSIN   DD *
NATUNLD SA * FROM FONTES WITH TYPE *
FIN
/*

Resultado do backup NATUNLD
 DATA SA * FROM FONTES WITH TYPE *
117:08:06              ***** NATURAL NATUNLD UTILITY *****            2015-10-21
 User AAFSNATB            - Unload Programming Objects -
0Object   Object      Src Vers. Target    Source     Date and Time       User ID
 Name     Type        Cat Level Library   DBID/FNR   of Save or Cat
 -------- ----------- --- ----- -------- ----------- ------------------- -------
 NOVP0DKX Program     Src 2.2.8 FONTES     010/15    1999-08-23 08:24:15 9988567
 NOVP00DJ Program     Src 2.2.8 FONTES     010/15    1999-08-23 19:51:59 9988567
 NOVP00DK Program     Src 2.2.8 FONTES     010/15    1999-09-14 17:58:07 9988567
 NOVPBK04 Program     Src 3.1.5 FONTES     010/15    2004-03-05 08:58:23 9988560
 NOVPDATX Program     Src 2.2.6 FONTES     010/15    1996-09-13 16:48:13 9988400
 NOVPXXXX Program     Src 2.2.8 FONTES     010/15    2000-04-07 09:35:10 9988401
 NOVM905B Map         Src 3.1.5 FONTES     010/15    2004-09-24 14:23:01 9988432
 NOVM906B Map         Src 2.2.8 FONTES     010/15    2003-04-10 21:53:27 9988432
 NOVPRV20 Program     Src 2.2.8 FONTES     010/15    2001-07-30 08:43:55 9988169
 NOVP906B Program     Src 3.1.5 FONTES     010/15    2004-09-24 14:24:51 9988432
 NOVP999B Program     Src 2.2.8 FONTES     010/15    2003-04-10 21:53:51 9988432
 NOVMHELP Map         Src 2.2.8 FONTES     010/15    2000-10-17 10:17:28 9988279
 NOVMHEL1 Map         Src 2.2.8 FONTES     010/15    2000-10-17 10:20:21 9988279
 NOVM001A Map         Src 2.2.8 FONTES     010/15    2000-10-17 10:02:01 9988279
 NOVPHELP Program     Src 2.2.8 FONTES     010/15    2000-09-20 09:40:56 9988279
--------------------------------------------------------------------------------
OP=S CL=ALL IN=ALL JB=AAFSNATB,06317 DS=1 SI=SO LR=10 LL=80 PP=0 DC=
RL=999999 AD=J DE= SC= PT= SQ=C RR=0 OC= SD=2000


Excluindo um Programa Natural

Vamos excluir um programa da biblioteca FONTES para simular a restauração usando o NATLOAD
 17:28:41               ***** NATURAL LIST COMMAND *****              21/10/2015
 User 9981055             - LIST Objects in a Library -         Library FONTES

 Cmd  Name       Type         S/C  SM Version  User ID    Date        Time
 ---  *________  *__________  *__  *  *______  *________  *__________ *________
 DE   NOVP0DKX   Program      S    R  2.2.08   9988567    1999-08-23  08:24:15
 __   NOVP00DJ   Program      S    R  2.2.08   9988567    1999-08-23  19:51:59
 __   NOVP00DK   Program      S    R  2.2.08   9988567    1999-09-14  17:58:07
 __   NOVPBK04   Program      S    R  3.1.05   9988560    2004-03-05  08:58:23
 __   NOVPDATX   Program      S    R  2.2.06   9988400    1996-09-13  16:48:13
 __   NOVPXXXX   Program      S    R  2.2.08   9988401    2000-04-07  09:35:10
 __   NOVM905B   Map          S    R  3.1.05   9988432    2004-09-24  14:23:01
 __   NOVM906B   Map          S    S  2.2.08   9988432    2003-04-10  21:53:27
 __   NOVPRV20   Program      S    S  2.2.08   9988169    2001-07-30  08:43:55
 __   NOVP906B   Program      S    S  3.1.05   9988432    2004-09-24  14:24:51
 __   NOVP999B   Program      S    S  2.2.08   9988432    2003-04-10  21:53:51
 __   NOVMHELP   Map          S    S  2.2.08   9988279    2000-10-17  10:17:28
 __   NOVMHEL1   Map          S    S  2.2.08   9988279    2000-10-17  10:20:21
 __   NOVM001A   Map          S    S  2.2.08   9988279    2000-10-17  10:02:01
                                                               14 Objects found
 Top of List.
 Command ===>
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Print Exit  Sort        --    -     +     ++          >     Canc

Confirmando para deletar;
 17:30:36               ***** NATURAL LIST COMMAND *****              21/10/2015
 User 9981055             - LIST Objects in a Library -         Library FONTES

 Cmd  Name       Type         S/C  SM Version  User ID    Date        Time
 ---  *________  *__________  *__  *  *______  *________  *__________ *________
 DE   NOVP0DKX   Pr+----------------DELETE----------------+999-08-23  08:24:15
 __   NOVP00DJ   Pr|                                      |999-08-23  19:51:59
 __   NOVP00DK   Pr|     Please select one item:          |999-09-14  17:58:07
 __   NOVPBK04   Pr|                                      |004-03-05  08:58:23
 __   NOVPDATX   Pr|     _  Confirm each deletion         |996-09-13  16:48:13
 __   NOVPXXXX   Pr|     X  Delete without confirmation   |000-04-07  09:35:10
 __   NOVM905B   Ma|     _  Exit (no deletion)            |004-09-24  14:23:01
 __   NOVM906B   Ma|                                      |003-04-10  21:53:27
 __   NOVPRV20   Pr+--------------------------------------+001-07-30  08:43:55
 __   NOVP906B   Program      S    S  3.1.05   9988432    2004-09-24  14:24:51
 __   NOVP999B   Program      S    S  2.2.08   9988432    2003-04-10  21:53:51
 __   NOVMHELP   Map          S    S  2.2.08   9988279    2000-10-17  10:17:28
 __   NOVMHEL1   Map          S    S  2.2.08   9988279    2000-10-17  10:20:21
 __   NOVM001A   Map          S    S  2.2.08   9988279    2000-10-17  10:02:01
                                                               14 Objects found

 Command ===>
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Print Exit  Sort        --    -     +     ++          >     Canc

O programa foi deletado;
 17:32:15               ***** NATURAL LIST COMMAND *****              21/10/2015
 User 9981055             - LIST Objects in a Library -         Library FONTES

 Cmd  Name       Type         S/C  SM Version  User ID    Date        Time
 ---  *________  *__________  *__  *  *______  *________  *__________ *________
 __   NOVP00DJ   Program      S    R  2.2.08   9988567    1999-08-23  19:51:59
 __   NOVP00DK   Program      S    R  2.2.08   9988567    1999-09-14  17:58:07
 __   NOVPBK04   Program      S    R  3.1.05   9988560    2004-03-05  08:58:23
 __   NOVPDATX   Program      S    R  2.2.06   9988400    1996-09-13  16:48:13
 __   NOVPXXXX   Program      S    R  2.2.08   9988401    2000-04-07  09:35:10
 __   NOVM905B   Map          S    R  3.1.05   9988432    2004-09-24  14:23:01
 __   NOVM906B   Map          S    S  2.2.08   9988432    2003-04-10  21:53:27
 __   NOVPRV20   Program      S    S  2.2.08   9988169    2001-07-30  08:43:55
 __   NOVP906B   Program      S    S  3.1.05   9988432    2004-09-24  14:24:51
 __   NOVP999B   Program      S    S  2.2.08   9988432    2003-04-10  21:53:51
 __   NOVMHELP   Map          S    S  2.2.08   9988279    2000-10-17  10:17:28
 __   NOVMHEL1   Map          S    S  2.2.08   9988279    2000-10-17  10:20:21
 __   NOVM001A   Map          S    S  2.2.08   9988279    2000-10-17  10:02:01
 __   NOVpHELP   Program      S    S  2.2.08   9988279    2000-09-20  09:40:55
                                                               14 Objects found
 Top of List.
 Command ===>
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Print Exit  Sort        --    -     +     ++          >     Canc

Para ter certeza vamos pesquisar o programa;
 17:34:16                    *****  NATURAL  *****                    21/10/2015
 User 9981055                    - Main Menu -                Library FONTES


                    Function

                 _  Development Functions
                 _  Development Environment Settings
                 _  Maintenance and Transfer Utilities
                 _  Debugging and Monitoring Utilities
                 _  Example Libraries
                 _  Other Products
                 _  Help
                 _  Exit Natural Session







 Command ===> L * NOVP0DKX
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help        Exit                                                  Canc

Não existe na biblioteca FONTES este programa;
 MORE
 Source NOVP0DKX not found in current library.

NATLOAD - Restaurando o Programa

Restaurando um programa Natural que excluimos;
//AAFSNATB JOB (AAFS,OSB),DBA,CLASS=S,MSGCLASS=A TIME=1440
//*UQ ALLOW
//* ----------------------------------------------------------
//*        RESTAURA PROGRAMA NATURAL DELETADO
//* ----------------------------------------------------------
//BUSCA   EXEC NATURAL,
//    PARM1='MT=0,SYS=W,MADIO=0,IM=D,INTENS=1,MAXCL=0,OBJIN=N'
//* ----------------------------------------------------------
//CMWKF01 DD DSN=AAF.C.OBJECTS.FONTES.DB010,DISP=OLD,
//           UNIT=CVRT,VOL=SER=VC1353,LABEL=(1,SL)
//* ----------------------------------------------------------
//SYSIN   DD *
NATLOAD SAVED|NOVP0DKX|FM|FONTES|REP
/*

Restaurou
1Logon accepted to library SUPPORT.
1NEXT NATLOAD SAVED|NOVP0DKX|FM|FONTES|REP
117:40:48              ***** NATURAL NATLOAD UTILITY *****            2015-10-21
 User AAFSNATB             - Load Programming Objects -
0             Processing Load File created on 2015-10-21 at 17:08
-             System files used for NATLOAD:    FNAT ....   010/8
                                                FUSER ...   010/15
                                                FDIC ....   010/11
                                                FSEC ....   010/9
117:40:48              ***** NATURAL NATLOAD UTILITY *****            2015-10-21
 User AAFSNATB             - Load Programming Objects -
0Target   Object   Object      Src   Date and Time      Target     Action
 Library  Name     Type        Cat   of Save or Cat     DBID/FNR
 -------- -------- ----------- --- ------------------- ----------- -------------
 FONTES   NOVP0DKX Program     Src 1999-08-23 08:24:15   010/15    Loaded
117:41:31              ***** NATURAL NATLOAD UTILITY *****            2015-10-21
 User AAFSNATB             - Load Programming Objects -
                     Statistical Report of Objects Processed
0                                          Saved     Cataloged
              Programs ...............           1           0
              Total programming obj ..           1           0
0             ------------------------  ----------------------
0             Total objects processed ...           1
              Total objects deleted .....           0
0             Total records processed ...     8222287
0                    Parameters used for processing:
 Function .......... L                  Object ............ N
 Number ............ 0
 Object Name ....... NOVP0DKX           DBID/FNR ..........      0 / 0
 Library ........... FONTES             New Library ....... *
 Object Type ....... *                  XREF .............. S
 S/C-Type .......... S                  User ID ........... *
 Date-Time from ....                    Date-Time to ......
0Allow delete ...... N                  Load Except ....... N
 Replace ........... Y                  Check Date ........ N
0               *** Utility has been terminated normally   ***
1NAT9995 Natural session terminated normally.
UQS0009 - END OF DATA SET.




--------------------------------------------------------------------------------
OP=S CL=ALL IN=ALL JB=AAFSNATB,06357 DS=1 SI=SO LR=22 LL=80 PP=0 DC=
RL=999999 AD=J DE= SC= PT= SQ=C RR=0 OC= SD=2000

Feito foi restaurado o NOVP0DKX
 17:46:11               ***** NATURAL LIST COMMAND *****              21/10/2015
 User 9981055             - LIST Objects in a Library -         Library FONTES

 Cmd  Name       Type         S/C  SM Version  User ID    Date        Time
 ---  NOVP0DKX>  *__________  *__  *  *______  *________  *__________ *________
 __   NOVP0DKX   Program      S    R  2.2.08   9988567    1999-08-23  08:24:15
 __   NOVP00DJ   Program      S    R  2.2.08   9988567    1999-08-23  19:51:59
 __   NOVP00DK   Program      S    R  2.2.08   9988567    1999-09-14  17:58:07
 __   NOVPBK04   Program      S    R  3.1.05   9988560    2004-03-05  08:58:23
 __   NOVPDATX   Program      S    R  2.2.06   9988400    1996-09-13  16:48:13
 __   NOVPXXXX   Program      S    R  2.2.08   9988401    2000-04-07  09:35:10
 __   NOVM905B   Map          S    R  3.1.05   9988432    2004-09-24  14:23:01
 __   NOVM906B   Map          S    S  2.2.08   9988432    2003-04-10  21:53:27
 __   NOVPRV20   Program      S    S  2.2.08   9988169    2001-07-30  08:43:55
 __   NOVP906B   Program      S    S  3.1.05   9988432    2004-09-24  14:24:51
 __   NOVP999B   Program      S    S  2.2.08   9988432    2003-04-10  21:53:51
 __   NOVMHELP   Map          S    S  2.2.08   9988279    2000-10-17  10:17:28
 __   NOVMHEL1   Map          S    S  2.2.08   9988279    2000-10-17  10:20:21
 __   NOVM001A   Map          S    S  2.2.08   9988279    2000-10-17  10:02:01
                                                               14 Objects found
 Top of List.
 Command ===>
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Print Exit  Sort        --    -     +     ++          >     Canc

Observações

Neste exemplo foi usado esses dois comandos
NATUNLD SA * FROM FONTES WITH TYPE *
NATLOAD SAVED|NOVP0DKX|FM|FONTES|REP
Copiei e restarei o objeto fonte do Natural (S), para salvar somente objetos copilados tem a opção (C), para salvar objetos catalogados/fontes a opção é (W), para mais detalhes veja abaixo;
A - Unload All/Individual Objects
S - Unload only Saved Objects
C - Unload only Cataloged Objects
W - Unload Saved and Cataloged Objects
B - Unload Stowed Objects

0 comentários:

Enviar um comentário