3. Find the filename of the new datafile.
SQL> select file_name from dba_data_files where tablespace_name='NEW_TBS';FILE_NAME---+DG1/orcl/datafile/new_tbs.256.675459139ASM and RMAN
Since ASM files are created on raw devices managed by Oracle, there is no way that
you can back up ASM files with operating system utilities: no regular operating system
command or utility can see the contents of an ASM disk, because it has no file system
installed upon it. You must use RMAN. The RMAN backup and restore and recover
commands do not change at all when using ASM; wherever you would use a filename,
enter the ASM filename. If your backup scripts specify tablespace names, or the whole
database, then they will run unchanged.
Apart from being required for regular backup and recovery procedures, RMAN is
also the only tool available for migrating a database from conventional file system
storage to ASM storage. The examples that follow assume that you have three disk
groups: group dg1 is for your datafiles; groups dg2 and dg3 are for controlfiles and
online redo log files.
To migrate the controlfile, change the CONTROLFILES instance parameter to
point toward your disk groups and then shut down the database and start it in
NOMOUNT mode:
SQL> alter system set controlfiles='+dg2','+dg3' scope=spfile;SQL> shutdown immediate;SQL> startup nomount;Then launch RMAN, and restore the controlfile from its original location:
RMAN> restore controlfile from'/u01/app/oracle/oradata/orcl/control01.ctl';You can now mount and open the database, using the controlfile on the ASM device.
From an RMAN prompt, this script will migrate all your datafiles to an ASM disk
group:
shutdown immediate;startup mount;backup as copy database format '+dg1';switch database to copy;alter database open;To migrate the redo logs, create new members in your disk groups and drop the
old members:
SQL> alter database add logfile member '+dg2','+dg3' to group 1;SQL> alter database drop logfile member '/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log ';Finally, you must move your temporary tablespace tempfiles. Since these cannot
be backed up, the technique is to drop them and create new files on a disk group. It
may be simpler just to create a new temporary tablespace, and drop the original
temporary tablespace:
create temporary tablespace tempasm tempfile '+dg1' size 1g;alter database default temporary tablespace tempasm;drop tablespace temp including contents and datafiles;EXAM TIP RMAN is the only tool you can use to back up ASM files. User-
managed backups are not possible, because operating system utilities cannot
see ASM files.
The ASMCMD Utility
In order to make administration of ASM files simpler, Oracle provides a command-line
utility that gives a Unix-like interface to ASM. This is the ASMCMD utility, named
%ORACLE_HOME%\bin\asmcmd.bat on Windows and $ORACLE_HOME/bin/asmcmd
on Unix. To run the tool, you must first set your ORACLE_SID environment variable
to the name of the ASM instance, and then a set of commands are available with
functionality and syntax similar to that of a Unix file system. The commands are
summarized in Table 20-2.
Most of the ASMCMD commands are self-explanatory and follow standard
(although much simplified) Unix in their syntax. Two do require special attention:
the md_backup and md_restore commands. These let you recreate a disk group.
They do not back up or restore any files in the disk group (the files must be protected
P AR T III
by other means, usually RMAN), but they do make it possible to extract the metadata
describing the disk groups and the disks of which they are composed. This would be
necessary in the event of a disaster recovery operation. If the machine hosting the
ASM instance and its attached disks were lost and had to be replaced, then after creating
an ASM instance on a replacement machine (which should ideally have the same disk
configuration), restoring the metadata would recreate the disk groups. Then using
RMAN, the files themselves could be restored.
Command Descriptionhelp View available commands and usagecd Navigate around the ASM directory structurecp Copy a filedu Return the space used in a directoryfind Find a filels List contents of a directorylsct List connected RDBMS instances lsdg List the disk groupsmkalias Create an alias name for a filemkdir Create a directorypwd Display the current ASM directoryrm Delete a filermalias Delete a file aliasmd_backup Back up the metadata describing a disk groupmd_restore Restore the metadata describing a disk grouplsdsk List the discovered disksremap Attempt to repair damaged disk blocksTable 20-2 ASMCMD Commands
Bạn đang xem 3. - OCA /OCP ORACLE DATABASE 11G A LL-IN-ONE EXAM GUIDE- P81 POT