Document Type | Technical Information
Category | Backup/Recovery
Applicable Product Version | 7FS02PS
Document Number | TBATI006
Overview
This guide explains how to perform the backup/recovery manager tbrmgr backup/recovery provided by Tibero using the SYSBACKUP account, which is an account with all permissions related to backup and recovery for Backup/Recovery purposes.
Method
Check SYSBACKUP's roles and privileges
1. Check Privileges
[tac1] SQL> select * from dba_sys_privs where grantee='SYSBACKUP'; GRANTEE PRIVILEGE ADMIN_OPTION -------------------- ---------------------------------------- ------------ SYSBACKUP ALTER SYSTEM NO SYSBACKUP CREATE SESSION NO SYSBACKUP ALTER SESSION NO SYSBACKUP CREATE TABLESPACE NO SYSBACKUP ALTER TABLESPACE NO SYSBACKUP DROP TABLESPACE NO SYSBACKUP ALTER DATABASE NO SYSBACKUP ALTER RMGR NO 8 rows selected.
2. Check Roles
[tac1] SQL> select * from dba_role_privs where grantee='SYSBACKUP'; GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE -------------------- -------------------- ------------ ------------ SYSBACKUP SELECT_CATALOG_ROLE NO YES 1 row selected.
3. Check Privileges granted to Roles
[tac1] SQL> SELECT GRANTEE, PRIVILEGE FROM DBA_SYS_PRIVS WHERE GRANTEE IN ('SELECT_CATALOG_ROLE');
GRANTEE PRIVILEGE
-------------------- ----------------------------------------
SELECT_CATALOG_ROLE SELECT ANY DICTIONARY
1 row selected.Backup & Recovery using Full Backup
1. Create sample schema and insert sample data
--Create sample Tablespace SQL>create tablespace test01 datafile '+DS0/tac/test01.dtf' size 100M autoextend off;
--Create sample schema SQL>create user test01 identified by test01 default tablespace test01; SQL>grant connect, resource to test01;
--Insert sample data
[tac1] SQL>conn test01/test01
[tac1] SQL>create table t (col number);
[tac1] SQL>BEGIN
FOR I IN 1..1000
LOOP
INSERT INTO t
SELECT LEVEL
FROM dual
CONNECT BY LEVEL <= 10;
END LOOP;
COMMIT;
END;
/--Verify data [tac1] SQL> select count(*) from t; COUNT(*) ---------- 10000 1 row selected.
2. Perform tbrmgr Full Backup
--Check tablespace and datafile [tac1] SQL>col DF_NAME format a40 [tac1] SQL>col TS_NAME format a15 [tac1] SQL>SELECT a.name as DF_NAME, b.name as TS_NAME, a.FILE#, b.TS# FROM v$datafile a JOIN v$tablespace b ON a.TS#=b.TS# ; DF_NAME TS_NAME FILE# TS# ---------------------------------------- --------------- ---------- ---------- +DS0/tac/system01/system01.dtf SYSTEM 0 0 +DS0/tac/system01/undo0_01.dtf UNDO0 1 1 +DS0/tac/system01/usr01.dtf USR 2 3 +DS0/tac/system01/tpr01.dtf SYSSUB 3 4 +DS0/tac/system02/undo1_01.dtf UNDO1 4 5 +DS0/tac/test01.dtf TEST01 5 6 6 rows selected.
--Perform tbrmgr full backup
$ tbrmgr backup --userid sysbackup/tibero@tac1 -o /home/tibero/backup -w
==============================================================================
= Recovery Manager(RMGR) starts =
= =
= TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. =
==============================================================================
archive log check succeeded
RMGR '-o' option used
: backing up to /home/tibero/backup
==============================================================================
RMGR - Backup (FULL)
==============================================================================
Initializing the backup progress, it may take few minutes...
BACKUP (set_id: 1, ts_id: 0, df_id: 0)
100.0% |===============================| 38400/38400 blks 0.00s
Synchronizing...
BACKUP (set_id: 1, ts_id: 1, df_id: 1)
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
BACKUP (set_id: 1, ts_id: 3, df_id: 2)
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
BACKUP (set_id: 1, ts_id: 4, df_id: 3)
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
BACKUP (set_id: 1, ts_id: 5, df_id: 4)
100.0% |===============================| 38400/38400 blks 0.00s
Synchronizing...
BACKUP (set_id: 1, ts_id: 6, df_id: 5)
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
Switching an online logfile...
Backing up archive logfiles...
Archivelog log-tac1-t0-r0-s8.arc (thread: 0, set_id: 1, low_tsn: 198541, next_tsn: 202169) backed up
Archivelog log-tac1-t1-r0-s6.arc (thread: 1, set_id: 1, low_tsn: 198541, next_tsn: 202169) backed up
Archive logfiles backup succeeded
Backing up the control file...
Control file backup succeeded
Database backup succeeded
RMGR backup ends3. Remove tablespace to simulate failure
--In TAS, datafile deletion is not possible while DB is running, so shut down DB $ cmrctl stop db --name tac1 --option immediate $ cmrctl stop db --name tac2 --option immediate
--Connect to TAS and delete test01.dtf data file [15:01]ASCMD +DS0/tac> ls c1.ctl c2.ctl system01/ system02/ archive/ .passwd test01.dtf Number of files found: 7 [15:01]ASCMD +DS0/tac> rm test01.dtf Removing file: +DS0/tac/test01.dtf
4. Perform tbrmgr Recovery
--Start DB and confirm failure $ cmrctl start db --name tac1 BOOT SUCCESS! (MODE : MOUNT) Check sys.log ******************************************************** * Critical Warning : Raise svmode failed. The reason is * TBR-1024 : Database needs media recovery: open failed(+DS0/tac/test01.dtf). * Current server mode is MOUNT. ********************************************************
--Perform tbrmgr recovery
$ tbrmgr recover --userid sysbackup/tibero@tac1 -o /home/tibero/backup -w
==============================================================================
= Recovery Manager(RMGR) starts =
= =
= TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. =
==============================================================================
RMGR '-o' option used
: restoring from /home/tibero/backup
==============================================================================
RMGR - recovery (WITH ARCHIVELOG)
==============================================================================
CM information
===========================================================
CM NAME : cm1
CM UI PORT : 18629
RESOURCE FILE PATH : /cm/cmresource
CM MODE : GUARD ON, FENCE OFF, ROOT ON
LOG LEVEL : 2
CM BLOCK SIZE : 512
===========================================================
Trying to shutdown other instances
=============================== SUCCESS! ===============================
Succeeded to request at the local node to stop the service.
Please use "cmrctl show service" command to verify the result.
=======================================================================
Shutdown succeeded
Shutting down the instance...
tbdown failed. proc info file is deleted.
Hint: Please check if the tbsvr instance was already stopped.
info file is deleted.
unlink failed.: No such file or directory
Control file #0 (+DS0/tac/c1.ctl) is accessible
Control file #1 (+DS0/tac/c2.ctl) is accessible
All control files are accessible. No need to restore the backup control file.
Booting up the instance...
Change core dump dir to /db/tibero7/bin/prof.
Listener port = 8629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (MOUNT mode).
Initializing the restore progress, it may take few minutes...
RMGR begins restoring backup files.
Full backup set_id: 1
Last incremental backup set_id: 1
RESTORE (set_id: 1, ts_id: 0, df_id: 0) - FULL BACKUP
100.0% |===============================| 38400/38400 blks 2.01s
Synchronizing...
RESTORE (set_id: 1, ts_id: 1, df_id: 1) - FULL BACKUP
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
RESTORE (set_id: 1, ts_id: 3, df_id: 2) - FULL BACKUP
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
RESTORE (set_id: 1, ts_id: 4, df_id: 3) - FULL BACKUP
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
RESTORE (set_id: 1, ts_id: 5, df_id: 4) - FULL BACKUP
100.0% |===============================| 38400/38400 blks 1.04s
Synchronizing...
RESTORE (set_id: 1, ts_id: 6, df_id: 5) - FULL BACKUP
100.0% |===============================| 12800/12800 blks 0.00s
Synchronizing...
Settling...
Restoring logfiles...
Archivelog log-tac1-t0-r0-s8.arc (thread: 0, set_id: 1, low_tsn: 198541, next_tsn: 202169) restored
Archivelog log-tac1-t1-r0-s6.arc (thread: 1, set_id: 1, low_tsn: 198541, next_tsn: 202169) restored
Archive logfiles restoration succeeded
Database restoration succeeded
Given recovery point: COMPLETE RECOVERY
Recoverable point using only backup archivelogs: change 202168
recoverSQL: ALTER DATABASE RECOVER AUTOMATIC
Database automatic recovery succeeded
Shutting down the instance...
Tibero instance terminated (NORMAL mode).
Booting up the instance...
Change core dump dir to /db/tibero7/bin/prof.
Listener port = 8629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (NORMAL mode).
RMGR recovery ends
5. Verify Data
--Verify data [tac1] SQL> conn test01/test01 Connected to Tibero. [tac1] SQL> select count(*) from t; COUNT(*) ---------- 10000 1 row selected
Note
This is the method to delete backup sets using tbrmgr.--Delete backup sets using tbrmgr $ tbrmgr delete -b 1 --userid sysbackup/tibero@tac1 ============================================================================== = Recovery Manager(RMGR) starts = = = = TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. = ============================================================================== archive log check succeeded RMGR '-o' option not used : deleting from the path actually backed up previously ============================================================================== RMGR - delete ============================================================================== 1 out of 1 backup_sets erased RMGR delete ends