rman存储脚本

存储脚本是命令文件的一种替方法用来管理频繁使用的一系列RMAN命令。存储脚本相比命令文件来说它的优点就是对于任何连接到目标数据库和恢复目录的RMAN客户端都能够使用它。而命令文件只有能够访问它的RMAN客户端能够使用。

存储脚本可以是全局或者局部脚本。一个局存储脚本与创建该脚本时RMAN所连接的目标数据库相关,只能当连接到该目标数据库时才能执行存储脚本。一个全局的存储脚本能在恢复目录中所注册的所有数据库中执行。注意执行存储脚本,即使是全局存储脚本,也必须连接到恢复目录和目标实例才能执行。

创建存储脚本
确保RMAN连接到正确的目标数据库和恢复目录,然后执行create script命令来创建局部存储脚本。例如:

create script full_backup
{
backup as backupset database plus archivelog;
delete obsolete;
}


RMAN> create script full_backup
2> {
3> backup as backupset database plus archivelog;
4> delete obsolete;
5> }

created script full_backup

执行创建命令如果没有输出错误信息,那么该存储脚本full_backup就创建成功并存储在恢复目录中。

下面创建一个全局存储脚本,如下所示:

create global script global_full_backup
{
backup as backupset database plus archivelog;
delete obsolete;
}


RMAN> create global script global_full_backup
2> {
3> backup as backupset database plus archivelog;
4> delete obsolete;
5> }

created global script global_full_backup

还可以提供了comment来描述全局存储脚本:

create global script global_full_backup
comment 'use only with archivelog mode database'
{
backup as backupset database plus archivelog;
delete obsolete;
}

RMAN> create global script global_full_backup
2> comment 'use only with archivelog mode database'
3> {
4> backup as backupset database plus archivelog;
5> delete obsolete;
6> }

created global script global_full_backup

还可以读取文本文件来创建局部或全局存储脚本:

RMAN> create script test_script from file '/u01/app/oracle/test_script_file.txt';

script commands will be loaded from file /u01/app/oracle/test_script_file.txt
created script test_script

RMAN> create global script global_test_script from file '/u01/app/oracle/test_script_file.txt';

script commands will be loaded from file /u01/app/oracle/test_script_file.txt
created global script global_test_script

文本文件内宾3必须以{开始,再接RUN块中的一系列有效的命令,最后以}结束。

执行存储脚本
为了执行存储脚本,连接到目标数据库和恢复目录,使用execute script命令,execute script命令要求使用RUN块:

RMAN> run
2> {
3> execute script full_backup;
4> }

executing script: full_backup


Starting backup at 18-MAR-15
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 devtype=DISK
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=1 recid=9 stamp=871547115
input archive log thread=1 sequence=2 recid=10 stamp=872692777
input archive log thread=1 sequence=3 recid=11 stamp=873390010
input archive log thread=1 sequence=4 recid=12 stamp=873477689
input archive log thread=1 sequence=5 recid=13 stamp=873557205
input archive log thread=1 sequence=6 recid=14 stamp=873628154
input archive log thread=1 sequence=7 recid=15 stamp=873881476
input archive log thread=1 sequence=8 recid=16 stamp=873969596
input archive log thread=1 sequence=9 recid=17 stamp=874234871
input archive log thread=1 sequence=10 recid=18 stamp=874315436
input archive log thread=1 sequence=11 recid=19 stamp=874486364
input archive log thread=1 sequence=12 recid=20 stamp=874574023
input archive log thread=1 sequence=13 recid=21 stamp=874579545
input archive log thread=1 sequence=14 recid=22 stamp=874657043
input archive log thread=1 sequence=15 recid=23 stamp=874663015
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpvd26_.bkp tag=TAG20150318T095657 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:27
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=44 recid=6 stamp=870948358
input archive log thread=1 sequence=45 recid=7 stamp=870948359
input archive log thread=1 sequence=46 recid=8 stamp=870948359
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpw6cl_.bkp tag=TAG20150318T095657 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/jy/system01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jy/undotbs01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jy/sysaux01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/jy/example01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jy/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T095727_bjkpw9xz_.bkp tag=TAG20150318T095727 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=16 recid=24 stamp=874663125
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095845_bjkpyqdc_.bkp tag=TAG20150318T095845 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting Control File and SPFILE Autobackup at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663128_bjkpytxr_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-15

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          3769   06-FEB-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_44_bf88d537_.arc
Archive Log          3770   06-FEB-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_45_bf88d73o_.arc
Archive Log          3771   06-FEB-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_46_bf88d7cv_.arc
Archive Log          3772   13-FEB-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_13/o1_mf_1_1_bftk375y_.arc
Archive Log          3773   26-FEB-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_26/o1_mf_1_2_bgxhx2ww_.arc
Archive Log          3774   03-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_03/o1_mf_1_3_bhbvorcp_.arc
Archive Log          3775   04-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_04/o1_mf_1_4_bhfk9mdr_.arc
Archive Log          3776   05-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_05/o1_mf_1_5_bhhyxwnp_.arc
Archive Log          3777   06-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_06/o1_mf_1_6_bhl47mgr_.arc
Archive Log          3778   09-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_09/o1_mf_1_7_bhsvmzby_.arc
Archive Log          3779   10-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_10/o1_mf_1_8_bhwkos6m_.arc
Archive Log          3780   13-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_13/o1_mf_1_9_bj4nqm2j_.arc
Archive Log          3781   14-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_14/o1_mf_1_10_bj73f7y4_.arc
Archive Log          3782   16-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_16/o1_mf_1_11_bjdbbrvm_.arc
Archive Log          3783   17-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_17/o1_mf_1_12_bjgzxz92_.arc
Archive Log          3784   17-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_17/o1_mf_1_13_bjh5bqyo_.arc
Archive Log          3785   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_14_bjkk0h4p_.arc
Backup Set           3786   06-FEB-15
  Backup Piece       3788   06-FEB-15          /u01/app/oracle/flash_recovery_area/JY/autobackup/2015_02_06/o1_mf_s_870945982_bf861zo6_.bkp
Datafile Copy        3794   03-MAR-15          /u01/app/oracle/users01.dbf
Backup Set           3787   06-FEB-15
  Backup Piece       3789   06-FEB-15          /u01/app/oracle/flash_recovery_area/JY/autobackup/2015_02_06/o1_mf_s_870948381_bf88dyom_.bkp
