在数据库中使用asm

来源:互联网 发布:有限元软件在线培训 编辑:程序博客网 时间:2024/05/16 05:11

asm支持的文件类型


Table 12-6 File TypesSupported by Automatic Storage Management


File Type

Supported

Default Templates

Control files

yes

CONTROLFILE

Datafiles

yes

DATAFILE

Redo log files

yes

ONLINELOG

Archive log files

yes

ARCHIVELOG

Trace files

no

n/a

Temporary files

yes

TEMPFILE

Datafile backup pieces

yes

BACKUPSET

Datafile incremental backup pieces

yes

BACKUPSET

Archive log backup piece

yes

BACKUPSET

Datafile copy

yes

DATAFILE

Persistent initialization parameter file (SPFILE)

yes

PARAMETERFILE

Disaster recovery configurations

yes

DATAGUARDCONFIG

Flashback logs

yes

FLASHBACK

Change tracking file

yes

CHANGETRACKING

Data Pump dumpset

yes

DUMPSET

Automatically generated control file backup

yes

AUTOBACKUP

Cross-platform transportable datafiles

yes

XTRANSPORT

Operating system files

no

n/a


 在asm中创建表空间

Creating a Tablespace in ASM: Example 1

This example illustrates "out of the box" usage of Automatic Storage Management. You let Automatic Storage Management create and manage the tablespace datafile for you, using Oracle supplied defaults that are adequate for most situations.

Assume the following initialization parameter setting:

DB_CREATE_FILE_DEST = '+dgroup2'

The following statement creates the tablespace and its datafile:

CREATE TABLESPACE tspace2;

Creating a Tablespace in ASM: Example 2

The following statements create a tablespace that uses a user defined template (assume it has been defined) to specify the redundancy and striping attributes of the datafile:

SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST = '+dgroup1(my_template)';SQL> CREATE TABLESPACE tspace3;

Creating a Tablespace in ASM: Example 3

The following statement creates an undo tablespace with a datafile that has an alias name, and with attributes that are set by the user defined templatemy_undo_template. It assumes a directory has been created in disk groupdgroup3 to contain the alias name and that the user defined template exists. Because an alias is used to create the datafile, the file is not an Oracle-managed file and will not be automatically deleted when the tablespace is dropped.

CREATE UNDO TABLESPACE myundo      DATAFILE '+dgroup3(my_undo_template)/myfiles/my_undo_ts' SIZE 200M; 

The following statement drops the file manually after the tablespace has been dropped:

ALTER DISKGROUP dgroup3 DROP FILE '+dgroup3/myfiles/my_undo_ts';


Creating Redo Logs in ASM

Online redo logs can be created in multiple disk groups, either implicitly in the initialization parameter file or explicitly in anALTER DATABASE...ADD LOGFILE statement. Each online log should have one log member in multiple disk groups. The filenames for log file members are automatically generated.

All partially created redo log files, created as a result of a system error, are automatically deleted.

Adding New Redo Log Files: Example

The following example creates a log file with a member in each of the disk groupsdgroup1 and dgroup2.

The following parameter settings are included in the initialization parameter file:

DB_CREATE_ONLINE_LOG_DEST_1 = '+dgroup1'DB_CREATE_ONLINE_LOG_DEST_2 = '+dgroup2'

The following statement is issued at the SQL prompt:

ALTER DATABASE ADD LOGFILE;


Creating a Control File in ASM

Control files can be explicitly created in multiple disk groups. The filenames for control files are automatically generated. If an attempt to create a control file fails, partially created control files will be automatically be deleted.

There may be times when you need to specify a control file by name. Alias filenames are provided to allow administrators to reference ASM files with human-understandable names. The use of an alias in the specification of the control file during its creation allows the DBA to later refer to the control file with a human-meaningful name. Furthermore, an alias can be specified as a control file name in theCONTROL_FILES initialization parameter. Control files created without aliases can be given alias names at a later time. TheALTER DISKGROUP...CREATE ALIAS statement is used for this purpose.

When creating a control file, datafiles and log files stored in an ASM disk group should be given to theCREATE CONTROLFILE command using the file reference context form of their ASM filenames. However, the use of theRESETLOGS option requires the use of a file creation context form for the specification of the log files.

Creating a Control File in ASM: Example 1

The following CREATE CONTROLFILE statement is generated by anALTER DATABASE BACKUP CONTROLFILETO TRACE command for a database with datafiles and log files created on disk groupsdgroup1 and dgroup2:

CREATE CONTROLFILE REUSE DATABASE "SAMPLE" NORESETLOGS ARCHIVELOG    MAXLOGFILES 16    MAXLOGMEMBERS 2    MAXDATAFILES 30    MAXINSTANCES 1    MAXLOGHISTORY 226LOGFILE  GROUP 1 (    '+DGROUP1/db/onlinelog/group_1.258.541956457',    '+DGROUP2/db/onlinelog/group_1.256.541956473'  ) SIZE 100M,  GROUP 2 (    '+DGROUP1/db/onlinelog/group_2.257.541956477',    '+DGROUP2/db/onlinelog/group_2.258.541956487'  ) SIZE 100MDATAFILE  '+DGROUP1/db/datafile/system.260.541956497',  '+DGROUP1/db/datafile/sysaux.259.541956511'CHARACTER SET US7ASCII;

Creating a Control File in ASM: Example 2

This example is a CREATE CONTROLFILE statement for a database with datafiles, but uses aRESETLOGS clause, and thus uses the creation context form for log files:

CREATE CONTROLFILE REUSE DATABASE "SAMPLE" RESETLOGS ARCHIVELOG    MAXLOGFILES 16    MAXLOGMEMBERS 2    MAXDATAFILES 30    MAXINSTANCES 1    MAXLOGHISTORY 226LOGFILE  GROUP 1 (    '+DGROUP1',    '+DGROUP2'  ) SIZE 100M,  GROUP 2 (    '+DGROUP1',    '+DGROUP2'  ) SIZE 100MDATAFILE  '+DGROUP1/db/datafile/system.260.541956497',  '+DGROUP1/db/datafile/sysaux.259.541956511'CHARACTER SET US7ASCII;


Creating Archive Log Files in ASM

Disk groups can be specified as archive log destinations in the LOG_ARCHIVE_DEST andLOG_ARCHIVE_DEST_n initialization parameters. When destinations are specified in this manner, the archive log filename will be unique, even if archived twice. All partially created archive files, created as a result of a system error, are automatically deleted.

If LOG_ARCHIVE_DEST is set to a disk group name, LOG_ARCHIVE_FORMAT is ignored. Unique filenames for archived logs are automatically created by the Oracle database. IfLOG_ARCHIVE_DEST is set to a directory in a disk group, LOG_ARCHIVE_FORMAT has its normal semantics.

The following sample archive log names might be generated with DB_RECOVERY_FILE_DEST set to+dgroup2. SAMPLE is the value of the DB_UNIQUE_NAME parameter:

+DGROUP2/SAMPLE/ARCHIVELOG/2003_09_23/thread_1_seq_38.614.541956473+DGROUP2/SAMPLE/ARCHIVELOG/2003_09_23/thread_4_seq_35.609.541956477+DGROUP2/SAMPLE/ARCHIVELOG/2003_09_23/thread_2_seq_34.603.541956487+DGROUP2/SAMPLE/ARCHIVELOG/2003_09_25/thread_3_seq_100.621.541956497+DGROUP2/SAMPLE/ARCHIVELOG/2003_09_25/thread_1_seq_38.614.541956511


查看asm的视图

ViewDescriptionV$ASM_DISKGROUPIn an ASM instance, describes a disk group (number, name, size related info, state, and redundancy type).

In a DB instance, contains one row for every ASM disk group mounted by the local ASM instance.

This view performs disk discovery every time it is queried.

V$ASM_DISKIn an ASM instance, contains one row for every disk discovered by the ASM instance, including disks that are not part of any disk group.

In a DB instance, contains rows only for disks in the disk groups in use by that DB instance.

This view performs disk discovery every time it is queried.

V$ASM_DISKGROUP_STATHas the same columns as V$ASM_DISKGROUP, but to reduce overhead, does not perform a discovery when it is queried. It therefore does not return information on any disks that are new to the storage system. For the most accurate data, use V$ASM_DISKGROUP instead.V$ASM_DISK_STATHas the same columns as V$ASM_DISK, but to reduce overhead, does not perform a discovery when it is queried. It therefore does not return information on any disks that are new to the storage system. For the most accurate data, use V$ASM_DISK instead.V$ASM_FILEIn an ASM instance, contains one row for every ASM file in every disk group mounted by the ASM instance.

In a DB instance, contains no rows.

V$ASM_TEMPLATEIn an ASM or DB instance, contains one row for every template present in every disk group mounted by the ASM instance.V$ASM_ALIASIn an ASM instance, contains one row for every alias present in every disk group mounted by the ASM instance.

In a DB instance, contains no rows.

V$ASM_OPERATIONIn an ASM instance, contains one row for every active ASM long running operation executing in the ASM instance.

In a DB instance, contains no rows.

V$ASM_CLIENTIn an ASM instance, identifies databases using disk groups managed by the ASM instance.

In a DB instance, contains one row for the ASM instance if the database has any open ASM files.




0 0
原创粉丝点击