Saturday, June 9, 2018

How to do the backup on the ZDLRA without backup module ?

The documentation say we need to download the backup module from http://www.oracle.com/technetwork/database/availability/oracle-zdlra-backup-module-2279224.html :

https://docs.oracle.com/cd/E88198_01/AMPDB/config_pdb.htm#AMPDB944

Backup module require java on database server. And the first question appeared when our client said: "we have no java on our IBM AIX". For this client we found a solution taking the java from ORACLE_HOME/OPatch. ORACLE_HOME has many javas (find /u01 -name java) and we proved in practice that java 8 from ORACLE_HOME well suite to install backup module.



The backup module ra_install.jar make 3 things:
- download fresh libra.so from internet and put it to $OH/lib
- make config file
- make wallet

The libra.so:
As you may know the libra.so reside in $OH/lib from 12.1 version. So, if you have at least 12.1 then you don't need to copy libra.so. If you'd like to take fresh copy you may download this file from Oracle and manually copy to $OH/lib. Look note 2219812.1 ZDLRA: Where to download new sbt library (libra.so module)


The config file
you may use or may not use this file (i ommit it in my configuration).
Look how to use it in ALLOCATE CHANNEL clause:

Two syntax of ALLOCATE CHANNEL(two working examples). The first line contain config file, but 2nd line not. I highlighted differences in bold:



allocate CHANNEL ch1 DEVICE TYPE 'SBT_TAPE' 
PARMS 'SBT_LIBRARY=/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libra.so, 
SBT_PARMS=(RA_CLIENT_CONFIG_FILE=/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/radb11204.ora)' 
;
 

ALLOCATE CHANNEL ch1 DEVICE TYPE  sbt_tape  
PARMS='SBT_LIBRARY=/u01/app/oracle/product/12.2.0.1/dbhome_1/lib/libra.so, 
ENV=(RA_WALLET=LOCATION=file:/u01/app/oracle/product/12.2.0.1/dbhome_1/dbs/ra_wallet/ CREDENTIAL_ALIAS=z01ingest-scan:1521/zdlra:dedicated)
;



The wallet:
And finally we need to create the wallet. Example:

$ mkdir $ORACLE_HOME/dbs/zdlra  
$ mkstore -wrl /u01/app/oracle/product/12.2.0/dbhome_1/dbs/zdlra -create   
$ mkstore -wrl /u01/app/oracle/product/12.2.0/dbhome_1/dbs/zdlra -createCredential "zdlra" "fd" "welcome1"

zdlra - is connect descriptor in tnsnames.ora
fd - is owner of virtual catalog, created with racli
welcome1 - is password to virtual catalog

Check the credentials in the wallet:

$ mkstore -wrl /u01/app/oracle/product/12.2.0/dbhome_1/dbs/zdlra -listCredential
Oracle Secret Store Tool : Version 12.2.0.1.0


Enter wallet password: 
List credential (index: connect_string username)
1: zdlra fd

The screenshot how i did it:



Next step is to add some lines in sqlnet.ora to point to wallet:

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SQLNET.WALLET_OVERRIDE = true
WALLET_LOCATION=
(SOURCE=(METHOD=file)
 (METHOD_DATA=
  (DIRECTORY=/u01/app/oracle/product/12.2.0/dbhome_1/dbs/zdlra)
 )
)


And we're ready to backup our database to ZDLRA:

RUN  {
ALLOCATE CHANNEL ch01 DEVICE TYPE sbt_tape PARMS='SBT_LIBRARY=/u01/app/oracle/product/12.2.0/dbhome_1/lib/libra.so,
ENV=(RA_WALLET=LOCATION=file:/u01/app/oracle/product/12.2.0/dbhome_1/dbs/zdlra CREDENTIAL_ALIAS=zdlra)'
FORMAT '%I_%T_%p_%u_%c';
backup incremental level 1 database tag 'B_FD';
plus archivelog tag 'A_$OWNER' delete all input;
}







Summary: 
In order to do the backup on ZDLRA you have to create the wallet. This is the only obligatory step if your database is of version 12.1 or higher. You may to refresh $OH/lib/libra.so but this is optional
If your database is of version 11.2 or lower, then you need to download and put the libra.so into $OH/lib directory.

