Create a backup of the ASM metadata, relying on the defaults, which will back up all mounted disk groups to a file in your current operating system directory.. Connect to the ASM instanc
Trang 1The syntax of the md_backup command is
md_backup [-b location_of_backup] [-g dgname]
The location of the output file will default to a file named AMBR_BACKUP_
INTERMEDIATE_FILE in the directory from which ASMCMD was launched, and
if no disk groups are specified, all mounted disk groups will be included
Exercise 20-5: Use the ASMCMD Utility In this exercise you will use the ASMCMD utility to investigate the files in the ASM disk group created in Exercise 20-4
1 At an operating system prompt, set your ORACLE_SID environment variable to the name of the ASM instance, and launch the ASMCMD utility On Windows:
set ORACLE_SID=+asm asmcmd.bat
Or on Unix:
export ORACLE_SID=+asm asmcmd
2 Display details of your disk group
lsdg
Note the difference between the values for Usable_file_MB space and Free_MB:
this is because the Type of the disk group is “NORMAL”, which is mirrored
3 Use the cd and ls commands to navigate to the directory and display the datafile shown in Step 3 of Exercise 20-4
cd +DG1/orcl/datafile
ls -l
4 Create a backup of the ASM metadata, relying on the defaults, which will back up all mounted disk groups to a file in your current operating system directory
md_backup
5 Exit from the ASMCMD utility, and inspect the generated file AMBR_BACKUP_ INTERMEDIATE_FILE with any editor It will be readable but should not be edited Observe the details of your disk group and disks
6 Launch SQL*Plus Connect to the ASM instance as SYSASM, and query views that describe your ASM files and disk groups
select * from v$asm_file;
select * from v$asm_diskgroup;
Note the correspondence with the results of Steps 2 and 3.
Two-Minute Drill
Describe Automatic Storage Management (ASM)
• ASM is a logical volume manager, providing striping and (optionally)
mirroring of Oracle database files
Trang 2• The files that can be stored on ASM devices include datafiles; tempfiles; the
controlfile; online and archive redo log files; the spfile; RMAN backup sets;
and image copies
• You cannot use ASM devices for the Oracle binaries or diagnostic and trace files
• ASM will always stripe files across all disks in a disk group, but mirroring is
optional
• The default mirroring is NORMAL REDUNDANCY (meaning two copies of
each allocation unit), but this can be adjusted to EXTERNAL REDUNDANCY
(one copy only), or to HIGH REDUNDANCY (three copies) if the group has
at least three disks
• The cluster services are required (even in a non-RAC environment) to set up
the connections between RDBMS instances and an ASM instance
• No data ever passes through an ASM instance ASM is responsible only for
managing the storage structures; the RDBMS instance(s) perform the I/O
operations
Set Up Initialization Parameter Files for ASM
and Database Instances
• The parameter INSTANCE_TYPE must be set to either RDBMS (the default) or
ASM to control whether the instance is a database instance or an ASM instance
• An ASM instance should have the ASM_DISKSTRING and ASM_DISKGROUP
parameters set to identify the disks that the ASM instance may use and the disk
groups it should mount These parameters are illegal in an RDBMS instance
• Very few parameters are legal in an ASM instance Usually INSTANCE_TYPE,
INSTANCE_NAME, and the ASM prefixed parameters are all that are needed
Start Up and Shut Down ASM Instances
• You can connect to an ASM instance only with operating system or password
file authentication, as SYSDBA or SYSASM (though SYSDBA is only supported
for backward compatibility)
• An ASM instance can be started only in NOMOUNT mode It will never mount
a controlfile nor open any datafiles—though it will mount disk groups to make
them available to RDBMS instances
• An ASM instance cannot be shut down (other than with an ABORT) if an
RDBMS instance has opened files in disk groups it is managing
Administer ASM Disk Groups
• Disk groups are made up of one or more discovered disks
• Files created in ASM disk groups consist of 1MB allocation units, distributed
across all the disks in the group
Trang 3• ASM files can be backed up only with RMAN; operating system utilities cannot see the files in a disk group
• Disks can be added to and removed from a disk group dynamically The allocation units of the files will be restriped by an automatic rebalancing operation to take advantage of any new disks, or to reestablished mirrors if a disk is removed
• Disk groups can be mounted manually with the ALTER DISKGROUP MOUNT command, or automatically by nominating them in the ASM_DISKGROUPS parameter
Self Test
1 What file types and directories can be stored with ASM? (Choose all that apply.)
A Alert log
B Controlfiles
C Datafiles
D Online redo log files
E Oracle Home directory
F Tempfiles
2 Which of the following recovery files can be stored with ASM? (Choose all that apply.)
A Archive redo log files
B RMAN backup sets
C RMAN image copies
D User-managed backups
E The flash recovery area
3 Which of the following parameters is required for an ASM instance? (Choose the best answer.)
A ASM_DISKGROUPS
B ASM_POWER_LIMIT
C INSTANCE_NAME
D INSTANCE_TYPE
4 How should you migrate your online redo log files to ASM storage? (Choose the best answer.)
A Copy the files to an ASM disk group, and use RENAME to update the controlfile
B Use RMAN to transfer them to an ASM disk group, and SWITCH to update the controlfile
Trang 4C Create new members in an ASM disk group, and drop the old members
D Online logs cannot use ASM storage
5 If you abort an ASM instance, what will be the effect on RDBMS instances that
make use of disk groups managed by the aborted instance? (Choose the best
answer.)
A ASM is a single point of failure, and therefore the RDBMS instances will
also abort
B The RDBMS instances will remain open, but any ASM datafiles will be
inaccessible
C RDBMS instances that have already opened ASM files will not be affected,
but no new RDBMS instances will be able to open
D The RDBMS instances will hang until the ASM instance is restarted
E You will receive a message stating that you cannot abort the instance
because it is in use
6 What are the default characteristics of ASM files? (Choose the best answer.)
A The files will be striped for performance but not mirrored for safety
B The files will be mirrored for safety but not striped for performance
C The files will be both striped and mirrored
D The files will be neither striped nor mirrored
7 What happens when you open an ASM instance? (Choose the best answer.)
A The ASM disk groups are made available to RDBMS instances
B The ASM disks are opened
C The ASM files are opened
D You cannot open an ASM instance
8 What statement is correct about ASM and logical volume managers (LVMs)?
(Choose the best answer.)
A ASM is itself an LVM and cannot work with a third-party LVM
B ASM can use LVM volumes, if they are formatted with a file system
C You can use ASM for striping, and the LVM for mirroring
D You can use ASM for mirroring, and the LVM for striping
9 What does the RBAL process do? (Choose the best answer.)
A It rebalances data across the disks in an ASM disk group when a disk is
added or removed
B It coordinates rebalancing activity
C It opens and closes ASM disks
D It depends on whether it is the RBAL process of an ASM instance or of an
RDBMS instance
Trang 510 Which of the following techniques is valid for backing up files on ASM disks?
(Choose all that apply.)
A If the files are mirrored, split the mirror, back up the split copy, and reinstantiate the mirror
B Put the tablespaces into hot backup mode, and copy the ASM datafiles
C Connect to the ASM instance with RMAN, and back up as normal
D Connect to the RDBMS instance with RMAN, and back up as normal
11 How can you connect to an ASM instance? (Choose the best answer.)
A By using operating system authentication only
B By using password file authentication only
C By using data dictionary authentication only
D None of the above are correct
12 What does ASM stripe? (Choose the best answer.)
A Files across all disk groups
B Disks across all disk groups
C Disk groups across all disks
D Files across all disks in a group
13 Some operations can only be carried out when connected to an ASM instance,
while others can only be carried out when connected to an RDBMS instance Mark each of these operations as being “ASM” or “RDBMS.”
A Creating ASM datafiles
B Creating ASM disk groups
C Backing up ASM datafiles
D Backing up volume group metadata
14 If an RDBMS instance that is using ASM files crashes, what will the ASM
instance do? (Choose the best answer.)
A The ASM instance will abort
B The ASM instance will recover the files that the RDBMS instance had open, and remain available for other RDBMS instances
C The ASM instance will recover the files that the RDBMS instance had open, and shut down cleanly
D Nothing
Trang 6Self Test Answers
1 þ B, C, D, and F You can use ASM for database files, such as the controlfile,
the datafiles, the tempfiles, and the online log files
ý A and E Your Oracle Home and the alert and trace files must be on
conventional storage
2 þ A, B, C, and E Archive logs, RMAN backups, and indeed the whole flash
recovery area can be on ASM
ý D You cannot direct user-managed backups to ASM, because operating
system utilities cannot write to ASM devices
3 þ D The only essential parameter is INSTANCE_TYPE.
ý A, B, and C These are not mandatory It would, however, be good practice
to set these parameters too
4 þ C The only method is to create new files.
ý A, B, and D ASM can certainly be used for online log file, but you can’t
copy to an ASM disk group, and RMAN cannot back up online log files
5 þ A The ABORT command will terminate the instance, and all dependent
RDBMS instance will then terminate also
ý B, C, D, and E All RDBMS instances that are using files in disk groups
managed by the ASM instance will abort immediately An ABORT is the only
shutdown method that will succeed—all others will generate an error message
if the ASM instance is in use
6 þ C By default, files are both striped and mirrored.
ý A, B, and D You can disable the mirroring by using the EXTERNAL
REDUNDANCY option when you create the disk group, or by specifying this
for any particular file You cannot disable the striping (and you would not
want to)
7 þ D You cannot open an ASM instance.
ý A, B, and C ASM will open the disks when it starts, and the disk groups
will be available to RDBMS instances when they are mounted ASM files are
opened by RDBMS instances, not the ASM instance
8 þ C This is probably the best way to use ASM: to rely on an LVM to provide
fault tolerance, and ASM to provide Oracle-aware striping
ý A, B, and D ASM can use any devices presented by the operating system,
even LVM devices, but they should not be formatted by a file system You can
use an LVM to mirror volumes, and then ASM will stripe files on top of this
Trang 79 þ D There is an RBAL process in both an ASM instance and the RDBMS
instances that are using it, but they perform different functions
ý A, B, and C A describes the ARBn process, B is RBAL in an ASM instance, and C is RBAL in an RDBMS instance.
10 þ D Absolutely normal RMAN backups, when you are connected to the
RDBMS instance as the target, are the only way to back up ASM files
ý A, B, and C A and B are variations on user-managed backups, which are not possible C makes the mistake of thinking that the backup would be done
through the ASM instance, not the RDBMS instance
11 þ D Both password file and operating system authentication will work.
ý A, B, and C ASM instances do not open a database, so you cannot use
data dictionary authentication, but both other methods are available
12 þ D ASM stripes files across all disks in the group.
ý A, B, and C ASM striping is managed per file, not per disk or disk group.
13 þ A and C, RDBMS; B and D, ASM Files are created and backed up with
normal commands issued from SQL*Plus or RMAN from the RDBMS instance Operations related to the disk groups can be accomplished only from the ASM instance
14 þ D An ASM need do nothing when a dependent RDBMS instance fails.
ý A, B, and C An ASM instance operates independently of the RDBMS
instances that are using it If any file recovery is needed, it is done through the RDBMS instance
Trang 8CHAPTER 21
The Resource Manager
Exam Objectives
In this chapter you will learn to
• 053.17.1 Understand the Database Resource Manager
• 053.17.2 Create and Use Database Resource Manager Components
773
Trang 9Many computer systems will have several groups of users, each with different standards for the level of service they require If the system as a whole is highly stressed, it may be impossible to deliver the desired level of service to all groups But if a priority structure can be negotiated, then it should be possible to guarantee a certain level of service to certain groups—perhaps at the expense of other groups
In a mainframe environment, the operating system itself handles allocating resources
to tasks A transaction processing (TP) monitor will ensure that high-priority jobs get
the processing power they need But simpler operating systems such as Unix or Windows may not have proper resource scheduling capabilities Oracle’s Resource Manager brings mainframe-style resource management capabilities to all supported Oracle platforms, meaning that you as DBA can guarantee that certain groups of database users will always receive a certain level of service, no matter what the overall workload on the database may be
The Need for Resource Management
Operating systems like Unix or Windows use a very simple algorithm to assign resources
to different processes: round-robin time slicing To the operating system, there is really
no difference between any of the background processes that make up the Oracle instance and any of the many server processes that support user sessions: as far as the operating system is concerned, a process is a process; it will be brought onto CPU, given a few cycles of CPU time, and then switched off CPU so that the next process can be brought
on The operating system has no way of knowing that one server process is supporting
a session doing completely trivial work, while another server process is supporting a session doing work critical to the survival of the organization A more immediate problem that all DBAs come across is that one bad SQL statement can kill the database The Resource Manager provides a mechanism whereby the operating system’s time-slicing algorithm can be adjusted, to ensure that some users receive more processing capacity than others—and to ensure that any single query does not destroy performance for everyone else The underlying mechanism is to place a cooperative multitasking layer controlled by Oracle on top of the operating system’s preemptive multitasking system Throughout this chapter, the environment is assumed to be that of a telesales organization There are several groups of users: of particular interest are the data entry clerks and the management accountants
There may be 200 data entry clerks in the call center, taking orders over the telephone If their database sessions are running slowly, this is disastrous for the company Customers will dial in only to be told “you are number 964 in the queue, your call is important to us, please do not hang up ” This is happening because the data entry clerks cannot process calls fast enough: they take an order, they click the Submit button, and then they wait and wait and wait for the system
to respond This is costing money
On the other hand, the management accountants’ work is not so urgent Perhaps
an advertisement has been run on one local radio station, and the response in terms
of sales inquiries needs to be evaluated before running the advertisement nationwide
Trang 10This is important work, but it doesn’t have to be real time If the reports take ten
minutes to run instead of five, does it really matter?
TIP Do not adjust the priorities of Oracle processes by using the Unix
renice command, or the Windows equivalent Oracle assumes that the
operating system is treating all processes equally, and if you interfere with
this there may be unexpected (and disastrous) side effects
What is needed is a technique for ensuring that if the database sessions supporting
the data entry clerks need computing resources, they get them—no matter what This
could mean that at certain times of day when the call center is really busy, the clerks need
100 percent of computing resources The Resource Manager can handle this, and during
that time of peak usage the sessions supporting the management accountants may hang
completely But during other times of day, when the call center is not busy, there will be
plenty of resources available to be directed to the management accountants’ work
At month end, another task will become top priority: the end-of-month billing
runs, and the rollover of the ledgers into the next accounting period The Resource
Manager needs to be versatile enough to manage this, too
Clearly, the Resource Manager is only necessary in highly stressed systems, but
when you need it, there is no alternative In fact, you are using the Resource Manager
whether you know it or not; it is configured by default in all databases from release
8i onward, but the default configuration has no effect on normal work.
The Resource Manager Architecture
Users are placed in Resource Manager consumer groups, and Resource Manager plans,
consisting of a set of directives, control the allocation of resources across the groups Each
session is assigned to a group, depending upon attributes defined when the session was
established and possibly modified subsequently The underlying architecture places a
cooperative multitasking layer on top of the preemptive multitasking provided by the
operating system The server process of a session in a low-priority group will, when
brought onto CPU by a context switch, voluntarily relinquish the CPU earlier than it
would have done if relying purely on the operating system’s preemptive multitasking
algorithm
Consumer Groups
A Resource Manager consumer group is a set of users with similar resource requirements
One group may contain many users, and one user may be a member of many groups,
but at any given moment, each session will have one group as its effective group When
a user first creates a session, his default consumer group membership will be active,
but if he is a member of multiple groups, he can switch to another group, activating
his membership of that group The switch can be manual or automatic, depending on
a number of factors