Move Oracle (1)-

Source: Internet
Author: User
Tags tru64

1. About Bare Devices

1.1 What is a raw device)

A bare device is a raw partition or raw logical volume that has not been created for a file system.

Character device driver to access it. How to read and write data on the device depends on the application that uses it. Because the operations on bare devices do not pass the UNIX buffer, the data stored in Oracle
The buffer cache and the disk are directly transmitted. Therefore, using bare devices can improve I/O performance to a certain extent and is suitable for systems with large I/O volumes. In addition, OPS/RAC
(Oracle Parallel Server/real application
In the cluster environment, multiple nodes access the same database at the same time. Therefore, control file, data file, and redo log must be created in raw
Device.

1.2 bare device space available

Different UNIX systems do not have the same management of bare devices. In particular, Some UNIX systems need to retain a certain amount of space in the header of each bare device, applications cannot overwrite this part when using bare devices,
Otherwise, the bare device will be damaged. Therefore, the actual available space of a bare device is the space allocated to the bare device and then the reserved space of this part of the operating system. Below are commonly used Unix OS
Reserved size list:

Unix OS reserved size

----------------------------

Sun Solaris 0

HP-UX 0

Ibm aix 4 K

Tru64 UNIX 64 K

Linux 0

1.3 dd command

For read/write bare devices on UNIX, commands such as CP, cpio, and tar cannot be used. DD is required. Below are some simple descriptions of common dd parameters, for more information, see the Unix user manual or use the man dd command.

Dd [operand = value...]

If = file specifies the input file. The default value is standard input.

Of = file specifies the output file. The default value is standard output.

BS = N set the size of the input and output blocks to n Bytes. You can also use "K" as the unit.

Skip = n skip N input blocks before copying. The default value is 0.

Seek = n skip n blocks from the output file header before copying. The default value is 0.

Count = n indicates the number of copies. By default, the copy ends with the input file.

1.4 Description of the examples in this article

A. In all examples, the db_block_size of Oracle is 8 K.

B./oradata is a file system directory.

C./dev/rlv_data,/dev/rlv_redo and/dev/rlv_ctrl are three raw devices, both of which are 8 MB (8192 K) in size)

D. If the operating system is not mentioned, the default value is AIX and OS _reserved_size = 4 K.

2. datafile)

2.1 create data files on bare Devices

Run the following command to create a tablespace:

SQL> Create tablespace ts_test datafile '/dev/rlv_data' size 8180 K;

The value specified by size must be less than or equal to 8180 K; otherwise, the statement will fail:

ORA-01119: Error in creating database file '/dev/rlv_data'

ORA-27042: not enough space on raw partition to fullfill request

The maximum value is calculated as follows:

8192 K (raw device size)-4 K (OS _reserved_size)-8 K (db_block_size) = 8180 K

Why do we need to subtract a db_block_size? This is because when Oracle creates a datafile, in addition to the size specified in the command, an additional
Block is called the "Oracle OS header block", which stores the logical block size and number of file blocks of this file. This is not in raw
Datafile on device is unique. If you create a datafile on the file system and specify a size of KB, you can use
The file size displayed by the-l or dir command is 1008 K (db_block_size = 8 K ).

2.2 move data files between file systems and bare Devices

2.2.1 from File System to bare Device

A. Create a 4 m datafile on the file system

SQL> Create tablespace test datafile '/oradata/test. dbf' size 4 m;

B. Check the size of the new datafile (Note: 4202496 = 4 m + 8 K)

$ LS-L/oradata/test. DBF

-RW-r ----- 1 Oracle DBA 4202496 Aug 29/oradata/test. DBF

C. Confirm the DD parameters according to the formula below.

D. If the database is not open, copy it with DD. The following command and output are provided.

AIX $ dd If =/oradata/test. DBF of =/dev/rlv_data BS = 4 K seek = 1

1026 + 0 records in

1026 + 0 records out


Tru64 $ dd If =/oradata/test. DBF of =/dev/rlv_data BS = 64 K seek = 1

64 + 1 records in

64 + 1 records out

Other $ dd If =/oradata/test. DBF of =/dev/rlv_data BS = 1024 K

4 + 1 records in

4 + 1 records out

2.2.2 from bare devices to file systems

A. determine the actual size of the data file file_size, which is used to calculate the DD parameter count in the next step. If the Count calculation is incorrect, the copied data file is invalid and the database cannot be opened.

SQL> select bytes, blocks, Bytes/blocks db_block_size, bytes + Bytes/blocks file_size

From dba_data_files where file_name = '/dev/rlv_data ';

Bytes blocks db_block_size file_size

----------------------------------------

4194304 512 8192 4202496

B. Determine the DD parameter according to the formula below. Min indicates that the values of the two are smaller.

C. If the database is not open, copy it with DD. The following command and output are provided.

AIX $ dd If =/dev/rlv_data of =/oradata/test2.dbf BS = 4 K skip = 1 COUNT = 1026

1026 + 0 records in

1026 + 0 records out


Tru64 $ dd If =/dev/rlv_data of =/oradata/test2.dbf BS = 8 K skip = 8 count = 513

513 + 0 records in

513 + 0 records out

Other $ dd If =/dev/rlv_data of =/oradata/test2.dbf BS = 8 k count = 513

513 + 0 records in

513 + 0 records out

2.2.3 whether copying data from File System to raw device or vice versa, you must perform the RENAME operation to enable Oracle to open the database with a new data file.

SQL> startup Mount;

SQL> alter database rename file 'oldfilename' to 'newfilename ';

SQL> alter database open;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.