Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Dd backup bare device

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Dd backup bare device v1.0

-sydjd main content: 1. UNIX uses dd to back up bare devices. 2. Dd command details 3. Determine the bare device data file size and verify the backup (2 tools) Making User-Managed Backups to Raw Devices

A bare device is a disk or partition that does not contain a file system, so a bare device can only contain one file.

When backing up files on raw devices through the operating system, you need to pay attention to some details. Let's discuss it in detail.

Backing Up to Raw Devices on UNIX

The most common way to back up raw devices under Unix is the dd command.

To use the dd command, you need to make some correct parameters, which are based on your os and database.

Backups of bare devices are different under Unix and Linux. Let's first look at three concepts.

Data

Explanation

Block size

That's the bs option. This size refers to the data size that dd copies at a time. This has nothing to do with the block size of Oracle, nor with os.

It is important to note that the size of this number affects the speed at which you copy data. If the bs is larger, the copy speed will be faster.

Raw offset

On some os, the beginning of a file on a bare device is used by os. These storage spaces, called raw offset,oracle, do not back up and restore these contents (bytes).

Note:1. Skip bytes containing offset when backing up.

two。 Some of the new systems now have no offset.

Size of Oracle block 0

At the beginning of each oracle file, the os system places a block called block 0.

The size of this block is the same as the oracle block of the data file in which it resides.

Normal oracle code does not recognize this block, but it is contained in the file size on the os. That is to say, oracle thinks the datafile1 size is 100 yuan, but according to os, the datafile1 size is 101 yuan (100+block 0).

Let's take a look at some of the parameter meanings of dd.

Options

Specifies

If

Enter the name of the file, that is, the file you want to read (backup)

Of

The name of the output file, that is, the file you want to write to

Bs

Cache size of data copied with dd (amount of data copied at a time)

Skip

If the raw device to be backed up has offset, it is used to skip offset. For example, if the offset size of the raw device you want to back up is 64kB, and the bs you set is 8KB, then you can specify specify skip=8 so that you can start copying from 64KB.

Seek

If you want to copy data to a raw device that contains offset, you need to set this value

Similar to skip.

Count

The number of block of the raw device you want to copy. It mainly depends on the size of your bs. If your data file contains 100 oracle blocks and the oracle block size is 8 K, then your count is set to 100.

In other words, bs × count = size of your datafile1

Of course, count can not be set up, so the entire raw device can be copied down. There is a waste of space. It is recommended to set the count size.

Because the raw device can be used as either an input file for a backup or an output file, the use of parameters in different cases is given below.

Backing up from... ..

Backing up to... ..

Dd parameters involved

Raw device

Raw device

If, of, bs, skip, seek, count

Raw device

File system

If, of, bs, skip, count

File system

Raw device

If, of, bs, seek

File system

File system

If, of, bs

How to know the size of your file? (determine count)

Very simple, use a gadget provided by oracle: dbfsize (oracle comes with it, valid for both data files and bare devices)

Syntax: use dbfsize your_file_name or raw device under oracle users

[oracle@standby test] $dbfsize system01.dbf

Database file: system01.dbf

Database file type: file system

Database file size: 49920 8192 byte blocks

We can know that the data file size of system01.dbf is 49920 × 8K.

So count=49920+1-Don't forget block 0 (mentioned above:)

Backing Up with the dd utility on UNIX: Examples

To use dd, we assume the following:

The data file to back up: 30720KBblock 0 = 8 KB.raw offset 64 KB. We set up bs=8k

Note: no spaces around "="

1) backup from raw device to raw device

% dd if=/dev/rsd1b of=/dev/rsd2b bs=8k skip=8 seek=8 count=3841

2) bare device to file system

% dd if=/dev/rsd1b of=/backup/df1.dbf bs=8k skip=8 count=3841

3) File system to bare device

% dd if=/backup/df1.dbf of=/dev/rsd2b bs=8k seek=8

4) from the file system to the file system, you can set the bs to a higher value in order to increase the Imax O

% dd if=/oracle/dbs/df1.dbf of=/backup/df1.dbf bs=1024k

Backing Up to Raw Devices on LNUIX

Linux generally does not have offset, and others are the same as Unix.

Backing Up to Raw Devices on Windows

Reference: p://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/osbackup008.htm

Verify dd backup

Use dbv, a tool provided by oracle, to support file system files and bare devices.

Syntax: dbv file=file_name blocksize=8192

[oracle@standby test] $dbv file=tools01.dbf blocksize=8192

DBVERIFY: Release 9.2.0.4.0-Production on Mon Aug 13 12:26:05 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

DBVERIFY-Verification starting: FILE = tools01.dbf

DBVERIFY-Verification complete

Total Pages Examined: 1280

Total Pages Processed (Data): 0

Total Pages Failing (Data): 0

Total Pages Processed (Index): 0

Total Pages Failing (Index): 0

Total Pages Processed (Other): 8

Total Pages Processed (Seg): 0

Total Pages Failing (Seg): 0

Total Pages Empty: 1272

Total Pages Marked Corrupt: 0

If there is a problem with the file, there will be an error prompt.

Corresponding to Chinese:

Total number of pages checked: 1280

Total number of pages processed (data): 150

Total number of failed pages (data): 0

Total number of pages processed (index): 127

Total number of failed pages (index): 0

Total pages processed (other): 1001

Total number of pages processed (segments): 0

Total number of failed pages (segments): 0

Total number of empty pages: 0

Total number of pages marked as damaged: 2

Total page inflows: 0

Highest block SCN: 428223 (0.428223)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report