Saturday, August 12, 2023

Oracle RDBMS: Perform an Online Incremental level 0 backup

In this blog we will see how to perform an online incremental level 0 backup


1) Ensure to collect minimum information on what our target for this operation

DB Version: 12.2.0.1
DB name: GGSRC03T
DB size: 1551 MB
Mountpath: /oraarch [this is the default path, since I have my db_recovery_file_dest set to this path]
Usage of encryption walltet or keystore: Yes

Actual output:
[oracle@vcentos79-oracle-ggsrc GGSRC03T]$ sqlplus '/as sysdba'
SQL*Plus: Release 12.2.0.1.0 Production on Sat Aug 12 12:55:02 2023
Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> select name,open_mode from v$database;
NAME      OPEN_MODE
--------- --------------------
GGSRC03T  READ WRITE
SQL> select sum(bytes)/1024/1024 from dba_data_files;
SUM(BYTES)/1024/1024
--------------------
                1551
SQL> set lines 300
SQL> set pages 3000
SQL> select * from v$encryption_wallet;
WRL_TYPE
--------------------
WRL_PARAMETER
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------    -----------------------------------------------------------------------------------------------------------------------------------
STATUS                         WALLET_TYPE          WALLET_OR FULLY_BAC     CON_ID
------------------------------ -------------------- --------- --------- ----------
FILE
/u01/app/oracle/admin/GGSRC03T/wallet/
OPEN                           AUTOLOGIN            SINGLE    YES                0

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     13
Next log sequence to archive   15
Current log sequence           15
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@vcentos79-oracle-ggsrc GGSRC03T]$

1) Frame RMAN incremental backup command

run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level 0 database format '/oraarch/GGSRC03T/DBBackup/rman_lvl0_%d_%U' plus archivelog format '/oraarch/GGSRC03T/DBBackup/rman_arch_%d_%U';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}


2) Verify the syntax of the backup command if this is framed newly

rman checksyntax

>>> Paste the above syntax into rman prompt

Actual output:
[oracle@vcentos79-oracle-ggsrc GGSRC03T]$ rman checksyntax
Recovery Manager: Release 12.2.0.1.0 - Production on Sat Aug 12 12:57:08 2023
Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
RMAN> run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
2> 3> 4> 5> 6> 7> backup as compressed backupset incremental level 0 database format '/oraarch/GGSRC03T/DBBackup/rman_lvl0_%d_%U' plus archivelog format '/oraarch/GGSRC0    3T/DBBackup/rman_arch_%d_%U';
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}8> 9> 10> 11> 12>
The command has no syntax errors
RMAN> exit

Recovery Manager complete.

3) Verify if you have necessary disk space in the candidate mountpoint

df -h /oraarch/GGSRC03T/DBBackup

Actual output:

[oracle@vcentos79-oracle-ggsrc GGSRC03T]$ df -h /oraarch/GGSRC03T/DBBackup/
Filesystem                           Size  Used Avail Use% Mounted on
/dev/mapper/appdata--vg-oraarch--lv  4.0G  963M  3.1G  24% /oraarch
[oracle@vcentos79-oracle-ggsrc GGSRC03T]$

4) Perform the backup

Copy/paste the command in RMAN command prompt

Good Practise: Put it in script file and launch in background. I am doing this in foreground, since my db is small.

Actual output:

