How To Move Datafiles On AIX Using Raw Logical Volumes To A New Location?
Oracle Server - Enterprise Edition - Version: 8.1.7.0 to 11.1.0.6 - Release: 8.1.7 to 11.1
IBM AIX on POWER Systems (64-bit)
IBM AIX on POWER Systems (32-bit)
AIX5L Based Systems (64-bit)AIX Based Systems (32-bit)
AIX 4.3, 5L (5.1, 5.2, 5.3, etc.), 6.1
Database Server 8i (8.1.7), 9iR2 (9.2.0), 10gR2 (10.2.0), 11gR1 (11.1.0)
You can determine whether there is an LVCB at the beginning of the RLV by checking the DEVICESUBTYPE field of the /usr/sbin/lslv output. There are two possible values for the DEVICESUBTYPE: "DS_LV" or "DS_LVZ". A value of DS_LV (or not having DEVICESUBTYPE field in the lslv output) means you do have an LVCB at the beginning of the RLV. A value of DS_LVZ means you do not have an LVCB at the beginning of the RLV. Oracle checks the DEVICESUBTYPE field, and if it finds DS_LVZ, then Oracle does not use an offset and the Oracle data starts at the beginning of the RLV, otherwise Oracle uses an offset of 4096 to leave room for the LVCB. You can check this manually by running...
/usr/sbin/lslv
...where is the name of the logical volume for the Oracle datafile you want to move. If you prefer, you can use the "checkoffset" shell script provided below. To use the checkoffset script, just run...
checkoffset
...where is the raw logical volume device for the Oracle datafile you want to move. The checkoffset script will output the Oracle offset, either 0 or 4096. Although most do not, some Oracle RAC releases include $ORACLE_HOME/bin/offset which does basically the same thing. If you do not have $ORACLE_HOME/bin/offset, then you can use checkoffset.
If the new location is on a different system, then it is recommended that you NFS mount the directory containing the new empty RLV device on the new target system so it is accessible from the old source system. Please contact your systems administrator and/or IBM Support if you need assistance configuring NFS.
The OS command "dd" will be used to copy the data from the old RLV to the new one. The dd option "skip" tells dd how many blocks to skip before reading data. The dd option "seek" tells dd how many blocks to seek before writing data.
For the command below, if the Oracle offset is 0 for the source RLV, then use "skip=0", otherwise "skip=1". If the Oracle offset is 0 for the target RLV, then use "seek=0", otherwise "seek=1".
dd if=/path/to/source_RLV of=/path/to/target_RLV bs=4096 skip=? seek=?
If the RLV on the new system is the exact same name and directory as it was on the old source system, then this should be all that is needed to move the RLV to the new system. If there are any changes to the RLV name or directory, then just like with regular datafiles, you must rebuild the controlfiles. More information about rebuilding controlfiles can be found in...
Note 1012929.6 How to Recreate the Controlfile
There are no differences in the datafile structure of the same Oracle release between different AIX versions. This means if you are moving an Oracle datafile using an RLV on AIX4 to AIX5, then no special steps are needed to deal with the OS version change.
It is recommended that you do not attempt to change the Oracle version at the same time you are moving datafiles to a new system. If you need to move the datafiles to a new system as part of an Oracle upgrade, then either...
Upgrade the database on the old system and verify it works fine with the new Oracle version on the old system, then move the datafiles to the new system
...or...
Move the datafiles to the new system, verify the database still works fine using the old Oracle version on the new system, then upgrade to the new Oracle version.
---
to download the file (save the filename as "checkoffset").
IBM AIX on POWER Systems (64-bit)
IBM AIX on POWER Systems (32-bit)
AIX5L Based Systems (64-bit)AIX Based Systems (32-bit)
AIX 4.3, 5L (5.1, 5.2, 5.3, etc.), 6.1
Database Server 8i (8.1.7), 9iR2 (9.2.0), 10gR2 (10.2.0), 11gR1 (11.1.0)
GOAL
You will be moving one or more Oracle datafiles on AIX that are located on Raw Logical Volumes (RLVs) to a new location, and would like information about the special steps needed to do this.SOLUTION
Before discussing the steps to copy an Oracle datafile on an AIX Raw Logical Volume (RLV) to a new location, it is important to note that some RLVs have a Logical Volume Control Block (LVCB) at the beginning of the RLV. The LVCB, if it exists, is an AIX OS structure separate from any Oracle data. You must determine whether your RLV has a LVCB at the beginning before copying the RLV. This must be checked on both the source and target.You can determine whether there is an LVCB at the beginning of the RLV by checking the DEVICESUBTYPE field of the /usr/sbin/lslv output. There are two possible values for the DEVICESUBTYPE: "DS_LV" or "DS_LVZ". A value of DS_LV (or not having DEVICESUBTYPE field in the lslv output) means you do have an LVCB at the beginning of the RLV. A value of DS_LVZ means you do not have an LVCB at the beginning of the RLV. Oracle checks the DEVICESUBTYPE field, and if it finds DS_LVZ, then Oracle does not use an offset and the Oracle data starts at the beginning of the RLV, otherwise Oracle uses an offset of 4096 to leave room for the LVCB. You can check this manually by running...
/usr/sbin/lslv
...where
checkoffset
...where
NOTE: If you have an AIX version that supports zero offset Raw Logical Volumes (RLVs), and your Oracle version is 9.2.0.3 or higher, it is strongly recommended that you use an RLV with a zero offset (by including the "-T O" option when creating the RLV with the "mklv" command). See Metalink Note 261460.1 for more details.
If the new location is on a different system, then it is recommended that you NFS mount the directory containing the new empty RLV device on the new target system so it is accessible from the old source system. Please contact your systems administrator and/or IBM Support if you need assistance configuring NFS.
The OS command "dd" will be used to copy the data from the old RLV to the new one. The dd option "skip" tells dd how many blocks to skip before reading data. The dd option "seek" tells dd how many blocks to seek before writing data.
For the command below, if the Oracle offset is 0 for the source RLV, then use "skip=0", otherwise "skip=1". If the Oracle offset is 0 for the target RLV, then use "seek=0", otherwise "seek=1".
dd if=/path/to/source_RLV of=/path/to/target_RLV bs=4096 skip=? seek=?
If the RLV on the new system is the exact same name and directory as it was on the old source system, then this should be all that is needed to move the RLV to the new system. If there are any changes to the RLV name or directory, then just like with regular datafiles, you must rebuild the controlfiles. More information about rebuilding controlfiles can be found in...
Note 1012929.6 How to Recreate the Controlfile
There are no differences in the datafile structure of the same Oracle release between different AIX versions. This means if you are moving an Oracle datafile using an RLV on AIX4 to AIX5, then no special steps are needed to deal with the OS version change.
It is recommended that you do not attempt to change the Oracle version at the same time you are moving datafiles to a new system. If you need to move the datafiles to a new system as part of an Oracle upgrade, then either...
Upgrade the database on the old system and verify it works fine with the new Oracle version on the old system, then move the datafiles to the new system
...or...
Move the datafiles to the new system, verify the database still works fine using the old Oracle version on the new system, then upgrade to the new Oracle version.
---
to download the file (save the filename as "checkoffset").
#!/bin/ksh
# input:
# string: raw character device to check
# output:
# numeric: offset in raw device where oracle data begins
# error exit codes:
# 255 - usage
# 254 - block device (instead of raw device)
# 253 - not a raw device (regular file, directory, etc.)
# 252 - LV not recognized by 'lslv' command
# notes:
# This script checks the output of the AIX 'lslv' command for a device subtype of DS_LVZ.
# Note that most implementations of 'lslv' will only output the DEVICESUBTYPE field if
# the value is something other than DS_LV. If the DEVICESUBTYPE field is not displayed,
# or displays a value other than DS_LVZ, then offset is output as 4096, otherwise 0. A
# device subtype of DS_LVZ indicates that the normal AIX Logical Volume Control Block
# (lvcb) does not occupy the first 512 bytes of the raw device file, and Oracle data
# begins at offset 0. A device subtype of DS_LV (default) indicates the first 512 bytes
# of the raw device are occupied by the AIX lvcb, and Oracle data begins at offset 4096.
# check that one, and only one, parameter was passed
if [ $# -lt 1 -o $# -gt 1 ]; then
/usr/bin/echo "Usage: checkoffset raw_device"
/usr/bin/echo "Example: checkoffset /dev/rASMRAW1"
exit 255
fi
# resolve relative path to full path
dirn=`/usr/bin/dirname $1`
if [ $dirn = "." ]; then
dirn=`/usr/bin/pwd`
fi
if [ $dirn = "/" ]; then
dirn=""
fi
basn=`/usr/bin/basename $1`
rdev="$dirn/$basn"
# check whether the parameter passed is a block device
if [ -b $1 ]; then
/usr/bin/echo "Error: $rdev is a block device"
exit 254
fi
# check whether the parameter passed is a raw character device
if [ ! -c $1 ]; then
/usr/bin/echo "Error: $rdev is not a raw character device"
exit 253
fi
# strip the 'r' from the device name to get the LV name
lvname=`/usr/bin/echo $basn | /usr/bin/cut -c 2-`
# check whether lslv accepts the LV name as valid
lvchk=`/usr/sbin/lslv $lvname > /dev/null 2>&1 ; print $?`
if [ $lvchk != "0" ]; then
/usr/bin/echo "Error: Command failed: /usr/sbin/lslv $lvname"
/usr/sbin/lslv $lvname
exit 252
fi
# check lslv output for DEVICESUBTYPE of DS_LVZ and set offset
offset=`/usr/sbin/lslv $lvname | /usr/bin/grep DEVICESUBTYPE`
offset=`echo $offset | /usr/bin/grep DS_LVZ ; print $?`
if [ $offset = "0" ]; then
offset="0"
else
offset="4096"
fi
# display offset and exit cleanly
echo $offset
exit 0
# input:
# string: raw character device to check
# output:
# numeric: offset in raw device where oracle data begins
# error exit codes:
# 255 - usage
# 254 - block device (instead of raw device)
# 253 - not a raw device (regular file, directory, etc.)
# 252 - LV not recognized by 'lslv' command
# notes:
# This script checks the output of the AIX 'lslv' command for a device subtype of DS_LVZ.
# Note that most implementations of 'lslv' will only output the DEVICESUBTYPE field if
# the value is something other than DS_LV. If the DEVICESUBTYPE field is not displayed,
# or displays a value other than DS_LVZ, then offset is output as 4096, otherwise 0. A
# device subtype of DS_LVZ indicates that the normal AIX Logical Volume Control Block
# (lvcb) does not occupy the first 512 bytes of the raw device file, and Oracle data
# begins at offset 0. A device subtype of DS_LV (default) indicates the first 512 bytes
# of the raw device are occupied by the AIX lvcb, and Oracle data begins at offset 4096.
# check that one, and only one, parameter was passed
if [ $# -lt 1 -o $# -gt 1 ]; then
/usr/bin/echo "Usage: checkoffset raw_device"
/usr/bin/echo "Example: checkoffset /dev/rASMRAW1"
exit 255
fi
# resolve relative path to full path
dirn=`/usr/bin/dirname $1`
if [ $dirn = "." ]; then
dirn=`/usr/bin/pwd`
fi
if [ $dirn = "/" ]; then
dirn=""
fi
basn=`/usr/bin/basename $1`
rdev="$dirn/$basn"
# check whether the parameter passed is a block device
if [ -b $1 ]; then
/usr/bin/echo "Error: $rdev is a block device"
exit 254
fi
# check whether the parameter passed is a raw character device
if [ ! -c $1 ]; then
/usr/bin/echo "Error: $rdev is not a raw character device"
exit 253
fi
# strip the 'r' from the device name to get the LV name
lvname=`/usr/bin/echo $basn | /usr/bin/cut -c 2-`
# check whether lslv accepts the LV name as valid
lvchk=`/usr/sbin/lslv $lvname > /dev/null 2>&1 ; print $?`
if [ $lvchk != "0" ]; then
/usr/bin/echo "Error: Command failed: /usr/sbin/lslv $lvname"
/usr/sbin/lslv $lvname
exit 252
fi
# check lslv output for DEVICESUBTYPE of DS_LVZ and set offset
offset=`/usr/sbin/lslv $lvname | /usr/bin/grep DEVICESUBTYPE`
offset=`echo $offset | /usr/bin/grep DS_LVZ ; print $?`
if [ $offset = "0" ]; then
offset="0"
else
offset="4096"
fi
# display offset and exit cleanly
echo $offset
exit 0
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15747463/viewspace-1418381/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- How to Optimize PostgreSQL Logical ReplicationSQL
- how to move a MediaWiki wiki from one server to anotherServer
- How to Add a New Disk new partition in centos7CentOS
- How to get the description of blast hit using blastdbcmd?AST
- How to develop locally a Laravel app using LaragondevLaravelAPPGo
- 轉載 個人用 How To Remove Docker Images, Containers, and VolumesREMDockerAI
- Wpf draw ellipse at random location, magnify/highlight ellipse when selected, move ellipserandom
- How to create the Gold gold using RGB color values All In OneGo
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- 【AIX】AIX程式監控工具AI
- ncurses皮膚庫:new_panel(),doupdate(),show_panel(),hide_panel(),move_panel(),del_panel()...IDE
- AIX VGDAAI
- Linux 建立LVM(Logical Volume)LinuxLVM
- 1.1 Logical Structure of Database ClusterStructDatabase
- Location
- WPF mvvm canvas move elements via mouse down, up and move eventsMVVMCanvas
- 【AIX-PS】AIX系統ps命令詳解AI
- docker資料卷(Data Volumes)Docker
- Oracle DG建立Logical Standby DatabaseOracleDatabase
- LeetCode—283—Move ZeroesLeetCode
- Location物件物件
- nginx locationNginx
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- window.location.replace vs window.location.href
- Dockerfile裡的VOLUMES關鍵字Docker
- Install python on AIX 7PythonAI
- AIX掛載NFSAINFS
- AIX_EXT_VGAI
- aix lvm big vgAILVM
- 【AIX】記憶體AI記憶體
- aix升級opensshAI
- [20181113]Logical Standby建立2.txt
- js 原生獲取 url地址引數 const query = new URLSearchParams(window.location.search); const added = query.get("added")JS
- WPF Image zoomin zoomout moveOOM
- IBM AIX儲存層結構分析+aix常用命令IBMAI
- location.protocolProtocol
- location.host
- Nginx Location 配置Nginx
- location.reload()