Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » ASM

asmcmd之模板管理

ASMCMD Template Management Commands(模板管理),通过模板我们可以定制不同文件类型的属性比如冗余度,条带粒度,ASM primary/seconday extent放置的区域,我们也可以创建新的模板。主要有以下命令:chtmpl, lstmpl, mktmpl, rmtmpl

11g ASM默认AU,blocksize,条带宽度,条带大小
_asm_stripewidth   8          ASM file stripe width
_asm_stripesize    131072     ASM file stripe size
_asm_ausize        1048576    allocation unit size
_asm_blksize       4096       metadata block size

条带化有2种选择,coarse(粗粒度条带化),fine(细粒度条带化)
在粗粒度条带下,条带宽度、条带大小不可改变。条带宽度将一直是1,条带大小等同于AU大小
在细粒度条带下,条带宽度、条带大小可使用_asm_stripesize和_asm_stripewidth两个隐藏参数调节
建议日志文件采用细粒度条带化,数据库文件和其他文件选择粗粒度条带化

lstmpl 列出指定磁盘组的模板属性
Lists all templates or the templates for a specified disk group.
        lstmpl [-l] [--suppressheader] [-G diskgroup] [pattern]
        The options for the lstmpl command are described below.

        -G diskgroup     - Specifies disk group name.
        --suppressheader - Suppresses column headings.
        -l               - Displays all details.
        pattern          - Displays the templates that match pattern expression.
ASMCMD> lstmpl -l -G data_pgold
Group_Name  Group_Num  Name              Stripe  Sys  Redund  PriReg  MirrReg  
DATA_PGOLD  1          ARCHIVELOG        COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          ASMPARAMETERFILE  COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          AUTOBACKUP        COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          BACKUPSET         COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          CHANGETRACKING    COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          CONTROLFILE       FINE    Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          DATAFILE          COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          DATAGUARDCONFIG   COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          DUMPSET           COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          FLASHBACK         COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          FLASHFILE         COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          OCRFILE           COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          ONLINELOG         COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          PARAMETERFILE     COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          TEMPFILE          COARSE  Y    UNPROT  COLD    COLD     
DATA_PGOLD  1          XTRANSPORT        COARSE  Y    UNPROT  COLD    COLD     
ASMCMD>

ASMCMD> lstmpl -G systemdg -l
Group_Name  Group_Num  Name              Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          ARCHIVELOG        COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          ASMPARAMETERFILE  COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          AUTOBACKUP        COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          BACKUPSET         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          CHANGETRACKING    COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          CONTROLFILE       FINE    Y    HIGH    COLD    COLD     
SYSTEMDG    3          DATAFILE          COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          DATAGUARDCONFIG   COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          DUMPSET           COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          FLASHBACK         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          FLASHFILE         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          OCRFILE           COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          ONLINELOG         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          PARAMETERFILE     COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          TEMPFILE          COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          XTRANSPORT        COARSE  Y    MIRROR  COLD    COLD     
ASMCMD>        

ASMCMD> lstmpl -G systemdg -l controlfile
Group_Name  Group_Num  Name         Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          CONTROLFILE  FINE    Y    HIGH    COLD    COLD     
ASMCMD>

chtmpl 修改模板的属性,要根据实际情况去设定,如果你是external模式,想修改--redundancy为mirror会失败
Changes the attributes of a template.
        chtmpl -G diskgroup { [--striping {coarse|fine}] [--redundancy {high|mirror|unprotected} ] [--primary {hot|cold}] [--secondary {hot|cold}]} template

        The options for the chtmpl command are described below.

        -G diskgroup                    - Name of the disk group.
        template                        - Name of the template to change.
        --striping {coarse | fine}      - Striping specification, either
                                          coarse or fine.
        --redundancy { high | mirror | unprotected} - Redundancy specification,
                                          either high, mirror, or unprotected.
        --primary { hot | cold }        - Intelligent Data Placement
                                          specification for primary extents,
                                          either hot or cold region.
        --secondary { hot | cold }      - Intelligent Data Placement
                                          specification for secondary extents,
                                          either hot or cold region.
ASMCMD> lstmpl -G systemdg -l controlfile
Group_Name  Group_Num  Name         Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          CONTROLFILE  FINE    Y    HIGH    COLD    COLD     
ASMCMD> chtmpl --redundancy high  --striping fine --primary hot --secondary cold datafile -G systemdg
ASMCMD> lstmpl -G systemdg -l datafile
Group_Name  Group_Num  Name      Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          DATAFILE  FINE    Y    HIGH    HOT     COLD     
ASMCMD>

