1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Oracle Database 11g New Features P2 pdf

20 475 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Chapter 1: Oracle Database 11g Getting Started
Thể loại Book chapter
Định dạng
Số trang 20
Dung lượng 468,85 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Oracle Press has a great book on RMAN called Oracle Database 10g RMAN Backup and Recovery that can guide you on your RMAN backup.. Here is an example of an RMAN command that you can use

Trang 1

or you can enter an alternative directory location for these files to be stored in We will

discuss the disgnostic_dest parameter and other new parameter-related information

later in this chapter

As with previous versions of the DBUA, you can choose to have Oracle back up the database before the upgrade, or you can indicate that you have already backed

up the database If you allow the DBUA to back up the database, then the backup will be a cold backup, so be aware that you will be adding to the total time the

database will be down for the upgrade if you are going to have DBUA perform the backup

If you want to perform your own backup, I’d suggest you use Recovery Manager (RMAN) to perform the backup Oracle Press has a great book on RMAN called

Oracle Database 10g RMAN Backup and Recovery that can guide you on your

RMAN backup Here is an example of an RMAN command that you can use to

back up your database:

RMAN> shutdown immediate

RMAN> startup restrict

RMAN> backup database plus archivelog

format 'backup_destination_here' tag before_upgrade;

RMAN> shutdown immediate

RMAN> startup

NOTE

Of course, backups are very important, particularly

when an upgrade fails for whatever reason I’d prefer

to back up the database before the upgrade If you

are using RMAN you can validate the backup and

make sure it’s complete If you have the time and

resources, I’d do a test restore on the backup just to

cover yourself completely.

The DBUA also gives you the option of moving your database datafiles during the upgrade process if you so desire You can move them from file system to file

system, from a file system to ASM, or from ASM to a file system Personally, I think I’d do this independent of an upgrade, but that’s just me

The DBUA also gives you the option of configuring the Flash Recovery Area (FRA)

This is particularly handy if you are moving from Oracle9i, which did not offer the FRA, or if you did not use the FRA in previous Oracle Database 10g databases.

Another choice you will make from the DBUA is the option to recompile invalid objects after the upgrade This is similar to running the utlrp.sql package from the

SQL command line The default option is to recompile packages, and I recommend you take this option Finally the DBUA provides the option to backup the database (again, I prefer to do this before hand, manually) Having decided to backup or not

Trang 2

backup, DBUA will provide a summary of your choices, and warnings related to the database upgrade You simply click on the finish button, and your upgrade will begin! Note that once you start the upgrade, you will not be able to use the database until the upgrade is complete Figure 1-2 is an example of the DBUA window as it is upgrading a database

DBUA-Related Logging

Notice at the bottom of the DBUA output shown in Figure 1-2 that the logging directory for the DBUA is listed (in our case $ORACLE_HOME/cfgtoollogs/dbua/db_ name) In this directory you will find the logs related to a DBUA upgrade After each upgrade you should review the logs in this directory for errors after the migration is complete

Note the location of the log files in the DBUA window The logs can be very handy in solving upgrade problems should that arise The DBUA will create a number of logs in the directory listed Note that each separate upgrade of a database will have its own log directory (thus, old logs are not removed) For example, in Figure 1-2 the DBUA has put logs into the $ORACLE_HOME/db_1/cfgtools/dbua/ rob10dbua/upgrade2 directory In this case we see that the rob10dbua database has had one upgrade attempt previous to this upgrade attempt (the first upgrade attempt would be in the upgrade1 directory)

FIGURE 1-2 The Database Upgrade Assistant: progress screen

Trang 3

Within the DBUA log file directory there are a number of logs you might be

interested in Table 1-2 provides a list of the log files of most interest to you

How Do I Know If the Upgrade Is Successful?

Of course, if you watch the DBUA to completion, then you will know the upgrade

is successful (and that you can patiently outwait a very boring bit of screen output) The DBUA will provide you with the screen seen in Figure 1-3 which indicates

success

After you click on OK, the DBUA will display the Upgrade Results page This page provides summary information about the completed upgrade that includes

Arup Says…

I find it extremely useful to let the log files scroll by as the entries are written to them In Unix-based systems, it is rather trivial A simple command in another

terminal, tail -f <logfile>, shows a continuous display of the tail end of the file

As new material is added to it, I see it This gives a little bit more educated

insight into the process than just looking at the upgrade screen with a slider bar and a percentage indicator