Wednesday, June 6, 2018

RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process

In processof the backup archived log to ZDLRA we got a message:
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process


The backup of datafiles is run successfully, but archived logs got a stuck:


Starting backup at 2018-JUN-06 17:28:14
current log archived
channel ch01: starting archived log backup set
channel ch01: specifying archived log(s) in backup set
input archived log thread=1 sequence=850 RECID=791 STAMP=978108063
input archived log thread=1 sequence=851 RECID=792 STAMP=978108142
input archived log thread=1 sequence=852 RECID=793 STAMP=978108145
input archived log thread=1 sequence=853 RECID=794 STAMP=978109461
channel ch01: starting piece 1 at 2018-JUN-06 17:28:17
channel ch01: finished piece 1 at 2018-JUN-06 17:28:24
piece handle=4136710722_20180606_1_13t4pidh_1 tag=A_FD comment=API Version 2.0,MMS Version 12.2.0.1
channel ch01: backup set complete, elapsed time: 00:00:07
channel ch01: deleting archived log(s)
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_850_fkhs3gvz_.arc thread=1 sequence=850
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_851_fkhs5y1c_.arc thread=1 sequence=851
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_852_fkhs61cw_.arc thread=1 sequence=852
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_853_fkhth5dm_.arc thread=1 sequence=853
Finished backup at 2018-JUN-06 17:28:25


The workaround is:

SQL> alter system set log_archive_dest_state_3='DEFER' scope=both sid='*';

System altered.

And you'll have:

Starting backup at 2018-JUN-06 17:34:26
current log archived
channel ch01: starting archived log backup set
channel ch01: specifying archived log(s) in backup set
input archived log thread=1 sequence=850 RECID=791 STAMP=978108063
input archived log thread=1 sequence=851 RECID=792 STAMP=978108142
input archived log thread=1 sequence=852 RECID=793 STAMP=978108145
input archived log thread=1 sequence=853 RECID=794 STAMP=978109461
channel ch01: starting piece 1 at 2018-JUN-06 17:34:28
channel ch01: finished piece 1 at 2018-JUN-06 17:34:35
piece handle=4136710722_20180606_1_17t4pip4_1 tag=A_FD comment=API Version 2.0,MMS Version 12.2.0.1
channel ch01: backup set complete, elapsed time: 00:00:07
channel ch01: deleting archived log(s)
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_850_fkhs3gvz_.arc RECID=791 STAMP=978108063
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_851_fkhs5y1c_.arc RECID=792 STAMP=978108142
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_852_fkhs61cw_.arc RECID=793 STAMP=978108145
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_853_fkhth5dm_.arc RECID=794 STAMP=978109461
Finished backup at 2018-JUN-06 17:34:36



But if you return your setting back:

SQL> alter system set log_archive_dest_state_3='enable' scope=both sid='*';

System altered.

The problem appears:

Starting backup at 2018-JUN-06 17:35:41
current log archived
channel ch01: starting archived log backup set
channel ch01: specifying archived log(s) in backup set
input archived log thread=1 sequence=860 RECID=801 STAMP=978111311
input archived log thread=1 sequence=861 RECID=802 STAMP=978111341
channel ch01: starting piece 1 at 2018-JUN-06 17:35:42
channel ch01: finished piece 1 at 2018-JUN-06 17:35:43
piece handle=4136710722_20180606_1_1bt4pire_1 tag=A_FD comment=API Version 2.0,MMS Version 12.2.0.1
channel ch01: backup set complete, elapsed time: 00:00:01
channel ch01: deleting archived log(s)
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_860_fkhw8zos_.arc thread=1 sequence=860
RMAN-08137: WARNING: archived log not deleted, needed for standby or upstream capture process
archived log file name=/oradata/fra/O11203/archivelog/2018_06_06/o1_mf_1_861_fkhw9xjo_.arc thread=1 sequence=861
Finished backup at 2018-JUN-06 17:35:44


# ocrconfig -add +DATA PROT-30: The Oracle Cluster Registry location to be added is not usable. PROC-50: The Oracle Cluster Registry locatio...