Archive Log          3806   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_15_bjkpv6py_.arc
Backup Set           3813   18-MAR-15
  Backup Piece       3817   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpvd26_.bkp
Backup Set           3814   18-MAR-15
  Backup Piece       3818   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpw6cl_.bkp

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_44_bf88d537_.arc recid=6 stamp=870948358
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_45_bf88d73o_.arc recid=7 stamp=870948359
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_06/o1_mf_1_46_bf88d7cv_.arc recid=8 stamp=870948359
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_13/o1_mf_1_1_bftk375y_.arc recid=9 stamp=871547115
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_02_26/o1_mf_1_2_bgxhx2ww_.arc recid=10 stamp=872692777
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_03/o1_mf_1_3_bhbvorcp_.arc recid=11 stamp=873390010
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_04/o1_mf_1_4_bhfk9mdr_.arc recid=12 stamp=873477689
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_05/o1_mf_1_5_bhhyxwnp_.arc recid=13 stamp=873557205
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_06/o1_mf_1_6_bhl47mgr_.arc recid=14 stamp=873628154
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_09/o1_mf_1_7_bhsvmzby_.arc recid=15 stamp=873881476
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_10/o1_mf_1_8_bhwkos6m_.arc recid=16 stamp=873969596
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_13/o1_mf_1_9_bj4nqm2j_.arc recid=17 stamp=874234871
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_14/o1_mf_1_10_bj73f7y4_.arc recid=18 stamp=874315436
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_16/o1_mf_1_11_bjdbbrvm_.arc recid=19 stamp=874486364
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_17/o1_mf_1_12_bjgzxz92_.arc recid=20 stamp=874574023
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_17/o1_mf_1_13_bjh5bqyo_.arc recid=21 stamp=874579545
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_14_bjkk0h4p_.arc recid=22 stamp=874657043
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_02_06/o1_mf_s_870945982_bf861zo6_.bkp recid=4 stamp=870948272
deleted datafile copy
datafile copy filename=/u01/app/oracle/users01.dbf recid=2 stamp=873392067
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_02_06/o1_mf_s_870948381_bf88dyom_.bkp recid=5 stamp=870948382
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_15_bjkpv6py_.arc recid=23 stamp=874663015
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpvd26_.bkp recid=6 stamp=874663020
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095657_bjkpw6cl_.bkp recid=7 stamp=874663046
Deleted 23 objects

上面的命令将调用指定名称的局部脚本full_script。如果没有找到局部脚本,但存在相同名称的全局脚本,RMAN将执行同名的全局存储脚本。如果存在同名的局部和全局脚本可以使用execute global script来控制只执行全局脚本。在恢复目录中没有名叫global_full_backup的局部脚本存在,那么执行下面两个命令的结果是一样的:

RMAN> run
2> {
3> execute global script global_full_backup;
4> }

executing global script: global_full_backup


Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=16 recid=24 stamp=874663125
input archive log thread=1 sequence=17 recid=25 stamp=874663571
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100613_bjkqdppq_.bkp tag=TAG20150318T100613 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/jy/system01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jy/undotbs01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jy/sysaux01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/jy/example01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jy/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T100615_bjkqds89_.bkp tag=TAG20150318T100615 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=18 recid=26 stamp=874663651
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100732_bjkqh6cv_.bkp tag=TAG20150318T100732 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting Control File and SPFILE Autobackup at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663655_bjkqh9db_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-15

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          3845   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_16_bjkpynv3_.arc
Backup Set           3846   18-MAR-15
  Backup Piece       3850   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T095727_bjkpw9xz_.bkp
Backup Set           3864   18-MAR-15
  Backup Piece       3870   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095845_bjkpyqdc_.bkp
Archive Log          3913   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_17_bjkqdmto_.arc
Backup Set           3880   18-MAR-15
  Backup Piece       3882   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663128_bjkpytxr_.bkp
Backup Set           3925   18-MAR-15
  Backup Piece       3928   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100613_bjkqdppq_.bkp

Do you really want to delete the above objects (enter YES or NO)? yes
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_16_bjkpynv3_.arc recid=24 stamp=874663125
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T095727_bjkpw9xz_.bkp recid=8 stamp=874663049
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T095845_bjkpyqdc_.bkp recid=9 stamp=874663127
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_17_bjkqdmto_.arc recid=25 stamp=874663571
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663128_bjkpytxr_.bkp recid=10 stamp=874663130
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100613_bjkqdppq_.bkp recid=11 stamp=874663574
Deleted 6 objects



RMAN> run
2> {
3> execute script global_full_backup;
4> }

executing global script: global_full_backup


Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=18 recid=26 stamp=874663651
input archive log thread=1 sequence=19 recid=27 stamp=874664008
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T101329_bjkqtbtn_.bkp tag=TAG20150318T101329 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/jy/system01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/jy/undotbs01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/jy/sysaux01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/jy/example01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/jy/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T101331_bjkqtdoh_.bkp tag=TAG20150318T101331 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=20 recid=28 stamp=874664078
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T101439_bjkqwjl4_.bkp tag=TAG20150318T101439 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting Control File and SPFILE Autobackup at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874664082_bjkqwmhg_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-15

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log          3944   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_18_bjkqh3ov_.arc
Backup Set           3945   18-MAR-15
  Backup Piece       3948   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T100615_bjkqds89_.bkp
Backup Set           3967   18-MAR-15
  Backup Piece       3973   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100732_bjkqh6cv_.bkp
Archive Log          4036   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_19_bjkqt8p5_.arc
Backup Set           3988   18-MAR-15
  Backup Piece       3990   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663655_bjkqh9db_.bkp
Backup Set           4053   18-MAR-15
  Backup Piece       4056   18-MAR-15          /u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T101329_bjkqtbtn_.bkp

Do you really want to delete the above objects (enter YES or NO)? YES
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_18_bjkqh3ov_.arc recid=26 stamp=874663651
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_nnndf_TAG20150318T100615_bjkqds89_.bkp recid=12 stamp=874663576
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T100732_bjkqh6cv_.bkp recid=13 stamp=874663654
deleted archive log
archive log filename=/u01/app/oracle/flash_recovery_area/JY/archivelog/2015_03_18/o1_mf_1_19_bjkqt8p5_.arc recid=27 stamp=874664008
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/autobackup/2015_03_18/o1_mf_s_874663655_bjkqh9db_.bkp recid=14 stamp=874663657
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/JY/backupset/2015_03_18/o1_mf_annnn_TAG20150318T101329_bjkqtbtn_.bkp recid=15 stamp=874664010
Deleted 6 objects

