Document Type | Technical Information
Category | Administration
Applicable Product Version | Tibero7.2.4
Document Number | TBATI047
Overview
This document describes DD Copy and its precautions. The scenario aims to rebuild a DB on another server by using DB backup and DD Copy in an operating Tibero environment (TAC Raw-Device).
Test Environment
- OS Version: Rocky Linux 8.10 (Green Obsidian)
- Tibero Version: Tibero7 (DB7.2.4) Build 303667
- AS-IS Tibero Configuration: 2Node TAC (Raw-Device)
- TO-BE Tibero Configuration: 2Node TAC (Raw-Device)
Method
What is DD Copy?
DD Copy is the process of accurately duplicating (imaging) data on storage devices (disks, partitions, files, etc.) at the block level. It copies the file system structure, partition information, and metadata exactly the same as the original.
Option Descriptions and Usage Examples
Only options frequently used in Tibero are described here. (โป More options can be checked via dd --help.)
| Option Name | Unit | Description |
|---|---|---|
| if (Input File) | File, Disk | Source file or disk |
| of (Output File) | File, Disk | Target file or disk |
| bs (Block Size) | Bytes | Specifies how many bytes to read at once; usually used with the count option (default is 512) |
| count | N | Copies only N input blocks |
| iflag (Input Flag) | Option | Reads disk directly without using OS cache (Direct I/O) |
| oflag (Output Flag) | Option | Writes directly to disk without using OS cache (Direct I/O) |
DD Copy Usage Examples
1. Copy the contents from Source to Target.
ใดdd if=Source of=Target
2. Copy 1024*10 bytes from source to target.
ใดdd if=source of=target bs=1024 count=10
ใดdd if=source of=target bs=512 count=20
Limitations
In some systems, the model of the system where the source disk is mounted must be the same as the model of the target disk system.
If the source disk's filesystem has issues, those problematic parts will also be copied.
(โป Improper use of this command can overwrite the entire disk, so caution is required when using it.)
Performing DD Copy in Tibero
Example of Raw-Device replication and incomplete recovery using DD Copy
This section explains how DD Copy is used in a Tibero Raw-Device environment by illustrating a scenario where a DB is rebuilt in a TO-BE environment by using DB backup and DD Copy from an AS-IS 2-Node TAC (Raw-Device) configuration with incomplete recovery.
TO-BE Environment Pre-Preparation
- Configure the environment identical to AS-IS
e.g., Hostname, IP, Port, Raw-Device configuration, disk permissions, OS Profile settings, etc.
- Install and configure Tibero engine identical to AS-IS (DB creation is not done since it is for recovery)
e.g., $TB_HOME path, $TB_SID.tip, Resources, etc.
Expected Scenario
- Perform online backup (Begin Backup ~ End Backup)
- Create test tables and perform DML on both nodes (to simulate operational load)
- Perform DD Copy on data area (Raw-Device - Filesystem)
- Backup control file (resetlogs)
- Transfer archives and backups to TO-BE server
- Restore backup (Filesystem) to Raw-Device using DD Copy
- Start in nomount mode and recreate control file
- Start in mount mode and perform recovery
- Start with resetlogs and normal startup
โป Precautions during DD Copy in online backup (for Raw-Device configuration)
When performing DD Copy during online backup, if the iflag=direct and oflag=direct options are not used, I/O passes through the OS cache. This can cause the TSN values between the operating system and backup to differ, resulting in recovery failure. Therefore, it is strongly recommended to specify these two options during DD Copy.
== AS-IS Execution ==
[t7_1]tibero7@tibero_raw:/home/tibero7> tbsql sys
tbSQL 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Enter Password:
Connected to Tibero.
-- Create test table 'test'
SQL> create table tibero.test ( a date, b varchar2(10)) tablespace usr;
Table 'TIBERO.TEST' created.
SQL> insert into tibero.test (a, b) values (systimestamp, 'aa');
1 row inserted.
SQL> commit;
Commit completed.
-- Begin backup
SQL> alter database begin backup;
Database altered.
-- Simulate operational load on node1,2
SQL> DECLARE
BEGIN
FOR i IN 1..50000 LOOP
INSERT INTO TIBERO.TEST (a,b) VALUES (SYSTIMESTAMP, 'AA');
IF MOD(i,10000) = 0 THEN
COMMIT;
END IF;
END LOOP;
COMMIT;
END;
/
PSM completed.
-- End backup
SQL> alter database end backup;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> alter system checkpoint;
System altered.
-- Raw-Device DD Copy of data area
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw17 bs=128M iflag=direct oflag=direct of=/home/tibero7/system001.dtf bs=128M status=progress
402653184 bytes (403 MB, 384 MiB) copied, 1 s, 394 MB/s
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.57237 s, 333 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw18 bs=128M iflag=direct oflag=direct of=/home/tibero7/usr001.dtf bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.17725 s, 445 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw19 bs=128M iflag=direct oflag=direct of=/home/tibero7/undo001.dtf bs=128M status=progress
524288000 bytes (524 MB, 500 MiB) copied, 1 s, 493 MB/s
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.32987 s, 394 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw20 bs=128M iflag=direct oflag=direct of=/home/tibero7/undo002.dtf bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.15563 s, 454 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw22 bs=128M iflag=direct oflag=direct of=/home/tibero7/data001.dtf bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.18858 s, 441 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw23 bs=128M iflag=direct oflag=direct of=/home/tibero7/data002.dtf bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.19607 s, 438 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/dev/raw/raw24 bs=128M iflag=direct oflag=direct of=/home/tibero7/syssub001.dtf bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 1.19354 s, 439 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> ls -rlt
..
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 system001.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 usr001.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 undo001.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 undo002.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 data001.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:27 data002.dtf
-rw-rw-r--. 1 tibero7 tibero7 524288000 Nov 25 03:28 syssub001.dtf
-- Copy all backups and archives to TO-BE server via scp
[t7_1]tibero7@tibero_raw:/home/tibero7> scp ./*.dtf root@192.168.29.101:/home/tibero7
The authenticity of host '192.168.29.101 (192.168.29.101)' can't be established.
ECDSA key fingerprint is SHA256:X1dZuXKK781n1qhXT7zPo/tAnYUL4AxmGN9ywX3sy/w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.29.101' (ECDSA) to the list of known hosts.
root@192.168.29.101's password:
data001.dtf 100% 500MB 110.4MB/s 00:04
data002.dtf 100% 500MB 110.9MB/s 00:04
syssub001.dtf 100% 500MB 109.1MB/s 00:04
system001.dtf 100% 500MB 103.5MB/s 00:04
undo001.dtf 100% 500MB 102.5MB/s 00:04
undo002.dtf 100% 500MB 72.2MB/s 00:06
usr001.dtf 100% 500MB 76.1MB/s 00:06
[t7_1]tibero7@tibero_raw:/home/tibero7/tibero_arch/t7/t7_1/arch> scp ./*.arc root@192.168.29.101:/home/tibero7/tibero_arch/t7/t7_1/arch
root@192.168.29.101's password:
log-t0-r0-s1.arc 100% 512 99.9KB/s 00:00
log-t0-r0-s10.arc 100% 512 1.3MB/s 00:00
log-t0-r0-s11.arc 100% 512 1.6MB/s 00:00
log-t0-r0-s12.arc 100% 512 1.4MB/s 00:00
log-t0-r0-s2.arc 100% 1510KB 89.9MB/s 00:00
log-t0-r0-s3.arc 100% 80MB 110.6MB/s 00:00
log-t0-r0-s4.arc 100% 2886KB 118.6MB/s 00:00
log-t0-r0-s5.arc 100% 319KB 51.5MB/s 00:00
log-t0-r0-s6.arc 100% 100MB 115.1MB/s 00:00
log-t0-r0-s7.arc 100% 1415KB 111.1MB/s 00:00
log-t0-r0-s8.arc 100% 14MB 175.1MB/s 00:00
log-t0-r0-s9.arc 100% 1024 1.6MB/s 00:00
[t7_2]tibero7@tibero_raw:/home/tibero7/tibero_arch/t7/t7_2/arch> scp ./*.arc root@192.168.29.101:/home/tibero7/tibero_arch/t7/t7_1/arch
The authenticity of host '192.168.29.101 (192.168.29.101)' can't be established.
ECDSA key fingerprint is SHA256:X1dZuXKK781n1qhXT7zPo/tAnYUL4AxmGN9ywX3sy/w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.29.101' (ECDSA) to the list of known hosts.
root@192.168.29.101's password:
log-t1-r0-s1.arc 100% 512 428.2KB/s 00:00
log-t1-r0-s2.arc 100% 1057KB 110.6MB/s 00:00
log-t1-r0-s3.arc 100% 4376KB 49.6MB/s 00:00
log-t1-r0-s4.arc 100% 15MB 177.6MB/s 00:00
log-t1-r0-s5.arc 100% 512 1.2MB/s 00:00
log-t1-r0-s6.arc 100% 512 691.9KB/s 00:00
log-t1-r0-s7.arc 100% 512 1.3MB/s 00:00
log-t1-r0-s8.arc 100% 512 1.6MB/s 00:00
-- Backup control file with resetlogs
SQL> alter database backup controlfile to trace as '/home/tibero7/reset.sql' resetlogs;
Database altered.
== TO-BE Execution ==
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/system001.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw17 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.796823 s, 658 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/usr001.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw18 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.687016 s, 763 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/undo001.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw19 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.661971 s, 792 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/undo002.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw20 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.698065 s, 751 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/data001.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw22 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.673473 s, 778 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/data002.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw23 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.684171 s, 766 MB/s
[t7_1]tibero7@tibero_raw:/home/tibero7> dd if=/home/tibero7/syssub001.dtf bs=128M iflag=direct oflag=direct of=/dev/raw/raw24 bs=128M status=progress
3+1 records in
3+1 records out
524288000 bytes (524 MB, 500 MiB) copied, 0.71869 s, 730 MB/s
-- Start in nomount mode and recreate control file
[t7_1]tibero7@tibero_raw:/home/tibero7> tbboot nomount
Listener port = 2629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (NOMOUNT mode).
[t7_1]tibero7@tibero_raw:/home/tibero7> tbsql sys
tbSQL 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Enter Password:
Connected to Tibero.
SQL> @reset.sql
Control File created.
-- Start in mount mode, create redo groups for thread 1 and enable thread 1
[t7_1]tibero7@tibero_raw:/home/tibero7> tbboot mount
Listener port = 2629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (MOUNT mode).
SQL> ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 10 ('/dev/raw/raw11','/dev/raw/raw12') SIZE 100M reuse ;
Database altered.
SQL> ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 11 ('/dev/raw/raw13','/dev/raw/raw14') SIZE 100M reuse ;
Database altered.
SQL> ALTER DATABASE ADD LOGFILE THREAD 1 GROUP 12 ('/dev/raw/raw15','/dev/raw/raw16') SIZE 100M reuse ;
Database altered.
SQL> ALTER DATABASE ENABLE PUBLIC THREAD 1;
Database altered.
-- Perform incomplete recovery
SQL> alter database recover automatic;
TBR-1147: Need log file (thread 0 seq 13) to recover from TSN 161776.
Recovery done until 2025/11/25 03:28:55 TSN 161767.
Recovery is incomplete and resetlogs is required.
[t7_1]tibero7@tibero_raw:/home/tibero7> tbdown immediate
Tibero instance terminated (IMMEDIATE mode).
-- Perform resetlogs
[t7_1]tibero7@tibero_raw:/home/tibero7> tbboot resetlogs;
Listener port = 2629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (NORMAL RESETLOGS mode).
-- TO-BE Node 1 normal startup
[t7_1]tibero7@tibero_raw:/home/tibero7> tbdown immediate
Tibero instance terminated (IMMEDIATE mode).
Listener port = 2629
Tibero 7
TmaxTibero Corporation Copyright (c) 2020-. All rights reserved.
Tibero instance started up (NORMAL mode).
-- Verify objects after recovery
SQL> select count(*) from tibero.test;
COUNT(*)
----------
100001
1 row selected.