分类: Oracle
2009-09-22 13:38:21
INSTANCE_TYPE
- Set to ASM or RDBMS depending on the instance type. The default is RDBMS.DB_UNIQUE_NAME
- Specifies a globally unique name for the database. This defaults to
+ASM but must be altered if you intend to run multiple ASM instances.ASM_POWER_LIMIT
-The maximum power for a rebalancing operation on an ASM instance. The
valid values range from 1 to 11, with 1 being the default. The higher
the limit the more resources are allocated resulting in faster
rebalancing operations. This value is also used as the default when the
POWER
clause is omitted from a rebalance operation.ASM_DISKGROUPS
- The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER DISKGROUP ALL MOUNT
statement. ASM configuration changes are automatically reflected in this parameter.ASM_DISKSTRING
- Specifies a value that can be used to limit the disks considered for
discovery. Altering the default value may improve the speed of disk
group mount time and the speed of adding a disk to a disk group.
Changing the parameter to a value which prevents the discovery of
already mounted disks results in an error. The default value is NULL
allowing all suitable disks to be considered.Next, using SQL*Plus connect to the ide instance.INSTANCE_TYPE=ASM
Create an spfile using the contents of the init+ASM.ora file.export ORACLE_SID=+ASM
sqlplus / as sysdba
Finally, start the instance with theSQL> CREATE SPFILE FROM PFILE='/tmp/init+ASM.ora';
File created.
NOMOUNT
option.The ASM instance is now ready to use for creating and mounting disk groups. To shutdown the ASM instance issue the following command.SQL> startup nomount
ASM instance started
Total System Global Area 125829120 bytes
Fixed Size 1301456 bytes
Variable Size 124527664 bytes
Database Buffers 0 bytes
Redo Buffers 0 bytes
SQL>
Once an ASM instance is present disk groups can be used for the following parameters in database instances (SQL> shutdown
ASM instance shutdown
SQL>
INSTANCE_TYPE=RDBMS
) to allow ASM file creation:DB_CREATE_FILE_DEST
DB_CREATE_ONLINE_LOG_DEST_n
DB_RECOVERY_FILE_DEST
CONTROL_FILES
LOG_ARCHIVE_DEST_n
LOG_ARCHIVE_DEST
STANDBY_ARCHIVE_DEST
STARTUP
command are:FORCE
- Performs a SHUTDOWN ABORT
before restarting the ASM instance.MOUNT
- Starts the ASM instance and mounts the disk groups specified by the ASM_DISKGROUPS
parameter.NOMOUNT
- Starts the ASM instance without mounting any disk groups.OPEN
- This is not a valid option for an ASM instance.SHUTDOWN
command are:NORMAL
- The ASM instance waits for all connected ASM instances and SQL sessions to exit then shuts down.IMMEDIATE
- The ASM instance waits for any SQL transactions to complete then shuts down. It doesn't wait for sessions to exit.TRANSACTIONAL
- Same as IMMEDIATE
.ABORT
- The ASM instance shuts down instantly.CREATE DISKGROUP
statement. This statement allows you to specify the level of redundancy:NORMAL REDUNDANCY
- Two-way mirroring, requiring two failure groups.HIGH REDUNDANCY
- Three-way mirroring, requiring three failure groups.EXTERNAL REDUNDANCY
- No mirroring for disks that are already protected using hardware mirroring or RAID.NAME
clause is omitted the disks are given a system
generated name like "disk_group_1_0001". The FORCE
option can be used to move a disk from another disk group into this one.Disk groups can be deleted using theCREATE DISKGROUP disk_group_1 NORMAL REDUNDANCY
FAILGROUP failure_group_1 DISK
'/devices/diska1' NAME diska1,
'/devices/diska2' NAME diska2,
FAILGROUP failure_group_2 DISK
'/devices/diskb1' NAME diskb1,
'/devices/diskb2' NAME diskb2;
DROP DISKGROUP
statement.Disks can be added or removed from disk groups using theDROP DISKGROUP disk_group_1 INCLUDING CONTENTS;
ALTER DISKGROUP
statement. Remember that the wildcard "*" can be used to reference disks so long
as the resulting string does not match a disk already used by an existing disk group.Disks can be resized using the-- Add disks.
ALTER DISKGROUP disk_group_1 ADD DISK
'/devices/disk*3',
'/devices/disk*4';
-- Drop a disk.
ALTER DISKGROUP disk_group_1 DROP DISK diska2;
RESIZE
clause of the ALTER DISKGROUP
statement. The statement can be used to resize individual disks, all disks
in a failure group or all disks in the disk group. If the SIZE
clause is omitted the disks are resized to the size of the disk returned by the OS.The-- Resize a specific disk.
ALTER DISKGROUP disk_group_1
RESIZE DISK diska1 SIZE 100G;
-- Resize all disks in a failure group.
ALTER DISKGROUP disk_group_1
RESIZE DISKS IN FAILGROUP failure_group_1 SIZE 100G;
-- Resize all disks in a disk group.
ALTER DISKGROUP disk_group_1
RESIZE ALL SIZE 100G;
UNDROP DISKS
clause of the ALTER DISKGROUP
statement allows pending disk drops to be undone. It will not revert drops that have completed, or
disk drops associated with the dropping of a disk group.Disk groups can be rebalanced manually using theALTER DISKGROUP disk_group_1 UNDROP DISKS;
REBALANCE
clause of the ALTER DISKGROUP
statement.If the POWER
clause is omitted
the ASM_POWER_LIMIT
parameter value is used. Rebalancing is only needed when the speed of the automatic rebalancing is not appropriate.
Disk groups are mounted at ASM instance startup and unmounted at ASM instance shutdown. Manual mounting and dismounting can be accomplished using theALTER DISKGROUP disk_group_1 REBALANCE POWER 5;
ALTER DISKGROUP
statement
as seen below.ALTER DISKGROUP ALL DISMOUNT;
ALTER DISKGROUP ALL MOUNT;
ALTER DISKGROUP disk_group_1 DISMOUNT;
ALTER DISKGROUP disk_group_1 MOUNT;
Available attributes include:-- Create a new template.
ALTER DISKGROUP disk_group_1 ADD TEMPLATE my_template ATTRIBUTES (MIRROR FINE);
-- Modify template.
ALTER DISKGROUP disk_group_1 ALTER TEMPLATE my_template ATTRIBUTES (COARSE);
-- Drop template.
ALTER DISKGROUP disk_group_1 DROP TEMPLATE my_template;
ALTER DISKGROUP
statement to support ASM file aliasing. The following examples show how ASM directories
can be created, modified and deleted.-- Create a directory.
ALTER DISKGROUP disk_group_1 ADD DIRECTORY '+disk_group_1/my_dir';
-- Rename a directory.
ALTER DISKGROUP disk_group_1 RENAME DIRECTORY '+disk_group_1/my_dir' TO '+disk_group_1/my_dir_2';
-- Delete a directory and all its contents.
ALTER DISKGROUP disk_group_1 DROP DIRECTORY '+disk_group_1/my_dir_2' FORCE;
Attempting to drop a system alias results in an error.-- Create an alias using the fully qualified filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file.dbf'
FOR '+disk_group_1/mydb/datafile/my_ts.342.3';
-- Create an alias using the numeric form filename.
ALTER DISKGROUP disk_group_1 ADD ALIAS '+disk_group_1/my_dir/my_file.dbf'
FOR '+disk_group_1.342.3';
-- Rename an alias.
ALTER DISKGROUP disk_group_1 RENAME ALIAS '+disk_group_1/my_dir/my_file.dbf'
TO '+disk_group_1/my_dir/my_file2.dbf';
-- Delete an alias.
ALTER DISKGROUP disk_group_1 DELETE ALIAS '+disk_group_1/my_dir/my_file.dbf';
-- Drop file using an alias.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/my_dir/my_file.dbf';
-- Drop file using a numeric form filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1.342.3';
-- Drop file using a fully qualified filename.
ALTER DISKGROUP disk_group_1 DROP FILE '+disk_group_1/mydb/datafile/my_ts.342.3';
CHECK
clause of the ALTER DISKGROUP
statement.-- Check metadata for a specific disk in the disk group. ALTER DISKGROUP disk_group_1 CHECK DISK diska1; -- Check metadata for all disks in the disk group. ALTER DISKGROUP disk_group_1 CHECK ALL;-- Check metadata for a specific file.
ALTER DISKGROUP disk_group_1 CHECK FILE '+disk_group_1/my_dir/my_file.dbf'
-- Check metadata for a specific failure group in the disk group.
ALTER DISKGROUP disk_group_1 CHECK FAILGROUP failure_group_1;
V$ASM_%
views, which often contain different information depending on whether they are queried from the
ASM instance, or a dependant database instance.View | ASM Instance | DB Instance |
V$ASM_ALIAS |
Displays a row for each alias present in every disk group mounted by the ASM instance. | Returns no rows |
V$ASM_CLIENT |
Displays a row for each database instance using a disk group managed by the ASM instance. | Displays a row for the ASM instance if the database has open ASM files. |
V$ASM_DISK |
Displays a row for each disk discovered by the ASM instance, including disks which are not part of any disk group. | Displays a row for each disk in disk groups in use by the database instance. |
V$ASM_DISKGROUP |
Displays a row for each disk group discovered by the ASM instance. | Displays a row for each disk group mounted by the local ASM instance. |
V$ASM_FILE |
Displays a row for each file for each disk group mounted by the ASM instance. | Displays no rows. |
V$ASM_OPERATION |
Displays a row for each file for each long running operation executing in the ASM instance. | Displays no rows. |
V$ASM_TEMPLATE |
Displays a row for each template present in each disk group mounted by the ASM instance. | Displays a row for each template present in each disk group mounted by the ASM instance with which the database instance communicates. |
Filename Type | Format |
Fully Qualified ASM Filename | +dgroup/dbname/file_type/file_type_tag.file.incarnation |
Numeric ASM Filename | +dgroup.file.incarnation |
Alias ASM Filenames | +dgroup/directory/filename |
Alias ASM Filename with Template | +dgroup(template)/alias |
Incomplete ASM Filename | +dgroup |
Incomplete ASM Filename with Template | +dgroup(template) |
disk_group_1
disk group.CREATE TABLESPACE my_ts DATAFILE '+disk_group_1' SIZE 100M AUTOEXTEND ON;
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
SQL> SHUTDOWN IMMEDIATE
DB_CREATE_FILE_DEST
and DB_CREATE_ONLINE_LOG_DEST_n
parameters to the relevant ASM disk groups.CONTROL_FILES
parameter from the spfile so the control files will be moved to the DB_CREATE_*
destination and the
spfile gets updated automatically. If you are using a pfile the CONTROL_FILES
parameter must be set to the appropriate ASM files or aliases.RMAN> STARTUP NOMOUNT
RMAN> RESTORE CONTROLFILE FROM 'old_control_file_name';
RMAN> ALTER DATABASE MOUNT;
RMAN> BACKUP AS COPY DATABASE FORMAT '+disk_group';
RMAN> SWITCH DATABASE TO COPY;
RMAN> ALTER DATABASE OPEN;
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
chinaunix网友2009-10-12 14:57:03
10.使用好在页头中的标签,这个挺有效果。也是最重要的。 本人作品,大家可以给点建议。 1. 公司注册网 http://www.51zhuce.net 2.上海公司注册网 http://www.51gongsizhuce.com/ 3.外资公司注册网 http://www.zhucewaizi.com 4.代表处注册网 http://www.shdbc.com 5.上海企业注册网 http://www.shanghaizhuce.com