在执行全局脚本只影响RMAN所连接到的目标数据库;为了跨多个数据库执行全局脚本,必须单独连接到每一个数据库并执行全局存储脚本。

在执行脚本时将会使用配置的自动通道来执行脚本。如果需要覆盖配置的自动通道可以在脚本中使用allocate channel命令来手动分配通道。注意因为使用的是RUN块,如果脚本中的一个RMAN命令失败,脚本中的后续命令将不会执行。

查看存储脚本内容
print script命令用来查看存储脚本或将脚本内容写入到新文件。使用RMAN连接到目标数据库和恢复目录。执行print script:

RMAN> print script full_backup;

printing stored script: full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

显示全局脚本内容:
RMAN> print global script global_full_backup;

printing stored global script: global_full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

为将脚本内容写入到新文件中,执行以下命令:

RMAN> print script full_backup to file '/u01/app/oracle/full_backup.txt';

script full_backup written to file /u01/app/oracle/full_backup.txt

将全局脚本内容写入文件:

RMAN> print global script global_full_backup to file '/u01/app/oracle/global_full_backup.txt';

global script global_full_backup written to file /u01/app/oracle/global_full_backup.txt

查看恢复目录中的存储脚本:list script names
使用list script names命令来显示恢复目录中的存储脚本名。这个命令会显示所有存储脚本名。

RMAN> list script names;

List of Stored Scripts in Recovery Catalog


    Scripts of Target Database JY

       Script Name
       Description
       -----------------------------------------------------------------------
       full_backup


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup
       use only with archivelog mode database

只显示全局存储脚本名:

RMAN> list global script names;

List of Stored Scripts in Recovery Catalog


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup
       use only with archivelog mode database

为了查看当前恢复目录中所有存储脚本的名称,包括在恢复目录中所有已经注册的目标数据库的全局和局部脚本,执行以下命令:

RMAN> list all script names;

List of Stored Scripts in Recovery Catalog


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup
       use only with archivelog mode database


    Scripts of Target Database JY

       Script Name
       Description
       -----------------------------------------------------------------------
       full_backup


    Scripts of Target Database TEST

       Script Name
       Description
       -----------------------------------------------------------------------
       test_full_backup

可以看到上面显示了两个目标数据库(jy,test)中的所有存储脚本

更新存储脚本
为了更新存储脚本,连接到目标数据库和恢复目录并使用replace script命令来执行更新。如果脚本不存在,那么RMAN将会创建一个新存储脚本。

下面的命令用来更新脚本full_backup的内容:
先来查看恢复目录中所有存储脚本名来检查是否存在full_backup脚本

RMAN> list all script names;

List of Stored Scripts in Recovery Catalog


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup
       use only with archivelog mode database


    Scripts of Target Database JY

       Script Name
       Description
       -----------------------------------------------------------------------
       full_backup


    Scripts of Target Database TEST

       Script Name
       Description
       -----------------------------------------------------------------------
       test_full_backup

查看脚本full_backup的内容

RMAN> print script full_backup;

printing stored script: full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

更新脚本full_backup
RMAN> replace script full_backup
2> {
3> backup as backupset database plus archivelog;
4> }

replaced script full_backup

检查脚本full_backup是否已经被更新

RMAN> print script full_backup;

printing stored script: full_backup
 {backup as backupset database plus archivelog;
}

从脚本内容可知full_backup内容确实已经被更新.

下面来更新一个不存在的脚本full_backup_bak

RMAN> replace script full_backup_update
2> {
3> backup as backupset database plus archivelog;
4> }

replaced script full_backup_update

从下面的信息中可以看到当更新一个不存在的脚本,RMAN确实会创建这个脚本

RMAN> list all script names;

List of Stored Scripts in Recovery Catalog


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup
       use only with archivelog mode database


    Scripts of Target Database JY

       Script Name
       Description
       -----------------------------------------------------------------------
       full_backup

       full_backup_update


    Scripts of Target Database TEST

       Script Name
       Description
       -----------------------------------------------------------------------
       test_full_backup



RMAN> print script full_backup_update;

printing stored script: full_backup_update
 {backup as backupset database plus archivelog;
}

全局存储脚本可以使用replace global script命令来进行更新:
查看更新前global_full_backup脚本的内容

RMAN> print script global_full_backup;

printing stored global script: global_full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

更新全局脚本global_full_backup

RMAN> replace global script global_full_backup
2> {
3> backup as backupset database plus archivelog;
4> }

replaced global script global_full_backup

显示更新后全局脚本global_full_backup的内容

RMAN> print global script global_full_backup;

printing stored global script: global_full_backup
 {backup as backupset database plus archivelog;
}

与create script命令一样,可以使用文件来更新局部或全局存储脚本。

更新前查看全局脚本global_full_backup的内容

RMAN> print global script global_full_backup;

printing stored global script: global_full_backup
 {backup as backupset database plus archivelog;
}

使用global_full_backup.txt文件来更新全局脚本global_full_backup

RMAN> replace global script global_full_backup from file '/u01/app/oracle/global_full_backup.txt';

script commands will be loaded from file /u01/app/oracle/global_full_backup.txt
replaced global script global_full_backup

查看更新后的脚本内容:

RMAN> print global script global_full_backup;

printing stored global script: global_full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

更新前查看局部脚本full_backup的内容

RMAN> print script full_backup;

printing stored script: full_backup
 {backup as backupset database plus archivelog;
}

使用full_backup.txt文件来更新局部脚本full_backup

RMAN> replace script full_backup from file '/u01/app/oracle/full_backup.txt';

script commands will be loaded from file /u01/app/oracle/full_backup.txt
replaced script full_backup

查看更新后的脚本内容:

RMAN> print script full_backup;

printing stored script: full_backup
 {backup as backupset database plus archivelog;
delete obsolete;
}

删除存储脚本
为了从恢复目录中删除存储脚本,连接恢复目录和目标数据库后执行delete script命令:

RMAN> list script names;