ASMCMD> chtmpl --redundancy mirror --striping fine --primary hot --secondary cold datafile -G ohsdba
ORA-15067: command or option incompatible with diskgroup redundancy (DBD ERROR: OCIStmtExecute)

mktmpl 增加一个模板,可以定制属性,使用定制模板
Adds a template to a disk group.
        mktmpl -G diskgroup [--striping {coarse|fine}][--redundancy {high|mirror|unprotected} ] [--primary {hot|cold}][--secondary {hot|cold}] template

        The options for the mktmpl command are described below.

        -G diskgroup    - Name of the disk group.
        template        - Name of the template to create.
        --striping {coarse | fine}      - Striping specification,
                          either coarse or fine.
        --redundancy { high | mirror | unprotected}     - Redundancy
                          specification, either high, mirror, or unprotected.
        --primary { hot | cold }        - Intelligent Data Placement
                          specification for primary extents, either
                          hot or cold region.
        --secondary { hot | cold }      - Intelligent Data Placement
                          specification for secondary extents, either
                          hot or cold region.

        The following is an example of the mktmpl command that add
ASMCMD> lsattr -G systemdg -l
Name                     Value       
access_control.enabled   FALSE       
access_control.umask     066         
au_size                  1048576     
cell.smart_scan_capable  FALSE       
compatible.asm           11.2.0.0.0  
compatible.rdbms         11.2        
disk_repair_time         3.6h        
sector_size              512         
ASMCMD> mktmpl -G systemdg --redundancy high --striping fine --primary hot --secondary cold mytemplate
ASMCMD> lstmpl -G systemdg -l
Group_Name  Group_Num  Name              Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          ARCHIVELOG        COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          ASMPARAMETERFILE  COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          AUTOBACKUP        COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          BACKUPSET         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          CHANGETRACKING    COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          CONTROLFILE       FINE    Y    HIGH    COLD    COLD     
SYSTEMDG    3          DATAFILE          FINE    Y    HIGH    HOT     COLD     
SYSTEMDG    3          DATAGUARDCONFIG   COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          DUMPSET           COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          FLASHBACK         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          FLASHFILE         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          MYTEMPLATE        FINE    N    HIGH    HOT     COLD     
SYSTEMDG    3          OCRFILE           COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          ONLINELOG         COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          PARAMETERFILE     COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          TEMPFILE          COARSE  Y    MIRROR  COLD    COLD     
SYSTEMDG    3          XTRANSPORT        COARSE  Y    MIRROR  COLD    COLD     
ASMCMD>

SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string
SQL> alter systme set db_create_file_dest=+systemdg(mytemplate)


SQL> alter system set db_create_file_dest='+systemdg(mytemplate)';

System altered.

SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string      +systemdg(mytemplate)
SQL>
SQL> create tablespace mktmpl_test;
Tablespace created.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
+DATA_PGOLD/pgold/system01.dbf
+DATA_PGOLD/pgold/sysaux01.dbf
+DATA_PGOLD/pgold/undotbs01.dbf
+DATA_PGOLD/pgold/users01.dbf
+DATA_PGOLD/pgold/undotbs02.dbf
+DATA_PGOLD/pgold/datafile/ohsdba.269.911599547
+SYSTEMDG/pgold/datafile/mktmpl_test.257.911835397
7 rows selected.
SQL> ASMCMD> pwd +systemdg/pgold/DATAFILE ASMCMD> ls -l Type      Redund  Striped  Time             Sys  Name DATAFILE  HIGH    FINE     MAY 14 15:00:00  Y    MKTMPL_TEST.257.911835397 ASMCMD>  也可以使用create tablespace mktmpl_test datafile '+DATA_PGOLD(mytemplate)';

rmtmpl 移除模板
        Removes a template from a disk group.
        rmtmpl -G diskgroup template
        The options for the rmtmpl command are described below.

        -G diskgroup    - Name of the disk group.
        template        - Name of the template to delete.

        The following is an example of the rmtmpl command that removes the
        mytemplate template from the DATA disk group.

        ASMCMD [+]>rmtmpl -G DATA mytemplate

