Document Type | Technical Information
Field | Management/Configuration
Applicable Product Versions | Tibero5, Tibero6, Tibero7
Document Number | TADTI215
Overview
This document describes the BMT scenario to verify the normal operation of backup and recovery functions in a SINGLE environment.
Method
Complete Recovery Function After Online Backup
Execution
| Execution Order | Scenario |
|---|---|
| 1 | Create test data
|
| 2 | Pre-check
|
| 3 | Perform and verify Begin Backup |
| 4 | Perform hot backup |
| 5 | Perform End Backup and log switch |
| 6 | Insert data and perform log switch |
| 7 | Query data |
| 8 | Shutdown Tibero and delete all data files |
| 9 | Start Tibero, check mount mode and error status |
| 10 | Shutdown Tibero and restore hot backup files |
| 11 | Start Tibero in mount mode and perform recovery |
| 12 | Start Tibero |
| 13 | Query table row count |
Results
| Execution Order | Scenario |
|---|---|
| 1 | Create test data
|
tbsql sys/tibero
CREATE TABLESPACE TS_TEST DATAFILE 'test001.dtf' SIZE 16M AUTOEXTEND ON NEXT 16M MAXSIZE 1G, 'test002.dtf' SIZE 16M AUTOEXTEND ON NEXT 16M MAXSIZE 1G EXTENT MANAGEMENT LOCAL AUTOALLOCATE; Tablespace 'TS_TEST' created.
CREATE TABLESPACE TS_TEST_IDX DATAFILE 'test_idx_001.dtf' SIZE 8M AUTOEXTEND ON NEXT 8M MAXSIZE 1G EXTENT MANAGEMENT LOCAL AUTOALLOCATE; Tablespace 'TS_TEST_IDX' created.
CREATE USER TEST IDENTIFIED BY TEST DEFAULT TABLESPACE TS_TEST; User 'TEST' created.
Granted. conn test/test
CREATE TABLE TEST.T1 (ID NUMBER,ANAME VARCHAR2(32),BNAME VARCHAR2(32),ID2 NUMBER) TABLESPACE TS_TEST; Table 'TEST.T1' created. CREATE INDEX IDX_T1 ON T1(ID, ANAME) TABLESPACE TS_TEST_IDX; Index 'IDX_T1' created. | |
| 2 | Pre-check
|
select count(*) from test.t1; COUNT(*) 1 row selected.
SELECT TABLESPACE_NAME FROM DBA_TABLESPACES; TABLESPACE_NAME
select file_name from dba_data_files; FILE_NAME
select name from v$controlfile; NAME | |
| 3 | Perform and verify Begin Backup |
ALTER DATABASE BEGIN BACKUP; Database altered. SELECT * FROM V$BACKUP; FILE# STATUS CHANGE# TIME
exit | |
| 4 | Perform hot backup |
mkdir /tibero/data_bak cp -Rp /tibero/data/system001.dtf /tibero/data_bak/. cp -Rp /tibero/data/tbctl1 /tibero/data_bak/. | |
| 5 | Perform End Backup and log switch |
tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
alter database end backup; Database altered.
alter system switch logfile; System altered.
alter system switch logfile; System altered.
alter system switch logfile; System altered.
SELECT * FROM V$BACKUP; FILE# STATUS CHANGE# TIME | |
| 6 | Insert data and perform log switch |
INSERT INTO TEST.T1 SELECT ROWNUM, 'A'||TO_CHAR(ROWNUM), 'B'||TO_CHAR(ROWNUM),ROUND(ROWNUM/50) FROM DUAL CONNECT BY ROWNUM<=50000; 50000 rows inserted. commit; Commit completed.
alter system switch logfile; System altered. | |
| 7 | Query data |
SELECT COUNT(*) FROM TEST.T1; COUNT(*) 1 row selected. | |
| 8 | Shutdown Tibero and delete all data files |
tbdown immediate Tibero instance terminated (IMMEDIATE mode).
rm -rf /tibero/data | |
| 9 | Start Tibero, check mount mode and error status |
tbboot ********************************************************
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 10 | Shutdown Tibero and restore hot backup files tbdown immediate Tibero instance terminated (IMMEDIATE mode).
cp -Rp /tibero/data_bak/system001.dtf /tibero/data/. |
| 11 | Start Tibero in mount mode and perform recovery |
tbboot mount Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
alter database recover automatic; Database altered.
tbdown immediate Tibero instance terminated (IMMEDIATE mode). | |
| 12 | Start Tibero |
tbboot Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 13 | Query table row count |
SELECT COUNT(*) FROM TEST.T1; COUNT(*) 1 row selected. |
Complete Recovery Function After Offline Backup (Cold Backup)
Execution
| Execution Order | Scenario |
|---|---|
| 1 | Check backup targets - Control files, redo logs, data files, temp files |
| 2 | Query table row count |
| 3 | Shutdown Tibero and perform cold backup |
| 4 | Start Tibero |
| 5 | Insert data |
| 6 | Query data |
| 7 | Shutdown Tibero and delete all data files |
| 8 | Check Tibero mode and error status |
| 9 | Shutdown Tibero and restore cold backup files |
| 10 | Start Tibero and perform recovery |
| 11 | Shutdown Tibero and start Tibero |
| 12 | Query table row count |
Results
| Execution Order | Scenario |
|---|---|
| 1 | Check backup targets - Control files, redo logs, data files, temp files |
tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
SELECT NAME FROM V$CONTROLFILE; NAME 2 rows selected.
SELECT MEMBER FROM V$LOGFILE; MEMBER 3 rows selected.
SELECT FILE_NAME FROM DBA_DATAFILES; FILE_NAME 8 rows selected.
SELECT FILE_NAME FROM DBA_TEMP_FILES; FILE_NAME 1 row selected. | |
| 2 | Query table row count |
SELECT COUNT(*) FROM TEST.T1; COUNT(*) | |
| 3 | Shutdown Tibero and perform cold backup tbdown immediate Tibero instance terminated (IMMEDIATE mode).
cp -Rp /tibero/data /tibero/data_cold_backup
|
| 4 | Start Tibero |
tbboot Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 5 | Insert data |
tbsql test/test tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
INSERT INTO TEST.T1 SELECT ROWNUM, 'A'||TO_CHAR(ROWNUM), 'B'||TO_CHAR(ROWNUM),ROUND(ROWNUM/50) FROM DUAL CONNECT BY ROWNUM<=50000; 50000 rows inserted.
commit; Commit completed. | |
| 6 | Query data |
SELECT COUNT(*) FROM TEST.T1; COUNT(*) | |
| 7 | Shutdown Tibero and delete all data files |
tbdown immediate Tibero instance terminated (IMMEDIATE mode). rm -rf /tibero/data | |
| 8 | Start Tibero and check mode and error status |
tbboot ********************************************************
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 9 | Shutdown Tibero and restore cold backup files |
tbdown immediate Tibero instance terminated (IMMEDIATE mode).
mv /tibero/data_cold_backup /tibero/data | |
| 10 | Start Tibero and perform recovery |
tbboot mount Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
alter database recover automatic; Database altered. | |
| 11 | Shutdown Tibero and start Tibero |
tbdown immediate Tibero instance terminated (IMMEDIATE mode).
tbboot Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 12 | Query table row count |
select count(*) from test.t1; COUNT(*) |
Media Recovery Function
Execution
| Execution Order | Scenario |
|---|---|
| 1 | Query table row count |
| 2 | Perform Begin Backup |
| 3 | Perform hot backup |
| 4 | Perform End Backup and log switch |
| 5 | Query Sysdate |
| 6 | Insert data |
| 7 | Query table row count |
| 8 | Backup control file and perform log switch |
| 9 | Shutdown Tibero and delete all data files (including Redo Logs) |
| 10 | Start Tibero, check mount mode and error status |
| 11 | Shutdown Tibero and restore hot backup files |
| 12 | Start in nomount mode and recover control file |
| 13 | Start in mount mode and perform recovery |
| 14 | Shutdown Tibero |
| 15 | Start Tibero and complete recovery |
| 16 | Verify row count |
Results
| Execution Order | Scenario |
|---|---|
| 1 | Query table row count |
select count(*) from test.t1; COUNT(*) | |
| 2 | Perform Begin Backup |
alter database begin backup; Database altered. | |
| 3 | Perform hot backup |
cp /tibero/data/*.dtf /tibero/data_bak/.
tibero@localhost /tibero/data_bak โค ls -alrt | |
| 4 | Perform End Backup and log switch |
tibero@localhost ~ โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> alter database end backup; Database altered.
SQL> ALTER SYSTEM SWITCH LOGFILE; System altered. SQL> ALTER SYSTEM SWITCH LOGFILE; System altered. | |
| 5 | Query Sysdate |
SQL> ALTER SESSION SET NLS_DATE_FORMAT='YYYY/MM/DD HH24:MI:SS'; Session altered.
SYSDATE 1 row selected. | |
| 6 | Insert data |
SQL> INSERT INTO TEST.T1 (ID) VALUES ('444444'); 1 row inserted.
SQL> commit; Commit completed. | |
| 7 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) | |
| 8 | Backup control file and perform log switch |
SQL> alter database backup controlfile to trace as '/home/tibero/ctl_bak.sql' reuse resetlogs; Database altered.
SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered. SQL> alter system switch logfile; System altered.
SQL> exit | |
| 9 | Shutdown Tibero and delete all data files (including Redo Logs) |
| tibero@localhost /tibero/data โค rm -rf *dtf *.ctl *.log tibero@localhost /tibero/data โค ls -alrt total 16 drwx------. 3 tibero dba 4096 Dec 12 14:57 java drwxr-xr-x. 9 tibero dba 4096 Dec 12 17:04 .. -rw-r--r--. 1 tibero dba 88 Dec 12 17:13 .passwd drwxr-xr-x. 3 tibero dba 4096 Dec 12 17:13 . | |
| 10 | Start Tibero, check mode and error status |
tibero@localhost ~ โค tbboot ********************************************************
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 11 | Shutdown Tibero and restore hot backup files |
tibero@localhost ~ โค tbdown immediate Tibero instance terminated (IMMEDIATE mode). tibero@localhost /tibero โค cp /tibero/data_bak/*.dtf /tibero/data/. | |
| 12 | Start in nomount mode and recover control file |
tibero@localhost /tibero โค tbboot nomount Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
vi /home/tibero/ctl_bak.sql โค ---- Set #2. Delete NORESETLOGS case
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
SQL> @/home/tibero/ctl_bak.sql Control File created. tibero@localhost /tibero โค tbdown immediate Tibero instance terminated (IMMEDIATE mode). | |
| 13 | Start in mount mode and perform recovery |
tibero@localhost /tibero โค tbboot mount Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
SQL> ALTER SYSTEM SET NLS_DATE_FORMAT='YYYY/MM/DD HH24:MI:SS'; System altered.
SQL> alter database recover automatic database until time '2025/12/12 17:10:00'; | |
| 14 | Shutdown Tibero |
tibero@localhost /tibero โค tbdown immediate Tibero instance terminated (IMMEDIATE mode). | |
| 15 | Start Tibero and complete recovery |
tibero@localhost /tibero โค tbboot resetlogs Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/tibero/data/temp001.dtf' SIZE 100M REUSE AUTOEXTEND ON NEXT 10M MAXSIZE 32G; Tablespace 'TEMP' altered. | |
| 16 | Verify row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 1 row selected. |
Partial Backup Function
Explanation of incremental and differential backups.
Execution (Incremental Backup)
| Execution Order | Scenario |
|---|---|
| 1 | Online Full Backup using Recovery Manager (tbrmgr) |
| 2 | Query table row count |
| 3 | Insert data |
| 4 | Query table row count |
| 5 | Incremental Backup 1 |
| 6 | Insert data |
| 7 | Query table row count |
| 8 | Incremental Backup 2 |
| 9 | Insert data |
| 10 | Query table row count |
| 11 | Incremental Backup 3 |
| 12 | Shutdown Tibero and delete data files |
| 13 | Start Tibero, check mount mode and error status, then shutdown |
| 14 | Recovery with tbrmgr |
| 15 | Query row count (should match Incremental Backup 3 point) |
Results (Incremental Backup)
| Execution Order | Scenario |
|---|---|
| 1 | Online Full Backup using Recovery Manager (tbrmgr) |
tibero@localhost /tibero โค export TB_BACKUP=/tibero/BACKUP ============================================================================== ============================================================================== BACKUP (set_id: 1, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 2 | Query table row count |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) | |
| 3 | Insert data |
SQL> INSERT INTO TEST.T1
SQL> COMMIT; | |
| 4 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 1 row selected. | |
| 5 | Incremental Backup 1 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/incremental -i -v ============================================================================== ============================================================================== BACKUP (set_id: 2, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 6 | Insert data |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
50000 rows inserted.
SQL> COMMIT; Commit completed. | |
| 7 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 1 row selected. | |
| 8 | Incremental Backup 2 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/incremental -i -v ============================================================================== ============================================================================== BACKUP (set_id: 3, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 9 | Insert data |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> INSERT INTO TEST.T1 50000 rows inserted. SQL> COMMIT; Commit completed. | |
| 10 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) | |
| 11 | Incremental Backup 3 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/incremental -i -v ============================================================================== ============================================================================== BACKUP (set_id: 4, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 12 | Shutdown Tibero and delete data files |
tibero@localhost /tibero/BACKUP โค tbdown immediate Tibero instance terminated (IMMEDIATE mode). tibero@localhost /tibero/BACKUP โค rm -rf /tibero/data/*.dtf | |
| 13 | Start Tibero, check mount mode and error status, then shutdown |
tibero@localhost /tibero/BACKUP โค tbboot ********************************************************
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. tibero@localhost /tibero/BACKUP โค tbdown immediate Tibero instance terminated (IMMEDIATE mode). | |
| 14 | Recovery with tbrmgr |
tibero@localhost /tibero/BACKUP โค tbrmgr recover -o $TB_BACKUP/incremental -v ============================================================================== ============================================================================== tbdown failed. proc info file is deleted. Control file #0 (/tibero/data/c1.ctl) is accessible All control files are accessible. No need to restore the backup control file.
Change core dump dir to /home/tibero/tibero7/bin/prof. Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
RESTORE (set_id: 1, ts_id: 0, df_id: 0) - FULL BACKUP Database restoration succeeded recoverSQL: ALTER DATABASE RECOVER AUTOMATIC Shutting down the instance...
Booting up the instance... Change core dump dir to /home/tibero/tibero7/bin/prof. Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 15 | Query row count (should match Incremental Backup 3 point) |
tibero@localhost /tibero/BACKUP โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> SELECT COUNT(*) FROM TEST.T1;
1 row selected. |
Execution (Differential Backup)
| Execution Order | Scenario |
|---|---|
| 1 | Copy tbrmgr full backup files |
| 2 | Query table row count |
| 3 | Insert data |
| 4 | Query table row count |
| 5 | Cumulative Backup 1 |
| 6 | Insert data |
| 7 | Query table row count |
| 8 | Cumulative Backup 2 |
| 9 | Insert data |
| 10 | Query table row count |
| 11 | Cumulative Backup 3 |
| 12 | Shutdown Tibero and delete all data files |
| 13 | Start Tibero, check mount mode and error status, then shut down again |
| 14 | tbrmgr Recovery |
| 15 | Query row count (should match Cumulative Backup 3 point) |
Results (Differential Backup)
| Execution Order | Scenario |
|---|---|
| 1 | Copy tbrmgr full backup files |
| cp -r $TB_BACKUP/full $TB_BACKUP/cumulative | |
| 2 | Query table row count |
tibero@localhost /tibero/BACKUP โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
SQL> select count(*) from test.t1; COUNT(*) 250001 1 row selected. | |
| 3 | Insert data |
SQL> select count(*) from test.t1; COUNT(*) 250001 1 row selected.
SQL> INSERT INTO TEST.T1 50000 rows inserted.
SQL> COMMIT; Commit completed. | |
| 4 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 300001 1 row selected. | |
| 5 | Cumulative Backup 1 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/cumulative -C -v ============================================================================== ============================================================================== BACKUP (set_id: 5, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 6 | Insert data |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero.
50000 rows inserted.
SQL> commit; Commit completed. | |
| 7 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 350001 | |
| 8 | Cumulative Backup 2 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/cumulative -C -v ============================================================================== ============================================================================== BACKUP (set_id: 6, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends | |
| 9 | Insert data |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> INSERT INTO TEST.T1 50000 rows inserted.
SQL> COMMIT; Commit completed. | |
| 10 | Query table row count |
SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 400001 1 row selected. | |
| 11 | Cumulative Backup 3 |
tibero@localhost /tibero โค tbrmgr backup -o $TB_BACKUP/cumulative -C -v ============================================================================== ============================================================================== BACKUP (set_id: 7, ts_id: 0, df_id: 0) Switching an online logfile... Backing up the control file... Database backup succeeded RMGR backup ends
tibero@localhost /tibero โค ls -al $TB_BACKUP/cumulative | |
| 12 | Shutdown Tibero and delete all data files |
tibero@localhost /tibero โค tbdown Tibero instance terminated (NORMAL mode).
tibero@localhost /tibero โค rm /tibero/data/*.dtf | |
| 13 | Start Tibero, check mount mode and error status, then shut down again |
tibero@localhost /tibero โค tbboot ********************************************************
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance terminated (IMMEDIATE mode). | |
| 14 | tbrmgr Recovery |
tibero@localhost /tibero โค tbrmgr recover -o $TB_BACKUP/cumulative -v ============================================================================== ============================================================================== tbdown failed. proc info file is deleted. Control file #0 (/tibero/data/c1.ctl) is accessible All control files are accessible. No need to restore the backup control file.
Change core dump dir to /home/tibero/tibero7/bin/prof. Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
RESTORE (set_id: 1, ts_id: 0, df_id: 0) - FULL BACKUP Database restoration succeeded recoverSQL: ALTER DATABASE RECOVER AUTOMATIC Shutting down the instance...
Booting up the instance... Change core dump dir to /home/tibero/tibero7/bin/prof. Tibero 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. | |
| 15 | Query row count (should match Cumulative Backup 3 point) |
tibero@localhost /tibero โค tbsql sys/tibero tbSQL 7 TmaxTibero Corporation Copyright (c) 2020-. All rights reserved. Connected to Tibero. SQL> SELECT COUNT(*) FROM TEST.T1; COUNT(*) 400001 1 row selected |