List of Stored Scripts in Recovery Catalog


    Scripts of Target Database JY

       Script Name
       Description
       -----------------------------------------------------------------------
       full_backup

       full_backup_update


    Global Scripts


       Script Name
       Description
       -----------------------------------------------------------------------
       global_full_backup

为了从恢复目录中删除局部存储脚本full_backup

RMAN> delete script 'full_backup';

deleted script: full_backup

为了删除全局存储脚本global_full_backup,执行delete global script:

RMAN> delete global script 'global_full_backup';

deleted global script: global_full_backup

如果没有给delete script命令指定global参数,并且目标数据库中没有指定名称的存储脚本存在,RMAN将使用指定名称来查找全局存储脚本如果找到就将其删除。因此为了删除全局存储脚本也可以执行以下的命令:

RMAN> delete script 'global_full_backup';

deleted script: global_full_backup

对于delete script ‘global_full_backup’命令,RMAN会在连接到的目标数据库中查找脚本’global_full_backup’,如果没有找到,将会搜索名为’global_full_backup’的全局脚本,如果找到就将其删除。

启动RMAN客户端并执行存储脚本
为了运行RMAN客户端并执行存储在恢复目录中的存储脚本,可以使用script参数来启动RMAN客户端:

[oracle@oracle11g ~]$ rman target sys/zzh_2046@test catalog rman/rman@jy script 'global_full_backup'

Recovery Manager: Release 10.2.0.5.0 - Production on Wed Mar 18 11:22:04 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: TEST (DBID=2168949517)
connected to recovery catalog database

executing global script: global_full_backup


Starting backup at 18-MAR-15
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
skipping archive log file /u02/1_49_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_50_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_51_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_52_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_53_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_54_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_55_870806981.dbf; already backed up 1 time(s)
skipping archive log file /u02/1_56_870806981.dbf; already backed up 1 time(s)
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=57 recid=64 stamp=874668125
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u02/ora_test874668127_671 tag=TAG20150318T112206 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/u01/app/oracle/oradata/test/system01.dbf
input datafile fno=00003 name=/u01/app/oracle/oradata/test/sysaux01.dbf
input datafile fno=00005 name=/u01/app/oracle/oradata/test/example01.dbf
input datafile fno=00006 name=/u01/app/oracle/oradata/test/tspitr01.dbf
input datafile fno=00002 name=/u01/app/oracle/oradata/test/undotbs01.dbf
input datafile fno=00004 name=/u01/app/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u02/ora_test874668130_681 tag=TAG20150318T112209 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 18-MAR-15

Starting backup at 18-MAR-15
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=58 recid=65 stamp=874668205
channel ORA_DISK_1: starting piece 1 at 18-MAR-15
channel ORA_DISK_1: finished piece 1 at 18-MAR-15
piece handle=/u02/ora_test874668206_691 tag=TAG20150318T112326 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 18-MAR-15

Starting Control File and SPFILE Autobackup at 18-MAR-15
piece handle=/u01/app/oracle/flash_recovery_area/TEST/autobackup/2015_03_18/o1_mf_s_874668209_bjkvxl3b_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 18-MAR-15

Recovery Manager complete.

在启动RMAN客户端时必须要连接到恢复目录(存储脚本存储在恢复目录中)和目标数据库。

存储脚本命名限制
RMAN是如何解决脚本名称,尤其是在局部和全局脚本共享相同名称时存在的一些问题:
.RMAN允许但一般不要求将存储脚本名使用引号括起来。然而,存储脚本名以数字或RMAN的保留关键开头就需要将存储脚本名称使用引号括起来。对于存储脚本名称要考虑避免使用A-Z之外的字符或RMAN的保留关键字作为名称的开始字符。
.当在命令行中使用script参数来启动RMAN客户端,如果存在相同名称的局部和全局存储脚本,那么RMAN将总是执行局部脚本。
.对于execute script,delete script和print script命令,如果脚本名称作为一个参数被传递并且在连接到的目标数据库中没有该相同名称的脚本存在,RMAN将执行,删除或显示相同名称的全局脚本。例如,如果在恢复目录中存在一个名叫global_full_backup的全局存储脚本,但在目标数据库中没有名叫global_full_backup的局部存储脚本,下面的命令将会删除全局脚本:
DELETE SCRIPT global_full_backup;

rman连接辅助数据库ORA-04031: unable to allocate 1040 bytes of shared memory

在给oracle 10g搭建dg使用rman复制数据库时,在连接辅助实例时出错,错误信息如下所示:

[oracle@oracle11g admin]$ rman target sys/zzh_2046@test auxiliary sys/system@aux_test catalog rman/rman@jy

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 17 10:50:22 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: TEST (DBID=2168949517)
connected to recovery catalog database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-00600: internal error code, arguments: [15435], [SYS], [X$STANDARD], [], [], [], [], []
ORA-04031: unable to allocate 1040 bytes of shared memory ("shared pool","X$STANDARD","PL/SQL DIANA","PAR.C:parapt:Page")
RMAN-04015: error setting target database character set to ZHS16GBK

从上面的错误信息可以看到ORA-04031是因为不能给共享内存分配1040 bytes大小的内存。如是直接用rman连接辅助实例也出现错误,错误信息如下所示:

[oracle@jingyong1 ~]$ rman target sys/system@aux_test

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 17 10:51:28 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04005: error from target database:
ORA-00600: internal error code, arguments: [15435], [SYS], [X$STANDARD], [], [], [], [], []
ORA-04031: unable to allocate 1040 bytes of shared memory ("shared pool","X$STANDARD","PL/SQL DIANA","PAR.C:parapt:Page")
RMAN-04015: error setting target database character set to ZHS16GBK

在MOS上找到了ORA-4031 During Startup Nomount using RMAN without parameter file [ID 1176443.1]内容如下:

Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.
***Checked for relevance on 08-May-2013***
Symptoms
RMAN startup nomount failed with ORA-4031

Customer was testing RMAN backup/restore in Exadata.
Customer firstly backup the database to tape and then remove all the datafiles, spfile, controlfiles for testing.
Then during the recover, customer connected RMAN with nocatalog and try to "startup nomount", then ORA-4031 occured.



==================== Log ========================
oracle@hkfop011db01:/home/oracle
$ export ORACLE_SID=TEST
oracle@test011db01:/home/oracle
$ rman target / nocatalog

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Jul 8 20:45:10 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/oracle/product/11.2.0/db_1/dbs/initTEST.ora'