ASMCMD>
ASMCMD> lstmpl -G systemdg -l %my%
Group_Name  Group_Num  Name        Stripe  Sys  Redund  PriReg  MirrReg  
SYSTEMDG    3          MYTEMPLATE  FINE    N    HIGH    HOT     COLD     
ASMCMD> rmtmpl -G systemdg mytemplate
ASMCMD> lstmpl -G systemdg -l %my%
Group_Name  Group_Num  Name  Stripe  Sys  Redund  PriReg  MirrReg  
ASMCMD>

ASM隐含参数查询
col name for a38
col value for a10
col describ for a70
set lines 156 pages 10000
SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ
FROM SYS.x$ksppi x, SYS.x$ksppcv y
WHERE x.indx = y.indx AND x.ksppinm LIKE '%_asm%';  

NAME                                   VALUE      DESCRIB
-------------------------------------- ---------- ----------------------------------------------------------------------
_lm_asm_enq_hashing                    TRUE       if TRUE makes ASM use enqueue master hashing for fusion locks
_ges_diagnostics_asm_dump_level        11         systemstate level on global enqueue diagnostics blocked by ASM
_asm_runtime_capability_volume_support FALSE      runtime capability for volume support returns supported
_asm_disable_multiple_instance_check   FALSE      Disable checking for multiple ASM instances on a given node
_asm_disable_amdu_dump                 FALSE      Disable AMDU dump
_asmsid                                asm        ASM instance id
_asm_allow_system_alias_rename         FALSE      if system alias renaming is allowed
_asm_instlock_quota                    0          ASM Instance Lock Quota
_asm_disk_repair_time                  14400      seconds to wait before dropping a failing disk
_asm_disable_profilediscovery          FALSE      disable profile query for discovery
_asm_imbalance_tolerance               3          hundredths of a percentage of inter-disk imbalance to tolerate
_asm_shadow_cycle                      3          Inverse shadow cycle requirement
_asm_primary_load_cycles               TRUE       True if primary load is in cycles, false if extent counts
_asm_primary_load                      1          Number of cycles/extents to load for non-mirrored files
_asm_secondary_load_cycles             FALSE      True if secondary load is in cycles, false if extent counts
_asm_secondary_load                    10000      Number of cycles/extents to load for mirrored files
_asm_log_scale_rebalance               FALSE      Rebalance power uses logarithmic scale
_asm_sync_rebalance                    FALSE      Rebalance uses sync I/O
_asm_ausize                            1048576    allocation unit size
_asm_blksize                           4096       metadata block size
_asm_acd_chunks                        1          initial ACD chunks created
_asm_partner_target_disk_part          8          target maximum number of disk partners for repartnering
_asm_partner_target_fg_rel             4          target maximum number of failure group relationships for repartnering
_asm_automatic_rezone                  TRUE       automatically rebalance free space across zones
_asm_rebalance_plan_size               120        maximum rebalance work unit
_asm_rebalance_space_errors            4          number of out of space errors allowed before aborting rebalance
_asm_libraries                         ufs        library search order for discovery
_asm_maxio                             1048576    Maximum size of individual I/O request
_asm_allow_only_raw_disks              TRUE       Discovery only raw devices
_asm_fob_tac_frequency                 9          Timeout frequency for FOB cleanup
_asm_emulate_nfs_disk                  FALSE      Emulate NFS disk test event
_asmlib_test                           0          Osmlib test event
_asm_allow_lvm_resilvering             TRUE       Enable disk resilvering for external redundancy
_asm_lsod_bucket_size                  13         ASM lsod bucket size
_asm_iostat_latch_count                31         ASM I/O statistics latch count
_asm_disable_smr_creation              FALSE      Do Not create smr
_asm_wait_time                         18         Max/imum time to wait before asmb exits
_asm_skip_resize_check                 FALSE      skip the checking of the clients for s/w compatibility for resize
_asm_skip_rename_check                 FALSE      skip the checking of the clients for s/w compatibility for rename
_asm_direct_con_expire_time            120        Expire time for idle direct connection to ASM instance
_asm_check_for_misbehaving_cf_clients  FALSE      check for misbehaving CF-holding clients
_asm_diag_dead_clients                 FALSE      diagnostics for dead clients
_asm_reserve_slaves                    TRUE       reserve ASM slaves for CF txns
_asm_kill_unresponsive_clients         TRUE       kill unresponsive ASM clients
_asm_disable_async_msgs                FALSE      disable async intra-instance messaging
_asm_stripewidth                       8          ASM file stripe width
_asm_stripesize                        131072     ASM file stripe size
_asm_random_zone                       FALSE      Random zones for new files
_asm_serialize_volume_rebalance        FALSE      Serialize volume rebalance
_asm_force_quiesce                     FALSE      Force diskgroup quiescing
_asm_dba_threshold                     0          ASM Disk Based Allocation Threshold
_asm_dba_batch                         500000     ASM Disk Based Allocation Max Batch Size
_asm_usd_batch                         64         ASM USD Update Max Batch Size
_asm_fail_random_rx                    FALSE      Randomly fail some RX enqueue gets
_asm_max_redo_buffer_size              2097152    asm maximum redo buffer size
_asm_max_cod_strides                   5          maximum number of COD strides
_asm_kfioevent                         0          KFIO event
_asm_evenread                          0          ASM Even Read level
_asm_evenread_alpha                    0          ASM Even Read Alpha
_asm_evenread_alpha2                   0          ASM Even Read Second Alpha
_asm_evenread_faststart                0          ASM Even Read Fast Start Threshold
_asm_dbmsdg_nohdrchk                   FALSE      dbms_diskgroup.checkfile does not check block headers
_asm_root_directory                    ASM        ASM default root directory
_asm_hbeatiowait                       15         number of secs to wait for PST Async Hbeat IO return
_asm_hbeatwaitquantum                  2          quantum used to compute time-to-wait for a PST Hbeat check
_asm_repairquantum                     60         quantum (in 3s) used to compute elapsed time for disk drop
_asm_emulmax                           10000      max number of concurrent disks to emulate I/O errors
_asm_emultimeout                       0          timeout before emulation begins (in 3s ticks)
_asm_kfdpevent                         0          KFDP event
_asm_storagemaysplit                   FALSE      PST Split Possible
_asm_avoid_pst_scans                   TRUE       Avoid PST Scans
_asm_compatibility                     10.1       default ASM compatibility level
_asm_admin_with_sysdba                 FALSE      Does the sysdba role have administrative privileges on ASM?
_asm_allow_appliance_dropdisk_noforce  FALSE      Allow DROP DISK/FAILUREGROUP NOFORCE on ASM Appliances
_asm_appliance_config_file                        Appliance configuration file name