TABLE 1-2 Oracle Database 11g DBUA Logs of Interest

UpgradeResults.html This is a summary of what the DBUA intends to upgrade

This HTML file is displayed by the DBUA before the upgrade begins

Trace.log Provides detailed tracing information on the entire upgrade

process Any errors reported by the DBUA will be recorded in this log

Oracle_Server.log This file (which can be quite large) provides details of the

execution of the entire migration project If an error occurs you can find more details in the text of this file If something

in the upgrade fails, this is where you are likely to find information pertinent to the failure

Post_Upgrade.log Log file for details on post upgrade operations You can look

in this file to determine if the upgrade was successful or not

Trang 4

information including the new ORACLE_HOME location, parameters that have been added or updated, and parameters that have been removed Also you can configure database passwords from the DBUA Upgrade Results page

If you feel that the upgrade was not successful in some way, the DBUA Upgrade Results page also provides the ability to rollback the upgrade If you had the DBUA backup the database before it started the upgrade then DBUA will restore the database and reset configuration parameters If you did your own backup, then this option will only reset various configuration settings and you will need to manually restore the database Figure 1-4 provides an example of the DBUA Upgrade Results page

Once your upgrade is complete, you should backup your new database again Also, backing up other related database files that have changed (like the listener.ora,

or the tnsnames.ora) would be a good idea after a successful upgrade

It may be that you will walk away from the process and then during your

absence some horrific thing like the system rebooting will occur (or as happened in

my case, your dog gets under your desk and kills the power) So, how do you know

if the upgrade was successful in this case? You will want to do the following:

1 Review the Oracle_Server.log (see the previous section for more on this log

file) Look for ORA- errors in the log If there are any in the log that are not expected, you will want to check with Oracle and determine what needs to

be done One problem is that our friends at Oracle have filled this log with

FIGURE 1-3 The Database Upgrade Assistant: Successful Upgrade

Trang 5

comments that include ORA- in them, so a simple search and find will not work very well Many times I will just go to the bottom of the log and look

to see if there is an error there or near the bottom Often if an error occurs it will be toward the end of the log

Another place to look is the Post_Upgrade.log file This logs all operations that occur after DBUA has actually upgraded the database Look at the

bottom of the file for a successful call to dbms_registry_sys.validate_

components call If it was completed successfully, then odds are that your upgrade was successful

2 Check the alert log of the database for errors during the migration There

have been some changes to the way the alert log is managed See Chapter 2

for more details on the new diagnostic_dest parameter and how it impacts

database logging

3 You can check the DBA_REGISTRY view to make sure all of the components

have the correct version number assigned to them If they do not, you will need to determine why this is the case (it may be as simple as a bug where one of the components is not getting updated correctly in the registry; that has happened before)

FIGURE 1-4 The Database Upgrade Assistant: Upgrade Results

Trang 6

Going Back

So, what if you see some errors during the upgrade process and the DBUA failed? What if you find errors in the logs and you want to go back? If you had DBUA backup your database, you can have it restore your database In other cases, you are going to have to restore the database that failed to migrate yourself

In the DBUA interface, the last screen will give you an option to recover your database if there was an error on the DBUA However, as in our earlier example, if the power went out and the DBUA session ended as a result, you no longer have that option This is one reason I just prefer to do a manual backup/restore DBUA does place all the files used to backup/restore your database into the logging

directory Therefore another option is to go to the logging directory and use the files contained there

In the case of a power outage (or perhaps the Blue Screen of Death from

Windows), you need to review the logs carefully If you can determine from the logs that the upgrade process failed, you can manually restart the upgrade process from that point However, if you prefer to stick to using the DBUA to do your upgrades, then the best course of action will be to recover the pre-upgrade database image from the backup you took before the upgrade, and restart the upgrade

DBUA does a simple copy of your data files when it does a backup rather than use RMAN You will find your backup files in the directory ORACLE_BASE/admin/

<database_name>/backup Here you will find a script file or batch file (the name varies by platform) that you can run to restore your database to the pre-Oracle

Database 11g version If you are running the script on Windows, it will also drop

and re-create the Oracle Windows service for you

If you backed up your database via RMAN before the upgrade, then restoring the database is as simple as issuing the following RMAN command (note we assume you tagged your backup with the tag “before_upgrade”)

STARTUP NOMOUNT

RUN