starting Oracle instance without parameter file for retrieval of spfile
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 07/08/2010 20:45:19
RMAN-04014: startup failed: ORA-04031: unable to allocate 111264 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","KEWS sesstat values")
Cause
RMAN has failed to start a dummy instance without pfile.
Default values used for the dummy instance are not enough to start the instance up.

This is reported in Bug 9680987 - RMAN CANNOT START DATABASE WITHOUT PARAMETER FILE

Solution
There are two possible solutions:
1- Create temporary init.ora file (/oracle/product/11.2.0/db_1/dbs/initTEST.ora) with the following parameters:

    db_name=
    large_pool_size=100m
    shared_pool_size=250m
    db_cache_size=10m

2- Set environment variable  ORA_RMAN_SGA_TARGET before executing rman. For example:

    $ export ORA_RMAN_SGA_TARGET=350

这篇文章给出了两种解决方法,一种是增加内存参数,一种是设置环境变量,适用版本是11.2.0.1及其以后版本,我这里是oracle 10.2.0.5,因为第二种方法简单,所以尝试使用设置环境变量的方法:

[oracle@jingyong1 ~]$ export ORA_RMAN_SGA_TARGET=350
[oracle@jingyong1 ~]$ rman target sys/system@aux_test

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 17 10:51:46 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-06003: ORACLE error from target database:
ORA-00604: error occurred at recursive SQL level 2
ORA-04031: unable to allocate 16 bytes of shared memory ("shared pool","select ks.inst_id,ksuxsins,k...","sql area","ub1[]: qkexrXformVal")

我这里的版本是10.2.0.5,使用第二种方法不行。只能采取第一种增加内存参数的方法。

[oracle@jingyong1 dbs]$ vi inittest.ora

db_name=test
db_unique_name=_test
control_files= /u01/app/oracle/auxiliary/control01.ctl
db_file_name_convert=(' /u01/app/oracle/oradata/test/',' /u01/app/oracle/auxiliary')
log_file_name_convert=(' /u01/app/oracle/oradata/test/',' /u01/app/oracle/auxiliary')
remote_login_passwordfile=exclusive
compatible = 10.2.0.5.0
db_block_size=8192
sga_target=160M
sga_max_size=160M
pga_aggregate_target=16M

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1272624 bytes
Variable Size              58721488 bytes
Database Buffers          104857600 bytes
Redo Buffers                2920448 bytes

[oracle@jingyong1 dbs]$ export ORACLE_SID=test
[oracle@jingyong1 dbs]$ rman target/

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 17 11:00:47 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: test (not mounted)

[oracle@oracle11g admin]$ rman target sys/zzh_2046@test auxiliary sys/system@aux_test catalog rman/rman@jy

Recovery Manager: Release 10.2.0.5.0 - Production on Tue Mar 17 11:01:00 2015

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: TEST (DBID=2168949517)
connected to recovery catalog database
connected to auxiliary database: TEST (not mounted)

通过向参数文件中增加内存参数解决了这个故障。

IBM服务器更换rootvg故障磁盘操作指南

1 Rootvg做镜像
1.1 Rootvg做镜像要求
在安装完操作系统,配完应用后,我们一般要给rootvg做镜像,做rootvg镜像的硬盘必须和rootvg的硬盘空间大小相同,转速相同的同一型号内置SCSI硬盘。可通过下面这些命令来确认:
lsdev -Cc disk 确定主机中有几块硬盘,有几块内置硬盘

# lsdev -Cc disk
[IBMP740-1:root:/]#lsdev -Cc disk
hdisk0      Available 00-00-00 SAS Disk Drive
hdisk1      Available 00-00-00 SAS Disk Drive
hdisk2      Defined   07-00-02 EMC CLARiiON FCP LUNZ Disk
hdisk3      Defined   07-00-02 EMC CLARiiON FCP LUNZ Disk
hdisk4      Defined   05-00-02 EMC CLARiiON FCP LUNZ Disk
hdisk5      Defined   05-00-02 EMC CLARiiON FCP LUNZ Disk
hdisk6      Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk7      Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk8      Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk9      Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk10     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk11     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk12     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk13     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk14     Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk15     Defined   07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk16     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk17     Available 05-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk18     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk19     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk20     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk21     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk22     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdisk23     Available 07-00-02 EMC CLARiiON FCP RAID 5 Disk
hdiskpower0 Available 05-00-02 PowerPath Device
hdiskpower1 Available 07-00-02 PowerPath Device
hdiskpower2 Available 05-00-02 PowerPath Device

lspv 确定主机中那块内置硬盘没有被VG使用

# lspv
hdisk0          0057908c7251c07a                    rootvg
hdisk1          0057908cea9403a2                    None
hdisk2          005d03fc9859db6c                    datavg
[IBMP740-1:root:/]# lspv
hdisk0          00f7ac3dfb20ed5a                    None
hdisk1          00f7ac3d60694e5e                    rootvg          active
hdisk10         none                                None
hdisk11         none                                None
hdisk12         none                                None
hdisk13         none                                None
hdisk16         none                                None
hdisk17         none                                None
hdisk18         none                                None
hdisk19         none                                None
hdisk20         none                                None
hdisk21         none                                None
hdisk22         none                                None
hdisk23         none                                None

lsattr -El 确定hdisk0与hdisk1硬盘的大小一致