75 rows selected.

SQL> 

Reference
http://docs.oracle.com/cd/B14117_01/server.101/b10739/storeman.htm
http://docs.oracle.com/cd/B19306_01/server.102/b14231/storeman.htm#i1021337
http://docs.oracle.com/cd/B19306_01/server.102/b14215/asm_util.htm
http://docs.oracle.com/cd/E11882_01/server.112/e18951/asmcon.htm
http://docs.oracle.com/cd/E11882_01/server.112/e18951/asm_util001.htm
http://docs.oracle.com/database/121/OSTMG/GUID-34A732CD-CC55-4A25-982A-209FDF6134BE.htm
http://docs.oracle.com/database/121/OSTMG/GUID-1E5C4FAD-087F-4598-B959-E66670804C4F.htm
http://docs.oracle.com/database/121/OSTMG/GUID-995198B7-9235-4FCF-988E-A48B3B62B405.htm
http://blog.itpub.net/321157/viewspace-740874/
 
关键词:asm 

相关文章

12c 如何将Standard ASM转化为Flex ASM
How to use amdu(ASM Metadata Dump Utility)
How to use kfed(Kernel Files metadata Editor)
How to use kfod(Kernel Files OSM Disk)
如何计算ASM磁盘头自动备份的位置
What is disk_repair_time?
Find block in ASM
12c新特性ASMFD
asmcmd之文件访问控制管理
asmcmd之卷管理
asmcmd之模板管理
asmcmd之磁盘组管理

联系我们

韩朝阳



    Phone:186-9589-1286

    E-mail:ohsdba@qq.com

    微  信: ohsdba


电话(186-9589-1286)

QQ(375349564)

微信(ohsdba)


常用链接

Oracle Database Upgrade

Oracle

eDelivery
My Oracle Support

Exadata 12.1 Document

Exadata 12.2 Document

Oracle 11gR2 Document

Oracle 12cR1 Document

Oracle 12cR2 Document

GoldenGate 12c

Oracle Fusion Middleware

Mysql Document

PostgreSQL

Python

github

sourceforge



Top
Cell186-9589-1286
QQ 375349564
E-mail ohsdba@qq.com