[oracle@vcentos79-oracle-ggsrc GGSRC03T]$ rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Sat Aug 12 12:58:11 2023
Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
connected to target database: GGSRC03T (DBID=3898417486)
RMAN> run
{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
allocate channel c3 device type disk;
allocate channel c4 device type disk;
backup as compressed backupset incremental level 0 database format '/oraarch/GGSRC03T/DBBackup/rman_lvl0_%d_%U' plus archivelog format '/oraarch/GGSRC03T/DBBackup/rman_a    rch_%d_%U';
release channel c1;
2> 3> 4> 5> 6> 7> 8> 9> release channel c2;
release channel c3;
release channel c4;
}10> 11> 12>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=56 device type=DISK
...
Starting backup at 12-AUG-23
current log archived
channel c1: starting compressed archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=6 RECID=5 STAMP=1144099002
input archived log thread=1 sequence=7 RECID=6 STAMP=1144099006
input archived log thread=1 sequence=8 RECID=7 STAMP=1144668770
...
piece handle=/oraarch/GGSRC03T/DBBackup/rman_arch_GGSRC03T_0j23klk1_1_1 tag=TAG20230812T125841 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:08
channel c3: finished piece 1 at 12-AUG-23
...
Finished backup at 12-AUG-23
Starting backup at 12-AUG-23
channel c1: starting compressed incremental level 0 datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/GGSRC03T/datafile/o1_mf_system_ldwzp14y_.dbf
input datafile file number=00005 name=/oradata/GGSRC03T/datafile/o1_mf_encrypt__ldx2d7bg_.dbf
...
piece handle=/oraarch/GGSRC03T/DBBackup/rman_lvl0_GGSRC03T_0m23klkh_1_1 tag=TAG20230812T125857 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:55
Finished backup at 12-AUG-23
Starting backup at 12-AUG-23
current log archived
...
piece handle=/oraarch/GGSRC03T/DBBackup/rman_arch_GGSRC03T_0p23klm8_1_1 tag=TAG20230812T125952 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 12-AUG-23
Starting Control File and SPFILE Autobackup at 12-AUG-23
piece handle=/oraarch/GGSRC03T/autobackup/2023_08_12/o1_mf_s_1144673994_lfgx1t9l_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 12-AUG-23
released channel: c1
...
released channel: c4
RMAN> exit

Recovery Manager complete.
[oracle@vcentos79-oracle-ggsrc GGSRC03T]$

5) Verify the logfile of the backup

Copy above rman output to the logfile...
[oracle@vcentos79-oracle-ggsrc dba]$ vi rman_lvl0_backup_12aug23.log
[oracle@vcentos79-oracle-ggsrc dba]$ grep -Ei "RMAN-|ORA-" rman_lvl0_backup_12aug23.log

5) Backup key store

Example:
ADMINISTER KEY MANAGEMENT BACKUP KEYSTORE 
USING 'hr.emp_keystore' 
FORCE KEYSTORE 
IDENTIFIED BY software_keystore_password
TO '/etc/ORACLE/KEYSTORE/DB1/';

Actual: the backup command will append the timestamp, so we just need to append the keyword to it for us to identify the tde backup


ADMINISTER KEY MANAGEMENT BACKUP KEYSTORE 
USING 'rman_lvl0_tde_bkp' 
FORCE KEYSTORE 
IDENTIFIED BY "oracle"
TO '/oraarch/GGSRC03T/TDEBackup/';
Actual command:
SQL> ADMINISTER KEY MANAGEMENT BACKUP KEYSTORE
USING 'rman_lvl0_tde_bkp'
FORCE KEYSTORE
IDENTIFIED BY "oracle"
TO '/oraarch/GGSRC03T/TDEBackup/';  2    3    4    5
keystore altered.


6) Verify the key existance

ls -altr /oraarch/GGSRC03T/TDEBackup/
SQL> !ls -altr /oraarch/GGSRC03T/TDEBackup/
total 8
drwxr-x---. 6 oracle oinstall   75 Aug 12 12:37 ..
-rw-------. 1 oracle oinstall 3848 Aug 12 12:37 ewallet_2023081211374128_rman_lvl0_tde_key_12aug23.p12
-rw-------. 1 oracle oinstall 3848 Aug 12 13:02 ewallet_2023081212021006_rman_lvl0_tde_bkp.p12
drwxr-xr-x. 2 oracle oinstall  122 Aug 12 13:02 .
SQL>

This closes the rman online incremental level 0 backup excercise on a DB with TDE enabled.

Video of the above content:



No comments:

Post a Comment

Troubleshooting the “Cannot Generate SSPI Context” Error After SQL Server Migration

  Introduction After a recent  SQL Server migration from 2012 to 2022 , our team encountered a classic authentication issue: The target prin...