首页 > 代码库 > 使用dd命令复制ASM磁盘的spfile

使用dd命令复制ASM磁盘的spfile

通过下面sql查询参数文件在ASM磁盘中的AU分布

SELECT x1.file_number,
       x1.name,
       x2.GROUP_KFFXP,
       x2.DISK_KFFXP,
       x2.AU_KFFXP,
       x3.path
  FROM (SELECT *
          FROM (SELECT t1.GROUP_NUMBER, t1.FILE_NUMBER, t2.NAME, rownum AS rn
                  FROM v$asm_file t1
                  LEFT JOIN v$asm_alias t2
                    ON t1.FILE_NUMBER = t2.FILE_NUMBER
                 WHERE t1.type = ‘PARAMETERFILE‘)
         WHERE rn = 1) x1
  JOIN x$kffxp x2
    ON x1.file_number = x2.number_kffxp
  JOIN v$asm_disk x3
    ON x3.GROUP_NUMBER = x2.GROUP_KFFXP
 18     AND x3.DISK_NUMBER = x2.disk_kffxp
 19  ;

FILE_NUMBER NAME		 GROUP_KFFXP DISK_KFFXP   AU_KFFXP PATH
----------- -------------------- ----------- ---------- ---------- ---------------
	265 spfileorcl.ora		   1	      0       1015 /dev/asm-diskb
	265 spfileorcl.ora		   1	      1       1018 /dev/asm-diskc

由于asm磁盘组是冗余方式,这里从其中一个disk复制即可

下面通过dd命令复制

[root@localhost ~]# dd if=/dev/asm-diskb skip=1015 of=/tmp/spfile01.ora bs=1024k count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.004159 seconds, 252 MB/s
[root@localhost ~]# strings /tmp/spfile01.ora 
orcl.__db_cache_size=96468992
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=150994944
orcl.__sga_target=268435456
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=155189248
orcl.__streams_pool_size=0
*.audit_file_dest=‘/u01/app/oracle/admin/orcl/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘+DATA/orcl/controlfile/current.260.855531771‘,‘+FRA/orcl
/controlfile/current.256.855531771‘
*.db_block_size=8192
*.db_create_file_dest=‘+DATA‘
*.db_domain=‘‘
*.db_name=‘orcl‘
*.db_recovery_file_dest=‘+FRA‘
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest=‘/u01/app/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orclXDB)‘
*.memory_target=418381824
*.nls_language=‘SIMPLIFIED CHINESE‘
*.nls_territory=‘CHINA‘
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.undo_tablespace=‘UNDOTBS1‘


也可以根据下面命令dd,由于默认AU size为1M,块为8k, 也就是1个au 等于 1m/8k=128个快,因此如果按照Oracle快计算可知要跳过1015*(1m/8k)=129920个数据快,那么从1299920到后面的连续128个数据块就是参数文件内容了,然后dd如下

[root@localhost ~]# dd if=/dev/asm-diskb of=/tmp/spfile2.ora bs=8192 skip=129920 count=128 
128+0 records in
128+0 records out
1048576 bytes (1.0 MB) copied, 0.003003 seconds, 349 MB/s
[root@localhost ~]# strings /tmp/spfile2.ora 
orcl.__db_cache_size=96468992
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=150994944
orcl.__sga_target=268435456
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=155189248
orcl.__streams_pool_size=0
*.audit_file_dest=‘/u01/app/oracle/admin/orcl/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘+DATA/orcl/controlfile/current.260.855531771‘,‘+FRA/orcl
/controlfile/current.256.855531771‘
*.db_block_size=8192
*.db_create_file_dest=‘+DATA‘
*.db_domain=‘‘
*.db_name=‘orcl‘
*.db_recovery_file_dest=‘+FRA‘
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest=‘/u01/app/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orclXDB)‘
*.memory_target=418381824
*.nls_language=‘SIMPLIFIED CHINESE‘
*.nls_territory=‘CHINA‘
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.undo_tablespace=‘UNDOTBS1‘


可以看到两种dd方式内容一致。

下面是从disk /dev/asm-diskc中复制

[root@localhost ~]# dd if=/dev/asm-diskc of=/tmp/spfile3.ora bs=1024k skip=1018 count=1
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.05252 seconds, 20.0 MB/s
[root@localhost ~]# strings /tmp/spfile3.ora 
orcl.__db_cache_size=96468992
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=150994944
orcl.__sga_target=268435456
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=155189248
orcl.__streams_pool_size=0
*.audit_file_dest=‘/u01/app/oracle/admin/orcl/adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_files=‘+DATA/orcl/controlfile/current.260.855531771‘,‘+FRA/orcl
/controlfile/current.256.855531771‘
*.db_block_size=8192
*.db_create_file_dest=‘+DATA‘
*.db_domain=‘‘
*.db_name=‘orcl‘
*.db_recovery_file_dest=‘+FRA‘
*.db_recovery_file_dest_size=4070572032
*.diagnostic_dest=‘/u01/app/oracle‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=orclXDB)‘
*.memory_target=418381824
*.nls_language=‘SIMPLIFIED CHINESE‘
*.nls_territory=‘CHINA‘
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.undo_tablespace=‘UNDOTBS1‘


本文出自 “专注于Oracle性能调优” 博客,谢绝转载!

使用dd命令复制ASM磁盘的spfile