[IBMP740-1:root:/]#lsattr -El hdisk0
PCM             PCM/friend/scsiscsd                        Path Control Module           False
algorithm       fail_over                                  Algorithm                     True
dist_err_pcnt   0                                          Distributed Error Percentage  True
dist_tw_width   50                                         Distributed Error Sample Time True
hcheck_interval 0                                          Health Check Interval         True
hcheck_mode     nonactive                                  Health Check Mode             True
max_coalesce    0x10000                                    Maximum Coalesce Size         True
max_transfer    0x100000                                   Maximum TRANSFER Size         True
pvid            00f7ac3dfb20ed5a0000000000000000           Physical volume identifier    False
queue_depth     16                                         Queue DEPTH                   True
reserve_policy  no_reserve                                 Reserve Policy                True
size_in_mb      300000                                     Size in Megabytes             False
unique_id       2A1135000C50053CA70070BST9300653SS03IBMsas Unique device identifier      False
ww_id           5000c50053ca7007                           World Wide Identifier         False
[IBMP740-1:root:/]#lsattr -El hdisk1
PCM             PCM/friend/scsiscsd                        Path Control Module           False
algorithm       fail_over                                  Algorithm                     True
dist_err_pcnt   0                                          Distributed Error Percentage  True
dist_tw_width   50                                         Distributed Error Sample Time True
hcheck_interval 0                                          Health Check Interval         True
hcheck_mode     nonactive                                  Health Check Mode             True
max_coalesce    0x10000                                    Maximum Coalesce Size         True
max_transfer    0x100000                                   Maximum TRANSFER Size         True
pvid            00f7ac3d60694e5e0000000000000000           Physical volume identifier    False
queue_depth     16                                         Queue DEPTH                   True
reserve_policy  no_reserve                                 Reserve Policy                True
size_in_mb      300000                                     Size in Megabytes             False
unique_id       2A1135000C500594B60570BST9300653SS03IBMsas Unique device identifier      False
ww_id           5000c500594b6057                           World Wide Identifier         False
[IBMP740-1:root:/]#lscfg -vpl hdisk0

lscfg -vpl 确认硬盘的Part number或FRU Number号是否一样,如一样说明硬盘型号一样。

[IBMP740-1:root:/]#lscfg -vpl hdisk0
  hdisk0           U78AA.001.WZSHLUK-P2-D1  SAS Disk Drive (300000 MB)

        Manufacturer................IBM
        Machine Type and Model......ST9300653SS
        FRU Number..................74Y6496
        ROS Level and ID............37343044
        Serial Number...............6XN12EQS
        EC Level....................N23780
        Part Number.................74Y6486
        Device Specific.(Z0)........000006329F001002
        Device Specific.(Z1)........0301740D
        Device Specific.(Z2)........0021
        Device Specific.(Z3)........12136
        Device Specific.(Z4)........
        Device Specific.(Z5)........22
        Device Specific.(Z6)........N23780
        Hardware Location Code......U78AA.001.WZSHLUK-P2-D1


  PLATFORM SPECIFIC

  Name:  disk
    Node:  disk
    Device Type:  block
[IBMP740-1:root:/]#lscfg -vpl hdisk1
  hdisk1           U78AA.001.WZSHLUK-P2-D2  SAS Disk Drive (300000 MB)

        Manufacturer................IBM
        Machine Type and Model......ST9300653SS
        FRU Number..................74Y6496
        ROS Level and ID............37343044
        Serial Number...............6XN1F0V1
        EC Level....................N23780
        Part Number.................74Y6486
        Device Specific.(Z0)........000006329F001002
        Device Specific.(Z1)........0301740D
        Device Specific.(Z2)........0021
        Device Specific.(Z3)........12217
        Device Specific.(Z4)........
        Device Specific.(Z5)........22
        Device Specific.(Z6)........N23780
        Hardware Location Code......U78AA.001.WZSHLUK-P2-D2


  PLATFORM SPECIFIC

  Name:  disk
    Node:  disk
    Device Type:  block由上可知,hdisk0与hdisk1型号、大小一致,可以做rootvg镜像。

#一般基本上除了haview ,netwiew ( Tivoli)的包以外,所有的hacmp的包都要安装。
1.2 配制rootvg镜像
首先将hdisk1硬盘加入到rootvg中

# extendvg rootvg hdisk1
0516-014 linstallpv: The physical volume appears to belong to another
        volume group.
005d027c00004c00
0516-631 extendvg: Warning, all data belonging to physical
        volume hdisk1 will be destroyed.
extendvg: Do you wish to continue? y(es) n(o)? y
# lspv
hdisk0          0057908c7251c07a                    rootvg
hdisk1          0057908cea9403a2                    rootvg
hdisk2          005d03fc9859db6c                    datavg

给rootvg做镜像

# mirrorvg rootvg hdisk1
0516-1124 mirrorvg: Quorum requirement turned off, reboot system for this
        to take effect for rootvg.
0516-1126 mirrorvg: rootvg successfully mirrored, user should perform
        bosboot of system to initialize boot records.  Then, user must modify
        bootlist to include:  hdisk0 hdisk1.

给hdisk0、hdisk1分别做引导分区

# bosboot -ad hdisk0
bosboot: Boot image is 15092 512 byte blocks.
# bosboot -ad hdisk1
bosboot: Boot image is 15092 512 byte blocks.

设定系统的引导顺序为hdisk0、hdisk1

# bootlist -m normal hdisk0 hdisk1
# bootlist -m normal -o
hdisk0 blv=hd5 pathid=0
hdisk1 blv=hd5 pathid=0

设定Quorum为Disable.,这样保证了一旦硬盘坏了一块,rootvg还是能正常启来。

# chvg -Qn rootvg
0516-1804 chvg: The quorum change takes effect immediately.

执行lsvg命令确认rootvg已做镜像,可看到除了lg_dumplv之外所有其它LPs和PPs的对应关系为1对2的关系。

# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       2       2    closed/syncd  N/A
hd6                 paging     33      66      2    open/syncd    N/A
hd8                 jfs2log    1       2       2    open/syncd    N/A
hd4                 jfs2       40      80      2    open/syncd    /
hd2                 jfs2       10      20      2    open/syncd    /usr
hd9var              jfs2       10      20      2    open/syncd    /var
hd3                 jfs2       20      40      2    open/syncd    /tmp
hd1                 jfs2       10      20      2    open/syncd    /home
hd10opt             jfs2       196     392     2    open/syncd    /opt
hd11admin           jfs2       10      20      2    open/syncd    /admin
fwdump              jfs2       3       6       2    open/syncd    /var/adm/ras/platform
lg_dumplv           sysdump    16      16      1    open/syncd    N/A
livedump            jfs2       1       2       2    open/syncd    /var/adm/ras/livedump
fslv00              jfs2       40      80      2    closed/syncd  /u01

2 更换rootvg中的故障盘
这里假设hdisk0硬盘故障,需要更换。
2.1 确定hdisk0硬盘故障
首先执行errpt命令查看错误日志,如果hdisk0损坏的话,会有很多hdisk0的报错。

