The disk group compatibility attributes for existing disk groups can be altered using the SET ATTRIBUTE clause to the ALTER DISKGROUP command.CREATE DISKGROUP data DISK '/dev/raw/*' ATTRIBUTE 'compatible.asm' = '11.1'; CREATE DISKGROUP data DISK '/dev/raw/*' ATTRIBUTE 'compatible.rdbms' = '11.1', 'compatible.asm' = '11.1';
The current compatibility settings are available from the V$ASM_DISKGROUP and V$ASM_ATTRIBUTE views.ALTER DISKGROUP data SET ATTRIBUTE 'compatible.asm' = '11.1'; ALTER DISKGROUP data SET ATTRIBUTE 'compatible.rdbms' = '11.1';
COLUMN name FORMAT A10 COLUMN compatibility FORMAT A20 COLUMN database_compatibility FORMAT A20 SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup; GROUP_NUMBER NAME COMPATIBILITY DATABASE_COMPATIBILI ------------ ---------- -------------------- -------------------- 1 DATA 11.1.0.0.0 11.1.0.0.0 1 row selected. SQL> COLUMN name FORMAT A20 COLUMN value FORMAT A20 SELECT group_number, name, value FROM v$asm_attribute ORDER BY group_number, name; GROUP_NUMBER NAME VALUE ------------ -------------------- -------------------- 1 au_size 1048576 1 compatible.asm 11.1.0.0.0 1 compatible.rdbms 11.1 1 disk_repair_time 3.6h 4 rows selected. SQL>
ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'compatible.asm' = '11.1'; ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'compatible.rdbms' = '11.1;
The DROP AFTER clause of the ALTER DISKGROUP command is used to override the disk group default DISK_REPAIR_TIME.-- Set using the hours unit of time. ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '4.5h'; -- Set using the minutes unit of time. ALTER DISKGROUP disk_group_1 SET ATTRIBUTE 'disk_repair_time' = '300m';
If a disk goes offline during a rolling upgrade, the timer is not started until after the rolling upgrade is complete.-- Use the default DISK_REPAIR_TIME for the diskgroup. ALTER DISKGROUP disk_group_1 OFFLINE DISK D1_0001; -- Override the default DISK_REPAIR_TIME. ALTER DISKGROUP disk_group_1 OFFLINE DISK D1_0001 DROP AFTER 30m;
Once the cluster is in rolling upgrade mode each node in turn can be shutdown, upgraded and started. The cluster runs in a mixed version environment until the upgrade is complete. In this state, the cluster is limited to the following operations:ALTER SYSTEM START ROLLING MIGRATION TO 11.2.0.0.0;
Once the last node is upgraded, the rolling upgrade is stopped by issuing the following command, which checks all ASM instances are at the appropriate version, turns off rolling upgrade mode and restarts any pending rebalance operations.SELECT SYS_CONTEXT('sys_cluster_properties', 'cluster_state') FROM dual;
Restrictions and miscellaneous points about the rolling upgrade process include:ALTER SYSTEM STOP ROLLING MIGRATION;
Next, create a new user in the ASM instance and grant it the SYSASM privilege. The user is now able to connect using SYSASM.$ export ORACLE_SID=+ASM $ sqlplus / as sysasm
Alternatively, assigning an operating system user to the OSASM group (asmadmin) allows then to connect as SYSASM using OS authentication. The following example creates a new OS user assigned to the OSASM group (asmadmin), which is immediately able to connect using SYSASM.SQL> CREATE USER asm_user_1 IDENTIFIED by asm_password; User created. SQL> GRANT SYSASM TO asm_user_1; Grant succeeded. SQL> CONN asm_user_1/asm_password AS SYSASM Connected. SQL>
# useradd tim_hall -G asmadmin # su - tim_hall $ export ORACLE_SID=+ASM $ export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 $ $ORACLE_HOME/bin/sqlplus / as sysasm SQL*Plus: Release 11.1.0.6.0 - Production on Fri Aug 8 16:48:37 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
The combination of expanding extent sizes and larger allocation units should result in increased I/O performance for very large databases.CREATE DISKGROUP disk_group_2 EXTERNAL REDUNDANCY DISK '/dev/sde1' ATRRIBUTE 'au_size' = '32M';
The usage notes for each command is available by issuing the "help$ asmcmd -p ASMCMD [+] >
An example of the output from the basic command and the "-k" option are shown below.lsdsk [-ksptcgHI] [-d] [pattern]
The cp command allows files to be copied between ASM and local or remote destinations. The summary usage is shown below.ASMCMD [+] > lsdsk Path /dev/sdc1 /dev/sdd1 /dev/sde1 ASMCMD [+] > lsdsk -d data -k Total_MB Free_MB OS_MB Name Failgroup Library Label UDID Product Redund Path 8189 6961 8189 DATA_0000 DATA_0000 System UNKNOWN /dev/sdc1 8189 6961 8189 DATA_0001 DATA_0001 System UNKNOWN /dev/sdd1 8189 6950 8189 DATA_0002 DATA_0002 System UNKNOWN /dev/sde1 ASMCMD [+] >
The following example copies the current USERS datafile from ASM to the local file system.cp [-ifr] <[\@connect_identifier:]src> <[\@connect_identifier:]tgt>
There seems to be some concern that the cp command doesn't work for control files (here).ASMCMD [+] > cp +DATA/db11g/datafile/users.273.661514191 /tmp/users.dbf source +DATA/db11g/datafile/users.273.661514191 target /tmp/users.dbf copying file(s)... file, /tmp/users.dbf, copy committed. ASMCMD [+] >
An example of the command is shown below. The resulting file contains all the metadata needed to recreate the ASM setup.md_backup [-b location_of_backup] [-g dgname [-g dgname …]]
The md_restore command allows you to restore a disk group from the metadata created by the md_backup command. It also allows a certain amount of manipulation of the final disk groups during the restore. The summary usage is shown below.ASMCMD [+] > md_backup -b /tmp/backup.txt -g data Disk group to be backed up: DATA ASMCMD [+] >
A straight restore of the backup shown previously is shown below.md_restore -b[-li] [-t (full)|nodg|newdg] [-f ] [-g ' , ,...'] [-o ' : ,...']
The remap command repairs a range of physical blocks on disk. The contents of each block is not validated, so only blocks exhibiting read errors are repaired. The summary usage is shown below.ASMCMD [+] > md_restore -b /tmp/backup.txt -t full -g data
An example of the command is show below.remap
For detailed usage information see the ASMCDM Command Reference.ASMCMD [+] > remap data data_0001 5000-5999
SELECT name, failgroup FROM v$asm_disk; NAME FAILGROUP ------------------------------ ------------------------------ DATA_0000 DATA_0000 DATA_0001 DATA_0001 DATA_0002 DATA_0002 3 rows selected. SQL> ALTER SYSTEM SET ASM_PREFERRED_READ_FAILURE_GROUPS = 'data.data_0000', 'data.data_0001', 'data.data_0002';
In a RAC environment, a disk group mounted in RESTRICTED mode can only be accessed by a single instance. The restricted disk group is not available to any ASM clients, even on the node where it is mounted.SQL> SELECT name FROM v$asm_diskgroup; NAME ------------------------------ DATA SQL> ALTER DISKGROUP data DISMOUNT; Diskgroup altered. SQL> ALTER DISKGROUP data MOUNT RESTRICTED; Diskgroup altered. SQL> ALTER DISKGROUP data DISMOUNT; Diskgroup altered. SQL> ALTER DISKGROUP data MOUNT; Diskgroup altered. SQL>
ALTER DISKGROUP data CHECK; -- Like NOREPAIR ALTER DISKGROUP data CHECK NOREPAIR; ALTER DISKGROUP data CHECK REPAIR;
-- Individual disks. ALTER DISKGROUP data OFFLINE DISK 'disk_0000', 'disk_0001'; ALTER DISKGROUP data ONLINE DISK 'disk_0000', 'disk_0001'; -- Failure groups. ALTER DISKGROUP data OFFLINE DISKS IN FAILGROUP 'fg_0000'; ALTER DISKGROUP data ONLINE DISKS IN FAILGROUP 'fg_0000'; -- Bring online all disks in disk group. ALTER DISKGROUP data ONLINE ALL;
DROP DISKGROUP data FORCE;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7199859/viewspace-695519/,如需转载,请注明出处,否则将追究法律责任。