{

RESTORE CONTROLFILE FROM 'save_controlfile_location';

ALTER DATABASE MOUNT;

RESTORE DATABASE FROM TAG before_upgrade

RECOVER DATABASE NOREDO;

ALTER DATABASE OPEN RESETLOGS;

}

After the restore is complete, you will need to reset your environment variables

to point to the old Oracle software locations If you are using Windows you will need to drop and re-create your Oracle service

Trang 7

Manual Upgrades

The downside to manual upgrades is that they can be tedious and you have to

manage a number of steps The upside is that you have a great deal more control over the upgrade process If something fails and you are doing a manual upgrade, it

is often much easier to recover from that failure than if you are using the DBUA

If you are going to opt for a manual upgrade, the first thing I’d do is read the

upgrade manual carefully I’d then create a checklist for you to follow Each of the upgrade steps can vary a little bit by platform (for example, Windows installs require that you drop and re-create services) So it’s important to read the manual

In the next sections we will divide the manual process up into pre-upgrade,

upgrade, and post-upgrade sections In each section we will provide some direction and insight into that part of the upgrade process Finally, we will discuss rolling

back the upgrade if that becomes necessary

Before You Upgrade to Oracle Database 11g

Before you just haul off and run the database upgrade scripts, a bit of pre-planning is

in order While we present an ordered list in Table 1-3 of pre-upgrade steps to

follow, you must reference the Oracle Database 11g Upgrade Manual as well as the

Readme and other related files for the most current information on the steps to follow when upgrading We have found in the past that things tend to change between

different versions (and operating systems), and of course the specific version you are upgrading to may be different than the version we used when we wrote this book

(we used the first production version of Oracle Database 11g for this book).

Another thing we must mention (again) is that you need to test, test, test (we

actually had 10 pages of the word “test” here, but our editor/publisher decided that might be a bit much) before you do anything else Table 1-3 provides a summary of the pre-upgrade steps that you will want to make sure you take when performing an

Oracle Database 11g upgrade:

You will notice we mentioned the Oracle Pre-Upgrade Information Tool in step 8

in Table 1-3 It is critical to the smooth upgrade of your database that you run this tool every time you do an upgrade I have seen cases where the tool was run on

development and test databases without any problem findings being noted, only to have an upgrade fail in production This was because the DBA assumed that there would be no problems with the production upgrade since there were not any

problems in the other upgrades Don’t make this mistake

NOTE

If you are upgrading a clustered database, you will shut

down all but one of the instances of the cluster, which

will be the node you upgrade Check out the Oracle

upgrade documentation for specific actions that might

need to be completed on each node (such as installing

the new software on each node and so on).

Trang 8

Step Action

1 Read this book! Read the Oracle Database Upgrade guide!

2 Upgrade your OS and any other vendor software as required to support Oracle Database 11g.

3 Install the Oracle Database 11g software I always like to create a little test database after

installing the Oracle software just to make sure everything works right.

4 Test the upgrade on a non-production database first!

5 Back up the database (Earlier in this chapter we provided you with an example RMAN script that

you can use.)

6 Prepare the new oracle_home location Copy the old configuration files (SPFILE, IFILE, password

file, and so on) to the new Oracle Database 11g locations Review these files and update them to

include any new or changed parameters.

7 Check the redo log file size and ensure that it is greater than 4MB in size The Oracle Database

11g upgrade process will fail if the online redo logs are smaller than 4MB in size You can run

this query to determine the size of the online redo logs:

Select name, bytes

FROM V$LOGFILE;

8 Run the Oracle Pre-Upgrade Information Tool (utlu111i.sql in our version) to determine what you

will need to change in your database to make the upgrade successful You will find this tool in

ORACLE_HOME/rdbms/admin directory of your Oracle Database 11g software install Changes

you may need to make include:

a Remove obsolete database parameters.

b Adjust parameter settings to reflect minimum values indicated by the output of the

pre-upgrade tool For example the sga_target parameter might need to be increased

c Increase tablespace sizes

d You may wish to adjust the compatible parameter to 11.0 so you can use the new features

of Oracle Database 11g after the upgrade Note that once you modify the compatible

parameter, you cannot change the compatible parameter to a lower setting without

recovering your database to a point in time that was before the change of the compatible

parameter.

Note that during the upgrade, the compatible parameter must be set to at least 10.0.0 You

can reset it to 9.2.0 after the upgrade if you wish to ensure that you can only use the 9.2.0 feature set.