# errpt -d H
IDENTIFIER TIMESTAMP  T C RESOURCE_NAME  DESCRIPTION
12296806   0312162815 T H sissas0        SAS ERROR
12296806   0312162715 T H sissas0        SAS ERROR
12296806   0311235615 T H sissas0        SAS ERROR
12296806   0311235515 T H sissas0        SAS ERROR
12296806   0310235615 T H sissas0        SAS ERROR
12296806   0310235515 T H sissas0        SAS ERROR
12296806   0309235615 T H sissas0        SAS ERROR
12296806   0309235515 T H sissas0        SAS ERROR
12296806   0308235615 T H sissas0        SAS ERROR
12296806   0308235515 T H sissas0        SAS ERROR
12296806   0307235615 T H sissas0        SAS ERROR
12296806   0307235515 T H sissas0        SAS ERROR
12296806   0306235615 T H sissas0        SAS ERROR
12296806   0306235515 T H sissas0        SAS ERROR
12296806   0305235615 T H sissas0        SAS ERROR
12296806   0305235515 T H sissas0        SAS ERROR
12296806   0304235615 T H sissas0        SAS ERROR
12296806   0304235515 T H sissas0        SAS ERROR
E86653C3   0304054615 P H LVDD           I/O ERROR DETECTED BY LVM
E86653C3   0304054615 P H LVDD           I/O ERROR DETECTED BY LVM
C62E1EB7   0304054615 P H hdisk0         DISK OPERATION ERROR
12296806   0304054615 T H sissas0        SAS ERROR
E86653C3   0304054615 P H LVDD           I/O ERROR DETECTED BY LVM
E86653C3   0304054615 P H LVDD           I/O ERROR DETECTED BY LVM
C62E1EB7   0304054615 P H hdisk0         DISK OPERATION ERROR
C62E1EB7   0304054615 P H hdisk0         DISK OPERATION ERROR
12296806   0304054615 T H sissas0        SAS ERROR
12296806   0304054615 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054515 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR
12296806   0304054415 T H sissas0        SAS ERROR

执行lsvg 确认镜像丢失,可看到LPs和PPs的对应关系变为11对应。

# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     33      33      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       40      40      1    open/syncd    /
hd2                 jfs2       10      10      1    open/syncd    /usr
hd9var              jfs2       10      10      1    open/syncd    /var
hd3                 jfs2       20      20      1    open/syncd    /tmp
hd1                 jfs2       10      10      1    open/syncd    /home
hd10opt             jfs2       196     196     1    open/syncd    /opt
hd11admin           jfs2       10      10      1    open/syncd    /admin
fwdump              jfs2       3       3       1    open/syncd    /var/adm/ras/platform
lg_dumplv           sysdump    8       8       1    open/syncd    N/A
livedump            jfs2       1       1       1    open/syncd    /var/adm/ras/livedump
fslv00              jfs2       40      40      1    closed/syncd  /u01

执行lspv -l hdisk0命令会报错,确认hdisk0硬盘故障。

2.2 更换hdisk0硬盘
首先将hdisk0硬盘从rootvg中unmirror

# unmirrorvg rootvg hdisk0
0516-1246 rmlvcopy: If hd5 is the boot logical volume, please run 'chpv -c '
        as root user to clear the boot record and avoid a potential boot
        off an old boot image that may reside on the disk from which this
        logical volume is moved/removed.
0516-1132 unmirrorvg: Quorum requirement turned on, reboot system for this
        to take effect for rootvg.
0516-1144 unmirrorvg: rootvg successfully unmirrored, user should perform
        bosboot of system to reinitialize boot records.  Then, user must modify
        bootlist to just include:  hdisk1.

执行chpv -c hdisk0命令清除掉boot记录

# chpv -c hdisk0
0301-108 mkboot: Unable to read file blocks. Return code: -1
0516-1248 chpv: mkboot failure

# reducevg rootvg hdisk0
0516-016 ldeletepv: Cannot delete physical volume with allocated
        partitions. Use either migratepv to move the partitions or
        reducevg with the -d option to delete the partitions.
0516-884 reducevg: Unable to remove physical volume hdisk0.

这是因为 lg_dumplv在rootvg缺省情况下没有做镜像的原因,只创建在hdisk0上,现在要修改主dump目录为null(空目录)

# lslv -l lg_dumplv
lg_dumplv:N/A
PV                COPIES        IN BAND       DISTRIBUTION
hdisk0            008:000:000   100%          000:008:000:000:000

# sysdumpdev -P -p /dev/sysdumpnull
primary              /dev/sysdumpnull
secondary            /dev/sysdumpnull
copy directory       /var/adm/ras
forced copy flag     TRUE
always allow dump    FALSE
dump compression     ON
type of dump         traditional

从rootvg中删除hdisk0硬盘

# reducevg -d rootvg hdisk0
0516-914 rmlv: Warning, all data belonging to logical volume
        lg_dumplv on physical volume hdisk0 will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)? yes
rmlv: Logical volume lg_dumplv is removed.

# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       1       1    closed/syncd  N/A
hd6                 paging     33      33      1    open/syncd    N/A
hd8                 jfs2log    1       1       1    open/syncd    N/A
hd4                 jfs2       40      40      1    open/syncd    /
hd2                 jfs2       10      10      1    open/syncd    /usr
hd9var              jfs2       10      10      1    open/syncd    /var
hd3                 jfs2       20      20      1    open/syncd    /tmp
hd1                 jfs2       10      10      1    open/syncd    /home
hd10opt             jfs2       196     196     1    open/syncd    /opt
hd11admin           jfs2       10      10      1    open/syncd    /admin
fwdump              jfs2       3       3       1    open/syncd    /var/adm/ras/platform
livedump            jfs2       1       1       1    open/syncd    /var/adm/ras/livedump
fslv00              jfs2       40      40      1    closed/syncd  /u01

删除hdisk0硬盘

# rmdev -dl hdisk0
hdisk0 deleted
# lspv
hdisk1          00f45bd06cef0cfa                    rootvg          active
hdisk2          none                                None
hdisk3          none                                None
hdisk4          none                                None
hdisk5          none                                None
hdisk6          none                                None
hdisk7          none                                None
hdisk8          none                                None
hdisk9          none                                None
hdisk10         none                                None
hdisk11         none                                None
hdiskpower0     none                                None
hdiskpower1     none                                None
hdiskpower2     none                                None
hdiskpower3     none                                None
hdiskpower4     none                                None
hdisk12         none                                None
hdisk13         none                                None
hdisk14         none                                None
hdisk15         none                                None
hdisk16         none                                None
hdisk17         none                                None
hdiskpower5     none                                None
hdiskpower6     none                                None
hdiskpower7     none                                None
hdisk18         none                                None
hdisk19         none                                None
hdisk20         none                                None
hdisk21         none                                None
hdisk22         none                                None
hdisk23         none                                None
hdiskpower8     none                                None
hdiskpower9     none                                None
hdiskpower10    none                                None

2.3添加新硬盘到rootvg中,并做镜像
拔出hdisk0故障硬盘,插入新硬盘。执行以下操作将新硬盘加入到rootvg中
# cfgmgr -v
查看磁盘是否有pvid如果没有执行chdev -l hdisk0 -a pv=yes

# lspv
hdisk0          none                                None
hdisk1          00f45bd06cef0cfa                    rootvg          active
hdisk2          none                                None
hdisk3          none                                None
hdisk4          none                                None
hdisk5          none                                None
hdisk6          none                                None
hdisk7          none                                None
hdisk8          none                                None
hdisk9          none                                None
hdisk10         none                                None
hdisk11         none                                None
hdiskpower0     none                                None
hdiskpower1     none                                None
hdiskpower2     none                                None
hdiskpower3     none                                None
hdiskpower4     none                                None
hdisk12         none                                None
hdisk13         none                                None
hdisk14         none                                None
hdisk15         none                                None
hdisk16         none                                None
hdisk17         none                                None
hdiskpower5     none                                None
hdiskpower6     none                                None
hdiskpower7     none                                None
hdisk18         none                                None
hdisk19         none                                None
hdisk20         none                                None
hdisk21         none                                None
hdisk22         none                                None
hdisk23         none                                None
hdiskpower8     none                                None
hdiskpower9     none                                None
hdiskpower10    none                                None



# chdev -l hdisk0 -a pv=yes
hdisk0 changed
# lspv
hdisk0          00f45bd0101716a0                    None
hdisk1          00f45bd06cef0cfa                    rootvg          active
hdisk2          none                                None
hdisk3          none                                None
hdisk4          none                                None
hdisk5          none                                None
hdisk6          none                                None
hdisk7          none                                None
hdisk8          none                                None
hdisk9          none                                None
hdisk10         none                                None
hdisk11         none                                None
hdiskpower0     none                                None
hdiskpower1     none                                None
hdiskpower2     none                                None
hdiskpower3     none                                None
hdiskpower4     none                                None
hdisk12         none                                None
hdisk13         none                                None
hdisk14         none                                None
hdisk15         none                                None
hdisk16         none                                None
hdisk17         none                                None
hdiskpower5     none                                None
hdiskpower6     none                                None
hdiskpower7     none                                None
hdisk18         none                                None
hdisk19         none                                None
hdisk20         none                                None
hdisk21         none                                None
hdisk22         none                                None
hdisk23         none                                None
hdiskpower8     none                                None
hdiskpower9     none                                None
hdiskpower10    none                                None

把hdisk0加入到rootvg

# extendvg rootvg hdisk0
# lspv
hdisk0          00f45bd0101716a0                    rootvg          active
hdisk1          00f45bd06cef0cfa                    rootvg          active
hdisk2          none                                None
hdisk3          none                                None
hdisk4          none                                None
hdisk5          none                                None
hdisk6          none                                None
hdisk7          none                                None
hdisk8          none                                None
hdisk9          none                                None
hdisk10         none                                None
hdisk11         none                                None
hdiskpower0     none                                None
hdiskpower1     none                                None
hdiskpower2     none                                None
hdiskpower3     none                                None
hdiskpower4     none                                None
hdisk12         none                                None
hdisk13         none                                None
hdisk14         none                                None
hdisk15         none                                None
hdisk16         none                                None
hdisk17         none                                None
hdiskpower5     none                                None
hdiskpower6     none                                None
hdiskpower7     none                                None
hdisk18         none                                None
hdisk19         none                                None
hdisk20         none                                None
hdisk21         none                                None
hdisk22         none                                None
hdisk23         none                                None
hdiskpower8     none                                None
hdiskpower9     none                                None
hdiskpower10    none                                None

做rootvg镜像

# mirrorvg rootvg hdisk0
0516-306 getlvodm: Unable to find volume group root in the Device
        Configuration Database.
0516-1200 mirrorvg: Failed to mirror the volume group.

创建引导映像

# bosboot -ad hdisk0

bosboot: Boot image is 53276 512 byte blocks.
# bosboot -ad hdisk1

bosboot: Boot image is 53276 512 byte blocks.

改变引导区引导顺序

# bootlist -m normal hdisk0 hdisk1

查看引导顺序

# bootlist -m normal -o
hdisk0 blv=hd5 pathid=0
hdisk1 blv=hd5 pathid=0
# chvg -Qn rootvg
0516-1804 chvg: The quorum change takes effect immediately.

//-Q:确定卷组在丢失其物理卷的限额后,VG是否保持活动;-n:保持活动,默认为:-y。

重新创建dump

# mklv -t sysdump -y lg_dumplv rootvg 16 hdisk0
lg_dumplv

修改主dump device:

# sysdumpdev -Pp /dev/lg_dumplv
primary              /dev/lg_dumplv
secondary            /dev/sysdumpnull
copy directory       /var/adm/ras
forced copy flag     TRUE
always allow dump    FALSE
dump compression     ON
type of dump         traditional
# lsvg -l rootvg
rootvg:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
hd5                 boot       1       2       2    closed/syncd  N/A
hd6                 paging     33      66      2    open/syncd    N/A
hd8                 jfs2log    1       2       2    open/syncd    N/A
hd4                 jfs2       40      80      2    open/syncd    /
hd2                 jfs2       10      20      2    open/syncd    /usr
hd9var              jfs2       10      20      2    open/syncd    /var
hd3                 jfs2       20      40      2    open/syncd    /tmp
hd1                 jfs2       10      20      2    open/syncd    /home
hd10opt             jfs2       196     392     2    open/syncd    /opt
hd11admin           jfs2       10      20      2    open/syncd    /admin
fwdump              jfs2       3       6       2    open/syncd    /var/adm/ras/platform
lg_dumplv           sysdump    16      16      1    open/syncd    N/A
livedump            jfs2       1       2       2    open/syncd    /var/adm/ras/livedump
fslv00              jfs2       40      80      2    closed/syncd  /u01