e Adjust all paths in the parameter file to reflect the new oracle_home structure as needed.

f If you are going to upgrade a cluster, make sure cluster_database is set to false for the

upgrade.

9 Determine if there are any new Oracle parameters that you want to use Determine if there are

any parameters that you want to change You will make these changes after the database upgrade.

10 Determine if any users are currently using the CONNECT role This role is depreciated in Oracle

Database 11g and has all privileges stripped from it except the create session privilege

11 If you are using OEM, you will want to save your OEM Control Data should you need to

downgrade Refer to the Oracle Database 11g Upgrade Manual for more information on this

process

12 Create a listener for the Oracle Database 11g Database This will need to be done before you can

upgrade to Oracle Database 11g

TABLE 1-3 Oracle Database 11g Pre-Upgrade Steps

Trang 9

Upgrade to Oracle Database 11g

Once all the pre-upgrade work is done, it’s time for the fun part, upgrading the

database! Cowboys on the American plains might have said “yeeeehhhhaaawwww”

at this point Again we provide a table with a general list of steps to follow when upgrading your database I can’t say it enough—please check out the Oracle

upgrade manual and make sure nothing has changed or that there are no

OS-specific things you need to do Table 1-4 presents my list

One of two things, lack of memory or lack of tablespace space, causes many upgrade failures If your failure is due to one of these, you can simply correct the problem (for example, increase memory, extend the tablespace, or enable

autoextend) and then shutdown abort the database Then restart the database with the startup upgrade command and rerun the catupgrd.sql script again.

If you have started the upgrade with the catupgrd.sql script and you determine that for whatever reason you cannot complete it, you will need to restore your

database with the backup you took of it There is no “flashing back” an incomplete upgrade

Re-Run the Upgrade

In the case of an error during a manual upgrade, you can often re-run the upgrade Simply follow these steps:

1 Correct the problem.

2 Shutdown the database (shutdown immediate).

3 Restart the database with the startup upgrade command.

4 Re-start the upgrade process from step 9 in Table 1-4.

After You Upgrade to Oracle Database 11g

Once the upgrade script has completed the upgrade, you are almost done! Now we need to perform some post-upgrade steps to check the upgrade status and complete the process One last time we will provide a table with a general list of steps to follow when upgrading your database Also one last time we remind you to first check out the Oracle upgrade manual and make sure nothing has changed Table 1-5 gives you our list

NOTE

We can’t say it enough: These are the general

steps you will need to take You must reference the

upgrade guide, and your OS-specific documentation

for the complete enchilada! Don’t cry for me,

Argentina—you must prepare before you do!

Trang 10

Step Action

1 Shut down the database You should shut down the database in a consistent

manner using shutdown immediate If you must use shutdown abort, restart the database in restricted mode and then do a shutdown immediate.

2 If you are using Windows, you will need to stop the Oracle service for the

database you are upgrading You will then use the oradim utility to remove the service for the database you are migrating Then use the oradim utility to

re-create the new Oracle Database 11g service

3 If you are using UNIX, you will need to make sure your environment variables

are pointing to the new Oracle Database 11g directories This would include

oracle_home, path, classpath, and ld_library_path as well as any OS-specific

environment variables you may need to set

4 Open a command-line window/prompt and change to the ORACLE_HOME\ rdbms\admin directory

5 Start SQL*Plus (make sure you are using the 11g version of SQL*Plus!) and

connect to the database as a user with SYSDBA privileges

6 From the SQL*Plus prompt, start up the database in upgrade mode using the following command:

startup upgrade

Confirm that the banner says the database was started with Oracle Database version 11 There is no need to stop the upgrade process if errors appear indicating that obsolete initialization parameters are in use You can correct those errors after the upgrade has completed

7 If you are upgrading from Oracle 8.1.7 or Oracle9i, you will need to create a

sysaux tablespace Follow the direction in the upgrade guide to complete this

step

8 Use the spool command to start spooling the results of the upgrade to a log file.

SQL> spool upgrade.log

9 Using the catupgrd.sql script, start the upgrade process!

SQL> @catupgrd.sql

Once this script has completed, it will shutdown the database

10 Restart the newly upgraded database with the startup command.

TABLE 1-4 Oracle Database 11g Upgrade Steps

Ngày đăng: 25/01/2014, 14:20

TỪ KHÓA LIÊN QUAN